Re: Is it possible to decide the order of where conditions in Flink SQL

2019-07-28 Thread Tony Wei
Hi Hequn, Thank you very much. It's helpful to me. For clarification, I think the code should look like the following snippet, since original query was an `AND` operator. Am I right? > CASE > WHEN user_robot THEN false > WHEN !UDF_NEED_TO_QUERY_DB(user) THEN false > ELSE true > END Best regard

Re: Is it possible to decide the order of where conditions in Flink SQL

2019-07-28 Thread Hequn Cheng
Hi Tony, There is no order guarantee for filter conditions. The conditions would be pushed down or merged during query optimization. However, you can use the case when[1] to achieve what you want. The code looks like: CASE WHEN !user.is_robot THEN true WHEN UDF_NEED_TO_QUERY_DB(user) THEN true EL

Re: Is it possible to decide the order of where conditions in Flink SQL

2019-07-27 Thread Tony Wei
Hi, Thanks for your reply. I have tried both CTE and sql subquery, but it seems that sql plan optimizer will do filter pushdown. Therefore, where conditions will end up being together in physical plan. However, the visualization of physical plans on Flink UI were different for these three SQL que

Re: Is it possible to decide the order of where conditions in Flink SQL

2019-07-26 Thread sri hari kali charan Tummala
try cte common table expressions if it supports or sql subquery. On Fri, Jul 26, 2019 at 1:00 PM Fanbin Bu wrote: > how about move query db filter to the outer select. > > On Fri, Jul 26, 2019 at 9:31 AM Tony Wei wrote: > >> Hi, >> >> If I have multiple where conditions in my SQL, is it possibl

Re: Is it possible to decide the order of where conditions in Flink SQL

2019-07-26 Thread Fanbin Bu
how about move query db filter to the outer select. On Fri, Jul 26, 2019 at 9:31 AM Tony Wei wrote: > Hi, > > If I have multiple where conditions in my SQL, is it possible to specify > its order, so that the query > can be executed more efficiently? > > For example, if I have the following SQL,