Search in sources :

Example 6 with GenericDataType

use of org.apache.carbondata.processing.datatypes.GenericDataType in project carbondata by apache.

the class CarbonFactDataHandlerColumnar method setComplexMapSurrogateIndex.

private void setComplexMapSurrogateIndex(int dimensionCount) {
    int surrIndex = 0;
    for (int i = 0; i < dimensionCount; i++) {
        GenericDataType complexDataType = model.getComplexIndexMap().get(i);
        if (complexDataType != null) {
            List<GenericDataType> primitiveTypes = new ArrayList<GenericDataType>();
            complexDataType.getAllPrimitiveChildren(primitiveTypes);
            for (GenericDataType eachPrimitive : primitiveTypes) {
                eachPrimitive.setSurrogateIndex(surrIndex++);
            }
        } else {
            surrIndex++;
        }
    }
}
Also used : GenericDataType(org.apache.carbondata.processing.datatypes.GenericDataType) ArrayList(java.util.ArrayList)

Example 7 with GenericDataType

use of org.apache.carbondata.processing.datatypes.GenericDataType in project carbondata by apache.

the class CarbonFactDataHandlerColumnar method getExpandedComplexColsCount.

// return the number of complex column after complex columns are expanded
private int getExpandedComplexColsCount() {
    int count = 0;
    int dictDimensionCount = model.getDimensionCount();
    for (int i = 0; i < dictDimensionCount; i++) {
        GenericDataType complexDataType = model.getComplexIndexMap().get(i);
        if (complexDataType != null) {
            count += complexDataType.getColsCount();
        }
    }
    return count;
}
Also used : GenericDataType(org.apache.carbondata.processing.datatypes.GenericDataType)

Example 8 with GenericDataType

use of org.apache.carbondata.processing.datatypes.GenericDataType in project carbondata by apache.

the class CarbonFactDataHandlerColumnar method getBlockKeySizeWithComplexTypes.

/**
   * This method combines primitive dimensions with complex metadata columns
   *
   * @param primitiveBlockKeySize
   * @return all dimensions cardinality including complex dimension metadata column
   */
private int[] getBlockKeySizeWithComplexTypes(int[] primitiveBlockKeySize) {
    int allColsCount = getExpandedComplexColsCount();
    int[] blockKeySizeWithComplexTypes = new int[this.colGrpModel.getNoOfColumnStore() + allColsCount];
    List<Integer> blockKeySizeWithComplex = new ArrayList<Integer>(blockKeySizeWithComplexTypes.length);
    int dictDimensionCount = model.getDimensionCount();
    for (int i = 0; i < dictDimensionCount; i++) {
        GenericDataType complexDataType = model.getComplexIndexMap().get(i);
        if (complexDataType != null) {
            complexDataType.fillBlockKeySize(blockKeySizeWithComplex, primitiveBlockKeySize);
        } else {
            blockKeySizeWithComplex.add(primitiveBlockKeySize[i]);
        }
    }
    for (int i = 0; i < blockKeySizeWithComplexTypes.length; i++) {
        blockKeySizeWithComplexTypes[i] = blockKeySizeWithComplex.get(i);
    }
    return blockKeySizeWithComplexTypes;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) GenericDataType(org.apache.carbondata.processing.datatypes.GenericDataType) ArrayList(java.util.ArrayList)

Aggregations

GenericDataType (org.apache.carbondata.processing.datatypes.GenericDataType)8 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)2 ColumnSchema (org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataOutputStream (java.io.DataOutputStream)1 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 SegmentProperties (org.apache.carbondata.core.datastore.block.SegmentProperties)1 ComplexColumnPage (org.apache.carbondata.core.datastore.page.ComplexColumnPage)1 KeyGenException (org.apache.carbondata.core.keygenerator.KeyGenException)1 CarbonTableIdentifier (org.apache.carbondata.core.metadata.CarbonTableIdentifier)1 DataType (org.apache.carbondata.core.metadata.datatype.DataType)1 CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)1 CarbonDimension (org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension)1 CarbonMeasure (org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure)1