Upgrade Avro dependency from 1.11.5 to 1.12.2 - #3731
Conversation
85266f8 to
cec3aad
Compare
| parent.add(((DoubleArrayList) container).toDoubleArray()); | ||
| } else { | ||
| parent.add(((ArrayList) container).toArray()); | ||
| parent.add(((ArrayList) container) |
There was a problem hiding this comment.
N.B. The cast to ArrayList isn't necessary.
This line change is due to a bugfix in Avro, tightening up the permitted values when setting reflected fields. The right thing to do here is to put an array of the actual type in the container (as opposed to Object[]).
The TestReflectLogicalTypes#testReadUUIDArray fails here without this change.
There was a problem hiding this comment.
Good catch — dropped the ArrayList cast. container is already a Collection<?>, so toArray(T[]) is available directly. Done in the latest revision.
| parent.add(((ArrayList) container) | ||
| .toArray((Object[]) java.lang.reflect.Array.newInstance(elementClass, 0))); |
There was a problem hiding this comment.
I agree with @RyanSkraba's suggestion, tested locally, and the cast is not needed:
| parent.add(((ArrayList) container) | |
| .toArray((Object[]) java.lang.reflect.Array.newInstance(elementClass, 0))); | |
| parent.add(container.toArray((Object[]) java.lang.reflect.Array.newInstance(elementClass, 0))); |
There was a problem hiding this comment.
Applied your suggestion, thanks! Removed the cast since container is a Collection<?>.
- Create typed arrays instead of Object[] in AvroArrayConverter.end to satisfy Avro 1.12's stricter ReflectData.setField type checks - Add SERIALIZABLE_PACKAGES surefire property for Avro 1.12's ClassSecurityValidator
64c85c0 to
e53f552
Compare
Rationale for this change
Upgrades the Avro dependency from 1.11.5 to 1.12.2.
Avro 1.12 introduces some behavioral and API-compatibility changes that require corresponding adjustments in
parquet-avro:logicalTypeNPE:GenericData.getConversionByClassno longer null-checkslogicalTypeinternally, soAvroRecordConverter.newConverternow guards against a nulllogicalTypeto avoid an NPE.ReflectData.setFieldperforms stricter type checks, soAvroArrayConverter.endnow creates a typed array (viaArray.newInstance(elementClass, 0)) instead of an untypedObject[].ClassSecurityValidatorrequires whitelisting serializable packages; theorg.apache.avro.SERIALIZABLE_PACKAGESsurefire system property is added for the tests.What changes are included in this PR?
avro.versionto1.12.2in the rootpom.xml.logicalTypeinAvroRecordConverter.newConverter.Object[]inAvroArrayConverter.end.SERIALIZABLE_PACKAGESsurefire property inparquet-avro/pom.xml.Are these changes tested?
Yes, covered by the existing
parquet-avrotest suite.Are there any user-facing changes?
Users of
parquet-avrowill now pull in Avro 1.12.2.