@Override protected WritableComparable convert(Object value) { return new OrcTimestamp((long) value); } }
/** * Put the given SearchArgument into the configuration for an OrcInputFormat. * @param conf the configuration to modify * @param sarg the SearchArgument to put in the configuration * @param columnNames the list of column names for the SearchArgument */ public static void setSearchArgument(Configuration conf, SearchArgument sarg, String[] columnNames) { org.apache.orc.mapred.OrcInputFormat.setSearchArgument(conf, sarg, columnNames); }
@Override public V createValue() { return (V) OrcStruct.createValue(schema); }
public Integer getInt(String key, int iDef) throws Exception { if (data instanceof OrcStruct) { OrcStruct orcStruct = (OrcStruct) data; WritableComparable fieldValue = orcStruct.getFieldValue(key); if (fieldValue != null) { Integer value = ((IntWritable) fieldValue).get(); return value; } } return iDef; }
static void setStructValue(TypeDescription schema, StructColumnVector vector, int row, OrcStruct value) { List<TypeDescription> children = schema.getChildren(); for(int c=0; c < value.getNumFields(); ++c) { setColumn(children.get(c), vector.fields[c], row, value.getFieldValue(c)); } }
/** * Initialize ORC file reader and batch record reader. * Please note that `initBatch` is needed to be called after this. */ @Override public void initialize( InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException { FileSplit fileSplit = (FileSplit)inputSplit; Configuration conf = taskAttemptContext.getConfiguration(); Reader reader = OrcFile.createReader( fileSplit.getPath(), OrcFile.readerOptions(conf) .maxLength(OrcConf.MAX_FILE_LENGTH.getLong(conf)) .filesystem(fileSplit.getPath().getFileSystem(conf))); Reader.Options options = OrcInputFormat.buildOptions(conf, reader, fileSplit.getStart(), fileSplit.getLength()); recordReader = reader.rows(options); }
@Override public RecordWriter<NullWritable, V> getRecordWriter(FileSystem fileSystem, JobConf conf, String name, Progressable progressable ) throws IOException { Path path = getTaskOutputPath(conf, name); Writer writer = OrcFile.createWriter(path, buildOptions(conf).fileSystem(fileSystem)); return new OrcMapredRecordWriter<>(writer); } }
@Override public boolean equals(Object other) { return other != null && other.getClass() == getClass() && compareTo((OrcList<E>) other) == 0; }
@Override public boolean equals(Object other) { return other != null && other.getClass() == getClass() && compareTo((OrcMap<K,V>) other) == 0; }
@Override public Long getLong(String key, Long lDef) throws Exception { if (data instanceof OrcStruct) { OrcStruct orcStruct = (OrcStruct) data; WritableComparable fieldValue = orcStruct.getFieldValue(key); if (fieldValue != null) { Long value = ((LongWritable) fieldValue).get(); return value; } } return lDef; }
/** * Initialize ORC file reader and batch record reader. * Please note that `initBatch` is needed to be called after this. */ @Override public void initialize( InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException { FileSplit fileSplit = (FileSplit)inputSplit; Configuration conf = taskAttemptContext.getConfiguration(); Reader reader = OrcFile.createReader( fileSplit.getPath(), OrcFile.readerOptions(conf) .maxLength(OrcConf.MAX_FILE_LENGTH.getLong(conf)) .filesystem(fileSplit.getPath().getFileSystem(conf))); Reader.Options options = OrcInputFormat.buildOptions(conf, reader, fileSplit.getStart(), fileSplit.getLength()); recordReader = reader.rows(options); }
@Override public String getString(String key, String strDef) throws Exception { if (data instanceof OrcStruct) { OrcStruct orcStruct = (OrcStruct) data; WritableComparable fieldValue = orcStruct.getFieldValue(key); if (fieldValue != null) { String value = ((Text) fieldValue).toString(); return value; } } return strDef; }
@Override public Boolean getBoolean(String key, Boolean bDef) throws Exception { if (data instanceof OrcStruct) { OrcStruct orcStruct = (OrcStruct) data; WritableComparable fieldValue = orcStruct.getFieldValue(key); if (fieldValue != null) { Boolean value = ((BooleanWritable) fieldValue).get(); return value; } } return bDef; }
public Float getFloat(String key, float fDef) throws Exception { if (data instanceof OrcStruct) { OrcStruct orcStruct = (OrcStruct) data; WritableComparable fieldValue = orcStruct.getFieldValue(key); if (fieldValue != null) { Float value = ((FloatWritable) fieldValue).get(); return value; } } return fDef; }
@Override public Double getDouble(String key, Double dDef) throws Exception { if (data instanceof OrcStruct) { OrcStruct orcStruct = (OrcStruct) data; WritableComparable fieldValue = orcStruct.getFieldValue(key); if (fieldValue != null) { Double value = ((DoubleWritable) fieldValue).get(); return value; } } return dDef; }