I created a PR [1] to support the PostgreSQL :: casting operator. The way I
did this is by creating a new 'SqlBinaryOperator' child. This new child
wraps an instance of the 'SqlCastFunction' to reuse it's
'getOperandCountRange',
'inferReturnType', 'checkOperandTypes' and 'getMonotonicity' logic, and of
course unparses to the original input (i.e. op1 :: type).

But then the PR was commented to reuse the 'SqlCastFunction' type instead
of having a totally new 'SqlBinaryOperator', wich won't unparse properly
because 'op1 :: type' will be unparsed as 'CAST(op1 AS type)'.

Is this a big deal ? I prefer to preserve the orignal format for the parsed
string but to do that I'll have to extend 'SqlCastFunction' to override
it's 'unparse' implementation (I don't remember why I didn't do that, the
PR is like 3 months old)

So is preserving the original structure necessary, recommended or a must
while unparsing ?
If there are any related restriction I need to follow while working on
this, please let me know.

[1] https://github.com/apache/calcite/pull/1066

Thanks,
Gelbana

Reply via email to