In general I think it's not a good idea to rely on the front-end of the 
compiler giving you a specific shape for the program.
If you want to enforce certain structures you should write code that implements 
these structures.
For example, if you do not support IS NOT TRUE, you should write a visitor that 
converts IS NOT TRUE to some other form that your target supports.

Mihai

________________________________
From: udit varshney <29u...@gmail.com>
Sent: Sunday, December 1, 2024 9:12 PM
To: dev@calcite.apache.org <dev@calcite.apache.org>
Subject: Need Suggestion on Case expression simplification

Hi Team,

I am using the Calcite for materialised view rewrite. I need some
information related to the case expression. Following is the SQL sample-

*Select upper(c1) as alias1, sum(c2) as alias2 from test where case c3 =
'A' then false else true end group by 1*.

Above query is rewritten to-

*Select upper(c1) as alias1, sum(c2) as alias2 from mv where c3='A' is not
true group by upper(c1)*;

I tried to check in code and figure out that this conversation is happening
in *RexSimplify* class.
If a query engine doesn't support the *is not true* expression the is there
any way to keep case as it is?

Thanks,
Udit Kumar

Reply via email to