Search in sources :

Example 1 with RelationIdentifier

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

the class DataMapStoreManager method getAllDataMap.

/**
 * It gives all datamaps except the default datamap.
 *
 * @return
 */
public List<TableDataMap> getAllDataMap(CarbonTable carbonTable) {
    // TODO cache all schemas and update only when datamap status file updates
    List<DataMapSchema> dataMapSchemas = getAllDataMapSchemas();
    List<TableDataMap> dataMaps = new ArrayList<>();
    if (dataMapSchemas != null) {
        for (DataMapSchema dataMapSchema : dataMapSchemas) {
            RelationIdentifier identifier = dataMapSchema.getParentTables().get(0);
            if (dataMapSchema.isIndexDataMap() && identifier.getTableName().equals(carbonTable.getTableName()) && identifier.getDatabaseName().equals(carbonTable.getDatabaseName())) {
                dataMaps.add(getDataMap(carbonTable, dataMapSchema));
            }
        }
    }
    return dataMaps;
}
Also used : ArrayList(java.util.ArrayList) DataMapSchema(org.apache.carbondata.core.metadata.schema.table.DataMapSchema) RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 2 with RelationIdentifier

use of org.apache.carbondata.core.metadata.schema.table.RelationIdentifier 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 3 with RelationIdentifier

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

the class ThriftWrapperSchemaConverterImpl method fromExternalToWrapperDataMapSchema.

@Override
public DataMapSchema fromExternalToWrapperDataMapSchema(org.apache.carbondata.format.DataMapSchema thriftDataMapSchema) {
    DataMapSchema childSchema = new DataMapSchema(thriftDataMapSchema.getDataMapName(), thriftDataMapSchema.getClassName());
    childSchema.setProperties(thriftDataMapSchema.getProperties());
    if (null != thriftDataMapSchema.getChildTableIdentifier()) {
        RelationIdentifier relationIdentifier = new RelationIdentifier(thriftDataMapSchema.getChildTableIdentifier().getDatabaseName(), thriftDataMapSchema.getChildTableIdentifier().getTableName(), thriftDataMapSchema.getChildTableIdentifier().getTableId());
        childSchema.setRelationIdentifier(relationIdentifier);
        childSchema.setChildSchema(fromExternalToWrapperTableSchema(thriftDataMapSchema.getChildTableSchema(), relationIdentifier.getTableName()));
    }
    return childSchema;
}
Also used : DataMapSchema(org.apache.carbondata.core.metadata.schema.table.DataMapSchema) RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 4 with RelationIdentifier

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

the class ThriftWrapperSchemaConverterImpl method fromWrapperToExternalChildSchemaList.

private List<org.apache.carbondata.format.DataMapSchema> fromWrapperToExternalChildSchemaList(List<DataMapSchema> wrapperChildSchemaList) {
    List<org.apache.carbondata.format.DataMapSchema> thriftChildSchemas = new ArrayList<>();
    for (DataMapSchema wrapperChildSchema : wrapperChildSchemaList) {
        org.apache.carbondata.format.DataMapSchema thriftChildSchema = new org.apache.carbondata.format.DataMapSchema();
        if (wrapperChildSchema.getRelationIdentifier() != null) {
            org.apache.carbondata.format.RelationIdentifier relationIdentifier = new org.apache.carbondata.format.RelationIdentifier();
            relationIdentifier.setDatabaseName(wrapperChildSchema.getRelationIdentifier().getDatabaseName());
            relationIdentifier.setTableName(wrapperChildSchema.getRelationIdentifier().getTableName());
            relationIdentifier.setTableId(wrapperChildSchema.getRelationIdentifier().getTableId());
            thriftChildSchema.setChildTableIdentifier(relationIdentifier);
        }
        thriftChildSchema.setProperties(wrapperChildSchema.getProperties());
        thriftChildSchema.setClassName(wrapperChildSchema.getProviderName());
        thriftChildSchema.setDataMapName(wrapperChildSchema.getDataMapName());
        if (wrapperChildSchema.getChildSchema() != null) {
            thriftChildSchema.setChildTableSchema(fromWrapperToExternalTableSchema(wrapperChildSchema.getChildSchema()));
        }
        thriftChildSchemas.add(thriftChildSchema);
    }
    return thriftChildSchemas;
}
Also used : ArrayList(java.util.ArrayList) DataMapSchema(org.apache.carbondata.core.metadata.schema.table.DataMapSchema) RelationIdentifier(org.apache.carbondata.core.metadata.schema.table.RelationIdentifier)

Example 5 with RelationIdentifier

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

the class ThriftWrapperSchemaConverterImpl method fromExtrenalToWrapperParentTableColumnRelations.

private List<ParentColumnTableRelation> fromExtrenalToWrapperParentTableColumnRelations(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)

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