Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-944

coalesce with count(distinct) can lead to incorrect results

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 1.0.11, 1.1.0
    • 1.0.12, 1.1.1
    • ExeMgr
    • None
    • 2017-20, 2017-21

    Description

      to reproduce:

      CREATE TABLE test( 
      id BIGINT(20) NULL DEFAULT NULL, 
      integerfield INT(10) UNSIGNED NULL DEFAULT NULL,
       integerfield2 INT(10) UNSIGNED NULL DEFAULT NULL )
      ENGINE=Columnstore;
       
      INSERT INTO test
      VALUES (1, NULL,1), (2, NULL,1), (1,NULL,1);
       
      SELECT COUNT(distinct id),        
      SUM(integerfield),        
      SUM(integerfield2),        
      coalesce(SUM(integerfield),0),        
      coalesce(SUM(integerfield2),0),        
      coalesce(SUM(integerfield),0) + coalesce(SUM(integerfield2),0) 
      FROM   test;
      

      The last column value is -9223372036854775805 instead of 3. Removing the count(distinct) results in the correct result.

      Attachments

        Activity

          People

            dleeyh Daniel Lee (Inactive)
            dthompson David Thompson (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.