Search in sources :

Example 11 with CarbonTableIdentifier

use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.

the class BlockIndexStoreTest method testLoadAndGetTaskIdToSegmentsMapForSingleSegment.

@Test
public void testLoadAndGetTaskIdToSegmentsMapForSingleSegment() throws IOException {
    File file = getPartFile();
    TableBlockInfo info = new TableBlockInfo(file.getAbsolutePath(), 0, "0", new String[] { "loclhost" }, file.length(), ColumnarFormatVersion.V1);
    CarbonTableIdentifier carbonTableIdentifier = new CarbonTableIdentifier(CarbonCommonConstants.DATABASE_DEFAULT_NAME, "t3", "1");
    AbsoluteTableIdentifier absoluteTableIdentifier = new AbsoluteTableIdentifier("/src/test/resources", carbonTableIdentifier);
    try {
        List<TableBlockUniqueIdentifier> tableBlockInfoList = getTableBlockUniqueIdentifierList(Arrays.asList(new TableBlockInfo[] { info }), absoluteTableIdentifier);
        List<AbstractIndex> loadAndGetBlocks = cache.getAll(tableBlockInfoList);
        assertTrue(loadAndGetBlocks.size() == 1);
    } catch (Exception e) {
        assertTrue(false);
    }
    List<String> segmentIds = new ArrayList<>();
    segmentIds.add(info.getSegmentId());
    cache.removeTableBlocks(segmentIds, absoluteTableIdentifier);
}
Also used : TableBlockInfo(org.apache.carbondata.core.datastore.block.TableBlockInfo) CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) AbsoluteTableIdentifier(org.apache.carbondata.core.metadata.AbsoluteTableIdentifier) TableBlockUniqueIdentifier(org.apache.carbondata.core.datastore.block.TableBlockUniqueIdentifier) AbstractIndex(org.apache.carbondata.core.datastore.block.AbstractIndex) ArrayList(java.util.ArrayList) File(java.io.File) IOException(java.io.IOException) Test(org.junit.Test)

Example 12 with CarbonTableIdentifier

use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.

the class ForwardDictionaryCacheTest 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());
    columnIdentifiers = new String[] { "name", "place" };
    deleteStorePath();
    prepareDataSet();
    createDictionaryCacheObject();
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) Before(org.junit.Before)

Example 13 with CarbonTableIdentifier

use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.

the class CarbonTableIdentifierTest method equalsTestWithoutDatabaseName.

@Test
public void equalsTestWithoutDatabaseName() {
    CarbonTableIdentifier carbonTableIdentifierTest = new CarbonTableIdentifier(null, "tableName", "tableId");
    Boolean res = carbonTableIdentifierTest.equals(carbonTableIdentifier);
    assert (!res);
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) Test(org.junit.Test)

Example 14 with CarbonTableIdentifier

use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.

the class ReverseDictionaryCacheTest 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());
    columnIdentifiers = new String[] { "name", "place" };
    deleteStorePath();
    prepareDataSet();
    createDictionaryCacheObject();
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) Before(org.junit.Before)

Example 15 with CarbonTableIdentifier

use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.

the class CarbonTableIdentifierTest method equalsTestWithNullTableName.

@Test
public void equalsTestWithNullTableName() {
    CarbonTableIdentifier carbonTableIdentifierTest = new CarbonTableIdentifier("DatabseName", null, "tableId");
    Boolean res = carbonTableIdentifierTest.equals(carbonTableIdentifier);
    assert (!res);
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) Test(org.junit.Test)

Aggregations

CarbonTableIdentifier (org.apache.carbondata.core.metadata.CarbonTableIdentifier)42 Test (org.junit.Test)13 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)7 ColumnIdentifier (org.apache.carbondata.core.metadata.ColumnIdentifier)7 AbsoluteTableIdentifier (org.apache.carbondata.core.metadata.AbsoluteTableIdentifier)6 CarbonTablePath (org.apache.carbondata.core.util.path.CarbonTablePath)6 CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)5 Before (org.junit.Before)5 BeforeClass (org.junit.BeforeClass)5 TableBlockInfo (org.apache.carbondata.core.datastore.block.TableBlockInfo)4 File (java.io.File)3 HashMap (java.util.HashMap)3 AbstractIndex (org.apache.carbondata.core.datastore.block.AbstractIndex)3 TableBlockUniqueIdentifier (org.apache.carbondata.core.datastore.block.TableBlockUniqueIdentifier)3 CarbonDataLoadingException (org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException)3 Iterator (java.util.Iterator)2 ExecutorService (java.util.concurrent.ExecutorService)2 ICarbonLock (org.apache.carbondata.core.locks.ICarbonLock)2 ColumnSchema (org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema)2