Yes… but then what? We need at least one implementation that can calculate 
distinct over windows, and we don’t have one currently.

So, first level of ambition: throw an error, saying “We don’t support windowed 
distinct aggregates”. Second level of ambition, implement them and remove the 
error.

Thanks for logging https://issues.apache.org/jira/browse/CALCITE-1740 
<https://issues.apache.org/jira/browse/CALCITE-1740>. Let’s have any further 
discussion there. Contributions welcome, of course.

Julian


> On Apr 5, 2017, at 12:51 AM, Radu Tudoran <[email protected]> wrote:
> 
> Hi,
> 
> Wouldn't it be possible rather than throwing an error to set the flag instead?
> 
> Best regards,
> 
> Dr. Radu Tudoran
> Senior Research Engineer - Big Data Expert
> IT R&D Division
> 
> 
> HUAWEI TECHNOLOGIES Duesseldorf GmbH
> German Research Center
> Munich Office
> Riesstrasse 25, 80992 München
> 
> E-mail: [email protected]
> Mobile: +49 15209084330
> Telephone: +49 891588344173
> 
> HUAWEI TECHNOLOGIES Duesseldorf GmbH
> Hansaallee 205, 40549 Düsseldorf, Germany, www.huawei.com
> Registered Office: Düsseldorf, Register Court Düsseldorf, HRB 56063,
> Managing Director: Bo PENG, Qiuen Peng, Shengli Wang
> Sitz der Gesellschaft: Düsseldorf, Amtsgericht Düsseldorf, HRB 56063,
> Geschäftsführer: Bo PENG, Qiuen Peng, Shengli Wang 
> This e-mail and its attachments contain confidential information from HUAWEI, 
> which is intended only for the person or entity whose address is listed 
> above. Any use of the information contained herein in any way (including, but 
> not limited to, total or partial disclosure, reproduction, or dissemination) 
> by persons other than the intended recipient(s) is prohibited. If you receive 
> this e-mail in error, please notify the sender by phone or email immediately 
> and delete it!
> 
> 
> -----Original Message-----
> From: Julian Hyde [mailto:[email protected]] 
> Sent: Tuesday, April 04, 2017 11:09 PM
> To: [email protected]
> Subject: Re: Distinct aggregates
> 
> Calcite doesn’t currently support distinct aggregates in window functions. 
> See https://issues.apache.org/jira/browse/CALCITE-476 
> <https://issues.apache.org/jira/browse/CALCITE-476>. 
> 
> That said, it shouldn’t silently swallow the DISTINCT keyword. It should give 
> an error. I suspect that some rule is ignoring the distinct flag. Can you log 
> a JIRA case please?
> 
> Julian
> 
> 
>> On Apr 4, 2017, at 9:46 AM, Radu Tudoran <[email protected]> wrote:
>> 
>> Hi,
>> 
>> I am trying to parse the logical query plan that results after executing 
>> queries such as:
>> 
>> SELECT B1, SUM(DISTINCT B2) OVER  (ORDER BY  B4 RANGE BETWEEN INTERVAL '10' 
>> SECOND PRECEDING AND CURRENT ROW) FROM T
>> 
>> However, when I look in the list of the aggregates from the LogicalWindow, 
>> the Aggregate does not have any marker of being distinct. I also checked the 
>> isDistinct() and it returns false for the aggregate.
>> 
>> .. I get as LogicalWindow object
>> LogicalWindow(window#0=[window(partition {} order by [2] range between $3 
>> PRECEDING and CURRENT ROW aggs [COUNT($1), $SUM0($1)])])
>> 
>> Moreover if I run a query that has a count and a count distinct over a 
>> window it will be simplified to a single count aggregate.
>> 
>> Am I missing something or is there a bug?
>> 
>> Best regards,
>> 
>> Radu
>> 
> 

Reply via email to