LakshSingla commented on code in PR #15607:
URL: https://github.com/apache/druid/pull/15607#discussion_r1446638498


##########
sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/EarliestLatestAnySqlAggregator.java:
##########
@@ -316,6 +344,16 @@ public EarliestLatestReturnTypeInference(int ordinal)
     public RelDataType inferReturnType(SqlOperatorBinding sqlOperatorBinding)
     {
       RelDataType type = sqlOperatorBinding.getOperandType(this.ordinal);
+
+      // If complex and of type SerializablePairLong*, return type
+      if (type instanceof RowSignatures.ComplexSqlType) {
+        ColumnType complexColumnType = ((RowSignatures.ComplexSqlType) 
type).getColumnType();
+        String complexTypeName = complexColumnType.getComplexTypeName();
+        if (complexTypeName != null && 
(complexTypeName.equals(SerializablePairLongLongComplexMetricSerde.TYPE_NAME) 
|| 
complexTypeName.equals(SerializablePairLongFloatComplexMetricSerde.TYPE_NAME) 
|| 
complexTypeName.equals(SerializablePairLongDoubleComplexMetricSerde.TYPE_NAME)))
 {

Review Comment:
   If the input type is complex, it should return the scalar value for that 
complex type (float for longFloatPair etc), else if the input is numeric, it 
should return that numeric type, else it should return varchar (in unknown 
complex, string and any other sql type cases)



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to