Search in sources :

Example 11 with RelationIdentifier

use of org.apache.carbondata.core.metadata.schema.table.RelationIdentifier in project carbondata by apache.

the class IndexDataMapProvider method initMeta.

@Override
public void initMeta(CarbonTable mainTable, DataMapSchema dataMapSchema, String ctasSqlStatement) throws MalformedDataMapCommandException, IOException {
    if (mainTable == null) {
        throw new MalformedDataMapCommandException("Parent table is required to create index datamap");
    }
    ArrayList<RelationIdentifier> relationIdentifiers = new ArrayList<>();
    dataMapSchema.setParentTables(relationIdentifiers);
    relationIdentifiers.add(new RelationIdentifier(mainTable.getDatabaseName(), mainTable.getTableName(), mainTable.getTableInfo().getFactTable().getTableId()));
    DataMapFactory dataMapFactory = createIndexDataMapFactory(dataMapSchema);
    DataMapStoreManager.getInstance().registerDataMap(mainTable, dataMapSchema, dataMapFactory);
    storageProvider.saveSchema(dataMapSchema);
}
Also used : MalformedDataMapCommandException(org.apache.carbondata.common.exceptions.sql.MalformedDataMapCommandException) ArrayList(java.util.ArrayList) DataMapFactory(org.apache.carbondata.core.datamap.dev.DataMapFactory) RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 12 with RelationIdentifier

use of org.apache.carbondata.core.metadata.schema.table.RelationIdentifier in project carbondata by apache.

the class QueryUtil method getTableIdentifierForColumn.

public static AbsoluteTableIdentifier getTableIdentifierForColumn(CarbonDimension carbonDimension, AbsoluteTableIdentifier identifier) {
    RelationIdentifier relation = carbonDimension.getColumnSchema().getParentColumnTableRelations().get(0).getRelationIdentifier();
    String parentTableName = relation.getTableName();
    String parentDatabaseName = relation.getDatabaseName();
    String parentTableId = relation.getTableId();
    String newTablePath = CarbonTablePath.getNewTablePath(identifier.getTablePath(), parentTableName);
    return AbsoluteTableIdentifier.from(newTablePath, parentDatabaseName, parentTableName, parentTableId);
}
Also used : RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 13 with RelationIdentifier

use of org.apache.carbondata.core.metadata.schema.table.RelationIdentifier in project carbondata by apache.

the class MVSchema method readFields.

@Override
public void readFields(DataInput in) throws IOException {
    boolean isRelationIdentifierExists = in.readBoolean();
    if (isRelationIdentifierExists) {
        this.identifier = new RelationIdentifier(null, null, null);
        this.identifier.readFields(in);
    }
    int mapSize = in.readShort();
    this.properties = new HashMap<>(mapSize);
    for (int i = 0; i < mapSize; i++) {
        String key = in.readUTF();
        String value = in.readUTF();
        this.properties.put(key, value);
    }
}
Also used : RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 14 with RelationIdentifier

use of org.apache.carbondata.core.metadata.schema.table.RelationIdentifier in project carbondata by apache.

the class ParentColumnTableRelation method readFields.

@Override
public void readFields(DataInput in) throws IOException {
    this.relationIdentifier = new RelationIdentifier(null, null, null);
    relationIdentifier.readFields(in);
    this.columnId = in.readUTF();
    this.columnName = in.readUTF();
}
Also used : RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 15 with RelationIdentifier

use of org.apache.carbondata.core.metadata.schema.table.RelationIdentifier in project carbondata by apache.

the class ThriftWrapperSchemaConverterImpl method fromExternalToWrapperParentTableColumnRelations.

private List<ParentColumnTableRelation> fromExternalToWrapperParentTableColumnRelations(List<org.apache.carbondata.format.ParentColumnTableRelation> thriftParentColumnRelation) {
    List<ParentColumnTableRelation> parentColumnTableRelationList = new ArrayList<>();
    for (org.apache.carbondata.format.ParentColumnTableRelation carbonTableRelation : thriftParentColumnRelation) {
        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)

Aggregations

RelationIdentifier (org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)16 ArrayList (java.util.ArrayList)11 DataMapSchema (org.apache.carbondata.core.metadata.schema.table.DataMapSchema)4 ParentColumnTableRelation (org.apache.carbondata.core.metadata.schema.table.column.ParentColumnTableRelation)4 LoadMetadataDetails (org.apache.carbondata.core.statusmanager.LoadMetadataDetails)3 Gson (com.google.gson.Gson)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 SegmentStatusManager (org.apache.carbondata.core.statusmanager.SegmentStatusManager)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 MalformedDataMapCommandException (org.apache.carbondata.common.exceptions.sql.MalformedDataMapCommandException)1 DataMapFactory (org.apache.carbondata.core.datamap.dev.DataMapFactory)1 ICarbonLock (org.apache.carbondata.core.locks.ICarbonLock)1