danny0405 commented on a change in pull request #1437: [CALCITE-3318]
Preserving CAST of STRING operands in comparison operator
URL: https://github.com/apache/calcite/pull/1437#discussion_r321964270
##########
File path:
core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java
##########
@@ -305,21 +305,19 @@ private static RexNode stripCastFromString(RexNode node)
{
final RexNode o1 = call.operands.get(1);
if (o0.getKind() == SqlKind.CAST
&& o1.getKind() != SqlKind.CAST) {
- final RexNode o0b = ((RexCall) o0).getOperands().get(0);
- switch (o0b.getType().getSqlTypeName()) {
- case CHAR:
- case VARCHAR:
- return call.clone(call.getType(), ImmutableList.of(o0b, o1));
+ if (dialect.castRequiredForStringOperand((RexCall) o0)) {
+ return node;
Review comment:
I'm considering if we should introduce a method like
`SqlDialect#supportImplicitCast`, the `castRequiredForStringOperand` seems a
little too related to the sql contexts. There are kinds of sql contexts for
implicit type coercion, also not only for STRING type.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services