tanclary commented on code in PR #3741:
URL: https://github.com/apache/calcite/pull/3741#discussion_r1541707015


##########
core/src/main/java/org/apache/calcite/sql/SqlOperator.java:
##########
@@ -539,7 +539,9 @@ public RelDataType inferReturnType(
       }
 
       // MEASURE wrapper should be removed, e.g. MEASURE<DOUBLE> should just 
be DOUBLE
-      if (isMeasure(returnType) && returnType.getMeasureElementType() != null) 
{
+      if (opBinding.getOperator().kind != SqlKind.AS
+          && isMeasure(returnType)
+          && returnType.getMeasureElementType() != null) {
         returnType = 
Objects.requireNonNull(returnType.getMeasureElementType());

Review Comment:
   Is this still required given that we've just checked the element type isn't 
null?



##########
core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java:
##########
@@ -189,6 +189,15 @@ static class Fixture extends SqlTypeFixture {
     assertThat(dataType, is(innerType));
   }
 
+  @Test void testAsOperatorReturnTypeInferenceDoesNotRemoveMeasure() {

Review Comment:
   Add javadoc above with JIRA link



##########
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java:
##########
@@ -4756,6 +4756,22 @@ void checkUserDefinedOrderByOver(NullCollation 
nullCollation) {
         .ok();
   }
 
+  /** Test case for:
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6343";>[CALCITE-6343]
+   * AS alias operator strips MEASUREness from measures</a>.

Review Comment:
   Is "strips MEASURE wrapper" more descriptive?



-- 
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]

Reply via email to