Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zouxxyy committed Nov 7, 2024
1 parent 48b314b commit 4ade154
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,18 @@ public MergeFileSplitRead withReadType(RowType readType) {
this.pushdownProjection = projection.pushdownProjection;
this.outerProjection = projection.outerProjection;
if (pushdownProjection != null) {
List<DataField> fields = tableRowType.getFields();
List<String> projectedFieldNames =
Arrays.stream(
Arrays.stream(pushdownProjection)
.mapToInt(arr -> arr[0])
.toArray())
.mapToObj(fields::get)
.map(DataField::name)
.collect(Collectors.toList());
RowType pushdownRowType = readType.project(projectedFieldNames);
List<DataField> tableFields = tableRowType.getFields();
List<DataField> readFields = readType.getFields();
List<DataField> finalReadFields = new ArrayList<>();
for (int i : Arrays.stream(pushdownProjection).mapToInt(arr -> arr[0]).toArray()) {
DataField requiredField = tableFields.get(i);
finalReadFields.add(
readFields.stream()
.filter(x -> x.name().equals(requiredField.name()))
.findFirst()
.orElse(requiredField));
}
RowType pushdownRowType = new RowType(finalReadFields);
readerFactoryBuilder.withReadValueType(pushdownRowType);
mergeSorter.setProjectedValueType(pushdownRowType);
}
Expand Down

0 comments on commit 4ade154

Please sign in to comment.