Skip to content

Commit

Permalink
Fix test compile
Browse files Browse the repository at this point in the history
  • Loading branch information
szehon-ho committed Apr 29, 2023
1 parent 4bc6b21 commit f3d4cb2
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.apache.iceberg.types.Types.NestedField.optional;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -493,33 +492,32 @@ private void writeRecords(Table table, int files, int numRecords, int numPartiti
table,
files,
numRecords,
IntStream.range(0, numPartitions).mapToObj(ImmutableList::of).toArray(List<?>[]::new));
IntStream.range(0, numPartitions).mapToObj(ImmutableList::of).collect(Collectors.toList()));
}

private void writeRecordsWithPartitions(
Table table, int files, int numRecords, List<?>... partitions) {
Table table, int files, int numRecords, List<List<Integer>> partitions) {
int partitionTypeSize = table.spec().partitionType().fields().size();
Assert.assertTrue(
"This method currently supports only two columns as partition columns",
partitionTypeSize <= 2);
BiFunction<Integer, List<?>, ThreeColumnRecord> recordFunction =
BiFunction<Integer, List<Integer>, ThreeColumnRecord> recordFunction =
(i, partValues) -> {
switch (partitionTypeSize) {
case (0):
return new ThreeColumnRecord(i, String.valueOf(i), String.valueOf(i));
case (1):
return new ThreeColumnRecord(
(int) partValues.get(0), String.valueOf(i), String.valueOf(i));
return new ThreeColumnRecord(partValues.get(0), String.valueOf(i), String.valueOf(i));
case (2):
return new ThreeColumnRecord(
(int) partValues.get(0), (String) partValues.get(1), String.valueOf(i));
partValues.get(0), String.valueOf(partValues.get(1)), String.valueOf(i));
default:
throw new ValidationException(
"This method currently supports only two columns as partition columns");
}
};
List<ThreeColumnRecord> records =
Arrays.stream(partitions)
partitions.stream()
.flatMap(
partition ->
IntStream.range(0, numRecords)
Expand Down

0 comments on commit f3d4cb2

Please sign in to comment.