Github user hsuanyi commented on a diff in the pull request: https://github.com/apache/drill/pull/397#discussion_r56527875 --- 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 -- I thought Calcite might have mechanism to further catch the cases where implicit casting is not added in. Let me try if we can find any issue when there is no such a cast to ANY
--- 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. ---