GH-3780: Decouple ParquetReadOptions from hadoop-mapreduce-client-core - #3781
Conversation
|
+1 (non-binding), this seems delightful! It would be really nice to have a test that proves a file can be read without the hadoop libraries in the classpath or otherwise accessible. I think the easiest way to do that would be to create a new maven module that excludes |
|
I agree that it would be nice to have it tested, but it will add a lot of complexity to the project just for a test setup. I've tested this change in Carpet removing Unfortunately, we are far from removing the dependency of |
|
I was curious how complex the test would be, and it doesn't seem too bad. What do you think? https://github.com/dossett/parquet-java/pull/1/changes (that's a hypothetical PR against this branch) |
Rationale for this change
Reading the Parquet read configuration via
ParquetReadOptionspreviously referencedParquetInputFormat.getFilter(...)and statically imported its constants.ParquetInputFormatextendsorg.apache.hadoop.mapreduce.lib.input.FileInputFormat, so using the read configuration forced the JVMto initialize
ParquetInputFormatand thereforeFileInputFormatand its wholeorg.apache.hadoop.mapreduce.*transitive dependency graph, even though only plainString/booleanconfig properties were needed. The new
ParquetInputProperties(constants) andParquetInputFilters(filter resolution) centralise the
ParquetConfiguration-based read configuration so that read-onlyconsumers no longer transitively pull in the Hadoop
mapreducedependency.What changes are included in this PR?
New files
parquet-hadoop/src/main/java/org/apache/parquet/conf/ParquetInputProperties.javaParquetInputFormat:READ_SUPPORT_CLASS,UNBOUND_RECORD_FILTER,STRICT_TYPE_CHECKING,FILTER_PREDICATE,RECORD_FILTERING_ENABLED,STATS_FILTERING_ENABLED,DICTIONARY_FILTERING_ENABLED,COLUMN_INDEX_FILTERING_ENABLED,PAGE_VERIFY_CHECKSUM_ENABLED,BLOOM_FILTERING_ENABLED,OFF_HEAP_DECRYPT_BUFFER_ENABLED,HADOOP_VECTORED_IO_ENABLED,HADOOP_VECTORED_IO_DEFAULT.org.apache.hadoop.mapreducedependency.parquet-hadoop/src/main/java/org/apache/parquet/conf/ParquetInputFilters.javaParquetConfiguration-based filter resolution:getFilter(ParquetConfiguration),getUnboundRecordFilter(ParquetConfiguration)andgetFilterPredicate(ParquetConfiguration).org.apache.hadoop.mapreducedependency.Removed
parquet-hadoop/src/main/java/org/apache/parquet/ParquetInputConfiguration.java(intermediateclass, split into the two classes above).
Modified
parquet-hadoop/.../ParquetReadOptions.javaParquetInputProperties, and thegetFilter(...)call toParquetInputFiltersinstead ofParquetInputFormat.ParquetReadOptionsno longer referencesParquetInputFormat.parquet-hadoop/.../hadoop/InternalParquetRecordReader.javaRECORD_FILTERING_ENABLED/STRICT_TYPE_CHECKINGnow fromParquetInputProperties.parquet-hadoop/.../hadoop/ParquetInputFormat.java@Deprecated, delegating toParquetInputProperties.*.Configuration-basedgetFilter(Configuration)/getUnboundRecordFilter(Configuration)overloads (used by the MapReduce read path), delegating bywrapping into
HadoopParquetConfiguration. Internal callers useParquetInputFilters/ParquetInputPropertiesdirectly.DeprecatedInputFormatTest,TestParquetFileWriter,TestInputOutputFormat,TestInputFormatColumnProjection,TestDataPageChecksums,TestColumnChunkPageWriteStore,TestPropertiesDrivenEncryption).Are these changes tested?
No change in behavior, just refactoring code location. Code compilation and existing tests validate the change.
Are there any user-facing changes?
No. Fully backward and binary compatible: the
ParquetInputFormatconstants and methods are retained(deprecated) and delegate to the new class; constant string/boolean values are unchanged, so any
previously-serialised configuration still works.
Closes #3780