eldenmoon commented on code in PR #66204:
URL: https://github.com/apache/doris/pull/66204#discussion_r3672298215
##########
be/src/exprs/function/cast/variant_v2/cast_variant_to_array.cpp:
##########
@@ -138,16 +194,67 @@ Status cast_variant_to_array(FunctionContext* context,
const ColumnVariantV2& so
(!forced_nulls.empty() && forced_nulls.size() != rows)) {
return Status::InvalidArgument("Invalid Variant V2 input shape for
ARRAY CAST");
}
+
+ DataTypePtr leaf_type = remove_nullable(target_type);
+ while (leaf_type->get_primitive_type() == TYPE_ARRAY) {
+ leaf_type =
+ remove_nullable(assert_cast<const
DataTypeArray&>(*leaf_type).get_nested_type());
+ }
+ if (leaf_type->get_primitive_type() == TYPE_VARIANT &&
+ dynamic_cast<const DataTypeVariantV2*>(leaf_type.get()) == nullptr) {
+ return Status::InvalidArgument(
+ "Variant V2 ARRAY CAST does not support legacy Variant
targets");
+ }
+
if (source.is_typed()) {
- *output = make_all_null_column(target_type, rows);
+ if (!is_string_type(source.typed_type()->get_primitive_type())) {
Review Comment:
这里应该走typed cast到array的cast
wrapper,而不是手写cast_strings_to_array。另外typed中需要确认已支持array类型
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]