Infix cast comes from Postgres. Can someone find a table of operator precedence 
in Postgres? Perhaps write a test case involving operators with slightly higher 
and lower precedence, so we can check that Calcite is consistent.

> On Oct 4, 2022, at 10:20 AM, Itiel Sadeh <iti...@sqreamtech.com.INVALID> 
> wrote:
> 
> Hello,
> 
> I've encountered weird parsing of infix cast with the babel parser, where
> given the
> following query:
> SELECT -1 :: INT FROM t;
> It will parse it as
> UNARY_MINUS( CAST( 1 AS INT )),
> while i've expected it to be
> CAST(-1 AS INT)
> 
> As i've looked at the code I saw that the precedence of the INFIX_CAST is
> 94, and the precedence of the UNARY_MINUS is 80.
> 
> Is there a reason for the INFIX_CAST's precedence to be that high? Other
> binary operators such as BINARY_PLUS have precedence of 40.
> 
> Thanks,
> 
> Itiel

Reply via email to