lasdf1234 commented on code in PR #14883:
URL: https://github.com/apache/gravitino/pull/14883#discussion_r4594883631


##########
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:
   Thanks — fixed in 2b19394143.
   
   `PartitionUtils` no longer joins/splits transform field names on `.`. It 
keeps the transform’s field-name components for schema lookup 
(`resolveLeafDataType` walks each component, including struct-in-struct) and 
backtick-quotes each component when rendering the LHS (`quoteFieldPath` / 
`quoteIdentifier`, doubling embedded backticks). Iceberg Spark system function 
names stay bare (`catalog.system.days(...)`), only the field path and catalog 
identifier are quoted.
   
   Examples now emitted:
   - identity nested hyphen: `` `event`.`user-id` = 7 ``
   - identity struct-in-struct: `` `event`.`meta`.`user-id` = 7 ``
   - day on nested hyphen: `` `ice`.system.days(`event`.`event-ts`) = DATE 
'...' `` (not `` `system`.`days` ``)
   
   Coverage:
   - UT: `TestPartitionUtils` 
(`testIdentityNestedHyphenatedFieldIsBacktickQuoted`, top-level hyphen, 
struct-in-struct, day/bucket on hyphenated paths, non-struct intermediate path 
error)
   - Adapter: 
`TestGravitinoCompactionJobAdapter.testHierarchicalSchemaTableIdentifierAndQuotedFieldWhere`
 / `testStructInStructHyphenatedFieldWhere`
   - Spark CALL: `TestIcebergRewriteDataFilesJobWithSpark` (top-level / nested 
/ struct-in-struct hyphen, day on hyphenated nested fields, nested namespace)
   - Builtin helper regressions under `TestBuiltinIcebergRewriteDataFiles` 
(when `GRAVITINO_ENV_IT=true`)
   
   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]

Reply via email to