Copilot commented on code in PR #9136:
URL: https://github.com/apache/seatunnel/pull/9136#discussion_r2036610449


##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/sql/zeta/functions/SystemFunction.java:
##########
@@ -177,6 +178,26 @@ public static Object castAs(List<Object> args) {
                 BigDecimal bigDecimal = new BigDecimal(v1.toString());
                 Integer scale = (Integer) args.get(3);
                 return bigDecimal.setScale(scale, RoundingMode.CEILING);
+            case "BOOLEAN":
+                if (v1 instanceof Number) {
+                    if (Arrays.asList(1, 0).contains(((Number) 
v1).intValue())) {
+                        return ((Number) v1).intValue() == 1;
+                    } else {
+                        throw new TransformException(
+                                
CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,
+                                String.format("Unsupported CAST AS Boolean: 
%s", v2));

Review Comment:
   The variable 'v2' is not defined in this context. Consider replacing 'v2' 
with the correct variable (likely 'v1') to represent the value being cast.
   ```suggestion
                                   String.format("Unsupported CAST AS Boolean: 
%s", v1));
   ```



-- 
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: commits-unsubscr...@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to