[fix](Nereids) support string cast to complex type (#25154)
This commit is contained in:
@ -29,6 +29,7 @@ import org.apache.doris.nereids.types.MapType;
|
||||
import org.apache.doris.nereids.types.StructField;
|
||||
import org.apache.doris.nereids.types.StructType;
|
||||
import org.apache.doris.nereids.types.coercion.CharacterType;
|
||||
import org.apache.doris.nereids.types.coercion.PrimitiveType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -57,6 +58,9 @@ public class CheckCast extends AbstractExpressionRewriteRule {
|
||||
if (originalType.equals(targetType)) {
|
||||
return true;
|
||||
}
|
||||
if (originalType instanceof CharacterType && !(targetType instanceof PrimitiveType)) {
|
||||
return true;
|
||||
}
|
||||
if (originalType instanceof ArrayType && targetType instanceof ArrayType) {
|
||||
return check(((ArrayType) originalType).getItemType(), ((ArrayType) targetType).getItemType());
|
||||
} else if (originalType instanceof MapType && targetType instanceof MapType) {
|
||||
@ -77,8 +81,6 @@ public class CheckCast extends AbstractExpressionRewriteRule {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (originalType instanceof CharacterType && targetType instanceof StructType) {
|
||||
return true;
|
||||
} else if (originalType instanceof JsonType || targetType instanceof JsonType) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user