OIiveirra commented on code in PR #69032:
URL: https://github.com/apache/doris/pull/69032#discussion_r4273979494


##########
be/src/exprs/function/geo/functions_geo.cpp:
##########
@@ -507,24 +692,32 @@ struct StRelationFunction {
     static Status execute(Block& block, const ColumnNumbers& arguments, size_t 
result) {
         DCHECK_EQ(arguments.size(), 2);
         auto return_type = block.get_data_type(result);
-        auto left_col = 
ColumnView<TYPE_STRING>::create(block.get_by_position(arguments[0]).column);
-        auto right_col =
-                
ColumnView<TYPE_STRING>::create(block.get_by_position(arguments[1]).column);
+        const auto& left_col = block.get_by_position(arguments[0]).column;
+        const auto& right_col = block.get_by_position(arguments[1]).column;
+        const auto& left_type = block.get_data_type(arguments[0]);
+        const auto& right_type = block.get_data_type(arguments[1]);
+        RETURN_IF_ERROR(validate_geography_semantics(left_type, NAME));
+        RETURN_IF_ERROR(validate_geography_semantics(right_type, NAME));
 
-        const auto size = left_col.size();
+        const auto size = left_col->size();
 
         auto res = ColumnUInt8::create(size, 0);
         auto null_map = ColumnUInt8::create(size, 0);
         auto& null_map_data = null_map->get_data();
 
-        for (int row = 0; row < size; ++row) {
-            auto lhs_value = left_col.value_at(row);
-            auto rhs_value = right_col.value_at(row);
-
-            std::unique_ptr<GeoShape> shape1(
-                    GeoShape::from_encoded(lhs_value.data, lhs_value.size));
-            std::unique_ptr<GeoShape> shape2(
-                    GeoShape::from_encoded(rhs_value.data, rhs_value.size));
+        for (size_t row = 0; row < size; ++row) {
+            // Propagate NULL before using nested placeholders; a NULL 
geometry has an
+            // empty payload, not a WKB shape.
+            if (any_geo_argument_is_null(block, arguments, row)) {
+                null_map_data[row] = 1;
+                continue;
+            }
+            std::unique_ptr<GeoShape> shape1;
+            RETURN_IF_ERROR(
+                    decode_calculation_shape(left_col->get_data_at(row), 
left_type, &shape1, NAME));

Review Comment:
   Fixed in 
[c844f46f09f](https://github.com/apache/doris/commit/c844f46f09f64eaacd68688876227eb877c0f1db).
   
   Typed default Geography relations now dispatch through spherical S2 
operations instead of the legacy planar helpers. Point/line checks inspect 
every real consecutive geodesic edge; point/polygon checks use spherical 
interiors and ring boundaries. Line/polygon and other admitted non-point 
intersections use S2 shape indexes. Added date-line line/point, later-segment 
and date-line polygon/point tests, including operand order. The distance 
reproducer already returned 0 before this repair, so that existing correct path 
was retained. Targeted BE tests and GIS regression passed locally.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/StWithin.java:
##########
@@ -70,6 +70,12 @@ public List<FunctionSignature> getSignatures() {
         return SIGNATURES;
     }
 
+    @Override
+    public FunctionSignature searchSignature(List<FunctionSignature> 
signatures) {
+        FunctionSignature signature = 
SpatialFunctionSignature.binary(child(0), child(1), BooleanType.INSTANCE);

Review Comment:
   Fixed in 
[c844f46f09f](https://github.com/apache/doris/commit/c844f46f09f64eaacd68688876227eb877c0f1db).
   
   Added typed containment for Point/Point, LineString/Point and Polygon/Point, 
with the reversed pairs for Within. Identical nonempty points now return true 
for Contains/Within. Unsupported containment pairs return NotSupported rather 
than false. Tests cover point reflexivity, line interiors/endpoints, closed 
lines, polygon interiors/boundaries and unsupported pairs. The self-point 
golden was regenerated by the regression framework and verified without 
generation; the Iceberg spatial suite passed locally.



##########
be/src/exprs/function/geo/functions_geo.cpp:
##########
@@ -360,7 +527,7 @@ struct StAzimuth {
             }
 
             double angle = 0;
-            if (!GeoPoint::ComputeAzimuth(&point1, &point2, &angle)) {
+            if (!GeoPoint::ComputeAzimuth(pt1, pt2, &angle)) {

Review Comment:
   Fixed in 
[c844f46f09f](https://github.com/apache/doris/commit/c844f46f09f64eaacd68688876227eb877c0f1db).
   
   Typed Geography bearings now construct S2LatLng from the original WKB 
coordinates in latitude/longitude order and use the clockwise bearing 
convention. ST_Angle uses the corresponding clockwise bearing difference. Added 
non-equatorial north/south directions, east/west directions, angle orientation 
and coincident/antipodal NULL cases. The reported north/east reproductions and 
the targeted BE tests passed locally; the legacy STRING calculation path is 
preserved.



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

Reply via email to