Skip to content

Commit

Permalink
[AMORO-2165] Struct correct partition aliases from table schema (#2166)
Browse files Browse the repository at this point in the history
* partition field name struct issue

* spotless

---------

Co-authored-by: ZhouJinsong <zhoujinsong0505@163.com>
  • Loading branch information
XBaith and zhoujinsong committed Oct 23, 2023
1 parent 98d41f4 commit ed950bb
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions core/src/main/java/com/netease/arctic/utils/ArcticDataFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,7 @@ public static GenericRecord data(PartitionSpec spec, String partitionPath) {
private static GenericRecord genericRecord(PartitionSpec spec) {
List<String> collect =
spec.fields().stream()
.map(
s -> {
if (s.transform().toString().equals("identity")) {
return s.name();
} else if (s.name().endsWith("_" + s.transform().toString())) {
return s.name()
.substring(0, s.name().lastIndexOf("_" + s.transform().toString()));
} else if (s.transform().toString().contains("bucket")) {
return s.name().substring(0, s.name().lastIndexOf("_bucket"));
} else if (s.transform().toString().contains("truncate")) {
return s.name().substring(0, s.name().lastIndexOf("_trunc"));
} else {
return s.name();
}
})
.map(s -> spec.schema().findColumnName(s.sourceId()))
.collect(Collectors.toList());
return GenericRecord.create(spec.schema().select(collect));
}
Expand Down

0 comments on commit ed950bb

Please sign in to comment.