tjbanghart commented on code in PR #3336:
URL: https://github.com/apache/calcite/pull/3336#discussion_r1272549350
##########
core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java:
##########
@@ -153,6 +153,15 @@ private static final class CustomTypeSystem extends
RelDataTypeSystemImpl {
assertEquals(SqlTypeName.DOUBLE, dataType.getSqlTypeName());
}
+ @Test void testLeastRestrictiveUsesMeasureElementType() {
+ RelDataType innerType = TYPE_FACTORY.createSqlType(SqlTypeName.DOUBLE);
+ RelDataType operand1 = TYPE_FACTORY.createMeasureType(innerType);
+ RelDataType operand2 = TYPE_FACTORY.createSqlType(SqlTypeName.INTEGER);
+ RelDataType dataType = SqlLibraryOperators.IFNULL
+ .inferReturnType(TYPE_FACTORY, Lists.newArrayList(operand1, operand2));
+ assertEquals(dataType, operand1);
Review Comment:
`assertEquals(dataType, operand1)` ensures we have a `MEASURE<DOUBLE>`. Is
that desired? I think yes, but want to consider if the return type should be
the `innerType` of the measure.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]