amorynan commented on code in PR #44533:
URL: https://github.com/apache/doris/pull/44533#discussion_r1857714089
##########
be/src/vec/exprs/table_function/vexplode.cpp:
##########
@@ -37,6 +42,34 @@ VExplodeTableFunction::VExplodeTableFunction() {
_fn_name = "vexplode";
}
+Status VExplodeTableFunction::_process_init_variant(Block* block, int
value_column_idx) {
+ // explode variant array
+ const auto& variant_column = check_and_get_column<ColumnObject>(
+ remove_nullable(block->get_by_position(value_column_idx)
+ .column->convert_to_full_column_if_const())
+ .get());
+ _detail.output_as_variant = true;
+ if (!variant_column->is_null_root()) {
+ _array_column = variant_column->get_root();
+ // We need to wrap the output nested column within a variant column.
+ // Otherwise the type is missmatched
+ const auto* array_type = check_and_get_data_type<DataTypeArray>(
+ remove_nullable(variant_column->get_root_type()).get());
+ if (array_type == nullptr) {
+ return Status::NotSupported("explode not support none array type
{}",
+
variant_column->get_root_type()->get_name());
+ }
+ _detail.nested_type = array_type->get_nested_type();
+ } else {
+ // null root, use nothing type
+ _array_column =
ColumnNullable::create(ColumnArray::create(ColumnNothing::create(0)),
+ ColumnUInt8::create(0));
+
_array_column->assume_mutable()->insert_many_defaults(variant_column->size());
+ _detail.nested_type = std::make_shared<DataTypeNothing>();
Review Comment:
maybe here should wrap in nullable , because many calculate operator
behavior just make nested column in array as nullable
--
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]