/** * @return if DataType is ARRAY or STRUCT, this method return true, else * false. */ public Boolean isComplex() { return columnSchema.getDataType().isComplexType(); }
public static boolean[] getComplexDataTypeArray(ProjectionDimension[] queryDimensions) { boolean[] dictionaryEncodingArray = new boolean[queryDimensions.length]; for (int i = 0; i < queryDimensions.length; i++) { dictionaryEncodingArray[i] = queryDimensions[i].getDimension().getDataType().isComplexType(); } return dictionaryEncodingArray; }
private static String getComplexTypeString(DataField[] dataFields) { StringBuilder dimString = new StringBuilder(); for (DataField dataField : dataFields) { if (dataField.getColumn().getDataType().isComplexType()) { addAllComplexTypeChildren((CarbonDimension) dataField.getColumn(), dimString, ""); dimString.append(CarbonCommonConstants.SEMICOLON_SPC_CHARACTER); } } return dimString.toString(); }
/** * This method verifies if the Expression is qualified for Range Expression conversion. * * @param expChild * @return */ private boolean eligibleForRangeExpConv(Expression expChild) { for (Expression exp : expChild.getChildren()) { if (exp instanceof ColumnExpression) { return ((ColumnExpression) exp).isDimension() && ! (((ColumnExpression) exp).getDimension().getDataType().isComplexType()); } } return false; }
private int[] getComplexDimensionParentBlockIndexes(List<ProjectionDimension> queryDimensions) { List<Integer> parentBlockIndexList = new ArrayList<Integer>(); for (ProjectionDimension queryDimension : queryDimensions) { if (queryDimension.getDimension().getDataType().isComplexType()) { if (null != queryDimension.getDimension().getComplexParentDimension()) { if (queryDimension.getDimension().isComplex()) { parentBlockIndexList.add(queryDimension.getDimension().getOrdinal()); } else { parentBlockIndexList.add(queryDimension.getParentDimension().getOrdinal()); } } else { parentBlockIndexList.add(queryDimension.getDimension().getOrdinal()); } } } return ArrayUtils .toPrimitive(parentBlockIndexList.toArray(new Integer[parentBlockIndexList.size()])); }
/** * Match the columns for transactional and non transactional tables * @param isTransactionalTable * @param queryColumn * @param tableColumn * @return */ private static boolean isColumnMatches(boolean isTransactionalTable, CarbonColumn queryColumn, CarbonColumn tableColumn) { // If it is non transactional table just check the column names, no need to validate // column id as multiple sdk's output placed in a single folder doesn't have same // column ID but can have same column name if (tableColumn.getDataType().isComplexType() && !(tableColumn.getDataType().getId() == DataTypes.ARRAY_TYPE_ID)) { if (tableColumn.getColumnId().equalsIgnoreCase(queryColumn.getColumnId())) { return true; } else { return isColumnMatchesStruct(tableColumn, queryColumn); } } else { return (tableColumn.getColumnId().equalsIgnoreCase(queryColumn.getColumnId()) || ( !isTransactionalTable && tableColumn.getColName() .equalsIgnoreCase(queryColumn.getColName()))); } }
else if (isComplexDimensionStarted || columnSchema.getDataType().isComplexType()) { cardinalityIndexForComplexDimensionColumn.add(tableOrdinal); carbonDimension =
if (column.getDataType().isComplexType()) { ordinal = i + 1; ordinal = setLocalDictForComplexColumns(columns, ordinal, column.getNumberOfChild()); && column.getDataType().isComplexType()) { ordinal = i + 1; ordinal = setLocalDictForComplexColumns(columns, ordinal, column.getNumberOfChild()); && column.getDataType().isComplexType()) { ordinal = i + 1; ordinal = .isComplexType()) { ordinal = i + 1; ordinal = setLocalDictForComplexColumns(columns, ordinal, column.getNumberOfChild());
@Override public void readColumnChunks(RawBlockletColumnChunks rawBlockletColumnChunks) throws IOException { for (int i = 0; i < dimColEvaluatorInfoList.size(); i++) { DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = dimColEvaluatorInfoList.get(i); if (!dimColumnEvaluatorInfo.getDimension().getDataType().isComplexType()) { if (null == rawBlockletColumnChunks.getDimensionRawColumnChunks()[dimensionChunkIndex[i]]) { rawBlockletColumnChunks.getDimensionRawColumnChunks()[dimensionChunkIndex[i]] = rawBlockletColumnChunks.getDataBlock().readDimensionChunk( rawBlockletColumnChunks.getFileReader(), dimensionChunkIndex[i]); } } else { GenericQueryType complexType = complexDimensionInfoMap.get(dimensionChunkIndex[i]); complexType.fillRequiredBlockData(rawBlockletColumnChunks); } } for (MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo : msrColEvalutorInfoList) { int chunkIndex = msrColEvalutorInfoList.get(0).getColumnIndex(); if (null == rawBlockletColumnChunks.getMeasureRawColumnChunks()[chunkIndex]) { rawBlockletColumnChunks.getMeasureRawColumnChunks()[chunkIndex] = rawBlockletColumnChunks.getDataBlock() .readMeasureChunk(rawBlockletColumnChunks.getFileReader(), chunkIndex); } } } }
if (dataTypes[i].isComplexType()) { ByteArrayOutputStream byteArray = new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(byteArray);
|| DataTypes.isDecimal(field.getDataType()) || field.getDataType().isComplexType() || field.getDataType() == DataTypes.VARCHAR) { String errorMsg =
/** * This method will get the value for the given key. If value does not exist * for the given key, it will check and load the value. * * @param dictionaryColumnUniqueIdentifier unique identifier which contains dbName, * tableName and columnIdentifier * @return dictionary * @throws IOException in case memory is not sufficient to load dictionary into memory */ private Dictionary getDictionary( DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier) throws IOException { Dictionary forwardDictionary = null; // dictionary is only for primitive data type assert (!dictionaryColumnUniqueIdentifier.getDataType().isComplexType()); String columnIdentifier = dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId(); ColumnDictionaryInfo columnDictionaryInfo = getColumnDictionaryInfo(dictionaryColumnUniqueIdentifier, columnIdentifier); // load sort index file in case of forward dictionary checkAndLoadDictionaryData(dictionaryColumnUniqueIdentifier, columnDictionaryInfo, getLruCacheKey(dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId(), CacheType.FORWARD_DICTIONARY), true); forwardDictionary = new ForwardDictionary(columnDictionaryInfo); return forwardDictionary; }
/** * This method will get the value for the given key. If value does not exist * for the given key, it will check and load the value. * * @param dictionaryColumnUniqueIdentifier unique identifier which contains dbName, * tableName and columnIdentifier * @return dictionary * @throws IOException in case memory is not sufficient to load dictionary into memory */ private Dictionary getDictionary( DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier) throws IOException { Dictionary reverseDictionary = null; // dictionary is only for primitive data type assert (!dictionaryColumnUniqueIdentifier.getDataType().isComplexType()); String columnIdentifier = dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId(); ColumnReverseDictionaryInfo columnReverseDictionaryInfo = getColumnReverseDictionaryInfo(dictionaryColumnUniqueIdentifier, columnIdentifier); // do not load sort index file for reverse dictionary checkAndLoadDictionaryData(dictionaryColumnUniqueIdentifier, columnReverseDictionaryInfo, getLruCacheKey(dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId(), CacheType.REVERSE_DICTIONARY), false); reverseDictionary = new ReverseDictionary(columnReverseDictionaryInfo); return reverseDictionary; }
private void initComplexTypeChildren() { if (getDataType().isComplexType()) { StructField subFields = prepareSubFields(getFieldName(), getDataType()); if (DataTypes.isArrayType(getDataType()) || DataTypes.isMapType(getDataType())) { children = subFields.getChildren(); } else if (DataTypes.isStructType(getDataType())) { children = ((StructType) subFields.getDataType()).getFields(); } } }
continue; if (!dimColumnEvaluatorInfo.getDimension().getDataType().isComplexType()) { if (!dimColumnEvaluatorInfo.isDimensionExistsInCurrentSilce()) { record[dimColumnEvaluatorInfo.getRowIndex()] =
! columnList.get(0).getDimension().getDataType().isComplexType())) { dimColResolvedFilterInfo.setFilterValues(FilterUtil .getFilterListForAllValues(absoluteTableIdentifier, exp, columnList.get(0),
field.getDataType() == DataTypes.DATE || field.getDataType() == DataTypes.TIMESTAMP || field.getDataType().isComplexType() || (isComplexChild)) { newColumn.setDimensionColumn(true); newColumn .setEncodingList(createEncoding(field.getDataType(), isInvertedIdxColumn, isComplexChild)); if (field.getDataType().isComplexType()) { if (DataTypes.isArrayType(field.getDataType()) || DataTypes.isMapType(field.getDataType())) { newColumn.setNumberOfChild(1); if (field.getDataType().isComplexType()) { String parentFieldName = newColumn.getColumnName(); if (DataTypes.isArrayType(field.getDataType())) {
if (!dimColumnEvaluatorInfo.getDimension().getDataType().isComplexType()) { if (!dimColumnEvaluatorInfo.isDimensionExistsInCurrentSilce()) { record[index] = dimColumnEvaluatorInfo.getDimension().getDefaultValue();
if (currentCondExpression.isSingleColumn() && ! column.getDataType().isComplexType()) { if (column.isMeasure()) { if (FilterUtil.checkIfExpressionContainsColumn(currentCondExpression.getLeft()) currentCondExpression = (BinaryConditionalExpression) expression; column = currentCondExpression.getColumnList().get(0).getCarbonColumn(); if (currentCondExpression.isSingleColumn() && ! column.getDataType().isComplexType()) { if (column.isMeasure()) { if (FilterUtil.checkIfExpressionContainsColumn(currentCondExpression.getLeft())