Github user hsuanyi commented on a diff in the pull request: https://github.com/apache/drill/pull/397#discussion_r56458586 --- 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 -- This is to avoid implicit casting added by Calcite.
--- 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. ---