[ 
https://issues.apache.org/jira/browse/CALCITE-7386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082798#comment-18082798
 ] 

Stamatis Zampetakis commented on CALCITE-7386:
----------------------------------------------

"An error occurred while..." is not a good summary cause it is very abstract 
and does not mention what the error is. In addition, an error usually refers to 
an exception or crash but in this case the problem is about a transformation 
producing wrong results. 

Moreover, based on the discussion it seems that the problem was not in 
TopDownGeneralDecorrelator class but in another part of the decorrelation 
logic. When extra information becomes available don't hesitate to update the 
Jira title and commit message to make the description of the problem easier to 
understand by users.

I came back to this ticket while preparing the release notes because I was 
unsure what commit message means. Interested users would behave similarly so 
that's why its important to keep Jira and commit message up to date  and 
polished. I modified the summary based on my understanding of the problem.

> Wrong results after decorrelating query with MEASURE
> ----------------------------------------------------
>
>                 Key: CALCITE-7386
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7386
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Zhen Chen
>            Assignee: Zhen Chen
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.42.0
>
>
> An error will occur when executing the following SQL in CoreQuidemTest2.
> {code:java}
> # Measure with FILTER
> select job,
>     c,
>     aggregate(avg_sal) as avg_sal,
>     aggregate(c) filter (where deptno = 20) as c2,
>     aggregate(avg_sal) filter (where deptno = 20) as avg_sal2
> from (
>   select *, count(*) as measure c, avg(sal) as measure avg_sal
>   from "scott".emp
>   where job <> 'PRESIDENT')
> where deptno < 25
> group by job;
> +---------+---+---------+----+----------+
> | JOB     | C | AVG_SAL | C2 | AVG_SAL2 |
> +---------+---+---------+----+----------+
> | ANALYST | 2 | 3000.00 |  2 |  3000.00 |
> | CLERK   | 4 | 1037.50 |  2 |   950.00 |
> | MANAGER | 3 | 2758.33 |  1 |  2975.00 |
> +---------+---+---------+----+----------+
> (3 rows)!ok {code}
> The result is error.
> < | CLERK   | 4 | 1037.50 |  2 |   950.00 |
> < | MANAGER | 3 | 2758.33 |  1 |  2975.00 |
> ---
> > | CLERK   | 3 | 1066.66 |  2 |   950.00 |
> > | MANAGER | 2 | 2712.50 |  1 |  2975.00 |
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to