Flink SQL computing TOP count attributes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Flink SQL computing TOP count attributes

Ramya Ramamurthy
Hi,

I am making use of Flink SQL for processing my data.
And I would like to compute TOP counts, for many of the parameters in a row.
Is there any better way to do this as i can see that LIMIT is not supported
in Batch Queries.

Any help is appreciated.

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: Flink SQL computing TOP count attributes

Fabian Hueske-2
Hi Ramya,

LIMIT is supported for batch SQL but requires an ORDER BY clause to be
deterministic.
For example
  SELECT a, b, c FROM Abc ORDER BY a DESC LIMIT 5
is a supported query.

If you are only interested in the top-k values (and not the values of the
other attributes) you can also implement a user-defined aggregation
function.

Best,
Fabian

Am Mo., 11. Feb. 2019 um 09:06 Uhr schrieb Ramya Ramamurthy <
[hidden email]>:

> Hi,
>
> I am making use of Flink SQL for processing my data.
> And I would like to compute TOP counts, for many of the parameters in a
> row.
> Is there any better way to do this as i can see that LIMIT is not supported
> in Batch Queries.
>
> Any help is appreciated.
>
> Thanks,
>