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);
}
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);
}
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);
}
}
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();
}
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;
}
Aggregations