Search in sources :

Example 21 with ColumnIdentifier

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

the class DictionaryCacheLoaderImplTest method setUp.

@BeforeClass
public static void setUp() {
    CarbonTableIdentifier carbonTableIdentifier = new CarbonTableIdentifier("db", "table1", "1");
    AbsoluteTableIdentifier absoluteTableIdentifier = AbsoluteTableIdentifier.from("/tmp", carbonTableIdentifier);
    Map<String, String> columnProperties = new HashMap<>();
    columnProperties.put("prop1", "value1");
    columnProperties.put("prop2", "value2");
    columnIdentifier = new ColumnIdentifier("1", columnProperties, DataTypes.STRING);
    dictionaryColumnUniqueIdentifier = new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier, columnIdentifier, columnIdentifier.getDataType());
    dictionaryCacheLoader = new DictionaryCacheLoaderImpl(dictionaryColumnUniqueIdentifier);
    dictionaryInfo = new ColumnDictionaryInfo(DataTypes.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);
        }
    };
}
Also used : HashMap(java.util.HashMap) MockUp(mockit.MockUp) ByteBuffer(java.nio.ByteBuffer) ColumnDictionaryChunk(org.apache.carbondata.format.ColumnDictionaryChunk) CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) AbsoluteTableIdentifier(org.apache.carbondata.core.metadata.AbsoluteTableIdentifier) ColumnIdentifier(org.apache.carbondata.core.metadata.ColumnIdentifier) BeforeClass(org.junit.BeforeClass)

Example 22 with ColumnIdentifier

use of org.apache.carbondata.core.metadata.ColumnIdentifier 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");
    AbsoluteTableIdentifier absoluteTableIdentifier1 = AbsoluteTableIdentifier.from("storepath", carbonTableIdentifier1);
    AbsoluteTableIdentifier absoluteTableIdentifier2 = AbsoluteTableIdentifier.from("storepath", carbonTableIdentifier2);
    Map<String, String> properties = new HashMap<>();
    ColumnIdentifier columnIdentifier = new ColumnIdentifier("2", properties, DataTypes.STRING);
    ColumnIdentifier columnIdentifier2 = new ColumnIdentifier("1", properties, DataTypes.INT);
    dictionaryColumnUniqueIdentifier1 = new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier1, columnIdentifier, DataTypes.STRING, null);
    dictionaryColumnUniqueIdentifier2 = new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier2, columnIdentifier2, DataTypes.STRING, null);
    dictionaryColumnUniqueIdentifier3 = new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier2, columnIdentifier, DataTypes.STRING, null);
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) AbsoluteTableIdentifier(org.apache.carbondata.core.metadata.AbsoluteTableIdentifier) HashMap(java.util.HashMap) ColumnIdentifier(org.apache.carbondata.core.metadata.ColumnIdentifier) BeforeClass(org.junit.BeforeClass)

Aggregations

ColumnIdentifier (org.apache.carbondata.core.metadata.ColumnIdentifier)22 DictionaryColumnUniqueIdentifier (org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier)11 CarbonTableIdentifier (org.apache.carbondata.core.metadata.CarbonTableIdentifier)7 CarbonDictionaryWriter (org.apache.carbondata.core.writer.CarbonDictionaryWriter)7 Dictionary (org.apache.carbondata.core.cache.dictionary.Dictionary)6 CarbonDictionaryWriterImpl (org.apache.carbondata.core.writer.CarbonDictionaryWriterImpl)6 ArrayList (java.util.ArrayList)5 AbsoluteTableIdentifier (org.apache.carbondata.core.metadata.AbsoluteTableIdentifier)5 CarbonDictionarySortIndexWriter (org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortIndexWriter)5 CarbonDictionarySortIndexWriterImpl (org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortIndexWriterImpl)5 Test (org.junit.Test)5 CarbonDimension (org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension)4 BeforeClass (org.junit.BeforeClass)4 BufferedReader (java.io.BufferedReader)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Set (java.util.Set)3 Cache (org.apache.carbondata.core.cache.Cache)3 CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)3 CarbonDictionarySortInfo (org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortInfo)3