badalprasadsingh commented on code in PR #2795:
URL: https://github.com/apache/iceberg-go/pull/2795#discussion_r4782667165
##########
table/arrow_scanner.go:
##########
@@ -2665,7 +2665,7 @@ func (as *arrowScan) processRecordsWithPlans(
return err
}
- filePruningFilter, err :=
iceberg.TranslateColumnNames(pruningFilter, fileSchema)
+ filePruningFilter, err :=
iceberg.TranslateColumnNamesForPruning(pruningFilter, fileSchema)
Review Comment:
also a test following this path
##########
visitors.go:
##########
@@ -720,6 +720,31 @@ func TranslateColumnNames(expr BooleanExpression,
fileSchema *Schema) (BooleanEx
return res, nil
}
+// TranslateColumnNamesForPruning is TranslateColumnNames for expressions used
+// only to prune files or row groups from statistics. It differs in keeping
+// geospatial bbox predicates, rebuilt over the file's column name, so
+// statistics-based evaluators can use them. Such an expression must never
reach
+// the record filter, which has no form for bbox predicates. A bbox over a
column
+// missing from the file becomes AlwaysTrue, which keeps the file.
+func TranslateColumnNamesForPruning(expr BooleanExpression, fileSchema
*Schema) (BooleanExpression, error) {
Review Comment:
no test covers this function's missing col, rename or NotIntersects cases,
and they keep scans correct: a file that predates the col must give
"AlwaysTrue", not "AlwaysFalse", which would drop all of that file's rows
please add a test next to `TestBBoxTranslateColumnNames`
##########
visitors.go:
##########
@@ -910,8 +938,16 @@ func (t *scanTranslator) VisitBound(pred BoundPredicate)
BooleanExpression {
// A bbox predicate has no substrait/record-filter form; it is
evaluated only
// during metrics-based file pruning, so the record filter must
conservatively
// keep every row.
- if _, ok := pred.(BoundBBoxPredicate); ok {
- return AlwaysTrue{}
+ if bb, ok := pred.(BoundBBoxPredicate); ok {
Review Comment:
we need to update the `boundBBoxPredicate`doc in exprs.go: it still says the
visitor always turns a bbox into `AlwaysTrue`
--
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]