Search in sources :

Example 1 with ParentColumnTableRelation

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);
}
Also used : ColumnSchema(org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema) ParentColumnTableRelation(org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation) HashSet(java.util.HashSet)

Example 2 with ParentColumnTableRelation

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;
}
Also used : ColumnSchema(org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema) Encoding(org.apache.carbondata.core.metadata.encoder.Encoding) ParentColumnTableRelation(org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation) DataType(org.apache.carbondata.core.metadata.datatype.DataType) DecimalType(org.apache.carbondata.core.metadata.datatype.DecimalType)

Example 3 with ParentColumnTableRelation

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;
}
Also used : ArrayList(java.util.ArrayList) ParentColumnTableRelation(org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation) RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 4 with ParentColumnTableRelation

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;
}
Also used : ArrayList(java.util.ArrayList) ColumnSchema(org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema) Encoding(org.apache.carbondata.core.metadata.encoder.Encoding) ParentColumnTableRelation(org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation)

Example 5 with ParentColumnTableRelation

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;
}
Also used : ArrayList(java.util.ArrayList) ParentColumnTableRelation(org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation) RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Aggregations

ParentColumnTableRelation (org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation)10 ArrayList (java.util.ArrayList)6 ColumnSchema (org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema)6 Encoding (org.apache.carbondata.core.metadata.encoder.Encoding)4 RelationIdentifier (org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)4 DataType (org.apache.carbondata.core.metadata.datatype.DataType)2 DecimalType (org.apache.carbondata.core.metadata.datatype.DecimalType)2 HashSet (java.util.HashSet)1