You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/05/10 09:30:59 UTC

[GitHub] [hive] lcspinter commented on a diff in pull request #3270: HIVE-26203: Implement alter iceberg table metadata location

lcspinter commented on code in PR #3270:
URL: https://github.com/apache/hive/pull/3270#discussion_r869026054


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -336,6 +336,30 @@ public void preAlterTable(org.apache.hadoop.hive.metastore.api.Table hmsTable, E
       // that users can change data types or reorder columns too with this alter op type, so its name is misleading..)
       assertNotMigratedTable(hmsTable.getParameters(), "CHANGE COLUMN");
       handleChangeColumn(hmsTable);
+    } else if (AlterTableType.ADDPROPS.equals(currentAlterTableOp)) {
+      assertNotThirdPartyMetadataLocationChange(hmsTable.getParameters());
+    }
+  }
+
+  /**
+   * Perform a check on the current iceberg table whether a metadata change can be performed. A table is eligible if
+   * the current metadata uuid and the new metadata uuid matches.
+   * @param tblParams hms table properties, must be non-null
+   */
+  private void assertNotThirdPartyMetadataLocationChange(Map<String, String> tblParams) {
+    if (tblParams.containsKey(BaseMetastoreTableOperations.METADATA_LOCATION_PROP)) {
+      Preconditions.checkArgument(icebergTable != null,

Review Comment:
   This can happen if we want to migrate a table to an iceberg and change the metadata location in the same query



-- 
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