private static Class<?> getClassForType(TypeDescription schema) { switch (schema.getCategory()) { case BOOLEAN: return Boolean.class;
@SuppressWarnings("unchecked") private static Function<Object, Object> getCopyFunction(TypeDescription schema) { switch (schema.getCategory()) { case BOOLEAN: case BYTE:
switch (schema.getCategory()) { case BOOLEAN: return BasicTypeInfo.BOOLEAN_TYPE_INFO;
public static void processRow(JSONWriter writer, VectorizedRowBatch batch, TypeDescription schema, int row) throws JSONException { if (schema.getCategory() == TypeDescription.Category.STRUCT) { List<TypeDescription> fieldTypes = schema.getChildren(); List<String> fieldNames = schema.getFieldNames(); writer.object(); for (int c = 0; c < batch.cols.length; ++c) { writer.key(fieldNames.get(c)); setValue(writer, batch.cols[c], fieldTypes.get(c), row); } writer.endObject(); } else { setValue(writer, batch.cols[0], schema, row); } }
@Override public Object next(Object previous) throws IOException { if (!ensureBatch()) { return null; } if (schema.getCategory() == TypeDescription.Category.STRUCT) { OrcStruct result; List<TypeDescription> children = schema.getChildren(); int numberOfChildren = children.size(); if (previous == null || previous.getClass() != OrcStruct.class) { result = new OrcStruct(numberOfChildren); previous = result; } else { result = (OrcStruct) previous; if (result.getNumFields() != numberOfChildren) { result.setNumFields(numberOfChildren); } } for(int i=0; i < numberOfChildren; ++i) { result.setFieldValue(i, nextValue(batch.cols[i], rowInBatch, children.get(i), result.getFieldValue(i))); } } else { previous = nextValue(batch.cols[0], rowInBatch, schema, previous); } rowInBatch += 1; return previous; }
@Override public Object next(Object previous) throws IOException { if (!ensureBatch()) { return null; } if (schema.getCategory() == TypeDescription.Category.STRUCT) { OrcStruct result; List<TypeDescription> children = schema.getChildren(); int numberOfChildren = children.size(); if (previous == null || previous.getClass() != OrcStruct.class) { result = new OrcStruct(numberOfChildren); previous = result; } else { result = (OrcStruct) previous; if (result.getNumFields() != numberOfChildren) { result.setNumFields(numberOfChildren); } } for(int i=0; i < numberOfChildren; ++i) { result.setFieldValue(i, nextValue(batch.cols[i], rowInBatch, children.get(i), result.getFieldValue(i))); } } else { previous = nextValue(batch.cols[0], rowInBatch, schema, previous); } rowInBatch += 1; return previous; }
CompressionCodec codec, TreeReaderFactory.Context context, int[] columnMapping) throws IOException { if (schema.getCategory() != Category.STRUCT) { throw new AssertionError("Schema is not a struct: " + schema);
private ColumnVector createColumn(TypeDescription type, int batchSize, final boolean useDecimal64ColumnVectors) { switch (type.getCategory()) { case BOOLEAN: case BYTE: createColumn(subtypeIdxs.get(1), batchSize, useDecimal64ColumnVectors)); default: throw new IllegalArgumentException("LLAP does not support " + type.getCategory());
public static JsonConverter createConverter(TypeDescription schema) { switch (schema.getCategory()) { case BYTE: case SHORT: case INT: case LONG: return new LongColumnConverter(); case FLOAT: case DOUBLE: return new DoubleColumnConverter(); case CHAR: case VARCHAR: case STRING: return new StringColumnConverter(); case DECIMAL: return new DecimalColumnConverter(); case TIMESTAMP: return new TimestampColumnConverter(); case BINARY: return new BinaryColumnConverter(); case BOOLEAN: return new BooleanColumnConverter(); case STRUCT: return new StructColumnConverter(schema); case LIST: return new ListColumnConverter(schema); default: throw new IllegalArgumentException("Unhandled type " + schema); } }
if (schema.getCategory() == TypeDescription.Category.STRUCT && schema.getChildren().size() > dataColumns) { schema = schema.clone();
if (schema.getCategory() == TypeDescription.Category.STRUCT && schema.getChildren().size() > dataColumns) { schema = schema.clone();
switch (schema.getCategory()) { case BOOLEAN: writer.value(((LongColumnVector) vector).vector[row] != 0);
switch (schema.getCategory()) { case BINARY: case BOOLEAN:
switch (schema.getCategory()) { case BINARY: case BOOLEAN:
TypeDescription schema, Object previous) { switch (schema.getCategory()) { case BOOLEAN: return nextBoolean(vector, row, previous);
public static List<TypeDescription> setTypeBuilderFromSchema( OrcProto.Type.Builder type, TypeDescription schema) { List<TypeDescription> children = schema.getChildren(); switch (schema.getCategory()) { case BOOLEAN: type.setKind(OrcProto.Type.Kind.BOOLEAN); default: throw new IllegalArgumentException("Unknown category: " + schema.getCategory());
TypeDescription schema, Object previous) { switch (schema.getCategory()) { case BOOLEAN: return nextBoolean(vector, row, previous);
switch (schema.getCategory()) { case BOOLEAN: if (vector.noNulls) {
!(ignoreNonUtf8BloomFilter && hadBadBloomFilters(fileSchema.findSubtype(column) .getCategory(), version))) { bloomFilterKinds[column] = OrcProto.Stream.Kind.BLOOM_FILTER;
ColumnStreamData lengths, ColumnStreamData secondary, Context context, List<ColumnVector> vectors, final boolean useDecimal64ColumnVectors) throws IOException { switch (columnType.getCategory()) { case BINARY: return BinaryStreamReader.builder() .build(); default: throw new AssertionError("Not a primitive category: " + columnType.getCategory());