yihua commented on code in PR #11408:
URL: https://github.com/apache/hudi/pull/11408#discussion_r1690287786
##########
hudi-common/src/main/java/org/apache/hudi/internal/schema/visitor/NameToPositionVisitor.java:
##########
@@ -34,65 +30,36 @@
/**
* Schema visitor to produce name -> position map for internalSchema.
Positions are assigned in a depth-first manner.
*/
-public class NameToPositionVisitor extends InternalSchemaVisitor<Map<String,
Integer>> {
- private final Deque<String> fieldNames = new LinkedList<>();
- private final Map<String, Integer> nameToId = new HashMap<>();
+public class NameToPositionVisitor extends AbstractNameVisitor<Map<String,
Integer>> {
private final AtomicInteger position = new AtomicInteger(0);
+ public NameToPositionVisitor() {
+ super(new HashMap<>());
+ }
@Override
public void beforeField(Types.Field field) {
nameToId.put(createFullName(field.name(), fieldNames),
position.getAndIncrement());
fieldNames.push(field.name());
}
- @Override
- public void afterField(Types.Field field) {
Review Comment:
I think we can keep the current code for now. @Davis-Zhang-Onehouse lmk if
we can close this PR.
--
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]