Search in sources :

Example 1 with OpenTSDBTypes

use of org.apache.drill.exec.store.openTSDB.client.OpenTSDBTypes 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();
}
Also used : OpenTSDBTypes(org.apache.drill.exec.store.openTSDB.client.OpenTSDBTypes) ImmutableList(com.google.common.collect.ImmutableList) MinorType(org.apache.drill.common.types.TypeProtos.MinorType) TypeProtos(org.apache.drill.common.types.TypeProtos) ColumnDTO(org.apache.drill.exec.store.openTSDB.dto.ColumnDTO)

Example 2 with OpenTSDBTypes

use of org.apache.drill.exec.store.openTSDB.client.OpenTSDBTypes in project drill by apache.

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(logger);
        }
        ProjectedColumnInfo pci = getProjectedColumnInfo(column, name, minorType);
        pciBuilder.add(pci);
    }
    projectedCols = pciBuilder.build();
}
Also used : OpenTSDBTypes(org.apache.drill.exec.store.openTSDB.client.OpenTSDBTypes) ImmutableList(org.apache.drill.shaded.guava.com.google.common.collect.ImmutableList) MinorType(org.apache.drill.common.types.TypeProtos.MinorType) TypeProtos(org.apache.drill.common.types.TypeProtos) ColumnDTO(org.apache.drill.exec.store.openTSDB.dto.ColumnDTO)

Aggregations

TypeProtos (org.apache.drill.common.types.TypeProtos)2 MinorType (org.apache.drill.common.types.TypeProtos.MinorType)2 OpenTSDBTypes (org.apache.drill.exec.store.openTSDB.client.OpenTSDBTypes)2 ColumnDTO (org.apache.drill.exec.store.openTSDB.dto.ColumnDTO)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableList (org.apache.drill.shaded.guava.com.google.common.collect.ImmutableList)1