mrhhsg commented on code in PR #59734:
URL: https://github.com/apache/doris/pull/59734#discussion_r2680757849
##########
be/src/vec/functions/function_fake.cpp:
##########
@@ -117,17 +117,24 @@ struct FunctionExplodeMap {
template <bool AlwaysNullable = false>
struct FunctionPoseExplode {
static DataTypePtr get_return_type_impl(const DataTypes& arguments) {
- DCHECK(arguments[0]->get_primitive_type() == TYPE_ARRAY)
- << arguments[0]->get_name() << " not supported";
- DataTypes fieldTypes(2);
+ DataTypes fieldTypes(arguments.size() + 1);
fieldTypes[0] = std::make_shared<DataTypeInt32>();
- fieldTypes[1] =
-
check_and_get_data_type<DataTypeArray>(arguments[0].get())->get_nested_type();
+ for (int i = 0; i < arguments.size(); i++) {
+ DCHECK(arguments[0]->get_primitive_type() == TYPE_ARRAY)
Review Comment:
Move it to out of `for` loop,
Or maybe here should check `arguments[i]`?
And better use `DCHECK_EQ` instead of `DCHECK`
##########
be/src/vec/functions/function_fake.cpp:
##########
@@ -117,17 +117,24 @@ struct FunctionExplodeMap {
template <bool AlwaysNullable = false>
struct FunctionPoseExplode {
static DataTypePtr get_return_type_impl(const DataTypes& arguments) {
- DCHECK(arguments[0]->get_primitive_type() == TYPE_ARRAY)
- << arguments[0]->get_name() << " not supported";
- DataTypes fieldTypes(2);
+ DataTypes fieldTypes(arguments.size() + 1);
fieldTypes[0] = std::make_shared<DataTypeInt32>();
- fieldTypes[1] =
-
check_and_get_data_type<DataTypeArray>(arguments[0].get())->get_nested_type();
+ for (int i = 0; i < arguments.size(); i++) {
+ DCHECK(arguments[0]->get_primitive_type() == TYPE_ARRAY)
+ << arguments[0]->get_name() << " not supported";
+ auto nestedType =
+
check_and_get_data_type<DataTypeArray>(arguments[i].get())->get_nested_type();
+ if (nestedType->is_nullable()) {
+ fieldTypes[i + 1] = nestedType;
+ } else {
+ fieldTypes[i + 1] = make_nullable(nestedType);
+ }
Review Comment:
`fieldTypes[i + 1] = make_nullable(nestedType);` is sufficient.
--
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]