use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImpl method fromExternalToWrapperSchemaEvolutionEntry.
/* (non-Javadoc)
* convert from external to wrapper schema evolution entry
*/
@Override
public SchemaEvolutionEntry fromExternalToWrapperSchemaEvolutionEntry(org.apache.carbondata.format.SchemaEvolutionEntry externalSchemaEvolutionEntry) {
SchemaEvolutionEntry wrapperSchemaEvolutionEntry = new SchemaEvolutionEntry();
wrapperSchemaEvolutionEntry.setTimeStamp(externalSchemaEvolutionEntry.getTime_stamp());
List<ColumnSchema> wrapperAddedColumns = new ArrayList<ColumnSchema>();
if (null != externalSchemaEvolutionEntry.getAdded()) {
for (org.apache.carbondata.format.ColumnSchema externalColumnSchema : externalSchemaEvolutionEntry.getAdded()) {
wrapperAddedColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema));
}
}
List<ColumnSchema> wrapperRemovedColumns = new ArrayList<ColumnSchema>();
if (null != externalSchemaEvolutionEntry.getRemoved()) {
for (org.apache.carbondata.format.ColumnSchema externalColumnSchema : externalSchemaEvolutionEntry.getRemoved()) {
wrapperRemovedColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema));
}
}
wrapperSchemaEvolutionEntry.setAdded(wrapperAddedColumns);
wrapperSchemaEvolutionEntry.setRemoved(wrapperRemovedColumns);
return wrapperSchemaEvolutionEntry;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class FilterUtilTest method testPrepareDefaultStartIndexKey.
@Test
public void testPrepareDefaultStartIndexKey() throws KeyGenException {
List<ColumnSchema> columnsInTable = new ArrayList<>();
columnsInTable.add(columnSchema);
int[] columnCardinality = new int[] { 1, 2 };
new MockUp<ColumnSchema>() {
@Mock
public List<Encoding> getEncodingList() {
List<Encoding> encodingList = new ArrayList<>();
encodingList.add(Encoding.DICTIONARY);
return encodingList;
}
};
SegmentProperties segmentProperties = new SegmentProperties(columnsInTable, columnCardinality);
assertTrue(FilterUtil.prepareDefaultStartIndexKey(segmentProperties) instanceof IndexKey);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonUtilTest method testToGetColumnSchemaList.
@Test
public void testToGetColumnSchemaList() {
ColumnSchema column1Schema = new ColumnSchema();
ColumnSchema column2Schema = new ColumnSchema();
column1Schema.setColumnName("Column1");
column2Schema.setColumnName("Column2");
List<CarbonDimension> carbonDimension = new ArrayList<>();
carbonDimension.add(new CarbonDimension(column1Schema, 1, 1, 1, 1));
carbonDimension.add(new CarbonDimension(column2Schema, 2, 2, 2, 1));
List<CarbonMeasure> carbonMeasure = new ArrayList<>();
carbonMeasure.add(new CarbonMeasure(column1Schema, 1));
carbonMeasure.add(new CarbonMeasure(column2Schema, 2));
List<ColumnSchema> columnSchema = CarbonUtil.getColumnSchemaList(carbonDimension, carbonMeasure);
for (int i = 0; i < carbonMeasure.size(); i++) {
assertEquals(columnSchema.get(i), carbonMeasure.get(i).getColumnSchema());
}
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonUtilTest method testToFindDimension.
@Test
public void testToFindDimension() {
ColumnSchema column1Schema = new ColumnSchema();
ColumnSchema column2Schema = new ColumnSchema();
column1Schema.setColumnName("Column1");
column2Schema.setColumnName("Column2");
List<CarbonDimension> carbonDimension = new ArrayList<>();
carbonDimension.add(new CarbonDimension(column1Schema, 1, 1, 1, 1));
carbonDimension.add(new CarbonDimension(column2Schema, 2, 1, 2, 1));
assertEquals(CarbonUtil.findDimension(carbonDimension, "Column1"), new CarbonDimension(column1Schema, 1, 1, 1, 1));
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class CarbonUtilTest method testToIdentifyDimensionType.
@Test
public void testToIdentifyDimensionType() {
ColumnSchema column1Schema = new ColumnSchema();
ColumnSchema column2Schema = new ColumnSchema();
ColumnSchema column3Schema = new ColumnSchema();
column1Schema.setColumnName("Column1");
column1Schema.setColumnar(true);
column1Schema.setEncodingList(Arrays.asList(Encoding.DELTA, Encoding.DICTIONARY));
column2Schema.setColumnName("Column2");
column2Schema.setColumnar(false);
column2Schema.setEncodingList(Arrays.asList(Encoding.DELTA, Encoding.DICTIONARY));
column3Schema.setColumnName("Column3");
column3Schema.setColumnar(true);
column3Schema.setEncodingList(Arrays.asList(Encoding.DELTA, Encoding.INVERTED_INDEX));
CarbonDimension carbonDimension = new CarbonDimension(column1Schema, 1, 1, 1, 1);
CarbonDimension carbonDimension2 = new CarbonDimension(column2Schema, 2, 2, 2, 2);
CarbonDimension carbonDimension3 = new CarbonDimension(column3Schema, 3, 3, 3, 3);
List<CarbonDimension> carbonDimensions = Arrays.asList(carbonDimension, carbonDimension2, carbonDimension3);
boolean[] result = CarbonUtil.identifyDimensionType(carbonDimensions);
assertThat(result, is(equalTo(new boolean[] { true, true, false })));
}
Aggregations