You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "Gabriel39 (via GitHub)" <gi...@apache.org> on 2023/03/22 02:41:03 UTC
[GitHub] [doris] Gabriel39 commented on a diff in pull request #17919: [feature](function)Add ST_Angle_Sphere function
Gabriel39 commented on code in PR #17919:
URL: https://github.com/apache/doris/pull/17919#discussion_r1144171907
##########
be/src/vec/functions/functions_geo.cpp:
##########
@@ -208,6 +208,42 @@ struct StDistanceSphere {
}
};
+struct StAngleSphere {
+ static constexpr auto NEED_CONTEXT = false;
+ static constexpr auto NAME = "st_angle_sphere";
+ static const size_t NUM_ARGS = 4;
+ static Status execute(Block& block, const ColumnNumbers& arguments, size_t result) {
+ DCHECK_EQ(arguments.size(), 4);
+ auto return_type = remove_nullable(block.get_data_type(result));
+
+ auto x_lng = block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
+ auto x_lat = block.get_by_position(arguments[1]).column->convert_to_full_column_if_const();
+ auto y_lng = block.get_by_position(arguments[2]).column->convert_to_full_column_if_const();
+ auto y_lat = block.get_by_position(arguments[3]).column->convert_to_full_column_if_const();
+
+ const auto size = x_lng->size();
+
+ MutableColumnPtr res = nullptr;
+ auto null_type = std::reinterpret_pointer_cast<const DataTypeNullable>(return_type);
Review Comment:
unused variable `null_type`
##########
be/src/vec/functions/functions_geo.cpp:
##########
@@ -208,6 +208,42 @@ struct StDistanceSphere {
}
};
+struct StAngleSphere {
+ static constexpr auto NEED_CONTEXT = false;
+ static constexpr auto NAME = "st_angle_sphere";
+ static const size_t NUM_ARGS = 4;
+ static Status execute(Block& block, const ColumnNumbers& arguments, size_t result) {
+ DCHECK_EQ(arguments.size(), 4);
+ auto return_type = remove_nullable(block.get_data_type(result));
+
+ auto x_lng = block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
+ auto x_lat = block.get_by_position(arguments[1]).column->convert_to_full_column_if_const();
+ auto y_lng = block.get_by_position(arguments[2]).column->convert_to_full_column_if_const();
+ auto y_lat = block.get_by_position(arguments[3]).column->convert_to_full_column_if_const();
+
+ const auto size = x_lng->size();
+
+ MutableColumnPtr res = nullptr;
+ auto null_type = std::reinterpret_pointer_cast<const DataTypeNullable>(return_type);
+ res = ColumnNullable::create(return_type->create_column(), ColumnUInt8::create());
Review Comment:
You can use `block.get_data_type(result)` instead of `return_type` which is the nested type of `block.get_data_type(result)`
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org