Update struct fields for doc-only changes. (#66)
authorRyan Blue <rdblue@users.noreply.github.com>
Mon, 14 Jan 2019 21:45:36 +0000 (13:45 -0800)
committerGitHub <noreply@github.com>
Mon, 14 Jan 2019 21:45:36 +0000 (13:45 -0800)
core/src/main/java/com/netflix/iceberg/SchemaUpdate.java

index 65e7839..4e7f290 100644 (file)
@@ -30,6 +30,7 @@ import com.netflix.iceberg.types.Types;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import static com.netflix.iceberg.types.Types.NestedField.optional;
 import static com.netflix.iceberg.types.Types.NestedField.required;
@@ -261,7 +262,9 @@ class SchemaUpdate implements UpdateSchema {
           doc = update.doc();
         }
 
-        if (!name.equals(field.name()) || field.type() != resultType) {
+        if (!name.equals(field.name()) ||
+            field.type() != resultType ||
+            !Objects.equals(doc, field.doc())) {
           hasChange = true;
           if (field.isOptional()) {
             newFields.add(optional(field.fieldId(), name, resultType, doc));