hudi-agent commented on code in PR #20314:
URL: https://github.com/apache/hudi/pull/20314#discussion_r4270485030
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSource.java:
##########
@@ -496,7 +498,37 @@ private Option<Function<Integer, Integer>>
getDataBucketFunc(List<ResolvedExpres
if (!ExpressionUtils.isFilteringByAllFields(indexKeyFilters,
indexKeyFields)) {
return Option.empty();
}
- return Option.of(PrimaryKeyPruners.getBucketIdFunc(indexKeyFilters, conf));
+ return resolvePrefixedSingleFieldKey()
+ .map(prefixedSingleFieldKey ->
PrimaryKeyPruners.getBucketIdFunc(indexKeyFilters, conf,
prefixedSingleFieldKey));
+ }
+
+ /**
+ * Resolves whether the bucket writers hash a single record key field as
{@code <field>:<value>}.
+ *
+ * @return empty when the form of the stored record keys cannot be
determined, which skips the bucket pruning
+ */
+ private Option<Boolean> resolvePrefixedSingleFieldKey() {
Review Comment:
🤖 nit: could you replace `Option<Boolean>` with a small enum (e.g.
`PREFIXED`, `BARE`, `UNKNOWN`)? Here empty means "skip pruning" and `false`
means "bare keys", which is easy to misread at the call site.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]