jerryshao commented on code in PR #14883:
URL: https://github.com/apache/gravitino/pull/14883#discussion_r4594297363
##########
maintenance/optimizer/src/main/java/org/apache/gravitino/maintenance/optimizer/recommender/job/PartitionUtils.java:
##########
@@ -82,14 +129,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);
-
- String expression = buildExpression(transform, columnName);
- String literal = formatLiteral(transform, column,
entry.partitionValue());
+ // 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,
catalogName.trim());
Review Comment:
[P2] With an identity partition on the integer field `user-id` inside
`event`, schema lookup succeeds, but `event.user-id = 7` parses as subtraction
and the CALL can fail on an unresolved column. Please keep the transform’s
field-name components through lookup and backtick-quote each component when
rendering SQL, doubling any embedded backticks. A Spark regression using
`event`.`user-id` would cover both the field lookup and the generated predicate.
--
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]