use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImpl method fromExternalToWrapperTableSchema.
/* (non-Javadoc)
* convert from external to wrapper tableschema
*/
@Override
public TableSchema fromExternalToWrapperTableSchema(org.apache.carbondata.format.TableSchema externalTableSchema, String tableName) {
TableSchema wrapperTableSchema = new TableSchema();
wrapperTableSchema.setTableId(externalTableSchema.getTable_id());
wrapperTableSchema.setTableName(tableName);
wrapperTableSchema.setTableProperties(externalTableSchema.getTableProperties());
List<ColumnSchema> listOfColumns = new ArrayList<ColumnSchema>();
for (org.apache.carbondata.format.ColumnSchema externalColumnSchema : externalTableSchema.getTable_columns()) {
listOfColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema));
}
wrapperTableSchema.setListOfColumns(listOfColumns);
wrapperTableSchema.setSchemaEvalution(fromExternalToWrapperSchemaEvolution(externalTableSchema.getSchema_evolution()));
if (externalTableSchema.isSetBucketingInfo()) {
wrapperTableSchema.setBucketingInfo(fromExternalToWarpperBucketingInfo(externalTableSchema.bucketingInfo));
}
if (externalTableSchema.getPartitionInfo() != null) {
wrapperTableSchema.setPartitionInfo(fromExternalToWrapperPartitionInfo(externalTableSchema.getPartitionInfo()));
}
return wrapperTableSchema;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class FilterUtilTest method testPrepareDefaultEndIndexKey.
@Test
public void testPrepareDefaultEndIndexKey() throws Exception {
List<ColumnSchema> columnsInTable = new ArrayList<>();
columnsInTable.add(columnSchema);
int[] columnCardinality = new int[] { 1, 2 };
new MockUp<ColumnSchema>() {
@Mock
public List<Encoding> getEncodingList() {
List<Encoding> encodingList = new ArrayList<>();
encodingList.add(Encoding.DICTIONARY);
return encodingList;
}
};
SegmentProperties segmentProperties = new SegmentProperties(columnsInTable, columnCardinality);
assertTrue(FilterUtil.prepareDefaultEndIndexKey(segmentProperties) instanceof IndexKey);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ColGroupMinMaxTest method getDimensionColumn.
private ColumnSchema getDimensionColumn(int var, int groupId) {
ColumnSchema dimColumn = new ColumnSchema();
dimColumn.setColumnar(false);
dimColumn.setColumnName("IMEI" + var);
dimColumn.setColumnUniqueId(UUID.randomUUID().toString());
dimColumn.setDataType(DataType.STRING);
dimColumn.setDimensionColumn(true);
List<Encoding> encodeList = new ArrayList<Encoding>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
encodeList.add(Encoding.DICTIONARY);
dimColumn.setEncodingList(encodeList);
dimColumn.setColumnGroup(0);
dimColumn.setNumberOfChild(0);
return dimColumn;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonMetadataTest method getTableSchema.
private static TableSchema getTableSchema() {
TableSchema tableSchema = new TableSchema();
List<ColumnSchema> columnSchemaList = new ArrayList<ColumnSchema>();
columnSchemaList.add(getColumnarDimensionColumn());
columnSchemaList.add(getColumnarMeasureColumn());
tableSchema.setListOfColumns(columnSchemaList);
tableSchema.setTableId(UUID.randomUUID().toString());
tableSchema.setTableName("carbonTestTable");
return tableSchema;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class DataFileFooterConverterV3 method getNumberOfDimensionColumns.
/**
* Below method will be used to get the number of dimension column
* in carbon column schema
*
* @param columnSchemaList column schema list
* @return number of dimension column
*/
private int getNumberOfDimensionColumns(List<ColumnSchema> columnSchemaList) {
int numberOfDimensionColumns = 0;
int previousColumnGroupId = -1;
ColumnSchema columnSchema = null;
for (int i = 0; i < columnSchemaList.size(); i++) {
columnSchema = columnSchemaList.get(i);
if (columnSchema.isDimensionColumn() && columnSchema.isColumnar()) {
numberOfDimensionColumns++;
} else if (columnSchema.isDimensionColumn()) {
if (previousColumnGroupId != columnSchema.getColumnGroupId()) {
previousColumnGroupId = columnSchema.getColumnGroupId();
numberOfDimensionColumns++;
}
} else {
break;
}
}
return numberOfDimensionColumns;
}
Aggregations