SourabhBadhya commented on code in PR #4571:
URL: https://github.com/apache/hive/pull/4571#discussion_r1299688492


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -7563,9 +7585,26 @@ protected Operator genFileSinkPlan(String dest, QB qb, 
Operator input)
       ltd.setMoveTaskId(moveTaskId);
 
       loadTableWork.add(ltd);
-      if (!outputs.add(new WriteEntity(destinationPartition, 
determineWriteType(ltd, dest)))) {
-        throw new SemanticException(ErrorMsg.OUTPUT_SPECIFIED_MULTIPLE_TIMES
-            .getMsg(destinationTable.getTableName() + "@" + 
destinationPartition.getName()));
+
+      if (destinationTable.getStorageHandler() != null && 
destinationTable.getStorageHandler().alwaysUnpartitioned()) {
+        // HMS does not know about this partition
+        // but the underlying storage format knows about it.
+        DummyPartition dummyPartition;
+        try {
+          String partName = Warehouse.makePartName(partSpec, false);
+          dummyPartition = new DummyPartition(destinationTable, partName, 
partSpec);
+        } catch (MetaException e) {
+          throw new SemanticException("Unable to construct name for dummy 
partition due to: ", e);
+        }
+        if (!outputs.add(new WriteEntity(dummyPartition, 
determineWriteType(ltd, dest)))) {
+          throw new SemanticException(ErrorMsg.OUTPUT_SPECIFIED_MULTIPLE_TIMES
+                  .getMsg(destinationTable.getTableName() + "@" + 
destinationPartition.getName()));

Review Comment:
   Yes since Hive is not aware of the partitions present within the Iceberg 
table. To compensate I have used a dummy partition.



-- 
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-unsubscr...@hive.apache.org

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


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

Reply via email to