Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve problems in SQL commands #1761

Closed
zhouxh19 opened this issue May 7, 2022 · 4 comments · Fixed by #1820
Closed

Solve problems in SQL commands #1761

zhouxh19 opened this issue May 7, 2022 · 4 comments · Fixed by #1820
Assignees
Labels
bug Something isn't working

Comments

@zhouxh19
Copy link
Contributor

zhouxh19 commented May 7, 2022

I find two problems when using the explain+sql commands via terminal

(1) Need to click the "enter" key twice before seeing the explain results:

127.0.0.1:6527/test> explain select * from test;
127.0.0.1:6527/test> DATA_PROVIDER(request=test)

(2) Need to split the sql with the semicolon (;) with a character (e.g., an enter key or space), otherwise it will report errors:

127.0.0.1:6527/test> select * from (select * from
-> window win1 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000),
-> win2 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000))
-> as out0
-> last join (select * from test t1 last join test t2 on t1.c2=t2.c2) as out1 on out0.c2=out1.c2;
->
-> ;
Error: Syntax error: Expected end of input but got ";" [at 6:1]

127.0.0.1:6527/test> select * from (select * from
-> window win1 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000),
-> win2 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000))
-> as out0
-> last join (select * from test t1 last join test t2 on t1.c2=t2.c2) as out1 on out0.c2=out1.c2
-> ;


c1 c2 c3 c6 c7 c1 c2 c3 c6 c7 c1 c2 c3 c6 c7


@aceforeverd
Copy link
Collaborator

what's the openmldb version are u using ?

@zhouxh19
Copy link
Contributor Author

zhouxh19 commented May 7, 2022

what's the openmldb version are u using ?

0.4.4 in docker (4pdosc/openmldb:0.4.4)

@lumianph
Copy link
Collaborator

lumianph commented May 9, 2022

@aceforeverd pls help reproduce and confirm this issue?

@aceforeverd
Copy link
Collaborator

aceforeverd commented May 9, 2022

I find two problems when using the explain+sql commands via terminal

(1) Need to click the "enter" key twice before seeing the explain results:

127.0.0.1:6527/test> explain select * from test; 127.0.0.1:6527/test> DATA_PROVIDER(request=test)

reproduced.

(2) Need to split the sql with the semicolon (;) with a character (e.g., an enter key or space), otherwise it will report errors:

127.0.0.1:6527/test> select * from (select * from -> window win1 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000), -> win2 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000)) -> as out0 -> last join (select * from test t1 last join test t2 on t1.c2=t2.c2) as out1 on out0.c2=out1.c2; -> -> ; Error: Syntax error: Expected end of input but got ";" [at 6:1]

looks like the sql is incomplete. May you pls provide the complete sql in single line ?
I reproduced with

SELECT * FROM ( SELECT * FROM test WINDOW win1 AS( PARTITION BY c1 ORDER BY c2 rows_range BETWEEN 172799999 PRECEDING AND 0s PRECEDING MAXSIZE 1000), win2 AS( PARTITION BY c1 ORDER BY c2 rows_range BETWEEN 172799999 PRECEDING AND 0s PRECEDING MAXSIZE 1000)) AS out0 last JOIN ( SELECT * FROM test t1 LAST JOIN test t2 ON t1.c2 = t2.c2) AS out1 ON out0.c2 = out1.c2;

will check the reason

127.0.0.1:6527/test> select * from (select * from -> window win1 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000), -> win2 as (partition by c1 order by c2 rows_range between 172799999 preceding and 0s preceding MAXSIZE 1000)) -> as out0 -> last join (select * from test t1 last join test t2 on t1.c2=t2.c2) as out1 on out0.c2=out1.c2 -> ;

c1 c2 c3 c6 c7 c1 c2 c3 c6 c7 c1 c2 c3 c6 c7

@aceforeverd aceforeverd added the bug Something isn't working label May 9, 2022
@aceforeverd aceforeverd self-assigned this May 9, 2022
aceforeverd added a commit to aceforeverd/fedb that referenced this issue May 13, 2022
also removed the <tab> indent from physical_plan_str
aceforeverd added a commit to aceforeverd/fedb that referenced this issue May 16, 2022
also removed the <tab> indent from physical_plan_str
aceforeverd added a commit that referenced this issue May 23, 2022
close #1761, two problem in cli:

1. explain result missing a <CR>
2. fail to precess ending space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants