github-actions[bot] commented on code in PR #22933:
URL: https://github.com/apache/doris/pull/22933#discussion_r1293101257


##########
be/src/geo/util/GeoMultiPoint.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOINT_H
+#define DORIS_GEOMULTIPOINT_H
+
+#include "GeoCollection.h"
+#include "common/factory_creator.h"
+
+namespace doris {
+class GeoMultiPoint : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPoint);
+
+public:
+    GeoMultiPoint();
+    ~GeoMultiPoint() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POINT; }
+
+    [[nodiscard]] int get_dimension() const override { return 0; }
+
+    GeoParseStatus from_coords(const GeoCoordinates& list);
+
+    std::unique_ptr<GeoCoordinates> to_coords() const;
+
+    std::string as_wkt() const override;

Review Comment:
   warning: function 'as_wkt' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::string as_wkt() const override;
   ```
   



##########
be/src/geo/util/GeoMultiPoint.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOINT_H
+#define DORIS_GEOMULTIPOINT_H

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define DORIS_GEOMULTIPOINT_H
           ^
   ```
   



##########
be/src/geo/util/GeoMultiPoint.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOINT_H
+#define DORIS_GEOMULTIPOINT_H
+
+#include "GeoCollection.h"
+#include "common/factory_creator.h"
+
+namespace doris {
+class GeoMultiPoint : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPoint);
+
+public:
+    GeoMultiPoint();
+    ~GeoMultiPoint() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POINT; }
+
+    [[nodiscard]] int get_dimension() const override { return 0; }
+
+    GeoParseStatus from_coords(const GeoCoordinates& list);
+
+    std::unique_ptr<GeoCoordinates> to_coords() const;

Review Comment:
   warning: function 'to_coords' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::unique_ptr<GeoCoordinates> to_coords() const;
   ```
   



##########
be/src/geo/util/GeoMultiPoint.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOINT_H
+#define DORIS_GEOMULTIPOINT_H
+
+#include "GeoCollection.h"
+#include "common/factory_creator.h"
+
+namespace doris {
+class GeoMultiPoint : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPoint);
+
+public:
+    GeoMultiPoint();
+    ~GeoMultiPoint() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POINT; }

Review Comment:
   warning: function 'type' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] GeoShapeType type() const override { return 
GEO_SHAPE_MULTI_POINT; }
   ```
   



##########
be/src/geo/util/GeoMultiPoint.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOINT_H
+#define DORIS_GEOMULTIPOINT_H
+
+#include "GeoCollection.h"
+#include "common/factory_creator.h"
+
+namespace doris {
+class GeoMultiPoint : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPoint);
+
+public:
+    GeoMultiPoint();
+    ~GeoMultiPoint() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POINT; }
+
+    [[nodiscard]] int get_dimension() const override { return 0; }
+
+    GeoParseStatus from_coords(const GeoCoordinates& list);
+
+    std::unique_ptr<GeoCoordinates> to_coords() const;
+
+    std::string as_wkt() const override;
+
+    GeoPoint* get_point_n(std::size_t n) const;

Review Comment:
   warning: function 'get_point_n' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] GeoPoint* get_point_n(std::size_t n) const;
   ```
   



##########
be/src/geo/util/GeoMultiPoint.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOINT_H
+#define DORIS_GEOMULTIPOINT_H
+
+#include "GeoCollection.h"
+#include "common/factory_creator.h"
+
+namespace doris {
+class GeoMultiPoint : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPoint);
+
+public:
+    GeoMultiPoint();
+    ~GeoMultiPoint() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POINT; }
+
+    [[nodiscard]] int get_dimension() const override { return 0; }
+
+    GeoParseStatus from_coords(const GeoCoordinates& list);
+
+    std::unique_ptr<GeoCoordinates> to_coords() const;
+
+    std::string as_wkt() const override;
+
+    GeoPoint* get_point_n(std::size_t n) const;
+
+    bool contains(const GeoShape* shape) const override;
+
+    std::unique_ptr<GeoShape> boundary() const override;

Review Comment:
   warning: function 'boundary' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::unique_ptr<GeoShape> boundary() const override;
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.cpp:
##########
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "GeoMultiPolygon.h"
+
+#include <sstream>
+
+#include "GeoMultiLineString.h"
+
+namespace doris {
+
+GeoMultiPolygon::GeoMultiPolygon() = default;
+GeoMultiPolygon::~GeoMultiPolygon() = default;
+
+GeoParseStatus GeoMultiPolygon::from_coords(
+        const GeoCoordinateListCollections& coord_list_collections) {
+    for (int i = 0; i < coord_list_collections.coords_list_collections.size(); 
i++) {
+        std::unique_ptr<doris::GeoPolygon> polygon = 
GeoPolygon::create_unique();
+        if 
(polygon->from_coords(*coord_list_collections.coords_list_collections[i]) !=
+            GeoParseStatus::GEO_PARSE_OK) {
+            return GEO_PARSE_COORD_INVALID;
+        }
+        geometries.emplace_back(polygon.release());
+    }
+    return GEO_PARSE_OK;
+}
+
+std::unique_ptr<GeoCoordinateListCollections> GeoMultiPolygon::to_coords() 
const {
+    std::unique_ptr<GeoCoordinateListCollections> coords_collections(
+            new GeoCoordinateListCollections());
+    for (std::size_t i = 0; i < get_num_polygon(); ++i) {
+        const GeoPolygon* polygon = (const 
GeoPolygon*)GeoCollection::get_geometries_n(i);
+        if (polygon->is_empty()) continue;

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
           if (polygon->is_empty()) { continue;
   }
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.h:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOLYGON_H
+#define DORIS_GEOMULTIPOLYGON_H
+
+#include "common/factory_creator.h"
+//#include "GeoMultiLineString.h"
+#include "GeoCollection.h"
+
+namespace doris {
+
+class GeoMultiPolygon : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPolygon);
+
+public:
+    GeoMultiPolygon();
+    ~GeoMultiPolygon() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POLYGON; }

Review Comment:
   warning: function 'type' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] GeoShapeType type() const override { return 
GEO_SHAPE_MULTI_POLYGON; }
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.h:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOLYGON_H
+#define DORIS_GEOMULTIPOLYGON_H
+
+#include "common/factory_creator.h"
+//#include "GeoMultiLineString.h"
+#include "GeoCollection.h"
+
+namespace doris {
+
+class GeoMultiPolygon : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPolygon);
+
+public:
+    GeoMultiPolygon();
+    ~GeoMultiPolygon() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POLYGON; }
+
+    [[nodiscard]] int get_dimension() const override { return 2; }
+
+    GeoParseStatus from_coords(const GeoCoordinateListCollections& 
coord_list_collections);
+
+    std::unique_ptr<GeoCoordinateListCollections> to_coords() const;
+
+    // Returns the number of geometries in this collection
+    std::size_t get_num_polygon() const;
+
+    GeoPolygon* get_polygon_n(std::size_t n) const;

Review Comment:
   warning: function 'get_polygon_n' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] GeoPolygon* get_polygon_n(std::size_t n) const;
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.h:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOLYGON_H
+#define DORIS_GEOMULTIPOLYGON_H
+
+#include "common/factory_creator.h"
+//#include "GeoMultiLineString.h"
+#include "GeoCollection.h"
+
+namespace doris {
+
+class GeoMultiPolygon : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPolygon);
+
+public:
+    GeoMultiPolygon();
+    ~GeoMultiPolygon() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POLYGON; }
+
+    [[nodiscard]] int get_dimension() const override { return 2; }
+
+    GeoParseStatus from_coords(const GeoCoordinateListCollections& 
coord_list_collections);
+
+    std::unique_ptr<GeoCoordinateListCollections> to_coords() const;
+
+    // Returns the number of geometries in this collection
+    std::size_t get_num_polygon() const;
+
+    GeoPolygon* get_polygon_n(std::size_t n) const;
+
+    std::string as_wkt() const override;

Review Comment:
   warning: function 'as_wkt' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::string as_wkt() const override;
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.h:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOLYGON_H
+#define DORIS_GEOMULTIPOLYGON_H
+
+#include "common/factory_creator.h"
+//#include "GeoMultiLineString.h"
+#include "GeoCollection.h"
+
+namespace doris {
+
+class GeoMultiPolygon : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPolygon);
+
+public:
+    GeoMultiPolygon();
+    ~GeoMultiPolygon() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POLYGON; }
+
+    [[nodiscard]] int get_dimension() const override { return 2; }
+
+    GeoParseStatus from_coords(const GeoCoordinateListCollections& 
coord_list_collections);
+
+    std::unique_ptr<GeoCoordinateListCollections> to_coords() const;
+
+    // Returns the number of geometries in this collection
+    std::size_t get_num_polygon() const;

Review Comment:
   warning: function 'get_num_polygon' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::size_t get_num_polygon() const;
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.h:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOLYGON_H
+#define DORIS_GEOMULTIPOLYGON_H

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define DORIS_GEOMULTIPOLYGON_H
           ^
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.h:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOLYGON_H
+#define DORIS_GEOMULTIPOLYGON_H
+
+#include "common/factory_creator.h"
+//#include "GeoMultiLineString.h"
+#include "GeoCollection.h"
+
+namespace doris {
+
+class GeoMultiPolygon : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPolygon);
+
+public:
+    GeoMultiPolygon();
+    ~GeoMultiPolygon() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POLYGON; }
+
+    [[nodiscard]] int get_dimension() const override { return 2; }
+
+    GeoParseStatus from_coords(const GeoCoordinateListCollections& 
coord_list_collections);
+
+    std::unique_ptr<GeoCoordinateListCollections> to_coords() const;

Review Comment:
   warning: function 'to_coords' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::unique_ptr<GeoCoordinateListCollections> to_coords() 
const;
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;

Review Comment:
   warning: function 'to_coords' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] GeoCoordinates to_coords() const;
   ```
   



