You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "James Kim (Jira)" <ji...@apache.org> on 2021/06/03 17:45:00 UTC
[jira] [Created] (CALCITE-4635) Distinct on aggregate window
functions produce wrong result
James Kim created CALCITE-4635:
----------------------------------
Summary: Distinct on aggregate window functions produce wrong result
Key: CALCITE-4635
URL: https://issues.apache.org/jira/browse/CALCITE-4635
Project: Calcite
Issue Type: Bug
Reporter: James Kim
Using distinct with an aggregate window function like:
select (count(distinct \"T\".\"X\") over (partition by \"T\".\"Y\")) from (VALUES (4, 6), (4, 1), (2, 1), (2, 1)) as T(x, y)
produces wrong result; the distinct function is not being applied i.e., the result of the above query should be (1, 2) but currently it returns (1, 3).
After creating and running a test on RelOptRulesTest, I saw the distinct flag is not being dropped, so I suspect this might be an issue on execution side.
I looked into resolving this issue but have been stuck as to where the fix should be. For now I could throw with a RESOURCE.functionQuantifierNotAllowed error in SqlOverOperator until this is fixed.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)