use of org.apache.drill.exec.store.openTSDB.dto.ColumnDTO 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.exec.store.openTSDB.dto.ColumnDTO in project drill by axbaretto.
the class ServiceImpl method getUnfixedColumns.
@Override
public List<ColumnDTO> getUnfixedColumns(Map<String, String> queryParam) {
Set<MetricDTO> metrics = getAllMetricsByTags(queryParam);
List<ColumnDTO> unfixedColumns = new ArrayList<>();
for (MetricDTO metric : metrics) {
for (String tag : metric.getTags().keySet()) {
ColumnDTO tmp = new ColumnDTO(tag, OpenTSDBTypes.STRING);
if (!unfixedColumns.contains(tmp)) {
unfixedColumns.add(tmp);
}
}
}
return unfixedColumns;
}
use of org.apache.drill.exec.store.openTSDB.dto.ColumnDTO in project drill by apache.
the class Schema method setupStructure.
private void setupStructure() {
columns.add(new ColumnDTO(METRIC.toString(), OpenTSDBTypes.STRING));
columns.add(new ColumnDTO(AGGREGATE_TAGS.toString(), OpenTSDBTypes.STRING));
columns.add(new ColumnDTO(TIMESTAMP.toString(), OpenTSDBTypes.TIMESTAMP));
columns.add(new ColumnDTO(AGGREGATED_VALUE.toString(), OpenTSDBTypes.DOUBLE));
columns.addAll(db.getUnfixedColumns(getParamsForQuery()));
}
use of org.apache.drill.exec.store.openTSDB.dto.ColumnDTO in project drill by axbaretto.
the class DrillOpenTSDBTable method convertToRelDataType.
private void convertToRelDataType(RelDataTypeFactory typeFactory, List<String> names, List<RelDataType> types) {
for (ColumnDTO column : schema.getColumns()) {
names.add(column.getColumnName());
RelDataType type = getSqlTypeFromOpenTSDBType(typeFactory, column.getColumnType());
type = typeFactory.createTypeWithNullability(type, column.isNullable());
types.add(type);
}
}
use of org.apache.drill.exec.store.openTSDB.dto.ColumnDTO in project drill by axbaretto.
the class Schema method setupStructure.
private void setupStructure() {
columns.add(new ColumnDTO(METRIC.toString(), OpenTSDBTypes.STRING));
columns.add(new ColumnDTO(AGGREGATE_TAGS.toString(), OpenTSDBTypes.STRING));
columns.add(new ColumnDTO(TIMESTAMP.toString(), OpenTSDBTypes.TIMESTAMP));
columns.add(new ColumnDTO(AGGREGATED_VALUE.toString(), OpenTSDBTypes.DOUBLE));
columns.addAll(db.getUnfixedColumns(getParamsForQuery()));
}
Aggregations