Hi Andrew,

Sorry for late reply. Yes I removed that statement now it is working.

Thank you so much for suggestion

On Fri, Jul 16, 2021 at 12:26 PM Andrew Pilloud <apill...@google.com> wrote:

> Hi Talat,
>
> The syntax you've described actually does turn into the Top transform in
> Beam SQL
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache_beam_blob_243128a8fc52798e1b58b0cf1a271d95ee7aa241_sdks_java_extensions_sql_src_main_java_org_apache_beam_sdk_extensions_sql_impl_rel_BeamSortRel.java-23L215&d=DwMFaQ&c=V9IgWpI5PvzTw83UyHGVSoW3Uc1MFWe5J8PTfkrzVSo&r=BkW1L6EF7ergAVYDXCo-3Vwkpy6qjsWAz7_GD7pAR8g&m=t64ngtbWsSfQC4rND6Nc4ri8I--Ey30-KIuKISgxxI0&s=MvKjlgH8mheiiA9NYAp3JBkJ6-Hrb_rMe9KMwLWwuKE&e=>.
> However the code currently limits it to the global window. I assume your
> sample query fails with an error like "`ORDER BY` is only supported for
> global window...". I don't think there is a way to do this today, but I
> also wouldn't assume this syntax is necessarily wrong. If you remove the
> window check does it work? (Delete this if block:
> https://github.com/apache/beam/blob/243128a8fc52798e1b58b0cf1a271d95ee7aa241/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamSortRel.java#L200
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache_beam_blob_243128a8fc52798e1b58b0cf1a271d95ee7aa241_sdks_java_extensions_sql_src_main_java_org_apache_beam_sdk_extensions_sql_impl_rel_BeamSortRel.java-23L200&d=DwMFaQ&c=V9IgWpI5PvzTw83UyHGVSoW3Uc1MFWe5J8PTfkrzVSo&r=BkW1L6EF7ergAVYDXCo-3Vwkpy6qjsWAz7_GD7pAR8g&m=t64ngtbWsSfQC4rND6Nc4ri8I--Ey30-KIuKISgxxI0&s=f5C-HFf6aqOpMxRyaDjkMGNb7PsX-puF6K4cW-b_gTI&e=>
> )
>
> Andrew
>
>
> On Fri, Jul 9, 2021 at 12:57 PM Talat Uyarer <tuya...@paloaltonetworks.com>
> wrote:
>
>> Hi,
>>
>> I am trying to calculate the top k element based on a streaming
>> aggregation per window. Do you know if there is any support for it
>> on BeamSQL or How can achieve this goal with BeamSQL on stream ?
>>
>> Sample Query
>> SELECT customer_id, app, sum(bytes_total) as bytes_total FROM
>> PCOLLECTION  GROUP BY customer_id, app, TUMBLE(log_time, INTERVAL '1'
>> MINUTE) ORDER BY bytes_total DESC LIMIT 10
>>
>> Thanks
>>
>>

Reply via email to