use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImplTest method testFromExternalToWrapperSchemaEvolution.
@Test
public void testFromExternalToWrapperSchemaEvolution() {
new MockUp<SchemaEvolutionEntry>() {
@Mock
public List<ColumnSchema> getAdded() {
return columnSchemas;
}
@Mock
public List<ColumnSchema> getRemoved() {
return columnSchemas;
}
};
SchemaEvolution actualResult = thriftWrapperSchemaConverter.fromExternalToWrapperSchemaEvolution(schemaEvol);
assertEquals(columnSchemas, actualResult.getSchemaEvolutionEntryList().get(0).getAdded());
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class SegmentTaskIndexTest method testBuild.
@Test
public void testBuild() {
new MockUp<BlockBTreeBuilder>() {
@Mock
public void build(BTreeBuilderInfo segmentBuilderInfos) {
}
};
long numberOfRows = 100;
columnSchema.setColumnName("employeeName");
columnSchemaList.add(new ColumnSchema());
footer.setSegmentInfo(segmentInfo);
footer.setColumnInTable(columnSchemaList);
footer.setBlockletList(Arrays.asList(blockletInfo));
footer.setNumberOfRows(numberOfRows);
footerList.add(footer);
SegmentProperties properties = new SegmentProperties(footerList.get(0).getColumnInTable(), footerList.get(0).getSegmentInfo().getColumnCardinality());
SegmentTaskIndex segmentTaskIndex = new SegmentTaskIndex(properties);
segmentTaskIndex.buildIndex(footerList);
assertEquals(footerList.get(0).getNumberOfRows(), numberOfRows);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class IncrementalColumnDictionaryGeneratorTest method getKeyInvalid.
@Test
public void getKeyInvalid() throws Exception {
//Create required column schema
ColumnSchema columnSchema = new ColumnSchema();
columnSchema.setColumnName("empName");
CarbonDimension carbonDimension = new CarbonDimension(columnSchema, 0, 0, 0, 0, 0);
IncrementalColumnDictionaryGenerator generator = new IncrementalColumnDictionaryGenerator(carbonDimension, 10);
// Try to get value for an invalid key
Integer obtainedKey = generator.getKey("Second");
assertNull(obtainedKey);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class IncrementalColumnDictionaryGeneratorTest method generateKeyTwice.
@Test
public void generateKeyTwice() throws Exception {
//Create required column schema
ColumnSchema columnSchema = new ColumnSchema();
columnSchema.setColumnName("empName");
CarbonDimension carbonDimension = new CarbonDimension(columnSchema, 0, 0, 0, 0, 0);
// Create the generator and add the key to dictionary
IncrementalColumnDictionaryGenerator generator = new IncrementalColumnDictionaryGenerator(carbonDimension, 10);
Integer key = generator.generateKey("First");
// Add one more key and check if it works fine.
key = generator.generateKey("Second");
assertEquals(new Integer(12), key);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class IncrementalColumnDictionaryGeneratorTest method generateKeyAgain.
@Test
public void generateKeyAgain() throws Exception {
//Create required column schema
ColumnSchema columnSchema = new ColumnSchema();
columnSchema.setColumnName("empName");
CarbonDimension carbonDimension = new CarbonDimension(columnSchema, 0, 0, 0, 0, 0);
// Create the generator and add the key to dictionary
IncrementalColumnDictionaryGenerator generator = new IncrementalColumnDictionaryGenerator(carbonDimension, 10);
Integer key = generator.generateKey("First");
// Add the same key again anc check if the value is correct
key = generator.generateKey("First");
assertEquals(new Integer(11), key);
}
Aggregations