RussellSpitzer commented on a change in pull request #2087:
URL: https://github.com/apache/iceberg/pull/2087#discussion_r557450359



##########
File path: 
spark3/src/test/java/org/apache/iceberg/actions/TestCreateActions.java
##########
@@ -296,14 +406,25 @@ private void createSourceTable(String createStatement, 
String tableName)
   private void assertMigratedFileCount(CreateAction migrateAction, String 
source, String dest)
       throws NoSuchTableException, NoSuchDatabaseException, ParseException {
     CatalogTable sourceTable = loadSessionTable(source);
-    Path sourceDir = Paths.get(sourceTable.location());
-    List<File> files = FileUtils.listFiles(sourceDir.toFile(), 
TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)
-        .stream()
-        .filter(file -> !file.toString().endsWith("crc") && 
!file.toString().contains("_SUCCESS"))
-        .collect(Collectors.toList());
-    long expectedMigratedFiles = files.size();
-    List<Row> expected = spark.table(source).collectAsList();
+    List<URI> uris;
+    if (sourceTable.partitionColumnNames().size() == 0) {
+      uris = new ArrayList<>();
+      uris.add(sourceTable.location());
+    } else {
+      Seq<CatalogTablePartition> catalogTablePartitionSeq =
+              
spark.sessionState().catalog().listPartitions(sourceTable.identifier(), 
Option.apply(null));
+      uris = JavaConverters.seqAsJavaList(catalogTablePartitionSeq)
+              .stream()
+              .map(CatalogTablePartition::location)
+              .collect(Collectors.toList());
+    }
+    long expectedMigratedFiles = uris.stream()

Review comment:
       Is this change needed? Is this for checking if we have partitions that 
aren't in the sourcetable directory?




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to