The simplification code in Calcite effectively evaluates expressions at 
compilation time. For example, RexSimplify calls RexExecutor in simplifyCast. 
If the simplified expression generates an exception, simplification is aborted 
and the expression is kept unchanged and evaluated at runtime. But at this 
point the compiler knows that the expression will generate a runtime error, so 
it could give a warning.

(There's the additional complication of unspecified evaluation order, which 
could cause some such expressions never to be evaluated at runtime at all, but 
let's ignore this in the discussion.)

Mihai

________________________________
From: Julian Hyde <[email protected]>
Sent: Monday, December 18, 2023 10:41 PM
To: [email protected] <[email protected]>
Subject: Re: warnings in Calcite

I don’t think so.  One place to surface warnings would be via 
java.sql.Statement.getWarnings() but Avatica’s default implementation of that 
method returns null.

What are some scenarios where you think Calcite should give a warning?

Julian


> On Dec 18, 2023, at 7:13 PM, Mihai Budiu <[email protected]> wrote:
>
> Does calcite have any facilities for reporting warnings to users?
>
> Thank you,
> Mihai

Reply via email to