neuyilan commented on code in PR #5674:
URL: https://github.com/apache/paimon/pull/5674#discussion_r2141747398


##########
paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/procedure/CompactProcedureITCase.java:
##########
@@ -196,6 +198,73 @@ public void testHistoryPartitionCompact() throws Exception 
{
         }
     }
 
+    @Test
+    public void testExternalCompact() throws Exception {
+        // test for pk table
+        String tmpPath = getTempDirPath("external/" + UUID.randomUUID());
+        sql(
+                "CREATE TABLE Tpk ("
+                        + " k INT,"
+                        + " v INT,"
+                        + " hh INT,"
+                        + " dt STRING,"
+                        + " PRIMARY KEY (k, dt, hh) NOT ENFORCED"
+                        + ") PARTITIONED BY (dt, hh) WITH ("
+                        + " 'write-only' = 'true',"
+                        + " 'bucket' = '1',"
+                        + " 'data-file.external-paths' = 'file://%s'"
+                        + ")",
+                tmpPath);
+        FileStoreTable pkTable = paimonTable("Tpk");
+
+        sql(
+                "INSERT INTO Tpk VALUES (1, 100, 15, '20221208'), (1, 100, 16, 
'20221208'), (1, 100, 15, '20221209')");
+        sql(
+                "INSERT INTO Tpk VALUES (2, 100, 15, '20221208'), (2, 100, 16, 
'20221208'), (2, 100, 15, '20221209')");
+        tEnv.getConfig().set(TableConfigOptions.TABLE_DML_SYNC, true);
+        sql(
+                "CALL sys.compact(`table` => 'default.Tpk',"
+                        + " options => 
'compaction.force-compact-all-files=true,data-file.external-paths.strategy=specific-fs,data-file.external-paths.specific-fs=file')");
+        List<DataSplit> splits = 
pkTable.newSnapshotReader().read().dataSplits();
+        for (DataSplit split : splits) {
+            for (DataFileMeta meta : split.dataFiles()) {
+                assertThat(meta.externalPath().get().startsWith("file:" + 
tmpPath)).isTrue();

Review Comment:
   we should not insert data to the external path, we just compact it to the 
external path, and when we done the compaction task, we can check the files 
whether exist in the external or not.



##########
paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/procedure/CompactProcedureITCase.java:
##########
@@ -196,6 +198,73 @@ public void testHistoryPartitionCompact() throws Exception 
{
         }
     }
 
+    @Test
+    public void testExternalCompact() throws Exception {

Review Comment:
   `public void testForceCompactToExternalPath()`?



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

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

Reply via email to