use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonTableTest method getColumnarMeasureColumn.
static ColumnSchema getColumnarMeasureColumn() {
ColumnSchema dimColumn = new ColumnSchema();
dimColumn.setColumnName("IMEI_COUNT");
dimColumn.setColumnUniqueId(UUID.randomUUID().toString());
dimColumn.setDataType(DataTypes.STRING);
return dimColumn;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonTableWithComplexTypesTest method getColumnarDimensionColumn.
private List<ColumnSchema> getColumnarDimensionColumn() {
List<ColumnSchema> cols = new ArrayList<ColumnSchema>();
ColumnSchema dimColumn = new ColumnSchema();
dimColumn.setColumnar(true);
dimColumn.setColumnName("IMEI");
dimColumn.setColumnUniqueId(UUID.randomUUID().toString());
dimColumn.setDataType(DataTypes.STRING);
dimColumn.setDimensionColumn(true);
List<Encoding> encodeList = new ArrayList<Encoding>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
encodeList.add(Encoding.DICTIONARY);
dimColumn.setEncodingList(encodeList);
dimColumn.setNumberOfChild(0);
cols.add(dimColumn);
ColumnSchema structColumn = new ColumnSchema();
structColumn.setColumnar(true);
structColumn.setColumnName("mobile");
structColumn.setColumnUniqueId(UUID.randomUUID().toString());
structColumn.setDataType(DataTypes.createDefaultStructType());
structColumn.setDimensionColumn(true);
structColumn.setEncodingList(encodeList);
structColumn.setNumberOfChild(2);
cols.add(structColumn);
ColumnSchema primitiveColumn = new ColumnSchema();
primitiveColumn.setColumnar(true);
primitiveColumn.setColumnName("mobile.stdcode");
primitiveColumn.setColumnUniqueId(UUID.randomUUID().toString());
primitiveColumn.setDataType(DataTypes.STRING);
primitiveColumn.setDimensionColumn(true);
primitiveColumn.setEncodingList(encodeList);
primitiveColumn.setNumberOfChild(0);
cols.add(primitiveColumn);
ColumnSchema arrayColumn = new ColumnSchema();
arrayColumn.setColumnar(true);
arrayColumn.setColumnName("mobile.val");
arrayColumn.setColumnUniqueId(UUID.randomUUID().toString());
arrayColumn.setDataType(DataTypes.createDefaultArrayType());
arrayColumn.setDimensionColumn(true);
arrayColumn.setEncodingList(encodeList);
arrayColumn.setNumberOfChild(1);
cols.add(arrayColumn);
ColumnSchema primitiveColumn1 = new ColumnSchema();
primitiveColumn1.setColumnar(true);
primitiveColumn1.setColumnName("mobile.val.phoneno");
primitiveColumn1.setColumnUniqueId(UUID.randomUUID().toString());
primitiveColumn1.setDataType(DataTypes.STRING);
primitiveColumn1.setDimensionColumn(true);
primitiveColumn1.setEncodingList(encodeList);
primitiveColumn1.setNumberOfChild(0);
cols.add(primitiveColumn1);
return cols;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class FilterUtilTest method setUp.
@Before
public void setUp() throws Exception {
init();
this.databaseName = props.getProperty("database", "testSchema");
this.tableName = props.getProperty("tableName", "carbon");
this.carbonStorePath = props.getProperty("storePath", "carbonStore");
carbonTableIdentifier = new CarbonTableIdentifier(databaseName, tableName, UUID.randomUUID().toString());
this.carbonStorePath = props.getProperty("storePath", "carbonStore");
columnSchema = new ColumnSchema();
columnSchema.setColumnar(true);
columnSchema.setColumnName("IMEI");
columnSchema.setColumnUniqueId(UUID.randomUUID().toString());
columnSchema.setDataType(DataTypes.STRING);
columnSchema.setDimensionColumn(true);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class FilterUtilTest method testGetMaskKey.
@Test
public void testGetMaskKey() {
int surrogate = 1;
int[] keys = new int[] { 1, 2 };
MultiDimKeyVarLengthGenerator multiDimKeyVarLengthGenerator = new MultiDimKeyVarLengthGenerator(keys);
int ordinal = 1;
int keyOrdinal = 1;
int columnGroupOrdinal = 1;
int complexTypeOrdinal = 1;
ColumnSchema columnSchema = new ColumnSchema();
columnSchema.setColumnar(true);
columnSchema.setColumnName("IMEI");
columnSchema.setColumnUniqueId(UUID.randomUUID().toString());
columnSchema.setDataType(DataTypes.STRING);
columnSchema.setDimensionColumn(true);
CarbonDimension carbonDimension = new CarbonDimension(columnSchema, ordinal, keyOrdinal, columnGroupOrdinal, complexTypeOrdinal);
byte[] expectedResult = new byte[] { 1 };
byte[] actualResult = FilterUtil.getMaskKey(surrogate, carbonDimension, multiDimKeyVarLengthGenerator);
assertArrayEquals(expectedResult, actualResult);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class RestructureUtilTest method testToGetAggregatorInfos.
@Test
public void testToGetAggregatorInfos() {
ColumnSchema columnSchema1 = new ColumnSchema();
columnSchema1.setColumnName("Id");
columnSchema1.setDataType(DataTypes.STRING);
columnSchema1.setColumnUniqueId(UUID.randomUUID().toString());
ColumnSchema columnSchema2 = new ColumnSchema();
columnSchema2.setColumnName("Name");
columnSchema2.setDataType(DataTypes.STRING);
columnSchema2.setColumnUniqueId(UUID.randomUUID().toString());
ColumnSchema columnSchema3 = new ColumnSchema();
columnSchema3.setColumnName("Age");
columnSchema3.setDataType(DataTypes.STRING);
columnSchema3.setColumnUniqueId(UUID.randomUUID().toString());
CarbonMeasure carbonMeasure1 = new CarbonMeasure(columnSchema1, 1);
CarbonMeasure carbonMeasure2 = new CarbonMeasure(columnSchema2, 2);
CarbonMeasure carbonMeasure3 = new CarbonMeasure(columnSchema3, 3);
carbonMeasure3.getColumnSchema().setDefaultValue("3".getBytes());
List<CarbonMeasure> currentBlockMeasures = Arrays.asList(carbonMeasure1, carbonMeasure2);
ProjectionMeasure queryMeasure1 = new ProjectionMeasure(carbonMeasure1);
ProjectionMeasure queryMeasure2 = new ProjectionMeasure(carbonMeasure2);
ProjectionMeasure queryMeasure3 = new ProjectionMeasure(carbonMeasure3);
List<ProjectionMeasure> queryMeasures = Arrays.asList(queryMeasure1, queryMeasure2, queryMeasure3);
BlockExecutionInfo blockExecutionInfo = new BlockExecutionInfo();
RestructureUtil.createMeasureInfoAndGetCurrentBlockQueryMeasures(blockExecutionInfo, queryMeasures, currentBlockMeasures);
MeasureInfo measureInfo = blockExecutionInfo.getMeasureInfo();
boolean[] measuresExist = { true, true, false };
assertThat(measureInfo.getMeasureExists(), is(equalTo(measuresExist)));
Object[] defaultValues = { null, null, 3.0 };
assertThat(measureInfo.getDefaultValues(), is(equalTo(defaultValues)));
}
Aggregations