()
| 74 | } |
| 75 | |
| 76 | private void write() throws IOException { |
| 77 | Writer writer = OrcFile.createWriter(testFilePath, |
| 78 | OrcFile.writerOptions(conf) |
| 79 | .setSchema(schema) |
| 80 | .overwrite(true) |
| 81 | .setKeyProvider(keyProvider) |
| 82 | .encrypt(encryption) |
| 83 | .masks(mask)); |
| 84 | VectorizedRowBatch batch = schema.createRowBatch(); |
| 85 | LongColumnVector id = (LongColumnVector) batch.cols[0]; |
| 86 | BytesColumnVector name = (BytesColumnVector) batch.cols[1]; |
| 87 | for (int r = 0; r < VectorizedRowBatch.DEFAULT_SIZE * 2; ++r) { |
| 88 | int row = batch.size++; |
| 89 | id.vector[row] = r; |
| 90 | byte[] buffer = ("name-" + (r * 3)).getBytes(StandardCharsets.UTF_8); |
| 91 | name.setRef(row, buffer, 0, buffer.length); |
| 92 | if (batch.size == batch.getMaxSize()) { |
| 93 | writer.addRowBatch(batch); |
| 94 | batch.reset(); |
| 95 | } |
| 96 | } |
| 97 | if (batch.size != 0) { |
| 98 | writer.addRowBatch(batch); |
| 99 | } |
| 100 | writer.close(); |
| 101 | } |
| 102 | |
| 103 | private void read(boolean pushDown) throws IOException { |
| 104 | Reader reader = OrcFile.createReader(testFilePath, |
no test coverage detected