use of org.apache.drill.common.types.TypeProtos.MinorType in project drill by apache.
the class ColumnDef method makeDefaultGenerator.
private void makeDefaultGenerator() {
MinorType minorType = mockCol.getMinorType();
switch(minorType) {
case BIGINT:
break;
case BIT:
generator = new BooleanGen();
break;
case DATE:
break;
case DECIMAL18:
break;
case DECIMAL28DENSE:
break;
case DECIMAL28SPARSE:
break;
case DECIMAL38DENSE:
break;
case DECIMAL38SPARSE:
break;
case DECIMAL9:
break;
case FIXED16CHAR:
break;
case FIXEDBINARY:
break;
case FIXEDCHAR:
break;
case FLOAT4:
break;
case FLOAT8:
generator = new DoubleGen();
break;
case GENERIC_OBJECT:
break;
case INT:
generator = new IntGen();
break;
case INTERVAL:
break;
case INTERVALDAY:
break;
case INTERVALYEAR:
break;
case LATE:
break;
case LIST:
break;
case MAP:
break;
case MONEY:
break;
case NULL:
break;
case SMALLINT:
break;
case TIME:
break;
case TIMESTAMP:
break;
case TIMESTAMPTZ:
break;
case TIMETZ:
break;
case TINYINT:
break;
case UINT1:
break;
case UINT2:
break;
case UINT4:
break;
case UINT8:
break;
case UNION:
break;
case VAR16CHAR:
break;
case VARBINARY:
break;
case VARCHAR:
generator = new StringGen();
break;
default:
break;
}
if (generator == null) {
throw new IllegalArgumentException("No default column generator for column " + name + " of type " + minorType);
}
generator.setup(this);
}
use of org.apache.drill.common.types.TypeProtos.MinorType in project drill by apache.
the class AbstractSingleRowSet method buildReader.
/**
* Internal method to build the set of column readers needed for
* this row set. Used when building a row set reader.
* @param rowIndex object that points to the current row
* @return an array of column readers: in the same order as the
* (non-map) vectors.
*/
protected RowSetReader buildReader(RowSetIndex rowIndex) {
FlattenedSchema accessSchema = schema().flatAccess();
ValueVector[] valueVectors = vectors();
AbstractColumnReader[] readers = new AbstractColumnReader[valueVectors.length];
for (int i = 0; i < readers.length; i++) {
MinorType type = accessSchema.column(i).getType().getMinorType();
if (type == MinorType.MAP) {
// buildMapAccessor(i);
readers[i] = null;
} else if (type == MinorType.LIST) {
// buildListAccessor(i);
readers[i] = null;
} else {
readers[i] = ColumnAccessorFactory.newReader(valueVectors[i].getField().getType());
readers[i].bind(rowIndex, valueVectors[i]);
}
}
return new RowSetReaderImpl(accessSchema, rowIndex, readers);
}
use of org.apache.drill.common.types.TypeProtos.MinorType in project drill by apache.
the class ParquetToDrillTypeConverter method toMajorType.
public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName primitiveTypeName, int length, TypeProtos.DataMode mode, ConvertedType convertedType, int precision, int scale, OptionManager options) {
MinorType minorType = getMinorType(primitiveTypeName, length, convertedType, precision, scale, options);
TypeProtos.MajorType.Builder typeBuilder = TypeProtos.MajorType.newBuilder().setMinorType(minorType).setMode(mode);
if (CoreDecimalUtility.isDecimalType(minorType)) {
typeBuilder.setPrecision(precision).setScale(scale);
}
return typeBuilder.build();
}
use of org.apache.drill.common.types.TypeProtos.MinorType in project drill by axbaretto.
the class OpenTSDBRecordReader method initCols.
private void initCols(Schema schema) throws SchemaChangeException {
ImmutableList.Builder<ProjectedColumnInfo> pciBuilder = ImmutableList.builder();
for (int i = 0; i < schema.getColumnCount(); i++) {
ColumnDTO column = schema.getColumnByIndex(i);
final String name = column.getColumnName();
final OpenTSDBTypes type = column.getColumnType();
TypeProtos.MinorType minorType = TYPES.get(type);
if (isMinorTypeNull(minorType)) {
String message = String.format("A column you queried has a data type that is not currently supported by the OpenTSDB storage plugin. " + "The column's name was %s and its OpenTSDB data type was %s. ", name, type.toString());
throw UserException.unsupportedError().message(message).build(log);
}
ProjectedColumnInfo pci = getProjectedColumnInfo(column, name, minorType);
pciBuilder.add(pci);
}
projectedCols = pciBuilder.build();
}
use of org.apache.drill.common.types.TypeProtos.MinorType in project drill by axbaretto.
the class KuduRecordReader method initCols.
private void initCols(Schema schema) throws SchemaChangeException {
ImmutableList.Builder<ProjectedColumnInfo> pciBuilder = ImmutableList.builder();
for (int i = 0; i < schema.getColumnCount(); i++) {
ColumnSchema col = schema.getColumnByIndex(i);
final String name = col.getName();
final Type kuduType = col.getType();
MinorType minorType = TYPES.get(kuduType);
if (minorType == null) {
logger.warn("Ignoring column that is unsupported.", UserException.unsupportedError().message("A column you queried has a data type that is not currently supported by the Kudu storage plugin. " + "The column's name was %s and its Kudu data type was %s. ", name, kuduType.toString()).addContext("column Name", name).addContext("plugin", "kudu").build(logger));
continue;
}
MajorType majorType;
if (col.isNullable()) {
majorType = Types.optional(minorType);
} else {
majorType = Types.required(minorType);
}
MaterializedField field = MaterializedField.create(name, majorType);
final Class<? extends ValueVector> clazz = TypeHelper.getValueVectorClass(minorType, majorType.getMode());
ValueVector vector = output.addField(field, clazz);
vector.allocateNew();
ProjectedColumnInfo pci = new ProjectedColumnInfo();
pci.vv = vector;
pci.kuduColumn = col;
pci.index = i;
pciBuilder.add(pci);
}
projectedCols = pciBuilder.build();
}
Aggregations