zhangjun0x01 commented on code in PR #2167:
URL: https://github.com/apache/incubator-paimon/pull/2167#discussion_r1370439871


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/FlinkCatalog.java:
##########
@@ -842,8 +851,23 @@ public final void createPartition(
     @Override
     public final void dropPartition(
             ObjectPath tablePath, CatalogPartitionSpec partitionSpec, boolean 
ignoreIfNotExists)
-            throws CatalogException {
-        throw new UnsupportedOperationException();
+            throws PartitionNotExistException, CatalogException {
+
+        if (!partitionExists(tablePath, partitionSpec)) {
+            throw new PartitionNotExistException(getName(), tablePath, 
partitionSpec);
+        }
+
+        try {
+            Identifier identifier = toIdentifier(tablePath);
+            Table table = catalog.getTable(identifier);
+            AbstractFileStoreTable fileStoreTable = (AbstractFileStoreTable) 
table;
+            FileStoreCommit commit = 
fileStoreTable.store().newCommit(UUID.randomUUID().toString());
+            List<Map<String, String>> partitions =
+                    
Collections.singletonList(partitionSpec.getPartitionSpec());
+            commit.dropPartitions(partitions, 
BatchWriteBuilder.COMMIT_IDENTIFIER);
+        } catch (Catalog.TableNotExistException e) {
+            throw new CatalogException(e);
+        }

Review Comment:
   yes, you are right, I ignored this parameter `METASTORE_PARTITIONED_TABLE`, 
I update it 



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/FlinkCatalog.java:
##########
@@ -842,8 +851,23 @@ public final void createPartition(
     @Override
     public final void dropPartition(
             ObjectPath tablePath, CatalogPartitionSpec partitionSpec, boolean 
ignoreIfNotExists)
-            throws CatalogException {
-        throw new UnsupportedOperationException();
+            throws PartitionNotExistException, CatalogException {
+
+        if (!partitionExists(tablePath, partitionSpec)) {
+            throw new PartitionNotExistException(getName(), tablePath, 
partitionSpec);
+        }
+
+        try {
+            Identifier identifier = toIdentifier(tablePath);
+            Table table = catalog.getTable(identifier);
+            AbstractFileStoreTable fileStoreTable = (AbstractFileStoreTable) 
table;
+            FileStoreCommit commit = 
fileStoreTable.store().newCommit(UUID.randomUUID().toString());
+            List<Map<String, String>> partitions =
+                    
Collections.singletonList(partitionSpec.getPartitionSpec());
+            commit.dropPartitions(partitions, 
BatchWriteBuilder.COMMIT_IDENTIFIER);
+        } catch (Catalog.TableNotExistException e) {
+            throw new CatalogException(e);
+        }

Review Comment:
   yes, you are right, I ignored this parameter `METASTORE_PARTITIONED_TABLE`, 
I update it 



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

Reply via email to