use of org.apache.carbondata.core.metadata.CarbonMetadata in project carbondata by apache.
the class ServerDictionaryGeneratorTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
// enable lru cache by setting cache size
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_MAX_DRIVER_LRU_CACHE_SIZE, "10");
// Create two column schemas and dimensions for the table
empColumnSchema = new ColumnSchema();
empColumnSchema.setColumnName("empNameCol");
empColumnSchema.setDataType(DataTypes.STRING);
empColumnSchema.setColumnUniqueId("empNameCol");
empColumnSchema.setDimensionColumn(true);
empColumnSchema.setEncodingList(Arrays.asList(Encoding.DICTIONARY));
empDimension = new CarbonDimension(empColumnSchema, 0, 0, 0, 0, 0);
ageColumnSchema = new ColumnSchema();
ageColumnSchema.setColumnName("empNameCol");
ageColumnSchema.setColumnUniqueId("empNameCol");
ageColumnSchema.setDataType(DataTypes.SHORT_INT);
ageColumnSchema.setDimensionColumn(true);
ageColumnSchema.setEncodingList(Arrays.asList(Encoding.DICTIONARY));
ageDimension = new CarbonDimension(ageColumnSchema, 0, 0, 0, 0, 0);
// Create a Table
tableSchema = new TableSchema();
tableSchema.setTableName("TestTable");
tableSchema.setTableId("1");
tableSchema.setListOfColumns(Arrays.asList(empColumnSchema, ageColumnSchema));
CarbonMetadata metadata = CarbonMetadata.getInstance();
tableInfo = new TableInfo();
tableInfo.setFactTable(tableSchema);
tableInfo.setTableUniqueName("TestTable");
tableInfo.setDatabaseName("test");
storePath = System.getProperty("java.io.tmpdir") + "/tmp";
tableInfo.setTablePath(storePath + "/test" + "/TestTable");
carbonTable = CarbonTable.buildFromTableInfo(tableInfo);
// Add the created table to metadata
metadata.addCarbonTable(carbonTable);
}
use of org.apache.carbondata.core.metadata.CarbonMetadata in project carbondata by apache.
the class TableDictionaryGeneratorTest 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");
// Create two column schemas and dimensions for the table
empColumnSchema = new ColumnSchema();
empColumnSchema.setColumnName("empNameCol");
empColumnSchema.setColumnUniqueId("empNameCol");
empColumnSchema.setDimensionColumn(true);
empColumnSchema.setDataType(DataTypes.STRING);
empColumnSchema.setEncodingList(Arrays.asList(Encoding.DICTIONARY));
empDimension = new CarbonDimension(empColumnSchema, 0, 0, 0, 0, 0);
ageColumnSchema = new ColumnSchema();
ageColumnSchema.setDataType(DataTypes.SHORT_INT);
ageColumnSchema.setColumnName("ageNameCol");
ageColumnSchema.setColumnUniqueId("ageNameCol");
ageColumnSchema.setDimensionColumn(true);
ageColumnSchema.setEncodingList(Arrays.asList(Encoding.DICTIONARY));
ageDimension = new CarbonDimension(ageColumnSchema, 0, 0, 0, 0, 0);
// Create a Table
tableSchema = new TableSchema();
tableSchema.setTableName("TestTable");
tableSchema.setListOfColumns(Arrays.asList(empColumnSchema, ageColumnSchema));
CarbonMetadata metadata = CarbonMetadata.getInstance();
tableInfo = new TableInfo();
tableInfo.setFactTable(tableSchema);
tableInfo.setTableUniqueName("TestTable");
tableInfo.setDatabaseName("test");
storePath = System.getProperty("java.io.tmpdir") + "/tmp";
tableInfo.setTablePath(storePath + "/test" + "/TestTable");
carbonTable = CarbonTable.buildFromTableInfo(tableInfo);
// Add the created table to metadata
metadata.addCarbonTable(carbonTable);
}
Aggregations