diff --git a/parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java b/parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java index 669269a2a99f..ed6a6ca6dfcc 100644 --- a/parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java +++ b/parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java @@ -32,6 +32,7 @@ import org.apache.avro.specific.SpecificData; import org.apache.iceberg.avro.AvroSchemaVisitor; import org.apache.iceberg.avro.UUIDConversion; +import org.apache.iceberg.relocated.com.google.common.base.Objects; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; import org.apache.iceberg.relocated.com.google.common.collect.Lists; import org.apache.iceberg.types.TypeUtil; @@ -252,7 +253,7 @@ public Schema record(Schema record, List names, List types) { newFields.add(copyField(field, type)); - if (field.schema() != type) { + if (!Objects.equal(field.schema(), type)) { hasChange = true; } } @@ -274,7 +275,7 @@ public Schema union(Schema union, List options) { @Override public Schema array(Schema array, Schema element) { - if (array.getElementType() != element) { + if (!Objects.equal(array.getElementType(), element)) { return Schema.createArray(element); } return array; @@ -282,7 +283,7 @@ public Schema array(Schema array, Schema element) { @Override public Schema map(Schema map, Schema value) { - if (map.getValueType() != value) { + if (!Objects.equal(map.getValueType(), value)) { return Schema.createMap(value); } return map; @@ -318,7 +319,7 @@ private boolean isIdentical(List types, List replacements) { int length = types.size(); for (int i = 0; i < length; i += 1) { - if (types.get(i) != replacements.get(i)) { + if (!Objects.equal(types.get(i), replacements.get(i))) { return false; } } diff --git a/parquet/src/main/java/org/apache/iceberg/parquet/PruneColumns.java b/parquet/src/main/java/org/apache/iceberg/parquet/PruneColumns.java index 42598acf442e..fa784a532ed5 100644 --- a/parquet/src/main/java/org/apache/iceberg/parquet/PruneColumns.java +++ b/parquet/src/main/java/org/apache/iceberg/parquet/PruneColumns.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Set; +import org.apache.iceberg.relocated.com.google.common.base.Objects; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; import org.apache.iceberg.relocated.com.google.common.collect.Lists; import org.apache.parquet.schema.GroupType; @@ -102,7 +103,7 @@ public Type list(GroupType list, Type element) { if (elementId != null && selectedIds.contains(elementId)) { return list; } else if (element != null) { - if (element != originalElement) { + if (!Objects.equal(element, originalElement)) { Integer listId = getId(list); // the element type was projected Type listType = Types.list(list.getRepetition()) @@ -129,7 +130,7 @@ public Type map(GroupType map, Type key, Type value) { return map; } else if (value != null) { Integer mapId = getId(map); - if (value != originalValue) { + if (!Objects.equal(value, originalValue)) { Type mapType = Types.map(map.getRepetition()) .key(originalKey) .value(value)