flyrain commented on code in PR #7177:
URL: https://github.com/apache/iceberg/pull/7177#discussion_r1147849826
##########
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:
I cannot reproduce the NPE locally. Run this script on Java8 and Java11.
Neither triggered the NPE. Maybe Java has fixed the issue?
```
jshell> int a = 1
a ==> 1
jshell> Boolean b = a== 1 ? null: true
b ==> null
```
--
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]