public void writePage(Page page) { try { orcWriter.write(page); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override public void writePage(Page page) throws IOException { writer.write(page); }
@Override public void writePage(Page page) throws IOException { writer.write(page); }
@Override public void appendRows(Page dataPage) { Block[] blocks = new Block[fileInputColumnIndexes.length]; for (int i = 0; i < fileInputColumnIndexes.length; i++) { int inputColumnIndex = fileInputColumnIndexes[i]; if (inputColumnIndex < 0) { blocks[i] = new RunLengthEncodedBlock(nullBlocks.get(i), dataPage.getPositionCount()); } else { blocks[i] = dataPage.getBlock(inputColumnIndex); } } Page page = new Page(dataPage.getPositionCount(), blocks); try { orcWriter.write(page); } catch (IOException | UncheckedIOException e) { throw new PrestoException(HIVE_WRITER_DATA_ERROR, e); } }
private static void writeOrcColumnPresto(File outputFile, Format format, CompressionKind compression, Type type, Iterator<?> values, OrcWriterStats stats) throws Exception { ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder(); metadata.put("columns", "test"); metadata.put("columns.types", createSettableStructObjectInspector("test", type).getTypeName()); OrcWriter writer; writer = new OrcWriter( new OutputStreamOrcDataSink(new FileOutputStream(outputFile)), ImmutableList.of("test"), ImmutableList.of(type), format.getOrcEncoding(), compression, new OrcWriterOptions(), ImmutableMap.of(), HIVE_STORAGE_TIME_ZONE, true, BOTH, stats); BlockBuilder blockBuilder = type.createBlockBuilder(null, 1024); while (values.hasNext()) { Object value = values.next(); writeValue(type, blockBuilder, value); } writer.write(new Page(blockBuilder.build())); writer.close(); writer.validate(new FileOrcDataSource(outputFile, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), true)); }
writer.write(new Page(rowBlock)); writer.close();
writer.write(new Page(blocks)); writer.close();
@Override public void writePage(Page page) throws IOException { writer.write(page); }
@Override public void writePage(Page page) throws IOException { writer.write(page); }
private static void writeOrcColumnPresto(File outputFile, Format format, CompressionKind compression, Type type, Iterator<?> values, OrcWriterStats stats) throws Exception { ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder(); metadata.put("columns", "test"); metadata.put("columns.types", createSettableStructObjectInspector("test", type).getTypeName()); OrcWriter writer; writer = new OrcWriter( new OutputStreamOrcDataSink(new FileOutputStream(outputFile)), ImmutableList.of("test"), ImmutableList.of(type), format.getOrcEncoding(), compression, new OrcWriterOptions(), ImmutableMap.of(), HIVE_STORAGE_TIME_ZONE, true, BOTH, stats); BlockBuilder blockBuilder = type.createBlockBuilder(null, 1024); while (values.hasNext()) { Object value = values.next(); writeValue(type, blockBuilder, value); } writer.write(new Page(blockBuilder.build())); writer.close(); writer.validate(new FileOrcDataSource(outputFile, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), true)); }
writer.write(new Page(rowBlock)); writer.close();
writer.write(new Page(blocks)); writer.close();