[
https://issues.apache.org/jira/browse/CALCITE-4635?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated CALCITE-4635:
------------------------------------
Labels: pull-request-available (was: )
> 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
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)