/** * @param conf a configuration * @param file a file path * @param unboundRecordFilter an unbound record filter (from the old filter API) * @throws IOException if there is an error while reading * @deprecated will be removed in 2.0.0; use {@link #builder(InputFile)} instead. */ @Deprecated public AvroParquetReader(Configuration conf, Path file, UnboundRecordFilter unboundRecordFilter) throws IOException { super(conf, file, new AvroReadSupport<T>(), unboundRecordFilter); }
/** * @param file a file path * @throws IOException if there is an error while reading * @deprecated will be removed in 2.0.0; use {@link #builder(InputFile)} instead. */ @Deprecated public AvroParquetReader(Path file) throws IOException { super(file, new AvroReadSupport<T>()); }
/** * @param file a file path * @param unboundRecordFilter an unbound record filter (from the old filter API) * @throws IOException if there is an error while reading * @deprecated will be removed in 2.0.0; use {@link #builder(InputFile)} instead. */ @Deprecated public AvroParquetReader(Path file, UnboundRecordFilter unboundRecordFilter) throws IOException { super(file, new AvroReadSupport<T>(), unboundRecordFilter); }
/** * @param conf a configuration * @param file a file path * @throws IOException if there is an error while reading * @deprecated will be removed in 2.0.0; use {@link #builder(InputFile)} instead. */ @Deprecated public AvroParquetReader(Configuration conf, Path file) throws IOException { super(conf, file, new AvroReadSupport<T>()); }
@Override protected ReadSupport<T> getReadSupport() { if (isReflect) { conf.setBoolean(AvroReadSupport.AVRO_COMPATIBILITY, false); } else { conf.setBoolean(AvroReadSupport.AVRO_COMPATIBILITY, enableCompatibility); } return new AvroReadSupport<T>(model); } }
@Override public Collection<Object> readData(Configuration conf, Path path) throws IOException { Collection<Object> result = new ArrayList<>(); AvroReadSupport<GenericRecord> readSupport = new AvroReadSupport<>(); ParquetReader.Builder<GenericRecord> builder = ParquetReader.builder(readSupport, path); ParquetReader<GenericRecord> parquetReader = builder.withConf(conf).build(); GenericRecord record; while ((record = parquetReader.read()) != null) { result.add(record); } parquetReader.close(); return result; } }
@Override public Schema getSchema(Configuration conf, Path path) throws IOException { AvroReadSupport<GenericRecord> readSupport = new AvroReadSupport<>(); ParquetReader.Builder<GenericRecord> builder = ParquetReader.builder(readSupport, path); ParquetReader<GenericRecord> parquetReader = builder.withConf(conf).build(); GenericRecord record; Schema schema = null; while ((record = parquetReader.read()) != null) { schema = avroData.toConnectSchema(record.getSchema()); } parquetReader.close(); return schema; }
LOG.info("File name: "+finfo.getPath().getName()); LOG.info("File Size: " + finfo.getLen()); ParquetReader<GenericRecord> pr = ParquetReader.builder(new AvroReadSupport<GenericRecord>(), finfo.getPath()).build(); for(int i=0; i< 10; i++) { GenericRecord nextRecord = pr.read();
builder.readSupport((ReadSupport<D>) readSupport); } else { builder.readSupport(new AvroReadSupport<>(ParquetAvro.DEFAULT_MODEL));
ParquetReader updatedReader = ParquetReader.builder(new AvroReadSupport<>(), updatedParquetFilePath).build(); index = 0; while ((newRecord = (GenericRecord) updatedReader.read()) != null) {