5454import org .apache .hadoop .fs .Path ;
5555import org .apache .parquet .conf .HadoopParquetConfiguration ;
5656import org .apache .parquet .conf .ParquetConfiguration ;
57+ import org .apache .parquet .conf .PlainParquetConfiguration ;
5758import org .apache .parquet .hadoop .ParquetReader ;
5859import org .apache .parquet .hadoop .ParquetWriter ;
5960import org .apache .parquet .hadoop .api .WriteSupport ;
@@ -79,31 +80,39 @@ public class TestReadWrite {
7980 @ Parameterized .Parameters
8081 public static Collection <Object []> data () {
8182 Object [][] data = new Object [][] {
82- { false , false , false }, // use the new converters with hadoop config
83- { true , false , false }, // use the old converters with hadoop config
84- { false , true , false }, // use a local disk location with hadoop config
85- { false , false , true }, // use the new converters with parquet config interface
86- { true , false , true }, // use the old converters with parquet config interface
87- { false , true , true } }; // use a local disk location with parquet config interface
83+ { true , false , false , false }, // use the old converters with hadoop config
84+ { true , false , true , false }, // use the old converters with parquet config interface
85+ { false , false , false , false }, // use the new converters with hadoop config
86+ { false , true , false , false }, // use a local disk location with hadoop config
87+ { false , false , true , false }, // use the new converters with parquet config interface
88+ { false , true , true , false }, // use a local disk location with parquet config interface
89+ { false , false , true , true }, // use the new converters with plain parquet config
90+ { false , true , true , true } }; // use a local disk location with plain parquet config
8891 return Arrays .asList (data );
8992 }
9093
9194 private final boolean compat ;
9295 private final boolean local ;
9396 private final boolean confInterface ;
97+ private final boolean plainConf ;
9498 private final Configuration testConf = new Configuration ();
95- private final ParquetConfiguration parquetConf = new HadoopParquetConfiguration (true );
99+ private final ParquetConfiguration hadoopConfWithInterface = new HadoopParquetConfiguration ();
100+ private final ParquetConfiguration plainParquetConf = new PlainParquetConfiguration ();
96101
97- public TestReadWrite (boolean compat , boolean local , boolean confInterface ) {
102+ public TestReadWrite (boolean compat , boolean local , boolean confInterface , boolean plainConf ) {
98103 this .compat = compat ;
99104 this .local = local ;
100105 this .confInterface = confInterface ;
106+ this .plainConf = plainConf ;
101107 this .testConf .setBoolean (AvroReadSupport .AVRO_COMPATIBILITY , compat );
102108 this .testConf .setBoolean ("parquet.avro.add-list-element-records" , false );
103109 this .testConf .setBoolean ("parquet.avro.write-old-list-structure" , false );
104- this .parquetConf .setBoolean (AvroReadSupport .AVRO_COMPATIBILITY , compat );
105- this .parquetConf .setBoolean ("parquet.avro.add-list-element-records" , false );
106- this .parquetConf .setBoolean ("parquet.avro.write-old-list-structure" , false );
110+ this .hadoopConfWithInterface .setBoolean (AvroReadSupport .AVRO_COMPATIBILITY , compat );
111+ this .hadoopConfWithInterface .setBoolean ("parquet.avro.add-list-element-records" , false );
112+ this .hadoopConfWithInterface .setBoolean ("parquet.avro.write-old-list-structure" , false );
113+ this .plainParquetConf .setBoolean (AvroReadSupport .AVRO_COMPATIBILITY , compat );
114+ this .plainParquetConf .setBoolean ("parquet.avro.add-list-element-records" , false );
115+ this .plainParquetConf .setBoolean ("parquet.avro.write-old-list-structure" , false );
107116 }
108117
109118 @ Test
@@ -891,9 +900,15 @@ private ParquetWriter<GenericRecord> writer(String file, Schema schema) throws I
891900 .withSchema (schema );
892901 }
893902 if (confInterface ) {
894- return writerBuilder
895- .withConf (parquetConf )
896- .build ();
903+ if (plainConf ) {
904+ return writerBuilder
905+ .withConf (hadoopConfWithInterface )
906+ .build ();
907+ } else {
908+ return writerBuilder
909+ .withConf (plainParquetConf )
910+ .build ();
911+ }
897912 } else {
898913 return writerBuilder
899914 .withConf (testConf )
@@ -911,9 +926,15 @@ private ParquetReader<GenericRecord> reader(String file) throws IOException {
911926 return new AvroParquetReader <>(testConf , new Path (file ));
912927 }
913928 if (confInterface ) {
914- return readerBuilder
915- .withConf (parquetConf )
916- .build ();
929+ if (plainConf ) {
930+ return readerBuilder
931+ .withConf (hadoopConfWithInterface )
932+ .build ();
933+ } else {
934+ return readerBuilder
935+ .withConf (plainParquetConf )
936+ .build ();
937+ }
917938 } else {
918939 return readerBuilder
919940 .withConf (testConf )
0 commit comments