Search in sources :

Example 6 with CarbonMetadata

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);
}
Also used : TableSchema(org.apache.carbondata.core.metadata.schema.table.TableSchema) ColumnSchema(org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema) TableInfo(org.apache.carbondata.core.metadata.schema.table.TableInfo) CarbonMetadata(org.apache.carbondata.core.metadata.CarbonMetadata) CarbonDimension(org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension) BeforeClass(org.junit.BeforeClass)

Example 7 with CarbonMetadata

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);
}
Also used : TableSchema(org.apache.carbondata.core.metadata.schema.table.TableSchema) ColumnSchema(org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema) TableInfo(org.apache.carbondata.core.metadata.schema.table.TableInfo) CarbonMetadata(org.apache.carbondata.core.metadata.CarbonMetadata) CarbonDimension(org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension) Before(org.junit.Before)

Aggregations

CarbonMetadata (org.apache.carbondata.core.metadata.CarbonMetadata)7 CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)5 CarbonDimension (org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension)5 TableInfo (org.apache.carbondata.core.metadata.schema.table.TableInfo)4 TableSchema (org.apache.carbondata.core.metadata.schema.table.TableSchema)4 ColumnSchema (org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema)4 BeforeClass (org.junit.BeforeClass)2 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Dictionary (org.apache.carbondata.core.cache.dictionary.Dictionary)1 DictionaryColumnUniqueIdentifier (org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier)1 DataMapMeta (org.apache.carbondata.core.datamap.DataMapMeta)1 BiDictionary (org.apache.carbondata.core.devapi.BiDictionary)1 CarbonTableIdentifier (org.apache.carbondata.core.metadata.CarbonTableIdentifier)1 ColumnIdentifier (org.apache.carbondata.core.metadata.ColumnIdentifier)1 ExpressionType (org.apache.carbondata.core.scan.filter.intf.ExpressionType)1 DictionaryService (org.apache.carbondata.core.service.DictionaryService)1 CarbonDictionaryWriter (org.apache.carbondata.core.writer.CarbonDictionaryWriter)1 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)1