use of org.apache.carbondata.core.datastore.ColumnType in project carbondata by apache.
the class TablePage method getColumnPage.
/**
* return column page of specified column name
*/
public ColumnPage getColumnPage(String columnName) {
int dictDimensionIndex = -1;
int noDictDimensionIndex = -1;
ColumnPage page = null;
TableSpec spec = model.getTableSpec();
int numDimensions = spec.getNumDimensions();
for (int i = 0; i < numDimensions; i++) {
ColumnType type = spec.getDimensionSpec(i).getColumnType();
if ((type == ColumnType.GLOBAL_DICTIONARY) || (type == ColumnType.DIRECT_DICTIONARY)) {
page = dictDimensionPages[++dictDimensionIndex];
} else if (type == ColumnType.PLAIN_VALUE) {
page = noDictDimensionPages[++noDictDimensionIndex];
} else {
// do not support datamap on complex column
continue;
}
String fieldName = spec.getDimensionSpec(i).getFieldName();
if (fieldName.equalsIgnoreCase(columnName)) {
return page;
}
}
int numMeasures = spec.getNumMeasures();
for (int i = 0; i < numMeasures; i++) {
String fieldName = spec.getMeasureSpec(i).getFieldName();
if (fieldName.equalsIgnoreCase(columnName)) {
return measurePages[i];
}
}
throw new IllegalArgumentException("DataMap: must have '" + columnName + "' column in schema");
}
Aggregations