use of org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation in project carbondata by apache.
the class TableInfo method updateParentRelationIdentifier.
private void updateParentRelationIdentifier() {
Set<RelationIdentifier> parentRelationIdentifiers = new HashSet<>();
this.parentRelationIdentifiers = new ArrayList<>();
List<ColumnSchema> listOfColumns = this.factTable.getListOfColumns();
for (ColumnSchema columnSchema : listOfColumns) {
List<ParentColumnTableRelation> parentColumnTableRelations = columnSchema.getParentColumnTableRelations();
if (null != parentColumnTableRelations) {
for (int i = 0; i < parentColumnTableRelations.size(); i++) {
parentRelationIdentifiers.add(parentColumnTableRelations.get(i).getRelationIdentifier());
}
}
}
this.parentRelationIdentifiers.addAll(parentRelationIdentifiers);
}
use of org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation in project carbondata by apache.
the class CarbonUtil method thriftColumnSchmeaToWrapperColumnSchema.
public static ColumnSchema thriftColumnSchmeaToWrapperColumnSchema(org.apache.carbondata.format.ColumnSchema externalColumnSchema) {
ColumnSchema wrapperColumnSchema = new ColumnSchema();
wrapperColumnSchema.setColumnUniqueId(externalColumnSchema.getColumn_id());
wrapperColumnSchema.setColumnName(externalColumnSchema.getColumn_name());
wrapperColumnSchema.setColumnar(externalColumnSchema.isColumnar());
DataType dataType = thriftDataTyopeToWrapperDataType(externalColumnSchema.data_type);
if (DataTypes.isDecimal(dataType)) {
DecimalType decimalType = (DecimalType) dataType;
decimalType.setPrecision(externalColumnSchema.getPrecision());
decimalType.setScale(externalColumnSchema.getScale());
}
wrapperColumnSchema.setDataType(dataType);
wrapperColumnSchema.setDimensionColumn(externalColumnSchema.isDimension());
List<Encoding> encoders = new ArrayList<Encoding>();
for (org.apache.carbondata.format.Encoding encoder : externalColumnSchema.getEncoders()) {
encoders.add(fromExternalToWrapperEncoding(encoder));
}
wrapperColumnSchema.setEncodingList(encoders);
wrapperColumnSchema.setNumberOfChild(externalColumnSchema.getNum_child());
wrapperColumnSchema.setPrecision(externalColumnSchema.getPrecision());
wrapperColumnSchema.setColumnGroup(externalColumnSchema.getColumn_group_id());
wrapperColumnSchema.setScale(externalColumnSchema.getScale());
wrapperColumnSchema.setDefaultValue(externalColumnSchema.getDefault_value());
wrapperColumnSchema.setSchemaOrdinal(externalColumnSchema.getSchemaOrdinal());
Map<String, String> properties = externalColumnSchema.getColumnProperties();
if (properties != null) {
if (properties.get(CarbonCommonConstants.SORT_COLUMNS) != null) {
wrapperColumnSchema.setSortColumn(true);
}
}
wrapperColumnSchema.setFunction(externalColumnSchema.getAggregate_function());
List<org.apache.carbondata.format.ParentColumnTableRelation> parentColumnTableRelation = externalColumnSchema.getParentColumnTableRelations();
if (null != parentColumnTableRelation) {
wrapperColumnSchema.setParentColumnTableRelations(fromThriftToWrapperParentTableColumnRelations(parentColumnTableRelation));
}
return wrapperColumnSchema;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation in project carbondata by apache.
the class AbstractDataFileFooterConverter method fromThriftToWrapperParentTableColumnRelations.
private List<ParentColumnTableRelation> fromThriftToWrapperParentTableColumnRelations(List<org.apache.carbondata.format.ParentColumnTableRelation> thirftParentColumnRelation) {
List<ParentColumnTableRelation> parentColumnTableRelationList = new ArrayList<>();
for (org.apache.carbondata.format.ParentColumnTableRelation carbonTableRelation : thirftParentColumnRelation) {
RelationIdentifier relationIdentifier = new RelationIdentifier(carbonTableRelation.getRelationIdentifier().getDatabaseName(), carbonTableRelation.getRelationIdentifier().getTableName(), carbonTableRelation.getRelationIdentifier().getTableId());
ParentColumnTableRelation parentColumnTableRelation = new ParentColumnTableRelation(relationIdentifier, carbonTableRelation.getColumnId(), carbonTableRelation.getColumnName());
parentColumnTableRelationList.add(parentColumnTableRelation);
}
return parentColumnTableRelationList;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation in project carbondata by apache.
the class ThriftWrapperSchemaConverterImpl method fromExternalToWrapperColumnSchema.
/* (non-Javadoc)
* convert from external to wrapper columnschema
*/
@Override
public ColumnSchema fromExternalToWrapperColumnSchema(org.apache.carbondata.format.ColumnSchema externalColumnSchema) {
ColumnSchema wrapperColumnSchema = new ColumnSchema();
wrapperColumnSchema.setColumnUniqueId(externalColumnSchema.getColumn_id());
wrapperColumnSchema.setColumnName(externalColumnSchema.getColumn_name());
wrapperColumnSchema.setColumnar(externalColumnSchema.isColumnar());
wrapperColumnSchema.setDataType(fromExternalToWrapperDataType(externalColumnSchema.data_type, externalColumnSchema.precision, externalColumnSchema.scale));
wrapperColumnSchema.setDimensionColumn(externalColumnSchema.isDimension());
List<Encoding> encoders = new ArrayList<Encoding>();
for (org.apache.carbondata.format.Encoding encoder : externalColumnSchema.getEncoders()) {
encoders.add(fromExternalToWrapperEncoding(encoder));
}
wrapperColumnSchema.setEncodingList(encoders);
wrapperColumnSchema.setNumberOfChild(externalColumnSchema.getNum_child());
wrapperColumnSchema.setPrecision(externalColumnSchema.getPrecision());
wrapperColumnSchema.setColumnGroup(externalColumnSchema.getColumn_group_id());
wrapperColumnSchema.setScale(externalColumnSchema.getScale());
wrapperColumnSchema.setDefaultValue(externalColumnSchema.getDefault_value());
wrapperColumnSchema.setInvisible(externalColumnSchema.isInvisible());
wrapperColumnSchema.setColumnReferenceId(externalColumnSchema.getColumnReferenceId());
wrapperColumnSchema.setSchemaOrdinal(externalColumnSchema.getSchemaOrdinal());
wrapperColumnSchema.setSortColumn(false);
Map<String, String> properties = externalColumnSchema.getColumnProperties();
if (properties != null) {
String sortColumns = properties.get(CarbonCommonConstants.SORT_COLUMNS);
if (sortColumns != null) {
wrapperColumnSchema.setSortColumn(true);
}
}
wrapperColumnSchema.setFunction(externalColumnSchema.getAggregate_function());
List<org.apache.carbondata.format.ParentColumnTableRelation> parentColumnTableRelation = externalColumnSchema.getParentColumnTableRelations();
if (null != parentColumnTableRelation) {
wrapperColumnSchema.setParentColumnTableRelations(fromExtrenalToWrapperParentTableColumnRelations(parentColumnTableRelation));
}
return wrapperColumnSchema;
}
use of org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation in project carbondata by apache.
the class ThriftWrapperSchemaConverterImpl method wrapperToThriftRelationList.
private List<org.apache.carbondata.format.ParentColumnTableRelation> wrapperToThriftRelationList(List<ParentColumnTableRelation> wrapperColumnRelations) {
List<org.apache.carbondata.format.ParentColumnTableRelation> thriftColumnRelationList = new ArrayList<>();
for (ParentColumnTableRelation wrapperColumnRelation : wrapperColumnRelations) {
org.apache.carbondata.format.ParentColumnTableRelation thriftColumnTableRelation = new org.apache.carbondata.format.ParentColumnTableRelation();
thriftColumnTableRelation.setColumnId(wrapperColumnRelation.getColumnId());
thriftColumnTableRelation.setColumnName(wrapperColumnRelation.getColumnName());
org.apache.carbondata.format.RelationIdentifier thriftRelationIdentifier = new org.apache.carbondata.format.RelationIdentifier();
thriftRelationIdentifier.setDatabaseName(wrapperColumnRelation.getRelationIdentifier().getDatabaseName());
thriftRelationIdentifier.setTableName(wrapperColumnRelation.getRelationIdentifier().getTableName());
thriftRelationIdentifier.setTableId(wrapperColumnRelation.getRelationIdentifier().getTableId());
thriftColumnTableRelation.setRelationIdentifier(thriftRelationIdentifier);
thriftColumnRelationList.add(thriftColumnTableRelation);
}
return thriftColumnRelationList;
}
Aggregations