HappenLee commented on code in PR #48695: URL: https://github.com/apache/doris/pull/48695#discussion_r1986588420
########## be/src/vec/functions/functions_geo.cpp: ########## @@ -721,6 +721,291 @@ struct StContains { } }; // namespace doris::vectorized +struct StIntersects { + static constexpr auto NEED_CONTEXT = true; + static constexpr auto NAME = "st_intersects"; + static const size_t NUM_ARGS = 2; + using Type = DataTypeUInt8; + static Status execute(FunctionContext* context, Block& block, const ColumnNumbers& arguments, + size_t result) { + DCHECK_EQ(arguments.size(), 2); + auto return_type = block.get_data_type(result); + const auto& [left_column, left_const] = + unpack_if_const(block.get_by_position(arguments[0]).column); + const auto& [right_column, right_const] = + unpack_if_const(block.get_by_position(arguments[1]).column); + + const auto size = std::max(left_column->size(), right_column->size()); + + auto res = ColumnUInt8::create(); + res->reserve(size); + auto null_map = ColumnUInt8::create(size, 0); + auto& null_map_data = null_map->get_data(); + + if (left_const) { + const_vector(left_column, right_column, res, null_map_data, size); + } else if (right_const) { + vector_const(left_column, right_column, res, null_map_data, size); + } else { + vector_vector(left_column, right_column, res, null_map_data, size); + } + block.replace_by_position(result, + ColumnNullable::create(std::move(res), std::move(null_map))); + return Status::OK(); + } + + static void loop_do(StringRef& lhs_value, StringRef& rhs_value, Review Comment: i only use in the function, not need be a param in the function -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org