Search in sources :

Example 21 with CarbonTableIdentifier

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

the class CarbonTableIdentifierTest method equalsTestWithDifferentTableName.

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

Example 22 with CarbonTableIdentifier

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

the class CarbonTableIdentifierTest method equalsTestWithoutTableId.

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

Example 23 with CarbonTableIdentifier

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

the class DictionaryCacheLoaderImplTest method setUp.

@BeforeClass
public static void setUp() {
    CarbonTableIdentifier carbonTableIdentifier = new CarbonTableIdentifier("db", "table1", "1");
    dictionaryCacheLoader = new DictionaryCacheLoaderImpl(carbonTableIdentifier, "/tmp/");
    dictionaryInfo = new ColumnDictionaryInfo(DataType.STRING);
    new MockUp<CarbonDictionaryReaderImpl>() {

        @Mock
        @SuppressWarnings("unused")
        Iterator<byte[]> read(long startOffset, long endOffset) throws IOException {
            ColumnDictionaryChunk columnDictionaryChunk = new ColumnDictionaryChunk();
            ByteBuffer byteBuffer1 = ByteBuffer.wrap("c".getBytes());
            ByteBuffer byteBuffer2 = ByteBuffer.wrap("d".getBytes());
            columnDictionaryChunk.setValues(Arrays.asList(byteBuffer1, byteBuffer2));
            return new ColumnDictionaryChunkIterator(Arrays.asList(columnDictionaryChunk));
        }
    };
    new MockUp<CarbonDictionarySortIndexReaderImpl>() {

        @Mock
        @SuppressWarnings("unused")
        List<Integer> readSortIndex() throws IOException {
            return Arrays.asList(1, 2);
        }

        @Mock
        @SuppressWarnings("unused")
        List<Integer> readInvertedSortIndex() throws IOException {
            return Arrays.asList(1, 2);
        }
    };
    Map<String, String> columnProperties = new HashMap<>();
    columnProperties.put("prop1", "value1");
    columnProperties.put("prop2", "value2");
    columnIdentifier = new ColumnIdentifier("1", columnProperties, DataType.STRING);
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) HashMap(java.util.HashMap) MockUp(mockit.MockUp) ColumnIdentifier(org.apache.carbondata.core.metadata.ColumnIdentifier) ByteBuffer(java.nio.ByteBuffer) ColumnDictionaryChunk(org.apache.carbondata.format.ColumnDictionaryChunk) BeforeClass(org.junit.BeforeClass)

Example 24 with CarbonTableIdentifier

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

the class DictionaryColumnUniqueIdentifierTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    CarbonTableIdentifier carbonTableIdentifier1 = new CarbonTableIdentifier("testDatabase", "testTable", "1");
    CarbonTableIdentifier carbonTableIdentifier2 = new CarbonTableIdentifier("testDatabase", "testTable", "2");
    Map<String, String> properties = new HashMap<>();
    ColumnIdentifier columnIdentifier = new ColumnIdentifier("2", properties, DataType.STRING);
    ColumnIdentifier columnIdentifier2 = new ColumnIdentifier("1", properties, DataType.INT);
    dictionaryColumnUniqueIdentifier1 = new DictionaryColumnUniqueIdentifier(carbonTableIdentifier1, columnIdentifier, DataType.MAP);
    dictionaryColumnUniqueIdentifier2 = new DictionaryColumnUniqueIdentifier(carbonTableIdentifier2, columnIdentifier2, DataType.MAP);
    dictionaryColumnUniqueIdentifier3 = new DictionaryColumnUniqueIdentifier(carbonTableIdentifier2, columnIdentifier, DataType.MAP);
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) HashMap(java.util.HashMap) ColumnIdentifier(org.apache.carbondata.core.metadata.ColumnIdentifier) BeforeClass(org.junit.BeforeClass)

Example 25 with CarbonTableIdentifier

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

the class CarbonTableIdentifierTest method equalsTestWithDifferentTableId.

@Test
public void equalsTestWithDifferentTableId() {
    CarbonTableIdentifier carbonTableIdentifierTest = new CarbonTableIdentifier("DatabseName", "tableName", "diffTableId");
    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