[ https://issues.apache.org/jira/browse/HIVE-26771?focusedWorklogId=830047&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-830047 ]
ASF GitHub Bot logged work on HIVE-26771: ----------------------------------------- Author: ASF GitHub Bot Created on: 30/Nov/22 12:58 Start Date: 30/Nov/22 12:58 Worklog Time Spent: 10m Work Description: kasakrisz commented on code in PR #3802: URL: https://github.com/apache/hive/pull/3802#discussion_r1035938326 ########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java: ########## @@ -236,11 +236,25 @@ public void commitCreateTable(org.apache.hadoop.hive.metastore.api.Table hmsTabl setFileFormat(catalogProperties.getProperty(TableProperties.DEFAULT_FILE_FORMAT)); String metadataLocation = hmsTable.getParameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP); + Table table; if (metadataLocation != null) { - Catalogs.registerTable(conf, catalogProperties, metadataLocation); + table = Catalogs.registerTable(conf, catalogProperties, metadataLocation); } else { - Catalogs.createTable(conf, catalogProperties); + table = Catalogs.createTable(conf, catalogProperties); } + + if (!Boolean.parseBoolean(catalogProperties.getProperty(hive_metastoreConstants.TABLE_IS_CTAS))) { + return; + } + + // set this in the query state so that we can rollback the table in the lifecycle hook in case of failures + SessionStateUtil.addResource(conf, InputFormatConfig.CTAS_TABLE_NAME, + catalogProperties.getProperty(Catalogs.NAME)); + + String tableIdentifier = catalogProperties.getProperty(Catalogs.NAME); Review Comment: done ########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergSerDe.java: ########## @@ -120,16 +114,11 @@ public void initialize(@Nullable Configuration configuration, Properties serDePr this.tableSchema = hiveSchemaOrThrow(e, autoConversion); // This is only for table creation, it is ok to have an empty partition column list this.partitionColumns = ImmutableList.of(); - // create table for CTAS - if (e instanceof NoSuchTableException && - Boolean.parseBoolean(serDeProperties.getProperty(hive_metastoreConstants.TABLE_IS_CTAS))) { - if (!Catalogs.hiveCatalog(configuration, serDeProperties)) { - throw new SerDeException(CTAS_EXCEPTION_MSG); - } - if (!serDeProperties.containsKey(Constants.EXPLAIN_CTAS_LOCATION)) { - createTableForCTAS(configuration, serDeProperties); - } + if (e instanceof NoSuchTableException && + Boolean.parseBoolean(serDeProperties.getProperty(hive_metastoreConstants.TABLE_IS_CTAS)) && Review Comment: done Issue Time Tracking ------------------- Worklog Id: (was: 830047) Time Spent: 2h 10m (was: 2h) > Use DDLTask to created Iceberg table when running ctas statement > ---------------------------------------------------------------- > > Key: HIVE-26771 > URL: https://issues.apache.org/jira/browse/HIVE-26771 > Project: Hive > Issue Type: Improvement > Components: Iceberg integration > Reporter: Krisztian Kasa > Assignee: Krisztian Kasa > Priority: Major > Labels: pull-request-available > Time Spent: 2h 10m > Remaining Estimate: 0h > > When Iceberg table is created via ctas statement the table is created in > HiveIcebergSerDe and no DDL task is executed. > Negative effects of this workflow: > * Missing table properties: format-version, write.[delete|update|merge].mode > * Default privileges of the new table are not granted. > * The new Iceberg table can be seen by other transactions at compile time of > ctas. > * Table creation and table properties are not shown in explain ctas output. -- This message was sent by Atlassian Jira (v8.20.10#820010)