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


##########
maintenance/optimizer/src/main/java/org/apache/gravitino/maintenance/optimizer/recommender/job/PartitionUtils.java:
##########
@@ -156,16 +238,40 @@ private static String formatLiteral(Transform transform, 
Column column, String r
       case DECIMAL:
         return rawValue;
       case DATE:
-        return "DATE '" + rawValue + "'";
       case TIMESTAMP:
-        return "TIMESTAMP '" + rawValue + "'";
       case TIME:
-        return "TIME '" + rawValue + "'";
+        // Same CALL embedding constraint as days(); escape " / \ like string 
literals.
+        return type.name() + " \"" + escapeStringLiteral(rawValue) + "\"";
       default:
         return "\"" + escapeStringLiteral(rawValue) + "\"";
     }
   }
 
+  /**
+   * Validates and normalizes a day-partition stored value to {@code 
yyyy-MM-dd}.
+   *
+   * <p>Only ISO {@code yyyy-MM-dd} is accepted, matching Iceberg {@code
+   * DateTimeUtil.isoDateToDays(String)}. TMS update-stats stores Spark {@code 
DateType} partition
+   * values via {@code String.valueOf}, which is already ISO. Epoch-day ints 
and compact forms like
+   * {@code 20260101} are rejected rather than guessed.
+   */
+  private static String toIsoDateFromDayPartitionValue(String rawValue) {
+    try {
+      return LocalDate.parse(rawValue, DateTimeFormatter.ISO_LOCAL_DATE)

Review Comment:
   Addressed as fail-fast (no migration) on latest HEAD (`668d1d606f`).
   
   We keep ISO-only day values at `PartitionUtils` when building `where_clause` 
(before submit). Epoch-day (`19723`) and compact (`20260101`) fail loudly 
rather than guessing; there is no automatic migration from epoch-day stats. 
Built-in `update-stats` already writes ISO. Documented in TMS troubleshooting / 
alpha-scope notes.
   
   We intentionally do not re-accept epoch-day in the importer (avoids `*_day` 
name heuristics and keeps one gate at recommend/submit). 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