slfan1989 commented on code in PR #13913:
URL: https://github.com/apache/iceberg/pull/13913#discussion_r2371034604


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureInput.java:
##########
@@ -92,6 +109,22 @@ public Long asLong(ProcedureParameter param, Long 
defaultValue) {
     return args.isNullAt(ordinal) ? defaultValue : (Long) 
args.getLong(ordinal);
   }
 
+  public long[] asLongArray(ProcedureParameter param, Long[] defaultValue) {
+    validateParamType(param, DataTypes.createArrayType(DataTypes.LongType));
+    Long[] source =
+        array(param, (array, ordinal) -> array.getLong(ordinal), Long.class, 
defaultValue);
+
+    if (source == null) {
+      return null;

Review Comment:
   Thanks for your comment! The `defaultValue` has already been used in the 
array method:
   
   ```
   Long[] source =
       array(param, (array, ordinal) -> array.getLong(ordinal), Long.class, 
defaultValue);
   ```
   
   Therefore, if ` source` returns null, it means that `defaultValue` is also 
`null`, and in this case returning `null` is reasonable. Currently, the type of 
`defaultValue` is `Long[]`. If we were to return `defaultValue` directly here, 
we would need to introduce additional redundant logic just to satisfy Java 
syntax.
   
   I think returning null is a more appropriate approach since it keeps the 
code simpler. Is it fine if I handle it this way?



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