(Configuration conf, String[] args)
| 32 | |
| 33 | public class CoreWriter { |
| 34 | public static void main(Configuration conf, String[] args) throws IOException { |
| 35 | TypeDescription schema = TypeDescription.fromString("struct<x:int,y:string>"); |
| 36 | Writer writer = OrcFile.createWriter(new Path("my-file.orc"), |
| 37 | OrcFile.writerOptions(conf) |
| 38 | .setSchema(schema)); |
| 39 | VectorizedRowBatch batch = schema.createRowBatch(); |
| 40 | LongColumnVector x = (LongColumnVector) batch.cols[0]; |
| 41 | BytesColumnVector y = (BytesColumnVector) batch.cols[1]; |
| 42 | for(int r=0; r < 10000; ++r) { |
| 43 | int row = batch.size++; |
| 44 | x.vector[row] = r; |
| 45 | byte[] buffer = ("Last-" + (r * 3)).getBytes(StandardCharsets.UTF_8); |
| 46 | y.setRef(row, buffer, 0, buffer.length); |
| 47 | // If the batch is full, write it out and start over. |
| 48 | if (batch.size == batch.getMaxSize()) { |
| 49 | writer.addRowBatch(batch); |
| 50 | batch.reset(); |
| 51 | } |
| 52 | } |
| 53 | if (batch.size != 0) { |
| 54 | writer.addRowBatch(batch); |
| 55 | } |
| 56 | writer.close(); |
| 57 | } |
| 58 | |
| 59 | public static void main(String[] args) throws IOException { |
| 60 | main(new Configuration(), args); |
no test coverage detected