Hi, Anjali ~ Are you doing the UNION by Sql ? If so, can you give the Sql content ? Are you doing the UNION on RelNodes ?, If so, you need to do type CAST.
Jin Anjali Shrishrimal <anjali.shrishri...@1eq.com.invalid> 于2020年4月27日周一 下午4:25写道: > Hi, > > While doing union of 2 RelNodes with different types, I am getting NPE. (I > am using calcite 1.21.0) > java.lang.NullPointerException: at index 0 > at > com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:225) > at > com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:215) > at > com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:209) > at > com.google.common.collect.ImmutableList.construct(ImmutableList.java:346) > at > com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:258) > at > org.apache.calcite.rel.type.RelDataTypeFactoryImpl.canonize(RelDataTypeFactoryImpl.java:373) > at > org.apache.calcite.rel.type.RelDataTypeFactoryImpl.createStructType(RelDataTypeFactoryImpl.java:155) > at > org.apache.calcite.rel.type.RelDataTypeFactoryImpl.createStructType(RelDataTypeFactoryImpl.java:146) > at > org.apache.calcite.rel.type.RelDataTypeFactory$Builder.build(RelDataTypeFactory.java:569) > at > org.apache.calcite.rel.type.RelDataTypeFactoryImpl.leastRestrictiveStructuredType(RelDataTypeFactoryImpl.java:257) > at > org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictiveSqlType(SqlTypeFactoryImpl.java:285) > at > org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictive(SqlTypeFactoryImpl.java:156) > at > org.apache.calcite.rel.core.SetOp.deriveRowType(SetOp.java:107) > > If the column types (family types) are different, currently the derived > type is null. Is there any way to control that? > Where can I define the type in case of mismatch ? > > > Thank you, > Anjali Shrishrimal >