use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImplTest method testFromWrapperToExternalColumnSchemaForArrayDatatype.
@Test
public void testFromWrapperToExternalColumnSchemaForArrayDatatype() {
org.apache.carbondata.format.ColumnSchema thriftColumnSchema = new org.apache.carbondata.format.ColumnSchema(org.apache.carbondata.format.DataType.ARRAY, "columnName", "1", true, encoders, true);
thriftColumnSchema.setSchemaOrdinal(1);
thriftColumnSchema.setAggregate_function("");
new MockUp<ColumnSchema>() {
@Mock
public List<Encoding> getEncodingList() {
return encodings;
}
@Mock
public int getSchemaOrdinal() {
return 1;
}
@Mock
public DataType getDataType() {
return DataTypes.createDefaultArrayType();
}
@Mock
public String getColumnName() {
return "columnName";
}
@Mock
public String getColumnUniqueId() {
return "1";
}
@Mock
public boolean isColumnar() {
return true;
}
@Mock
public boolean isDimensionColumn() {
return true;
}
@Mock
public int getColumnGroupId() {
return 1;
}
@Mock
public int getScale() {
return 1;
}
@Mock
public int getPrecision() {
return 1;
}
@Mock
public int getNumberOfChild() {
return 1;
}
@Mock
public byte[] getDefaultValue() {
return new byte[] { 1, 2 };
}
@Mock
public Map<String, String> getColumnProperties() {
return columnPropertyMap;
}
@Mock
public boolean isInvisible() {
return true;
}
@Mock
public String getColumnReferenceId() {
return "1";
}
};
ColumnSchema wrapperColumnSchema = new ColumnSchema();
org.apache.carbondata.format.ColumnSchema actualResult = thriftWrapperSchemaConverter.fromWrapperToExternalColumnSchema(wrapperColumnSchema);
assertEquals(thriftColumnSchema, actualResult);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImplTest method testFromWrapperToExternalColumnSchemaForBooleanDataType.
@Test
public void testFromWrapperToExternalColumnSchemaForBooleanDataType() {
org.apache.carbondata.format.ColumnSchema thriftColumnSchema = new org.apache.carbondata.format.ColumnSchema(org.apache.carbondata.format.DataType.BOOLEAN, "columnName", "1", true, encoders, true);
thriftColumnSchema.setSchemaOrdinal(1);
thriftColumnSchema.setAggregate_function("");
ColumnSchema wrapperColumnSchema = new ColumnSchema();
new MockUp<ColumnSchema>() {
@Mock
public List<Encoding> getEncodingList() {
return encodings;
}
@Mock
public int getSchemaOrdinal() {
return 1;
}
@Mock
public DataType getDataType() {
return DataTypes.BOOLEAN;
}
@Mock
public String getColumnName() {
return "columnName";
}
@Mock
public String getColumnUniqueId() {
return "1";
}
@Mock
public boolean isColumnar() {
return true;
}
@Mock
public boolean isDimensionColumn() {
return true;
}
@Mock
public int getColumnGroupId() {
return 1;
}
@Mock
public int getScale() {
return 1;
}
@Mock
public int getPrecision() {
return 1;
}
@Mock
public int getNumberOfChild() {
return 1;
}
@Mock
public byte[] getDefaultValue() {
return new byte[] { 1, 2 };
}
@Mock
public Map<String, String> getColumnProperties() {
return columnPropertyMap;
}
@Mock
public boolean isInvisible() {
return true;
}
@Mock
public String getColumnReferenceId() {
return "1";
}
@Mock
public String getAggFunction() {
return "";
}
};
org.apache.carbondata.format.ColumnSchema actualResult = thriftWrapperSchemaConverter.fromWrapperToExternalColumnSchema(wrapperColumnSchema);
assertEquals(thriftColumnSchema, actualResult);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImplTest method testFromExternalToWrapperSchemaEvolutionEntry.
@Test
public void testFromExternalToWrapperSchemaEvolutionEntry() {
long time = 1112745600000L;
ColumnSchema wrapperColumnSchema = new ColumnSchema();
wrapperColumnSchema.setColumnUniqueId("1");
wrapperColumnSchema.setColumnName("columnName");
wrapperColumnSchema.setColumnar(true);
wrapperColumnSchema.setDataType(DataTypes.STRING);
wrapperColumnSchema.setDimensionColumn(true);
wrapperColumnSchema.setEncodingList(encodings);
wrapperColumnSchema.setNumberOfChild(1);
wrapperColumnSchema.setColumnGroup(1);
wrapperColumnSchema.setDefaultValue(new byte[] { 1, 2 });
wrapperColumnSchema.setColumnProperties(columnPropertyMap);
wrapperColumnSchema.setInvisible(true);
wrapperColumnSchema.setColumnReferenceId("1");
List<ColumnSchema> wrapperAddedColumns = new ArrayList<ColumnSchema>();
wrapperAddedColumns.add(wrapperColumnSchema);
SchemaEvolutionEntry wrapperSchemaEvolutionEntry = new SchemaEvolutionEntry();
List<ColumnSchema> wrapperRemovedColumns = new ArrayList<ColumnSchema>();
wrapperRemovedColumns.add(wrapperColumnSchema);
wrapperSchemaEvolutionEntry.setTimeStamp(time);
wrapperSchemaEvolutionEntry.setAdded(wrapperAddedColumns);
wrapperSchemaEvolutionEntry.setRemoved(wrapperRemovedColumns);
SchemaEvolutionEntry actualResult = thriftWrapperSchemaConverter.fromExternalToWrapperSchemaEvolutionEntry(schemaEvolEntry);
assertEquals(wrapperSchemaEvolutionEntry.getAdded().get(0), actualResult.getAdded().get(0));
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImplTest method testFromExternalToWrapperColumnSchemaForDoubleDatatype.
@Test
public void testFromExternalToWrapperColumnSchemaForDoubleDatatype() {
org.apache.carbondata.format.ColumnSchema thriftColumnSchema = new org.apache.carbondata.format.ColumnSchema(org.apache.carbondata.format.DataType.DOUBLE, "columnName", "1", true, encoders, true);
ColumnSchema actualResult = thriftWrapperSchemaConverter.fromExternalToWrapperColumnSchema(thriftColumnSchema);
Boolean expectedResult = true;
assertEquals(expectedResult, actualResult.hasEncoding(encodings.get(0)));
}
use of org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImplTest method testFromExternalToWrapperColumnSchemaForTimestampDatatype.
@Test
public void testFromExternalToWrapperColumnSchemaForTimestampDatatype() {
org.apache.carbondata.format.ColumnSchema thriftColumnSchema = new org.apache.carbondata.format.ColumnSchema(org.apache.carbondata.format.DataType.TIMESTAMP, "columnName", "1", true, encoders, true);
ColumnSchema actualResult = thriftWrapperSchemaConverter.fromExternalToWrapperColumnSchema(thriftColumnSchema);
Boolean expectedResult = true;
assertEquals(expectedResult, actualResult.hasEncoding(encodings.get(0)));
}
Aggregations