nastra commented on code in PR #13837:
URL: https://github.com/apache/iceberg/pull/13837#discussion_r2290277164
##########
spark/v4.0/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java:
##########
@@ -171,8 +177,79 @@ public void testProcedureWithInvalidInput() {
"Cannot find provided version file %s in metadata log.",
"v11.metadata.json");
}
+ @TestTemplate
+ public void testRewriteTablePathWithSkipFileList() {
+ String location = targetTableDir.toFile().toURI().toString();
+ Table table = validationCatalog.loadTable(tableIdent);
+ String metadataJson = TableUtil.metadataFileLocation(table);
+
+ List<Object[]> result =
+ sql(
+ "CALL %s.system.rewrite_table_path(table => '%s', source_prefix =>
'%s', target_prefix => '%s', skip_file_list => true)",
+ catalogName, tableIdent, table.location(), location);
+ assertThat(result).hasSize(1);
+ assertThat(result.get(0)[0])
+ .as("Should return correct latest version")
+ .isEqualTo(RewriteTablePathUtil.fileName(metadataJson));
+ assertThat(result.get(0)[1]).as("Should return
empty").asString().isEqualTo("");
+ }
+
private void checkFileListLocationCount(String fileListLocation, long
expectedFileCount) {
long fileCount =
spark.read().format("text").load(fileListLocation).count();
assertThat(fileCount).isEqualTo(expectedFileCount);
}
+
+ @TestTemplate
+ public void testRewriteTablePathWithManifestAndDeleteCounts() throws
IOException {
+
+ sql("INSERT INTO %s VALUES (1, 'a')", tableName);
+ sql("INSERT INTO %s VALUES (2, 'b')", tableName);
+ sql("INSERT INTO %s VALUES (3, 'c')", tableName);
+
+ Table table = validationCatalog.loadTable(tableIdent);
+ List<Pair<CharSequence, Long>> deletes =
Review Comment:
this says `deletes` but it actually refers to data files
--
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]