deniskuzZ commented on code in PR #6474:
URL: https://github.com/apache/hive/pull/6474#discussion_r3559360752


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -335,32 +350,10 @@ public void commitJob(JobContext originalContext) {
   @Override
   public void configureJobConf(TableDesc tableDesc, JobConf jobConf) {
     setCommonJobConf(jobConf);
-    if (tableDesc != null && tableDesc.getProperties() != null &&
-        tableDesc.getProperties().get(InputFormatConfig.OPERATION_TYPE_PREFIX 
+ tableDesc.getTableName()) != null) {
-      String tableName = tableDesc.getTableName();
-      String opKey = InputFormatConfig.OPERATION_TYPE_PREFIX + tableName;
-      // set operation type into job conf too
-      jobConf.set(opKey, tableDesc.getProperties().getProperty(opKey));
-      Preconditions.checkArgument(!tableName.contains(TABLE_NAME_SEPARATOR),
-          "Can not handle table " + tableName + ". Its name contains '" + 
TABLE_NAME_SEPARATOR + "'");
-      if 
(HiveCustomStorageHandlerUtils.getWriteOperation(tableDesc.getProperties()::getProperty,
 tableName) != null) {
-        HiveCustomStorageHandlerUtils.setWriteOperation(jobConf, tableName,
-            Operation.valueOf(tableDesc.getProperties().getProperty(
-                HiveCustomStorageHandlerUtils.WRITE_OPERATION_CONFIG_PREFIX + 
tableName)));
-      }
-      boolean isMergeTaskEnabled = Boolean.parseBoolean(tableDesc.getProperty(
-          HiveCustomStorageHandlerUtils.MERGE_TASK_ENABLED + tableName));
-      if (isMergeTaskEnabled) {
-        HiveCustomStorageHandlerUtils.setMergeTaskEnabled(jobConf, tableName, 
true);
-      }
-      String tables = jobConf.get(InputFormatConfig.OUTPUT_TABLES);
-      tables = (tables == null) ? tableName : tables + TABLE_NAME_SEPARATOR + 
tableName;
-      jobConf.set(InputFormatConfig.OUTPUT_TABLES, tables);
-
-      String catalogName = 
tableDesc.getProperties().getProperty(InputFormatConfig.CATALOG_NAME);
-      if (catalogName != null) {
-        jobConf.set(InputFormatConfig.TABLE_CATALOG_PREFIX + tableName, 
catalogName);
-      }
+    configureOutputTableJobConf(tableDesc, jobConf);
+    if 
(IcebergVendedCredentialUtil.requestsVendedCredentials(tableDesc.getProperties(),
 conf)) {
+      IcebergVendedCredentialUtil.refreshVendedCredentialsIfMissing(tableDesc, 
jobConf, conf);
+      IcebergVendedCredentialUtil.applyJobSecretsToJobConf(tableDesc, jobConf);

Review Comment:
   In Hive secrets ride in Hadoop Credentials (PlanUtils.configureJobConf → 
jobConf.getCredentials().addSecretKey(...)) and are restored on tasks by 
Utilities.copyJobSecretToTableProperties



##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -335,32 +350,10 @@ public void commitJob(JobContext originalContext) {
   @Override
   public void configureJobConf(TableDesc tableDesc, JobConf jobConf) {
     setCommonJobConf(jobConf);
-    if (tableDesc != null && tableDesc.getProperties() != null &&
-        tableDesc.getProperties().get(InputFormatConfig.OPERATION_TYPE_PREFIX 
+ tableDesc.getTableName()) != null) {
-      String tableName = tableDesc.getTableName();
-      String opKey = InputFormatConfig.OPERATION_TYPE_PREFIX + tableName;
-      // set operation type into job conf too
-      jobConf.set(opKey, tableDesc.getProperties().getProperty(opKey));
-      Preconditions.checkArgument(!tableName.contains(TABLE_NAME_SEPARATOR),
-          "Can not handle table " + tableName + ". Its name contains '" + 
TABLE_NAME_SEPARATOR + "'");
-      if 
(HiveCustomStorageHandlerUtils.getWriteOperation(tableDesc.getProperties()::getProperty,
 tableName) != null) {
-        HiveCustomStorageHandlerUtils.setWriteOperation(jobConf, tableName,
-            Operation.valueOf(tableDesc.getProperties().getProperty(
-                HiveCustomStorageHandlerUtils.WRITE_OPERATION_CONFIG_PREFIX + 
tableName)));
-      }
-      boolean isMergeTaskEnabled = Boolean.parseBoolean(tableDesc.getProperty(
-          HiveCustomStorageHandlerUtils.MERGE_TASK_ENABLED + tableName));
-      if (isMergeTaskEnabled) {
-        HiveCustomStorageHandlerUtils.setMergeTaskEnabled(jobConf, tableName, 
true);
-      }
-      String tables = jobConf.get(InputFormatConfig.OUTPUT_TABLES);
-      tables = (tables == null) ? tableName : tables + TABLE_NAME_SEPARATOR + 
tableName;
-      jobConf.set(InputFormatConfig.OUTPUT_TABLES, tables);
-
-      String catalogName = 
tableDesc.getProperties().getProperty(InputFormatConfig.CATALOG_NAME);
-      if (catalogName != null) {
-        jobConf.set(InputFormatConfig.TABLE_CATALOG_PREFIX + tableName, 
catalogName);
-      }
+    configureOutputTableJobConf(tableDesc, jobConf);
+    if 
(IcebergVendedCredentialUtil.requestsVendedCredentials(tableDesc.getProperties(),
 conf)) {
+      IcebergVendedCredentialUtil.refreshVendedCredentialsIfMissing(tableDesc, 
jobConf, conf);
+      IcebergVendedCredentialUtil.applyJobSecretsToJobConf(tableDesc, jobConf);

Review Comment:
   In Hive secrets ride in Hadoop Credentials (PlanUtils.configureJobConf → 
jobConf.getCredentials().addSecretKey(...)) and are restored on tasks by 
Utilities.copyJobSecretToTableProperties



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to