the-other-tim-brown commented on code in PR #766:
URL: https://github.com/apache/incubator-xtable/pull/766#discussion_r2638343914
##########
xtable-core/src/main/java/org/apache/xtable/iceberg/IcebergSchemaExtractor.java:
##########
@@ -53,18 +54,63 @@
@Log4j2
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class IcebergSchemaExtractor {
- private static final IcebergSchemaExtractor INSTANCE = new
IcebergSchemaExtractor();
private static final String MAP_KEY_FIELD_NAME = "key";
private static final String MAP_VALUE_FIELD_NAME = "value";
private static final String LIST_ELEMENT_FIELD_NAME = "element";
+ @Getter private final Map<Integer, String> idToStorageName = new HashMap<>();
public static IcebergSchemaExtractor getInstance() {
- return INSTANCE;
+ return new IcebergSchemaExtractor();
+ }
+
+ private void initializeFieldIdTracker(InternalSchema schema, AtomicInteger
fieldIdTracker) {
+ schema.getFields().stream()
+ .forEach(
+ field -> {
+ if (field.getFieldId() != null)
+ fieldIdTracker.accumulateAndGet(field.getFieldId(), Math::max);
+ initializeFieldIdTracker(field, fieldIdTracker);
+ });
+ }
+
+ private void initializeFieldIdTracker(InternalField field, AtomicInteger
fieldIdTracker) {
+ switch (field.getSchema().getDataType()) {
Review Comment:
Yes, I think that is more clear. The linter is flagging this for me locally
--
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]