huaxingao commented on code in PR #15977:
URL: https://github.com/apache/iceberg/pull/15977#discussion_r3175592247
##########
api/src/main/java/org/apache/iceberg/expressions/Literal.java:
##########
@@ -71,6 +71,18 @@ static Literal<BigDecimal> of(BigDecimal value) {
return new Literals.DecimalLiteral(value);
}
+ /**
+ * Returns a sentinel literal representing an explicit null default value.
Review Comment:
When users build predicates, they normally do something like:
```
Expressions.equal("col", null)
```
or
```
Expressions.lit(null)
```
These will fail immediately with NullPointerException("Cannot create
expression literal from null") because Literals.from(value) rejects null up
front.
The only way a user might misuse this is by explicitly calling
Literal.ofNull() and passing it into the low-level
```
Expressions.predicate(EQ, "col", Literal.ofNull())
```
That's a rare path. If someone does take this path, it would compile but
fail at runtime via NullLiteral.comparator() throwing
UnsupportedOperationException with `NullLiteral has no comparator`.
--
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]