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

CTE/aggreation function give wrong results

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 23.10.2
    • 23.10.4
    • PrimProc
    • None
    • 2025-1

    Description

      It s seem that the follow query:

       
      with defaultUARQuery as (
       
      SELECT 189579 requestId, t.id trackingId, t.question_id questionId, t.C_ID c_id , concat(pcct.Forename, ' ', pcct.Surname) nameSurname , pcct.email email ,pcct.externalUserId externalUserId, pcct.attributeList attributeList , fot.mName megaGroupName, fot.sName superGroupName,fot.gName groupName, fot.tName teamName , t.sentDate ,t.sentDateTime issued,t.openDateTime answerDate,t.openDateTime , pcs.statusName as status , pqt.parent_category_name categoryName, pqt.category_name subCategoryName , pqt.question_text questionText ,pqrt.questionText questionRepText , ifNULL (userAnswerRep.answerText , '') userAnswerText , ifNULL (correctAnswerRep.answerText , '') correctAnswerText , t.timeToAnswer answerTime, t.isCorrect isCorrect , pqt.externalId externalQuestionId , if ((pcs.id = 4 and t.isCorrect = 1), 'Correct',if (((pcs.id = 4 and t.isCorrect = 0) or pcs.id = 3), 'Incorrect', if ((pcs.id = 1 or pcs.id = 6), 'ReSend', if ((pcs.id = 5),'Expired','-')))) as answerResult , pqt.attributeList questionAttributeList , t.status statusCode , if ((pcs.id = 4 and t.isCorrect = 1),'YES', if ( ((pcs.id = 4 and t.isCorrect = 0) or pcs.id = 3),'NO','')) as resultYesNo , t.questionLabel questionLabel, t.questionFeedback questionFeedback, t.answerLabel answerLabel, t.answerFeedback answerFeedback FROM edf_colstore.vinci_cs_tracking_t t inner join edf_colstore.pl_cs_contact_t pcct on t.c_id = pcct.c_id and pcct.orgunit_id in (2,29,30,32,34,3782,3783,3793,3891,4006,4046,4108,4152,4153,5888,9454,9455,9598,9902,10648,18020,19589,21320,21321,21322,21323,21324,21325,40159,40305,43932,43936,43937,46410,46422,49614,49615,50055,50915,50916,50917,50918,50919,51867,53424,65070,66418,67182,69413,71720,78778,79027,81638,108647,108648,108655,108657,108659,108661,108677,108679,108783,108785,108788,108789,108790,108792,108794,108796,108798) inner join edf_colstore.pl_cs_question_t pqt on t.question_id = pqt.id inner join edf_colstore.vinci_filter_organization_t fot on fot.tId = pcct.orgunit_id left join edf_colstore.pl_cs_question_repository_t pqrt on pqrt.id = t.qrep_id left join edf_colstore.pl_cs_answer_repository_t correctAnswerRep on correctAnswerRep.id = t.correctAnswerRep_id left join edf_colstore.pl_cs_answer_repository_t userAnswerRep on userAnswerRep.id = t.providedAnswerRep_id inner join edf_colstore.pl_cs_tracking_status_t pcs on pcs.id = t.status WHERE t.accountId = 58773 AND ((t.isAnswered = 1 AND t.answerDate >= '2023-11-16' AND t.answerDate <= '2024-11-16' ) OR (t.sentDate >= '2023-11-16' AND t.sentDate <= '2024-11-16' )) and t.updateControl = 0 Order by issued desc ,t.ID ASC LIMIT 0,10)
       
      select
       
      group_concat(
       
      JSON_OBJECT(
       
      'nameSurname', ua.nameSurname
       
      ,
       
      'email', ua.email,
       
      'externalUserId', ua.externalUserId,
       
      'userAttributeList', ua.attributeList,
       
      'megaGroupName', ua.megaGroupName,
       
      'superGroupName', ua.superGroupName,
       
      'groupName',ua.groupName,
       
      'teamName', ua.teamName
       
      ,
       
      'issued',CAST(ua.issued AS varchar(50))
       
      ,
       
      'status',ua.status,
       
      'answerDate',CAST(ua.answerDate AS varchar(50))
       
      ,
       
      'categoryName',ua.categoryName,
       
      'subCategoryName',ua.subCategoryName,
       
      'exportCategory', concat(ua.categoryName,' / ', ua.subCategoryName)
       
      ,
       
      'questionText', if(ua.statusCode = 4, ua.questionRepText, ua.questionText)
       
      ,
       
      'correctAnswerText', ua.correctAnswerText
       
      )
       
      )
       
      retVal
       
      from defaultUARQuery ua
       
       
      
      

      give the wrong results

      Attachments

        Activity

          People

            leonid.fedorov Leonid Fedorov
            massimo.disaro Massimo
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.