##########
be/src/geo/util/GeoMultiPolygon.h:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOMULTIPOLYGON_H
+#define DORIS_GEOMULTIPOLYGON_H
+
+#include "common/factory_creator.h"
+//#include "GeoMultiLineString.h"
+#include "GeoCollection.h"
+
+namespace doris {
+
+class GeoMultiPolygon : public GeoCollection {
+    ENABLE_FACTORY_CREATOR(GeoMultiPolygon);
+
+public:
+    GeoMultiPolygon();
+    ~GeoMultiPolygon() override;
+
+    GeoShapeType type() const override { return GEO_SHAPE_MULTI_POLYGON; }
+
+    [[nodiscard]] int get_dimension() const override { return 2; }
+
+    GeoParseStatus from_coords(const GeoCoordinateListCollections& 
coord_list_collections);
+
+    std::unique_ptr<GeoCoordinateListCollections> to_coords() const;
+
+    // Returns the number of geometries in this collection
+    std::size_t get_num_polygon() const;
+
+    GeoPolygon* get_polygon_n(std::size_t n) const;
+
+    std::string as_wkt() const override;
+
+    bool contains(const GeoShape* shape) const override;
+
+    std::unique_ptr<GeoShape> boundary() const override;

Review Comment:
   warning: function 'boundary' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::unique_ptr<GeoShape> boundary() const override;
   ```
   



##########
be/src/geo/util/GeoPoint.cpp:
##########
@@ -0,0 +1,228 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "GeoPoint.h"
+
+#include <absl/strings/str_format.h>
+#include <s2/mutable_s2shape_index.h>
+#include <s2/s2earth.h>
+#include <s2/s2latlng.h>
+#include <s2/s2point_vector_shape.h>
+#include <s2/util/coding/coder.h>
+
+#include <iomanip>
+#include <sstream>
+
+namespace doris {
+GeoPoint::GeoPoint() : _point(new S2Point()) {}
+GeoPoint::~GeoPoint() = default;
+
+void GeoPoint::print_s2point(std::ostream& os, const S2Point& point) {
+    S2LatLng coord(point);
+    os << std::setprecision(12) << coord.lng().degrees() << " " << 
coord.lat().degrees();
+}
+
+static inline bool is_valid_lng_lat(double lng, double lat) {
+    return std::abs(lng) <= 180 && std::abs(lat) <= 90;
+}
+
+bool GeoPoint::is_valid() const {
+    return is_valid_lng_lat(x(), y());
+}
+
+// Return GEO_PARSE_OK, if and only if this can be converted to a valid S2Point
+GeoParseStatus GeoPoint::to_s2point(double lng, double lat, S2Point* point) {
+    if (!is_valid_lng_lat(lng, lat)) {
+        return GEO_PARSE_COORD_INVALID;
+    }
+    S2LatLng ll = S2LatLng::FromDegrees(lat, lng);
+    DCHECK(ll.is_valid()) << "invalid point, lng=" << lng << ", lat=" << lat;
+    *point = ll.ToPoint();
+    return GEO_PARSE_OK;
+}
+
+GeoParseStatus GeoPoint::to_s2point(const GeoCoordinate& coord, S2Point* 
point) {
+    return to_s2point(coord.x, coord.y, point);
+}
+
+GeoParseStatus GeoPoint::from_coord(double x, double y) {
+    return to_s2point(x, y, _point.get());
+}
+
+GeoParseStatus GeoPoint::from_coord(const GeoCoordinate& coord) {
+    return to_s2point(coord, _point.get());
+}
+
+GeoParseStatus GeoPoint::from_s2point(S2Point* point) {
+    *_point = *point;
+    return GEO_PARSE_OK;
+}
+
+//后面改成GeoCoordinate GeoPoint::to_coords(),现在涉及到wkb,暂时不动
+GeoCoordinates GeoPoint::to_coords() const {
+    GeoCoordinate coord;
+    coord.x = GeoPoint::x();
+    coord.y = GeoPoint::y();
+    GeoCoordinates coords;
+    coords.add(coord);
+    return coords;
+}
+
+std::unique_ptr<GeoCoordinate> GeoPoint::to_coord() const {
+    return std::make_unique<GeoCoordinate>(GeoPoint::x(), GeoPoint::y());
+}
+
+std::unique_ptr<S2Shape> GeoPoint::get_s2shape() const {
+    std::vector<S2Point> points;
+    points.emplace_back(*point());
+    return std::make_unique<S2PointVectorShape>(points);
+}
+
+bool GeoPoint::contains(const GeoShape* rhs) const {
+    switch (rhs->type()) {
+    case GEO_SHAPE_POINT: {
+        const GeoPoint* point = (const GeoPoint*)rhs;
+        return *_point == *(point->_point);
+    }
+    default:
+        return false;
+    }
+}
+
+bool GeoPoint::ComputeDistance(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                               double* distance) {
+    S2LatLng x = S2LatLng::FromDegrees(x_lat, x_lng);
+    if (!x.is_valid()) {
+        return false;
+    }
+    S2LatLng y = S2LatLng::FromDegrees(y_lat, y_lng);
+    if (!y.is_valid()) {
+        return false;
+    }
+    *distance = S2Earth::GetDistanceMeters(x, y);
+    return true;
+}
+
+bool GeoPoint::ComputeAngleSphere(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                                  double* angle) {
+    S2LatLng x = S2LatLng::FromDegrees(x_lat, x_lng);
+    if (!x.is_valid()) {
+        return false;
+    }
+    S2LatLng y = S2LatLng::FromDegrees(y_lat, y_lng);
+    if (!y.is_valid()) {
+        return false;
+    }
+    *angle = (x.GetDistance(y)).degrees();
+    return true;
+}
+
+bool GeoPoint::ComputeAngle(GeoPoint* point1, GeoPoint* point2, GeoPoint* 
point3, double* angle) {
+    S2LatLng latLng1 = S2LatLng::FromDegrees(point1->x(), point1->y());
+    S2LatLng latLng2 = S2LatLng::FromDegrees(point2->x(), point2->y());
+    S2LatLng latLng3 = S2LatLng::FromDegrees(point3->x(), point3->y());
+
+    //If points 2 and 3 are the same or points 2 and 1 are the same, returns 
NULL.
+    if (latLng2.operator==(latLng1) || latLng2.operator==(latLng3)) {
+        return false;
+    }
+    double x = 0;
+    double y = 0;
+    //If points 2 and 3 are exactly antipodal or points 2 and 1 are exactly 
antipodal, returns NULL.
+    if (GeoPoint::ComputeAngleSphere(point1->x(), point1->y(), point2->x(), 
point2->y(), &x) &&
+        GeoPoint::ComputeAngleSphere(point3->x(), point3->y(), point2->x(), 
point2->y(), &y)) {
+        if (x == 180 || y == 180) {
+            return false;
+        }
+    } else {
+        return false;
+    }
+    //Computes the initial bearing (radians) from latLng2 to latLng3
+    double a = S2Earth::GetInitialBearing(latLng2, latLng3).radians();
+    //Computes the initial bearing (radians) from latLng2 to latLng1
+    double b = S2Earth::GetInitialBearing(latLng2, latLng1).radians();
+    //range [0, 2pi)
+    if (b - a < 0) {
+        *angle = b - a + 2 * M_PI;
+    } else {
+        *angle = b - a;
+    }
+    return true;
+}
+
+bool GeoPoint::ComputeAzimuth(GeoPoint* p1, GeoPoint* p2, double* angle) {
+    GeoPoint north;
+    north.from_coord(0, 90);
+    return GeoPoint::ComputeAngle(&north, p1, p2, angle);
+}
+
+std::string GeoPoint::as_wkt() const {
+    std::stringstream ss;
+    ss << "POINT ";
+    if (is_empty()) {
+        ss << "EMPTY";
+        return ss.str();
+    }
+
+    ss << "(";
+    print_s2point(ss, *_point);
+    ss << ")";
+    return ss.str();
+}
+
+std::unique_ptr<GeoShape> GeoPoint::boundary() const {
+    std::unique_ptr<GeoShape> point(GeoPoint::create_unique().release());
+    point->set_empty();
+    return point;
+}
+
+bool GeoPoint::add_to_s2shape_index(MutableS2ShapeIndex& S2shape_index) const {
+    if (is_empty() || !is_valid()) return false;
+    std::vector<S2Point> points;

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
    !is_valid()) { return false;
   }
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define DORIS_GEOPOINT_H
           ^
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;
+
+    std::unique_ptr<GeoCoordinate> to_coord() const;
+
+    GeoShapeType type() const override { return GEO_SHAPE_POINT; }
+
+    bool is_valid() const override;
+
+    bool is_closed() const override { return !is_empty(); }
+
+    [[nodiscard]] int get_dimension() const override { return 0; }
+
+    [[nodiscard]] const S2Point* point() const { return _point.get(); }
+
+    [[nodiscard]] std::unique_ptr<S2Shape> get_s2shape() const;
+
+    bool contains(const GeoShape* rhs) const override;
+
+    static bool ComputeDistance(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                                double* distance);
+
+    static bool ComputeAngleSphere(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                                   double* angle);
+    static bool ComputeAngle(GeoPoint* p1, GeoPoint* p2, GeoPoint* p3, double* 
angle);
+    static bool ComputeAzimuth(GeoPoint* p1, GeoPoint* p2, double* angle);
+
+    std::string as_wkt() const override;
+
+    [[nodiscard]] std::size_t get_num_point() const override { return 1; }
+
+    std::unique_ptr<GeoShape> boundary() const override;

Review Comment:
   warning: function 'boundary' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::unique_ptr<GeoShape> boundary() const override;
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;
+
+    std::unique_ptr<GeoCoordinate> to_coord() const;
+
+    GeoShapeType type() const override { return GEO_SHAPE_POINT; }
+
+    bool is_valid() const override;

Review Comment:
   warning: function 'is_valid' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] bool is_valid() const override;
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;
+
+    std::unique_ptr<GeoCoordinate> to_coord() const;
+
+    GeoShapeType type() const override { return GEO_SHAPE_POINT; }
+
+    bool is_valid() const override;
+
+    bool is_closed() const override { return !is_empty(); }
+
+    [[nodiscard]] int get_dimension() const override { return 0; }
+
+    [[nodiscard]] const S2Point* point() const { return _point.get(); }
+
+    [[nodiscard]] std::unique_ptr<S2Shape> get_s2shape() const;
+
+    bool contains(const GeoShape* rhs) const override;
+
+    static bool ComputeDistance(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                                double* distance);
+
+    static bool ComputeAngleSphere(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                                   double* angle);
+    static bool ComputeAngle(GeoPoint* p1, GeoPoint* p2, GeoPoint* p3, double* 
angle);
+    static bool ComputeAzimuth(GeoPoint* p1, GeoPoint* p2, double* angle);
+
+    std::string as_wkt() const override;

Review Comment:
   warning: function 'as_wkt' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::string as_wkt() const override;
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;
+
+    std::unique_ptr<GeoCoordinate> to_coord() const;
+
+    GeoShapeType type() const override { return GEO_SHAPE_POINT; }
+
+    bool is_valid() const override;
+
+    bool is_closed() const override { return !is_empty(); }
+
+    [[nodiscard]] int get_dimension() const override { return 0; }
+
+    [[nodiscard]] const S2Point* point() const { return _point.get(); }
+
+    [[nodiscard]] std::unique_ptr<S2Shape> get_s2shape() const;
+
+    bool contains(const GeoShape* rhs) const override;
+
+    static bool ComputeDistance(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                                double* distance);
+
+    static bool ComputeAngleSphere(double x_lng, double x_lat, double y_lng, 
double y_lat,
+                                   double* angle);
+    static bool ComputeAngle(GeoPoint* p1, GeoPoint* p2, GeoPoint* p3, double* 
angle);
+    static bool ComputeAzimuth(GeoPoint* p1, GeoPoint* p2, double* angle);
+
+    std::string as_wkt() const override;
+
+    [[nodiscard]] std::size_t get_num_point() const override { return 1; }
+
+    std::unique_ptr<GeoShape> boundary() const override;
+
+    bool add_to_s2shape_index(MutableS2ShapeIndex& S2shape_index) const 
override;
+
+    //void add_to_s2point_index(S2PointIndex<int>& S2point_index, int i);
+
+    double x() const;

Review Comment:
   warning: function 'x' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] double x() const;
   ```
   



##########
be/src/geo/util/GeoPoint.cpp:
##########
@@ -0,0 +1,228 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "GeoPoint.h"
+
+#include <absl/strings/str_format.h>
+#include <s2/mutable_s2shape_index.h>
+#include <s2/s2earth.h>
+#include <s2/s2latlng.h>
+#include <s2/s2point_vector_shape.h>
+#include <s2/util/coding/coder.h>
+
+#include <iomanip>
+#include <sstream>
+
+namespace doris {
+GeoPoint::GeoPoint() : _point(new S2Point()) {}
+GeoPoint::~GeoPoint() = default;
+
+void GeoPoint::print_s2point(std::ostream& os, const S2Point& point) {
+    S2LatLng coord(point);
+    os << std::setprecision(12) << coord.lng().degrees() << " " << 
coord.lat().degrees();
+}
+
+static inline bool is_valid_lng_lat(double lng, double lat) {
+    return std::abs(lng) <= 180 && std::abs(lat) <= 90;
+}
+
+bool GeoPoint::is_valid() const {
+    return is_valid_lng_lat(x(), y());
+}
+
+// Return GEO_PARSE_OK, if and only if this can be converted to a valid S2Point
+GeoParseStatus GeoPoint::to_s2point(double lng, double lat, S2Point* point) {
+    if (!is_valid_lng_lat(lng, lat)) {
+        return GEO_PARSE_COORD_INVALID;
+    }
+    S2LatLng ll = S2LatLng::FromDegrees(lat, lng);
+    DCHECK(ll.is_valid()) << "invalid point, lng=" << lng << ", lat=" << lat;
+    *point = ll.ToPoint();
+    return GEO_PARSE_OK;
+}
+
+GeoParseStatus GeoPoint::to_s2point(const GeoCoordinate& coord, S2Point* 
point) {
+    return to_s2point(coord.x, coord.y, point);
+}
+
+GeoParseStatus GeoPoint::from_coord(double x, double y) {
+    return to_s2point(x, y, _point.get());
+}
+
+GeoParseStatus GeoPoint::from_coord(const GeoCoordinate& coord) {
+    return to_s2point(coord, _point.get());
+}
+
+GeoParseStatus GeoPoint::from_s2point(S2Point* point) {
+    *_point = *point;
+    return GEO_PARSE_OK;
+}
+
+//后面改成GeoCoordinate GeoPoint::to_coords(),现在涉及到wkb,暂时不动
+GeoCoordinates GeoPoint::to_coords() const {
+    GeoCoordinate coord;
+    coord.x = GeoPoint::x();
+    coord.y = GeoPoint::y();
+    GeoCoordinates coords;
+    coords.add(coord);
+    return coords;
+}
+
+std::unique_ptr<GeoCoordinate> GeoPoint::to_coord() const {
+    return std::make_unique<GeoCoordinate>(GeoPoint::x(), GeoPoint::y());
+}
+
+std::unique_ptr<S2Shape> GeoPoint::get_s2shape() const {
+    std::vector<S2Point> points;
+    points.emplace_back(*point());
+    return std::make_unique<S2PointVectorShape>(points);
+}
+
+bool GeoPoint::contains(const GeoShape* rhs) const {
+    switch (rhs->type()) {
+    case GEO_SHAPE_POINT: {
+        const GeoPoint* point = (const GeoPoint*)rhs;
+        return *_point == *(point->_point);
+    }
+    default:

Review Comment:
   warning: ISO C++20 considers use of overloaded operator '==' (with operand 
types 'Vector3<double>' and 'Vector3<double>') to be ambiguous despite there 
being a unique best viable function 
[clang-diagnostic-ambiguous-reversed-operator]
   ```cpp
    == *(point->_point);
    ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **thirdparty/installed/include/s2/util/math/vector.h:100:** ambiguity is 
between a regular call to this operator and a call with the argument order 
reversed
   ```cpp
     bool operator==(const D& b) const {
          ^
   ```
   
   </details>
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;
+
+    std::unique_ptr<GeoCoordinate> to_coord() const;

Review Comment:
   warning: function 'to_coord' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::unique_ptr<GeoCoordinate> to_coord() const;
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;
+
+    std::unique_ptr<GeoCoordinate> to_coord() const;
+
+    GeoShapeType type() const override { return GEO_SHAPE_POINT; }
+
+    bool is_valid() const override;
+
+    bool is_closed() const override { return !is_empty(); }

Review Comment:
   warning: function 'is_closed' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] bool is_closed() const override { return !is_empty(); }
   ```
   



##########
be/src/geo/util/GeoPoint.h:
##########
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifndef DORIS_GEOPOINT_H
+#define DORIS_GEOPOINT_H
+
+#include "GeoShape.h"
+#include "common/factory_creator.h"
+#include "geo/wkt_parse_type.h"
+
+template <typename T>
+class Vector3;
+class S2Shape;
+using S2Point = Vector3<double>;
+
+namespace doris {
+
+class GeoPoint : public GeoShape {
+    ENABLE_FACTORY_CREATOR(GeoPoint);
+
+public:
+    GeoPoint();
+    ~GeoPoint() override;
+
+    static void print_s2point(std::ostream& os, const S2Point& point);
+
+    static GeoParseStatus to_s2point(double lng, double lat, S2Point* point);
+    static GeoParseStatus to_s2point(const GeoCoordinate& coord, S2Point* 
point);
+
+    GeoParseStatus from_coord(double x, double y);
+    GeoParseStatus from_coord(const GeoCoordinate& point);
+
+    GeoParseStatus from_s2point(S2Point* point);
+
+    GeoCoordinates to_coords() const;
+
+    std::unique_ptr<GeoCoordinate> to_coord() const;
+
+    GeoShapeType type() const override { return GEO_SHAPE_POINT; }

Review Comment:
   warning: function 'type' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] GeoShapeType type() const override { return 
GEO_SHAPE_POINT; }
   ```
   



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