You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/05/12 03:28:48 UTC

[GitHub] [flink-table-store] LadyForest commented on a diff in pull request #119: POC for ALTER TABLE ... COMPACT

LadyForest commented on code in PR #119:
URL: https://github.com/apache/flink-table-store/pull/119#discussion_r870916347


##########
flink-table-store-connector/src/main/java/org/apache/flink/table/store/connector/TableStoreFactory.java:
##########
@@ -147,7 +153,22 @@ public void onDropTable(Context context, boolean ignoreIfNotExists) {
     @Override
     public Map<String, String> onCompactTable(
             Context context, CatalogPartitionSpec catalogPartitionSpec) {
-        throw new UnsupportedOperationException("Not implement yet");
+        Map<String, String> newOptions = new HashMap<>(context.getCatalogTable().getOptions());
+        FileStore fileStore = buildTableStore(context).buildFileStore();
+        Predicate partitionFilter =
+                PredicateConverter.CONVERTER.fromMap(
+                        catalogPartitionSpec.getPartitionSpec(), fileStore.partitionType());
+        FileStoreScan.Plan plan = fileStore.newScan().withPartitionFilter(partitionFilter).plan();
+        PartitionedManifestMeta manifestMeta =
+                new PartitionedManifestMeta(
+                        plan.snapshotId(),
+                        plan.groupByPartFiles(),
+                        fileStore.partitionType(),
+                        fileStore.keyType(),
+                        fileStore.valueType());
+        // TODO: filter manifest entries whose key range have overlap

Review Comment:
   Please correct me if I'm wrong.
   
   We can leverage the filter process to `CompactStrategy.pick` to get manifest entries whose key ranges are overlapped (or more accurately, which files need to be compacted)? 



-- 
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: issues-unsubscribe@flink.apache.org

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