aokolnychyi commented on code in PR #7177:
URL: https://github.com/apache/iceberg/pull/7177#discussion_r1145612369
##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureInput.java:
##########
@@ -62,31 +62,43 @@ public boolean isProvided(ProcedureParameter param) {
return !args.isNullAt(ordinal);
}
- public boolean bool(ProcedureParameter param, boolean defaultValue) {
+ public Boolean asBoolean(ProcedureParameter param, Boolean defaultValue) {
validateParamType(param, DataTypes.BooleanType);
int ordinal = ordinal(param);
- return args.isNullAt(ordinal) ? defaultValue : args.getBoolean(ordinal);
+ return args.isNullAt(ordinal) ? defaultValue : (Boolean)
args.getBoolean(ordinal);
Review Comment:
An explicit cast is needed to prevent a NPE, probably same as
[here](https://stackoverflow.com/questions/25417438/java-autoboxing-and-ternary-operator-madness).
##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureInput.java:
##########
@@ -62,31 +62,43 @@ public boolean isProvided(ProcedureParameter param) {
return !args.isNullAt(ordinal);
}
- public boolean bool(ProcedureParameter param, boolean defaultValue) {
+ public Boolean asBoolean(ProcedureParameter param, Boolean defaultValue) {
validateParamType(param, DataTypes.BooleanType);
int ordinal = ordinal(param);
- return args.isNullAt(ordinal) ? defaultValue : args.getBoolean(ordinal);
+ return args.isNullAt(ordinal) ? defaultValue : (Boolean)
args.getBoolean(ordinal);
Review Comment:
An explicit cast is needed to prevent a NPE when `defaultValue` is null,
probably same as
[here](https://stackoverflow.com/questions/25417438/java-autoboxing-and-ternary-operator-madness).
--
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]