[feature-wip](array-type) Array data can be loaded in stream load. (#8368) (#8585)

Please refer to #8367 .
This commit is contained in:
Adonis Ling
2022-03-22 15:25:40 +08:00
committed by GitHub
parent a498463ab5
commit e44038caf3
7 changed files with 371 additions and 8 deletions

View File

@ -241,12 +241,19 @@ public class CastExpr extends Expr {
this.opcode = TExprOpcode.CAST;
FunctionName fnName = new FunctionName(getFnName(type));
Function searchDesc = new Function(fnName, Arrays.asList(collectChildReturnTypes()), Type.INVALID, false);
if (isImplicit) {
fn = Catalog.getCurrentCatalog().getFunction(
searchDesc, Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
} else {
fn = Catalog.getCurrentCatalog().getFunction(
searchDesc, Function.CompareMode.IS_IDENTICAL);
if (type.isScalarType()) {
if (isImplicit) {
fn = Catalog.getCurrentCatalog().getFunction(
searchDesc, Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
} else {
fn = Catalog.getCurrentCatalog().getFunction(
searchDesc, Function.CompareMode.IS_IDENTICAL);
}
} else if (type.isArrayType()){
fn = ScalarFunction.createBuiltin(getFnName(Type.ARRAY),
type, Function.NullableMode.ALWAYS_NULLABLE,
Lists.newArrayList(Type.VARCHAR), false ,
"doris::CastFunctions::cast_to_array_val", null, null, true);
}
if (fn == null) {

View File

@ -81,6 +81,7 @@ public abstract class Type {
// Only used for alias function, to represent any type in function args
public static final ScalarType ALL = new ScalarType(PrimitiveType.ALL);
public static final MapType Map = new MapType();
public static final ArrayType ARRAY = ArrayType.create();
private static ArrayList<ScalarType> integerTypes;
private static ArrayList<ScalarType> numericTypes;
@ -123,7 +124,6 @@ public abstract class Type {
supportedTypes.add(DECIMALV2);
supportedTypes.add(TIME);
supportedTypes.add(STRING);
}
public static ArrayList<ScalarType> getIntegerTypes() {
@ -387,7 +387,7 @@ public abstract class Type {
} else if (t1.isArrayType() && t2.isArrayType()) {
return ArrayType.canCastTo((ArrayType)t1, (ArrayType)t2);
}
return t1.isNull();
return t1.isNull() || t1.getPrimitiveType() == PrimitiveType.VARCHAR;
}
/**