alibaba / alibaba/cobar

cobar支持空间数据库嘛?

Open
#61 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

我们在实际应用中发现通过cobar使用astext函数报错

mysql> SELECT rider_shape,astext(rider_shape) from sp_rider_space where city_id=1 and rider_id=1 and shardx=254
-> ;
ERROR 1064 (HY000): You have an error in your SQL syntax; Error occurs around this fragment: {er_shape,astext(rider_shap}. Error cause: SQL syntax error!

后端日志报
11:40:31,964 DEBUG [thread=Processor2-H2,class=ServerConnection,host=192.168.1.155,port=38701,schema=dwd_shardc]SELECT rider_shape,astext(rider_shape) from sp_rider_space where city_id=1 and rider_id=1 and shardx=254
11:40:31,965 WARN [thread=Processor2-H2,class=ServerConnection,host=192.168.1.155,port=38701,schema=dwd_shardc]SELECT rider_shape,astext(rider_shape) from sp_rider_space where city_id=1 and rider_id=1 and shardx=254
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; Error occurs around this fragment: {er_shape,astext(rider_shap}. Error cause: SQL syntax error!
at com.alibaba.cobar.parser.recognizer.SQLParserDelegate.parse(SQLParserDelegate.java:155)
at com.alibaba.cobar.parser.recognizer.SQLParserDelegate.parse(SQLParserDelegate.java:160)
at com.alibaba.cobar.route.ServerRouter.route(ServerRouter.java:99)
at com.alibaba.cobar.server.ServerConnection.execute(ServerConnection.java:146)
at com.alibaba.cobar.server.handler.SelectHandler.handle(SelectHandler.java:90)
at com.alibaba.cobar.server.ServerQueryHandler.query(ServerQueryHandler.java:63)
at com.alibaba.cobar.net.FrontendConnection.query(FrontendConnection.java:266)
at com.alibaba.cobar.net.handler.FrontendCommandHandler.handle(FrontendCommandHandler.java:48)
at com.alibaba.cobar.net.FrontendConnection$1.run(FrontendConnection.java:372)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLSyntaxErrorException: SQL syntax error!
at com.alibaba.cobar.parser.recognizer.SQLParserDelegate.parse(SQLParserDelegate.java:150)
... 11 more
11:40:42,492 DEBUG [thread=Processor0-R,class=ServerConnection,host=192.168.1.188,port=57651,schema=dwd_shardc]
java.io.EOFException
at com.alibaba.cobar.net.AbstractConnection.read(AbstractConnection.java:163)
at com.alibaba.cobar.net.NIOReactor$R.read(NIOReactor.java:130)
at com.alibaba.cobar.net.NIOReactor$R.run(NIOReactor.java:98)
at java.lang.Thread.run(Thread.java:662)
11:40:42,492 DEBUG [thread=Processor3-R,class=ServerConnection,host=192.168.1.188,port=57650,schema=dwd_shardc]
java.io.EOFException
at com.alibaba.cobar.net.AbstractConnection.read(AbstractConnection.java:163)
at com.alibaba.cobar.net.NIOReactor$R.read(NIOReactor.java:130)
at com.alibaba.cobar.net.NIOReactor$R.run(NIOReactor.java:98)
at java.lang.Thread.run(Thread.java:662)

貌似cobar的语法校验通不过

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported SELECT using the parser entry point in SQLParserDelegate.parse, then trace how ServerRouter.route handles the parsed statement. Check whether the SQL parser recognizes the MySQL spatial function astext; done means the query parses and routes without the reported syntax error, with a regression test if the existing test structure provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.