Github user jinfengni commented on a diff in the pull request:

    https://github.com/apache/drill/pull/397#discussion_r56524249
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/SqlConverter.java
 ---
    @@ -364,4 +401,35 @@ private static SchemaPlus rootSchema(SchemaPlus 
schema) {
         }
       }
     
    +  private static class DrillRexBuilder extends RexBuilder {
    +    private DrillRexBuilder(RelDataTypeFactory typeFactory) {
    +      super(typeFactory);
    +    }
    +
    +    @Override
    +    public RexNode ensureType(
    +        RelDataType type,
    +        RexNode node,
    +        boolean matchNullability) {
    +      RelDataType targetType = type;
    +      if (matchNullability) {
    +        targetType = matchNullability(type, node);
    +      }
    +      if (targetType.getSqlTypeName() == SqlTypeName.ANY) {
    +        return node;
    +      }
    +      if (!node.getType().equals(targetType)) {
    +        if(!targetType.isStruct()) {
    +          final RelDataType anyType = 
TypeInferenceUtils.createCalciteTypeWithNullability(
    --- End diff --
    
    Cast an expression to "any" type? why do we have to add this? On line 418, 
in Calcite, the code's intention is to skip CAST to "any", since it does not 
make sense to cast to "any". Why do you want to explicitly add this here?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to