yiguolei commented on code in PR #58004:
URL: https://github.com/apache/doris/pull/58004#discussion_r2532674906


##########
be/src/geo/wkt_parse.cpp:
##########
@@ -17,28 +17,28 @@
 
 #include "geo/wkt_parse.h"
 
+#include <utility>
+
+#include "geo/wkt_lex.l.h"
 #include "geo/wkt_parse_ctx.h"
 #include "geo/wkt_parse_type.h" // IWYU pragma: keep
 #include "geo/wkt_yacc.y.hpp"
 
-#define YYSTYPE WKT_STYPE
-#define YY_EXTRA_TYPE WktParseContext*
-#include "geo/wkt_lex.l.h"
+extern int wkt_lex_init_extra(WktParseContext*, yyscan_t*);
 
 namespace doris {
 #include "common/compile_check_avoid_begin.h"
 
-GeoParseStatus WktParse::parse_wkt(const char* str, size_t len, GeoShape** 
shape) {
+GeoParseStatus WktParse::parse_wkt(const char* str, size_t len, 
std::unique_ptr<GeoShape>& shape) {
     WktParseContext ctx;
-    // initialize lexer
-    wkt_lex_init_extra(&ctx, &ctx.scaninfo);
-    wkt__scan_bytes(str, len, ctx.scaninfo);
 
     // parse
-    auto res = wkt_parse(&ctx);
-    wkt_lex_destroy(ctx.scaninfo);
-    if (res == 0) {
-        *shape = ctx.shape;
+    int st = wkt_parse(str, len, ctx);
+
+    if (st == GEO_PARSE_OK) {
+        if (ctx.shape != nullptr) {
+            shape = std::move(ctx.shape);

Review Comment:
   ctx.shape== nullptr 怎么办?



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