how can handles Any , All query on flink

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

how can handles Any , All query on flink

hagersaleh
how can handles Any , All query on flink

Example
SELECT  model, price
FROM Laptop
WHERE price > ALL
       (SELECT price
       FROM PC);

Example on any
SELECT DISTINCT maker
FROM Product
WHERE  model > ANY
       (SELECT model
       FROM PC);
Reply | Threaded
Open this post in threaded view
|

Re: how can handles Any , All query on flink

hagersaleh
please help
Reply | Threaded
Open this post in threaded view
|

Re: how can handles Any , All query on flink

Chiwan Park-2
Hi, I wrote a example including queries which you want [1].
The example uses only Flink Scala API, but I think It would be better to use Table API.
I used broadcast set [2] to perform subqueries in your given query.

Flink has many functions to handle data and the great documentation to explain the functions.
I think that It is good to read Batch API section of Flink documentation for you.

If you have a question for the example, please reply mail to user mailing list.

Regards,
Chiwan Park

[1] https://gist.github.com/chiwanpark/5e2a6ac00b7e0bf85444
[2] https://ci.apache.org/projects/flink/flink-docs-master/apis/programming_guide.html#broadcast-variables

> On Jul 11, 2015, at 5:00 AM, hagersaleh <[hidden email]> wrote:
>
> please help
>
>
>
> --
> View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/how-can-handles-Any-All-query-on-flink-tp1997p2005.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
|

Re: how can handles Any , All query on flink

hagersaleh
why in this use ! and <= in handle Any
    override def filter(value: Product): Boolean = !bcSet.forall(value.model <= _)
  }).withBroadcastSet(pcModels, "pcModels").distinct("maker").map(_.maker)

Reply | Threaded
Open this post in threaded view
|

Re: how can handles Any , All query on flink

Chiwan Park-2
Because there is no default implementations like forany in scala, I use forall
method. Note that ANY (condition) is equivalent as NOT ALL (NOT condition).

Regards,
Chiwan Park

> On Jul 12, 2015, at 5:39 AM, hagersaleh <[hidden email]> wrote:
>
> why in this use ! and <= in handle Any
>    override def filter(value: Product): Boolean = !bcSet.forall(value.model
> <= _)
>  }).withBroadcastSet(pcModels, "pcModels").distinct("maker").map(_.maker)
>
>
>
>
>
> --
> View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/how-can-handles-Any-All-query-on-flink-tp1997p2009.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.





Reply | Threaded
Open this post in threaded view
|

Re: how can handles Any , All query on flink

hagersaleh
very thanks