[pick](cast)Feature cast complexttype2 json (#38632)

## Proposed changes
backport: https://github.com/apache/doris/pull/36548
Issue Number: close #xxx

<!--Describe your changes.-->
This commit is contained in:
amory
2024-08-01 09:18:15 +08:00
committed by GitHub
parent fa45f3b95a
commit 6bd93b119f
6 changed files with 216 additions and 1 deletions

View File

@ -833,6 +833,9 @@ public abstract class Type {
}
public static boolean canCastTo(Type sourceType, Type targetType) {
if (targetType.isJsonbType() && sourceType.isComplexType()) {
return true;
}
if (sourceType.isVariantType() && (targetType.isScalarType() || targetType.isArrayType())) {
// variant could cast to scalar types and array
return true;