-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
This caused a bit of confusion when one of our users ran an query on their table and the metadata that came back showed that all the columns in the result set were STRING. I debugged the issue and narrowed down the cause to the code below:
private static SelectionResultsBlock buildEmptySelectionQueryResults(QueryContext queryContext) {
List<ExpressionContext> selectExpressions = queryContext.getSelectExpressions();
int numSelectExpressions = selectExpressions.size();
String[] columnNames = new String[numSelectExpressions];
for (int i = 0; i < numSelectExpressions; i++) {
columnNames[i] = selectExpressions.get(i).toString();
}
ColumnDataType[] columnDataTypes = new ColumnDataType[numSelectExpressions];
// NOTE: Use STRING column data type as default for selection query
Arrays.fill(columnDataTypes, ColumnDataType.STRING);
DataSchema dataSchema = new DataSchema(columnNames, columnDataTypes);
return new SelectionResultsBlock(dataSchema, Collections.emptyList());
}
Note the use of Arrays.fill(columnDataTypes, ColumnDataType.STRING) which sets all the columns in result metadata to STRING when resultset is empty. I am wondering if can modify this to return either no metadata or no column datatypes or are there backward compatibly concerns around making such a change?
yuanbenson
Metadata
Metadata
Assignees
Labels
No labels