xiangfu0 commented on code in PR #18874:
URL: https://github.com/apache/pinot/pull/18874#discussion_r3799752421
##########
pinot-query-planner/src/main/java/org/apache/pinot/query/parser/CalciteRexExpressionParser.java:
##########
@@ -146,6 +147,8 @@ public static Literal toLiteral(RexExpression.Literal
literal) {
value = BooleanUtils.isTrueInternalValue(value);
} else if (dataType == ColumnDataType.BYTES) {
value = ((ByteArray) value).getBytes();
+ } else if (dataType == ColumnDataType.UUID) {
+ value = UuidUtils.toUUID((ByteArray) value);
Review Comment:
Good point. UUID Rex literals are already stored internally as ByteArray, so
this now shares the BYTES path and passes the underlying byte[] directly to
RequestUtils. The existing binary-literal test still verifies the exact 16
bytes.
##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java:
##########
@@ -264,6 +271,9 @@ private static RexExpression.Literal
fromRexLiteralValue(ColumnDataType dataType
case BYTES:
value = new ByteArray(((ByteString) value).getBytes());
break;
+ case UUID:
+ value = new ByteArray(UuidUtils.toBytes((UUID) value));
Review Comment:
Yes. Calcite represents a non-null SqlTypeName.UUID Rex literal as
java.util.UUID: RexBuilder.makeUuidLiteral(UUID) stores that value, and
RexLiteral validates the representation for the UUID type. This matches the
direct typed casts used for the other literal types above, and the round-trip
test verifies the value.
##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java:
##########
@@ -149,6 +151,11 @@ public static RexLiteral toRexLiteral(RelBuilder builder,
RexExpression.Literal
ByteString byteString = new ByteString(bytes);
return rexBuilder.makeBinaryLiteral(byteString);
}
+ case UUID:
+ if (value == null) {
Review Comment:
Good point—there is no UUID-specific reason. I aligned UUID with the
existing scalar cases by using the same non-null assertion and removed the
UUID-only typed-null test. Consistent typed-null handling should be addressed
across all types separately.
--
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]