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/11/21 22:04:00 UTC

Re: [PR] HIVE-26950: Iceberg: Addendum: CTLT sets incorrect 'TRANSLATED_TO_EXTERNAL' table property [hive]

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


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaHook.java:
##########
@@ -118,7 +119,7 @@ default void preDropTable(Table table, boolean deleteData) throws MetaException
    *
    * @param table table definition
    */
-  public void rollbackDropTable(Table table)
+  void rollbackDropTable(Table table)

Review Comment:
   are these removal of public related?



##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -1581,22 +1582,21 @@ public void prepareAlterTableEnvironmentContext(AbstractAlterTableDesc alterTabl
   public void setTableParametersForCTLT(org.apache.hadoop.hive.ql.metadata.Table tbl, CreateTableLikeDesc desc,
       Map<String, String> origParams) {
     // Preserve the format-version of the iceberg table and filter out rest.
-    String formatVersion = origParams.get(TableProperties.FORMAT_VERSION);
-    if ("2".equals(formatVersion)) {
-      tbl.getParameters().put(TableProperties.FORMAT_VERSION, formatVersion);
+    if (IcebergTableUtil.isV2Table(origParams)) {
+      tbl.getParameters().put(TableProperties.FORMAT_VERSION, "2");
       tbl.getParameters().put(TableProperties.DELETE_MODE, MERGE_ON_READ);
       tbl.getParameters().put(TableProperties.UPDATE_MODE, MERGE_ON_READ);
       tbl.getParameters().put(TableProperties.MERGE_MODE, MERGE_ON_READ);
     }
 
     // check if the table is being created as managed table, in that case we translate it to external
-    if (!desc.isExternal()) {
+    if (!HiveTableUtil.isExternalTable(origParams)) {

Review Comment:
   origParams would be of the source table, right?, if that is managed, why we need to put translated to external?, if the target table is created as Managed, then we convert it to External, & put this in, right?
   
   Means 
   ``create external table target like man_table;``
   this needs no translation, if man_table is managed I believe but ``create table target like man_table;`` needs to have that translation
   



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