rdblue commented on a change in pull request #619: Add schema validator
URL: https://github.com/apache/incubator-iceberg/pull/619#discussion_r344417103
##########
File path: api/src/main/java/org/apache/iceberg/Schema.java
##########
@@ -53,10 +54,24 @@
public Schema(List<Types.NestedField> columns, Map<String, Integer> aliases)
{
this.struct = Types.StructType.of(columns);
this.aliasToId = aliases != null ? ImmutableBiMap.copyOf(aliases) : null;
+
+ List<String> invalidFields = TypeUtil.validateFields(struct);
+ if (invalidFields.size() > 0) {
+ throw new ValidationException("Invalid Schema, please check fields: " +
+ Joiner.on(",").join(invalidFields.iterator()));
+ }
+
}
public Schema(List<Types.NestedField> columns) {
this.struct = Types.StructType.of(columns);
+ List<String> invalidFields = TypeUtil.validateFields(struct);
+
+ if (invalidFields.size() > 0) {
+ throw new ValidationException("Invalid Schema, please check fields: " +
+ Joiner.on(",").join(invalidFields.iterator()));
Review comment:
Nit: missing a space in the separator after `,`.
----------------------------------------------------------------
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]