Details
-
Improvement
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.17.0
Description
Now many DBs have support implicit type cast, eg: SqlServer, Oracle, Hive.
Implicit type cast is an useful function for many cases, So we should support this.
I checkout Calcite code and found that:
- Now we use a validator to validate our operands types[ through kinds of namespaces and scopes ]
- Most of the validations will finally goes to
SqlOperator.validateOperands
- which will use validation logic defined in corresponding SqlOperandTypeChecker
What i'm confused about is where should i put the implicit type cast logic in? I figured out 2 ways:
- Supply a tool class/rules to add casts into a parsed SqlNode tree which will then go through the validation logic later on.
- Unleash the validation logic in kinds of SqlOperandTypeChecker, then modify the RelNode/RexNodes tree converted from a validated SqlNode tree to add in casts through custom RelOptRules.
So guys, which of the 2 ways should i go, or if there are better way to do this?
I need your help.
Updated 18-05-30:
Hi guys, i have made a PR in CALCITE-2302
This is design doc: Calcite Implicit Type Cast Design.
This is the type conversion matrix: Type Conversion Matrix.
I really appreciate your suggestions, thx.
Attachments
Issue Links
- causes
-
CALCITE-3315 Multiple failures in Druid IT tests due to implicit casts
- Closed
-
CALCITE-3360 SqlValidator throws NPE for unregistered function without implicit type coercion
- Closed
- contains
-
CALCITE-2829 Use consistent types when processing ranges
- Closed
-
CALCITE-3217 Support "SELECT NULL"
- Closed
- is related to
-
CALCITE-2921 Allow NULL as argument to function calls
- Closed
-
CALCITE-3326 SQL with invalid function throws NullPointerException if typeCoercion is disabled
- Closed
- relates to
-
CALCITE-2745 RexSimplify fails with ClassCastException when the expression contains comparisons of operands with different types
- Open
-
CALCITE-5156 Support implicit integer type cast for IN Sub-query
- Resolved
-
CALCITE-2325 Calcite can not verify a explicit cast column in some scenario
- Closed
-
CALCITE-3327 Simplify SqlValidatorTest by replacing 'boolean typeCoercion' parameter with fluent method 'Sql.withTypeCoercion(boolean)'
- Closed
-
CALCITE-3423 Support using CAST operation and BOOLEAN type value in table macro
- Closed
-
CALCITE-3206 Better error message when param type incompatibility
- Closed
-
CALCITE-3331 Support implicit type cast for operators that use single operand family checker
- Closed
- links to