use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class IncrementalColumnDictionaryGeneratorTest method setUp.
@Before
public void setUp() throws Exception {
// enable lru cache by setting cache size
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_MAX_DRIVER_LRU_CACHE_SIZE, "10");
ColumnSchema columnSchema = new ColumnSchema();
columnSchema.setColumnName("empName");
columnSchema.setDataType(DataTypes.STRING);
TableSchema tableSchema = new TableSchema();
tableSchema.setTableName("TestTable");
tableSchema.setListOfColumns(Arrays.asList(columnSchema));
TableInfo tableInfo = new TableInfo();
tableInfo.setFactTable(tableSchema);
tableInfo.setTableUniqueName("TestTable");
tableInfo.setDatabaseName("test");
String storePath = System.getProperty("java.io.tmpdir") + "/tmp";
tableInfo.setTablePath(storePath + "/test" + "/TestTable");
carbonTable = CarbonTable.buildFromTableInfo(tableInfo);
carbonDimension = new CarbonDimension(columnSchema, 0, 0, 0, 0, 0);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonMetadataTest method getColumnarDimensionColumn.
private static ColumnSchema getColumnarDimensionColumn() {
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);
return dimColumn;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonMetadataTest method testGetCarbonDimensionBasedOnColIdentifierNullCase.
@Test
public void testGetCarbonDimensionBasedOnColIdentifierNullCase() {
CarbonTable carbonTable = CarbonTable.buildFromTableInfo(getTableInfo(1000L));
String columnIdentifier = "3";
final List<CarbonDimension> carbonDimensions = new ArrayList();
ColumnSchema colSchema1 = new ColumnSchema();
colSchema1.setColumnUniqueId("1");
colSchema1.setNumberOfChild(1);
CarbonDimension carbonDimension = new CarbonDimension(colSchema1, 1, 1, 2, 1);
carbonDimensions.add(carbonDimension);
final List<CarbonDimension> carbonChildDimensions = new ArrayList();
ColumnSchema colSchema2 = new ColumnSchema();
colSchema2.setColumnUniqueId("9");
colSchema2.setNumberOfChild(0);
carbonChildDimensions.add(new CarbonDimension(colSchema2, 1, 1, 2, 1));
new MockUp<CarbonTable>() {
@Mock
public String getTableName() {
return "carbonTestTable";
}
@Mock
public List<CarbonDimension> getDimensionByTableName(String tableName) {
return carbonDimensions;
}
};
new MockUp<CarbonDimension>() {
@Mock
public List<CarbonDimension> getListOfChildDimensions() {
return carbonChildDimensions;
}
};
CarbonDimension result = carbonMetadata.getCarbonDimensionBasedOnColIdentifier(carbonTable, columnIdentifier);
assertNull(result);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonMetadataTest method getColumnarMeasureColumn.
private 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 ThriftWrapperSchemaConverterImplTest method testFromWrapperToExternalSchemaEvolutionEntry.
@Test
public void testFromWrapperToExternalSchemaEvolutionEntry() {
final SchemaEvolutionEntry schemaEvolutionEntry = new SchemaEvolutionEntry();
new MockUp<SchemaEvolutionEntry>() {
@Mock
public List<ColumnSchema> getAdded() {
return columnSchemas;
}
@Mock
public List<ColumnSchema> getRemoved() {
return columnSchemas;
}
};
new MockUp<ColumnSchema>() {
@Mock
public List<Encoding> getEncodingList() {
return encodings;
}
@Mock
public DataType getDataType() {
return DataTypes.BOOLEAN;
}
@Mock
public String getColumnName() {
return "columnName";
}
@Mock
public String getColumnUniqueId() {
return "1";
}
@Mock
public boolean isColumnar() {
return true;
}
@Mock
public boolean isDimensionColumn() {
return true;
}
@Mock
public int getColumnGroupId() {
return 1;
}
@Mock
public int getScale() {
return 1;
}
@Mock
public int getPrecision() {
return 1;
}
@Mock
public int getNumberOfChild() {
return 1;
}
@Mock
public byte[] getDefaultValue() {
return new byte[] { 1, 2 };
}
@Mock
public Map<String, String> getColumnProperties() {
return columnPropertyMap;
}
@Mock
public boolean isInvisible() {
return true;
}
@Mock
public String getColumnReferenceId() {
return "1";
}
@Mock
public int getSchemaOrdinal() {
return 1;
}
};
org.apache.carbondata.format.SchemaEvolutionEntry actualResult = thriftWrapperSchemaConverter.fromWrapperToExternalSchemaEvolutionEntry(schemaEvolutionEntry);
assertEquals(schemaEvolEntry, actualResult);
}
Aggregations