rdblue commented on a change in pull request #619: Add schema validator
URL: https://github.com/apache/incubator-iceberg/pull/619#discussion_r345908365
##########
File path: api/src/main/java/org/apache/iceberg/Schema.java
##########
@@ -54,10 +54,14 @@
public Schema(List<NestedField> columns, Map<String, Integer> aliases) {
this.struct = StructType.of(columns);
this.aliasToId = aliases != null ? ImmutableBiMap.copyOf(aliases) : null;
+
+ // validate the schema through IndexByName visitor
+ TypeUtil.indexByName(struct);
Review comment:
As long as `indexByName` is being called, we may as well capture the result
and use it for the name to ID map. Can you update these constructors to call
`lazyNameToId` instead?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]