/** * below method is to check whether data type is present in the data type array * * @param dataType data type to be searched * @param dataTypes all data types * @return if data type is present */ public static boolean hasDataType(DataType dataType, DataType[] dataTypes) { for (int i = 0; i < dataTypes.length; i++) { if (dataType.equals(dataTypes[i])) { return true; } } return false; }
/** * the method prepares and return the message mentioning the reason of badrecord * * @param columnName * @param dataType * @return */ public static String prepareFailureReason(String columnName, DataType dataType) { return "The value with column name " + columnName + " and column data type " + dataType .getName() + " is not a valid " + dataType + " type."; }
/** * @return if DataType is ARRAY or STRUCT, this method return true, else * false. */ public Boolean isComplex() { return columnSchema.getDataType().isComplexType(); }
/** * Gives length in case of fixed schema other wise returns length * * @return */ public int getLength() { return dataType.getSizeInBytes(); }
if (column.getDataType().isComplexType()) { ordinal = i + 1; ordinal = setLocalDictForComplexColumns(columns, ordinal, column.getNumberOfChild()); if (column.isDimensionColumn() && (column.getDataType().equals(DataTypes.STRING) || column.getDataType().equals(DataTypes.VARCHAR)) && !column .hasEncoding(Encoding.DICTIONARY)) { column.setLocalDictColumn(true); && column.getDataType().isComplexType()) { ordinal = i + 1; ordinal = setLocalDictForComplexColumns(columns, ordinal, column.getNumberOfChild()); && column.getDataType().isComplexType()) { ordinal = i + 1; ordinal = if (column.isDimensionColumn() && (column.getDataType().equals(DataTypes.STRING) || column.getDataType().equals(DataTypes.VARCHAR)) && !column .hasEncoding(Encoding.DICTIONARY)) { if (!Arrays.asList(listOfDictionaryExcludeColumns).contains(column.getColumnName())) { .isComplexType()) { ordinal = i + 1; ordinal = setLocalDictForComplexColumns(columns, ordinal, column.getNumberOfChild()); if (column.isDimensionColumn() && (column.getDataType().equals(DataTypes.STRING) || column.getDataType().equals(DataTypes.VARCHAR)) && !column.hasEncoding(Encoding.DICTIONARY)
|| DataTypes.isDecimal(field.getDataType()) || field.getDataType().isComplexType() || field.getDataType() == DataTypes.VARCHAR) { String errorMsg = if (field.getDataType().getName().equalsIgnoreCase("ARRAY")) { .addColumn(new StructField(field.getFieldName(), complexType), valIndex, false, isInvertedIdxColumn > -1); } else if (field.getDataType().getName().equalsIgnoreCase("STRUCT")) { .addColumn(new StructField(field.getFieldName(), complexType), valIndex, false, isInvertedIdxColumn > -1); } else if (field.getDataType().getName().equalsIgnoreCase("MAP")) {
/** * 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()))); } }
public static boolean isMapType(DataType dataType) { return dataType.getId() == MAP_TYPE_ID; }
public static PrimitivePageStatsCollector newInstance(ValueEncoderMeta meta) { PrimitivePageStatsCollector instance = new PrimitivePageStatsCollector(DataType.getDataType(meta.getType())); DataType dataType = DataType.getDataType(meta.getType()); if (dataType == DataTypes.BOOLEAN || dataType == DataTypes.BYTE) { instance.minByte = (byte) meta.getMinValue();
public ColumnPageEncoderMeta(TableSpec.ColumnSpec columnSpec, DataType storeDataType, String compressorName) { if (columnSpec == null) { throw new IllegalArgumentException("columm spec must not be null"); } if (storeDataType == null) { throw new IllegalArgumentException("store data type must not be null"); } if (compressorName == null) { throw new IllegalArgumentException("compressor must not be null"); } this.columnSpec = columnSpec; this.storeDataType = storeDataType; this.compressorName = compressorName; setType(DataType.convertType(storeDataType)); }
@Override public int getLength() { if (length == 0) { return dataType.getSizeInBytes(); } else { return length; } }
metadata.setExpression(leftExp); metadata.setIncludeFilter(isIncludeFilter); if (columnExpression.getDataType().equals(DataTypes.TIMESTAMP) || columnExpression.getDataType().equals(DataTypes.DATE)) { isExpressionResolve = true; } else { ! columnList.get(0).getDimension().getDataType().isComplexType())) { dimColResolvedFilterInfo.setFilterValues(FilterUtil .getFilterListForAllValues(absoluteTableIdentifier, exp, columnList.get(0),
public static boolean isDecimal(DataType dataType) { return dataType.getId() == DECIMAL_TYPE_ID; }
TableSpec.ColumnSpec spec = TableSpec.ColumnSpec.newInstanceLegacy("legacy", stats.getDataType(), ColumnType.MEASURE); DataType dataType = DataType.getDataType(metadata.getType()); if (dataType == DataTypes.BYTE || dataType == DataTypes.SHORT || } else if (codec instanceof DirectCompressCodec) { ColumnPageEncoderMeta meta = new ColumnPageEncoderMeta(spec, DataType.getDataType(metadata.getType()), stats, compressor); meta.setFillCompleteVector(fullVectorFill); } else if (codec instanceof DirectCompressCodec) { ColumnPageEncoderMeta meta = new ColumnPageEncoderMeta(spec, DataType.getDataType(metadata.getType()), stats, compressor); meta.setFillCompleteVector(fullVectorFill);
@Override public String toString() { return getName(); }
/** * Overridden equals method for columnSchema */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ColumnSchema)) { return false; } ColumnSchema other = (ColumnSchema) obj; if (columnName == null) { if (other.columnName != null) { return false; } } else if (!columnName.equalsIgnoreCase(other.columnName)) { return false; } if (dataType == null) { if (other.dataType != null) { return false; } } else if (!dataType.equals(other.dataType)) { return false; } return true; }
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; }
@Override public int getLength() { return dataType.getSizeInBytes(); }
public static boolean isArrayType(DataType dataType) { return dataType.getId() == ARRAY_TYPE_ID; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + getName().hashCode(); return result; }