this.type = DataTypes.DOUBLE; } else if (type.equalsIgnoreCase("array")) { this.type = DataTypes.createArrayType(fields.get(0).getDataType()); } else if (type.equalsIgnoreCase("struct")) { this.type = DataTypes.createStructType(fields);
/** * Throw exception if {@param field} name is repeated */ private void checkRepeatColumnName(StructField field, String parentName) { checkRepeatColumnName( new StructField(parentName + "." + field.getFieldName(), field.getDataType(), field.getChildren())); }
newColumn.setDataType(field.getDataType()); if (isSortColumn || field.getDataType() == DataTypes.STRING || field.getDataType() == DataTypes.VARCHAR || field.getDataType() == DataTypes.DATE || field.getDataType() == DataTypes.TIMESTAMP || field.getDataType().isComplexType() || (isComplexChild)) { newColumn.setDimensionColumn(true); newColumn.setColumnReferenceId(newColumn.getColumnUniqueId()); newColumn .setEncodingList(createEncoding(field.getDataType(), isInvertedIdxColumn, isComplexChild)); if (field.getDataType().isComplexType()) { if (DataTypes.isArrayType(field.getDataType()) || DataTypes.isMapType(field.getDataType())) { newColumn.setNumberOfChild(1); } else { newColumn.setNumberOfChild(((StructType) field.getDataType()).getFields().size()); if (DataTypes.isDecimal(field.getDataType())) { DecimalType decimalType = (DecimalType) field.getDataType(); newColumn.setPrecision(decimalType.getPrecision()); newColumn.setScale(decimalType.getScale()); if (!newColumn.isDimensionColumn()) { measures.add(newColumn); } else if (DataTypes.isStructType(field.getDataType()) || DataTypes .isArrayType(field.getDataType()) || DataTypes.isMapType(field.getDataType()) || isComplexChild) {
StructField arrayField = prepareSubFields(fieldName, ((ArrayType) dataType).getElementType()); arrayFields.add(arrayField); return new StructField(fieldName, DataTypes.createArrayType(arrayField.getDataType()), arrayFields); } else if (DataTypes.isStructType(dataType)) { List<StructField> fields = ((StructType) dataType).getFields(); for (StructField field : fields) { structFields.add(prepareSubFields(field.getFieldName(), field.getDataType())); StructField field = new StructField(fieldName + ".val", DataTypes.createStructType(mapFields)); MapType mapDataType = DataTypes.createMapType(keyField.getDataType(), field.getDataType()); List<StructField> mapStructField = new ArrayList<>(); mapStructField.add(field);
((StructType) keyValueField.getDataType()).getFields().get(1).getDataType(); MapType mapType = DataTypes.createMapType(DataTypes.STRING, valueType); mapSubFields.add(keyValueField);
return mapField.getDataType();
DataTypes.createArrayType(field.getChildren().get(0).getDataType()); tableSchemaBuilder .addColumn(new StructField(field.getFieldName(), complexType), valIndex, false, for (StructField childFld : field.getChildren()) { structFieldsArray .add(new StructField(childFld.getFieldName(), childFld.getDataType())); field.getChildren().get(0).getDataType()); tableSchemaBuilder .addColumn(new StructField(field.getFieldName(), mapType), valIndex, false,
DataTypes.createMapType(DataTypes.STRING, mapKeyValueField.getDataType()); List<StructField> mapStructFields = new ArrayList<>(); mapStructFields.add(mapKeyValueField);
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(); } } }
vectors[i] = new CarbonColumnVectorImpl( CarbonV3DataFormatConstants.NUMBER_OF_ROWS_PER_BLOCKLET_COLUMN_PAGE_DEFAULT, fields[i].getDataType());