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

radu edited comment on CALCITE-1740 at 4/21/17 5:15 PM:
--------------------------------------------------------

[~julianhyde]

I have addressed the remarks. However, regarding your last remark of I think we 
should keep the existing test because we need to ensure that also the distinct 
is preserved when the project to window rule is applied.


was (Author: rtudoran):
[~julianhyde]

I have addressed the remarks except managing to create a test class in the 
SqlToRelConverterTest. I am following the model of the existing function but it 
seems that when the result is parsed for comparison (the result is correct - i 
manually checked and distinct is set correctly)..the checker does not find the 
plan. I did not manage to understand how to set and work with the objects that 
are verified. Basically the resourceName for which the resource element is 
checked is "plan" while the object contains as attribute  "sql"

Failed tests: 
  SqlToRelConverterTest.testSelectOverDistinct:452 plan expected:<[${plan}]> 
but was:<[
LogicalProject(SUMC=[CASE(>(COUNT($7) OVER (ROWS BETWEEN 10 PRECEDING AND 
CURRENT ROW), 0), CAST($SUM0($7) OVER (ROWS BETWEEN 10 PRECEDING AND CURRENT 
ROW)):INTEGER, null)])
  LogicalTableScan(table=[[CATALOG, SALES, EMP]])
]>

let me know if you have any thoughts on this.

Anyway..regardless of this we should keep the existing test because we need to 
ensure that also the distinct is preserved when the project to window rule is 
applied.

> Distinct aggregate flag in window function
> ------------------------------------------
>
>                 Key: CALCITE-1740
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1740
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: radu
>            Assignee: Julian Hyde
>              Labels: build, windows
>
> When parsing queries such as
> SELECT B1, SUM(DISTINCT B2) OVER  (ORDER BY  B4 RANGE BETWEEN INTERVAL '10' 
> SECOND PRECEDING AND CURRENT ROW) FROM T
> The aggregates in the LogicalWindow do not have any marker of being distinct. 
> isDistinct() flag is not set. Probably some rule(s) silently swallow the 
> DISTINCT keyword
> The LogicalWindow object that result is
> LogicalWindow(window#0=[window(partition {} order by [2] range between $3 
> PRECEDING and CURRENT ROW aggs [COUNT($1), $SUM0($1)])])



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to