zclllyybb commented on code in PR #34396:
URL: https://github.com/apache/doris/pull/34396#discussion_r1590237737


##########
be/src/vec/functions/functions_geo.cpp:
##########
@@ -463,17 +572,76 @@ struct StContains {
                           size_t result) {
         DCHECK_EQ(arguments.size(), 2);
         auto return_type = block.get_data_type(result);
-        auto shape1 = 
block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
-        auto shape2 = 
block.get_by_position(arguments[1]).column->convert_to_full_column_if_const();
+        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());
 
-        const auto size = shape1->size();
         MutableColumnPtr res = return_type->create_column();
 
+        if (left_const) {
+            const_vector(left_column, right_column, res, size);
+        } else if (right_const) {
+            vector_const(left_column, right_column, res, size);
+        } else {
+            int i;

Review Comment:
   ditto.



##########
be/src/vec/functions/functions_geo.cpp:
##########
@@ -44,20 +45,47 @@ struct StPoint {
         DCHECK_EQ(arguments.size(), 2);
         auto return_type = block.get_data_type(result);
 
-        auto column_x =
-                
block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
-        auto column_y =
-                
block.get_by_position(arguments[1]).column->convert_to_full_column_if_const();
+        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 = column_x->size();
+        const auto size = std::max(left_column->size(), right_column->size());
 
         MutableColumnPtr res = return_type->create_column();
 
+        if (left_const) {
+            const_vector(left_column, right_column, res, size);
+        } else if (right_const) {
+            vector_const(left_column, right_column, res, size);
+        } else {
+            GeoPoint point;

Review Comment:
   also wrap this in `vector_vector`



##########
be/src/vec/functions/functions_geo.cpp:
##########
@@ -333,8 +416,34 @@ struct StAzimuth {
             }
             res->insert_data(const_cast<const char*>((char*)&angle), 0);
         }
-        block.replace_by_position(result, std::move(res));
-        return Status::OK();
+    }
+
+    static void vector_const(const ColumnPtr& left_column, const ColumnPtr& 
right_column,
+                             MutableColumnPtr& res, size_t size) {
+        GeoPoint point1;
+        GeoPoint point2;
+
+        auto shape_value2 = right_column->get_data_at(0);
+        auto pt2 = point2.decode_from(shape_value2.data, shape_value2.size);
+        for (int row = 0; row < size; ++row) {
+            auto shape_value1 = left_column->get_data_at(0);

Review Comment:
   for things we did in loop. wrapping them in a function is better



-- 
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

Reply via email to