@Override public void close() throws IOException { reader.close(); } }
@Override public void close() throws IOException { reader.close(); } }
@Override public void close() throws IOException { parquetReader.close(); }
@Override public void close() throws IOException { reader.close(); }
@Override public void close() throws IOException { parquet.close(); } }
@Override public void close() throws IOException { this.closed = true; reader.close(); }
@Override public void close() throws IOException { if (reader != null) { reader.close(); } }
public void close() throws IOException { parquetReader.close(); } }
@Override public void close() throws IOException { parquetReader.close(); }
public void close() throws IOException { parquetReader.close(); } }
@Override public void close() { if (reader != null) { try { reader.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }
@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; } }
/** * NOTE: This literally reads the entire file contents, thus should be used with caution. */ public static List<GenericRecord> readAvroRecords(Configuration configuration, Path filePath) { ParquetReader reader = null; List<GenericRecord> records = new ArrayList<>(); try { reader = AvroParquetReader.builder(filePath).withConf(configuration).build(); Object obj = reader.read(); while (obj != null) { if (obj instanceof GenericRecord) { records.add(((GenericRecord) obj)); } obj = reader.read(); } } catch (IOException e) { throw new HoodieIOException("Failed to read avro records from Parquet " + filePath, e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // ignore } } } return records; }
@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; }
private void initReader(Path file) { try { if (reader != null) { reader.close(); } GenericData.get().addLogicalTypeConversion(new Conversions.DecimalConversion()); this.reader = AvroParquetReader.<GenericRecord>builder(file).withDataModel(GenericData.get()).build(); } catch (IOException e) { throw new RuntimeException(e); } }
throw new HoodieException(e); } finally { reader.close(); upsertHandle.close(); if (null != wrapper) {
fileReader.close(); } catch (final IOException ignore) {
updatedReader.close();