You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "ayushtkn (via GitHub)" <gi...@apache.org> on 2023/07/11 18:11:57 UTC

[GitHub] [hive] ayushtkn commented on a diff in pull request #4441: HIVE-27454: Iceberg: Allow expire snapshots by id.

ayushtkn commented on code in PR #4441:
URL: https://github.com/apache/hive/pull/4441#discussion_r1260105783


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/execute/AlterTableExecuteAnalyzer.java:
##########
@@ -89,8 +90,13 @@ protected void analyzeCommand(TableName tableName, Map<String, String> partition
 
       ZoneId timeZone = SessionState.get() == null ? new HiveConf().getLocalTimeZone() : SessionState.get().getConf()
           .getLocalTimeZone();
-      TimestampTZ time = TimestampTZUtil.parse(PlanUtils.stripQuotes(child.getText()), timeZone);
-      spec = new AlterTableExecuteSpec(EXPIRE_SNAPSHOT, new ExpireSnapshotsSpec(time.toEpochMilli()));
+      String childText = PlanUtils.stripQuotes(child.getText().trim());
+      if (childText.contains(",") || StringUtils.isNumeric(childText)) {

Review Comment:
   done



##########
ql/src/java/org/apache/hadoop/hive/ql/parse/AlterTableExecuteSpec.java:
##########
@@ -102,18 +104,34 @@ public String toString() {
    * </ul>
    */
   public static class ExpireSnapshotsSpec {
-    private final long timestampMillis;
+    private long timestampMillis = -1L;
+    private String[] idsToExpire = null;
 
     public ExpireSnapshotsSpec(long timestampMillis) {
       this.timestampMillis = timestampMillis;
     }
 
+    public ExpireSnapshotsSpec(String ids) {
+      this.idsToExpire = ids.split(",");
+    }
+
     public Long getTimestampMillis() {
       return timestampMillis;
     }
 
+    public String[] getIdsToExpire() {
+      return idsToExpire;
+    }
+
+    public boolean isExpireByIds() {
+      return idsToExpire != null;
+    }
+
     @Override
     public String toString() {
+      if (isExpireByIds()) {

Review Comment:
   done



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org