voonhous opened a new pull request, #21072: URL: https://github.com/apache/hudi/pull/21072
### Describe the issue this Pull Request addresses Closes #21063. On Spark 4 a string column can carry a collation that does not compare by bytes (for ex `UTF8_LCASE`, where "a" = "A"). Index stats are byte-ordered and index keys are the values' bytes, so data skipping on such a column could prune files holding matching rows. This cannot be reached yet: `HoodieSparkSchemaConverters` rejects collated columns at write time. The guard has to be in place before that changes, as noted in the #20458 review. ### Summary and Changelog - New `SparkAdapter#hasNonBinaryCollation(dataType)`: true for a string type, at any depth of a struct, array or map, whose collation does not support binary equality and ordering. It is always false on Spark 3. - `HoodieFileIndex#filterFileSlices` leaves every data filter that holds such a string out of partition and file pruning (partition stats, column stats, expression, record, secondary and bloom indexes). Spark still applies those filters to the rows read. - Tests in `TestHoodieFileIndex`: the collation check, and a column stats table where `str = 'k0001'` prunes to one file with the default string type but keeps every file with `STRING COLLATE UTF8_LCASE` (Spark 4 only). Without the guard, Spark 4.2 prunes the collated filter to one file. ### Impact None today. Once collated columns are accepted, filters over them no longer use indexes. ### Risk Level low ### Documentation Update none ### Contributor's checklist - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Enough context is provided in the sections above - [x] Adequate tests were added if applicable -- 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]
