sdaberdaku commented on issue #18701:
URL: https://github.com/apache/iceberg/issues/18701#issuecomment-7353020196
`lt` and `ltEq` have the same behaviour. For these two operators, the
evaluators also do not agree with each other. I checked Iceberg 1.12.0:
- `Evaluator.lt` and `ResidualEvaluator.lt` compare with the literal
comparator, which orders null first. A null value matches `x < v` and `x <= v`.
- `InclusiveEvalVisitor.lt` returns `ROWS_CANNOT_MATCH` when the file
contains only nulls. `StrictEvalVisitor.lt` returns `ROWS_MIGHT_NOT_MATCH` when
the file can contain nulls. For these two classes, a null value does not match.
So the result for a null value depends on the evaluator that gets the
predicate. I see two effects for an identity partition column `part` that has a
partition with a null value:
- `DeleteFiles.deleteFromRowFilter(lessThan("part", 2))` deletes the data
files of the null partition. `ResidualEvaluator` replaces the predicate with
`alwaysTrue()` for that partition, so the metrics evaluators do not get the
predicate.
- A scan with the same filter keeps the data files of the null partition
when they have no column metrics. It prunes them when they have null counts.
I found this through Trino, which sends such predicates without a `notNull`
guard. The delete also occurs with the Iceberg API only. The table has the
partitions `part = 1`, `part = 2` and `part = null`. After
`table.newDelete().deleteFromRowFilter(Expressions.lessThan("part",
2)).commit()`, only the data file of `part = 2` stays. I got the same result
for Parquet, ORC and Avro data files. I saw the scan effect through Trino only.
For the open question: for `lt` and `ltEq`, the current behaviour is not a
consistent two-valued logic.
--
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]