(Configuration conf, String[] args)
| 32 | |
| 33 | public class CoreReader { |
| 34 | public static void main(Configuration conf, String[] args) throws IOException { |
| 35 | // Get the information from the file footer |
| 36 | Reader reader = OrcFile.createReader(new Path("my-file.orc"), |
| 37 | OrcFile.readerOptions(conf)); |
| 38 | System.out.println("File schema: " + reader.getSchema()); |
| 39 | System.out.println("Row count: " + reader.getNumberOfRows()); |
| 40 | |
| 41 | // Pick the schema we want to read using schema evolution |
| 42 | TypeDescription readSchema = |
| 43 | TypeDescription.fromString("struct<z:int,y:string,x:bigint>"); |
| 44 | // Read the row data |
| 45 | VectorizedRowBatch batch = readSchema.createRowBatch(); |
| 46 | RecordReader rowIterator = reader.rows(reader.options() |
| 47 | .schema(readSchema)); |
| 48 | LongColumnVector z = (LongColumnVector) batch.cols[0]; |
| 49 | BytesColumnVector y = (BytesColumnVector) batch.cols[1]; |
| 50 | LongColumnVector x = (LongColumnVector) batch.cols[2]; |
| 51 | while (rowIterator.nextBatch(batch)) { |
| 52 | for(int row=0; row < batch.size; ++row) { |
| 53 | int zRow = z.isRepeating ? 0: row; |
| 54 | int xRow = x.isRepeating ? 0: row; |
| 55 | System.out.println("z: " + |
| 56 | (z.noNulls || !z.isNull[zRow] ? z.vector[zRow] : null)); |
| 57 | System.out.println("y: " + y.toString(row)); |
| 58 | System.out.println("x: " + |
| 59 | (x.noNulls || !x.isNull[xRow] ? x.vector[xRow] : null)); |
| 60 | } |
| 61 | } |
| 62 | rowIterator.close(); |
| 63 | reader.close(); |
| 64 | } |
| 65 | |
| 66 | public static void main(String[] args) throws IOException { |
| 67 | main(new Configuration(), args); |
no test coverage detected