danny0405 commented on code in PR #20654:
URL: https://github.com/apache/hudi/pull/20654#discussion_r4559552024


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/FlinkRowDataReaderContext.java:
##########
@@ -113,8 +113,11 @@ public ClosableIterator<RowData> getFileRecordIterator(
         .getReaderFactory(HoodieRecord.HoodieRecordType.FLINK)
         .getFileReader(tableConfig, filePath, format, Option.empty());
     try {
+      // Native delete logs may omit business key columns, so query predicates 
can discard tombstones needed for merging.
+      List<ExpressionPredicates.Predicate> predicates = 
FSUtils.isNativeDeleteLogFile(filePath.getName())

Review Comment:
   Thanks for clarifying the Spark behavior. Could we address this in Flink's 
predicate translation in the same way, by checking the actual Parquet file 
schema before constructing a predicate, instead of disabling all query 
predicates for native delete logs here?
   
   The existing MOR restriction to primary-key / `_hoodie_record_key` 
predicates should remain. The missing second check is physical field 
availability: `RecordIterators` currently calls `predicate.filter()` without 
validating the referenced columns against the file schema. For `uuid = 'id1'`, 
a native delete file has `_hoodie_record_key` and ordering fields but no 
`uuid`; Parquet treats the absent column as null and can prune the tombstone's 
row group, allowing the deleted base record to reappear.
   
   Spark's `HoodieSparkParquetReader` constructs `ParquetFilters` with 
`getFileSchema()`, and `ParquetFilters.canMakeFilterOn` checks 
`nameToParquetField.contains(name)`. Unsupported predicates are omitted. 
Applying the same principle in Flink would retain deletes when business-key 
columns are absent while preserving safe pushdown on the physically stored 
`_hoodie_record_key`, without translating business keys into their encoded 
representation.
   
   Please keep compound predicates conservative as well (e.g. do not push only 
the supported side of an OR), and extend the regression tests to cover both an 
absent business-key predicate retaining tombstones and a stored 
`_hoodie_record_key` predicate still pruning nonmatching delete row groups.



-- 
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]

Reply via email to