yzeng1618 commented on code in PR #10145:
URL: https://github.com/apache/seatunnel/pull/10145#discussion_r2633304169
##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/sql/zeta/functions/CommonFunction.java:
##########
@@ -44,6 +46,17 @@ public static SeaTunnelDataType resolveExpressionType(
if (expression instanceof NullValue) {
return null;
}
+ if (expression instanceof ComparisonOperator) {
+ return BasicType.BOOLEAN_TYPE;
+ }
+ if (expression instanceof BinaryExpression) {
+ BinaryExpression binaryExpression = (BinaryExpression) expression;
+ SeaTunnelDataType leftType =
+
resolveExpressionType(binaryExpression.getLeftExpression(), rowType);
+ SeaTunnelDataType rightType =
+
resolveExpressionType(binaryExpression.getRightExpression(), rowType);
+ return unifyCollectionType(leftType, rightType);
+ }
Review Comment:
This change extends CommonFunction.resolveExpressionType to support
ComparisonOperator (always BOOLEAN) and BinaryExpression (derive a common type
by recursively resolving operands), so type inference for ARRAY(...)/MAP(...)
works when arguments are expressions instead of only literals/columns;
--
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]