lasdf1234 commented on code in PR #14883:
URL: https://github.com/apache/gravitino/pull/14883#discussion_r4585661642
##########
maintenance/optimizer/src/main/java/org/apache/gravitino/maintenance/optimizer/recommender/job/PartitionUtils.java:
##########
@@ -82,14 +109,19 @@ public static String getWhereClauseForPartition(
Transform transform = partitioning[i];
String columnName = getColumnName(transform);
- Column column =
- Preconditions.checkNotNull(
- columnMap.get(columnName.toLowerCase(Locale.ROOT)),
- "Column '%s' not found in table schema",
- columnName);
+ // Nested paths like event.ts are absent from schema; fall back to
top-level event.
+ Column column = columnMap.get(columnName.toLowerCase(Locale.ROOT));
+ if (column == null && columnName.indexOf('.') >= 0) {
+ column =
+ columnMap.get(
+ columnName.substring(0,
columnName.indexOf('.')).toLowerCase(Locale.ROOT));
+ }
+ Preconditions.checkNotNull(column, "Column '%s' not found in table
schema", columnName);
String expression = buildExpression(transform, columnName);
- String literal = formatLiteral(transform, column,
entry.partitionValue());
+ // Walk into struct fields so nested identity uses TIMESTAMP/INT/... not
STRUCT→string.
+ String literal =
+ formatLiteral(transform, resolveLeafDataType(column, columnName),
entry.partitionValue());
Review Comment:
Fixed on latest HEAD (`74bc2a405b`).
`PartitionUtils#formatLiteral` now parses identity boolean / integral /
floating / decimal values before emitting SQL (fail-loud on malformed input). A
nested identity like `event.id = 7` still works; `7 OR 1 = 1` throws
`IllegalArgumentException` instead of broadening the predicate. Boolean only
accepts `true`/`false`. Added `TestPartitionUtils` regressions for the nested
integer injection case and a non-literal boolean.
`years`/`months`/`hours`/`bucket` share the same trim+parse helper with a
distinct error prefix.
Resolving.
--
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]