-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Feature] support prepare statement #27840
Conversation
@@ -0,0 +1,107 @@ | |||
// Copyright 2021-present StarRocks, Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need use starrocks license header.
Please explain the purpose and function of this pr. |
44eed3c
to
04de190
Compare
[FE PR Coverage Check]😞 fail : 26 / 294 (08.84%) file detail
|
PR intention has been mentioned
|
c82c7a9
to
b407652
Compare
SonarCloud Quality Gate failed.
|
@@ -471,6 +552,7 @@ private void dispatch() throws IOException { | |||
handleQuit(); | |||
break; | |||
case COM_QUERY: | |||
case COM_STMT_PREPARE: | |||
handleQuery(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this PR support JDBC useServerPrepStmts=true
option? I mean there are some differents between using sql text and using JDBC prepareStament.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, using sql text will bring some problems like sql injection, in addition, prepare statement here will skip parser. In future we also can use it skip parser or planner, but the work will be more. so util now we only offer 2 benefits
fe/fe-core/src/main/java/com/starrocks/analysis/LiteralExpr.java
Outdated
Show resolved
Hide resolved
// audit will affect performance | ||
boolean enableAudit = ctx.getSessionVariable().isAuditExecuteStmt(); | ||
String originStmt = enableAudit ? executeStmt.toSql() : "/* omit */"; | ||
executeStmt.setOrigStmt(new OriginStatement(originStmt, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to print prepareStmt and parameters separately, or print the prepareStmt's name and parameters, it's better than not print
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently, print contents are ExecuteStmt$toSql, only contain prepareStmt's name and parameters. we have run some tests, found that will influence performance. so here add a config iterm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, get it, and I think it's another question? we can split PR to reslove print log performance? because other statements may need to handle too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or can you commit a issuse to describe the performance question and your code, it's can help us to optimize it late
fe/fe-core/src/main/java/com/starrocks/sql/ast/StatementBase.java
Outdated
Show resolved
Hide resolved
...ore/src/main/java/com/starrocks/sql/optimizer/transformer/SqlToScalarOperatorTranslator.java
Show resolved
Hide resolved
be64ecd
to
9f4464d
Compare
e4d620f
to
830776c
Compare
|
||
@Override | ||
public Void visitParameterExpr(Parameter node, Scope context) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should analyze actual expr here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but other expression will depend on child's class type(like lambda/date func), I think it's can't work good, and will throw some expcetion
14d9532
to
192ea6c
Compare
Signed-off-by: jukejian <jukejian@bytedance.com>
Signed-off-by: jukejian <jukejian@bytedance.com>
Signed-off-by: jukejian <jukejian@bytedance.com>
Signed-off-by: jukejian <jukejian@bytedance.com>
Signed-off-by: jukejian <jukejian@bytedance.com>
Signed-off-by: jukejian <jukejian@bytedance.com>
Signed-off-by: jukejian <jukejian@bytedance.com>
Signed-off-by: jukejian <jukejian@bytedance.com>
5d96437
to
6ca9be4
Compare
Kudos, SonarCloud Quality Gate passed! |
[FE Incremental Coverage Report]😞 fail : 50 / 314 (15.92%) file detail
|
[BE Incremental Coverage Report]😞 fail : 3 / 62 (04.84%) file detail
|
@mergify backport branch-3.2 |
✅ Backports have been created
|
Signed-off-by: jukejian <jukejian@bytedance.com> Co-authored-by: root <root@n37-042-050.byted.org> (cherry picked from commit 264b6dc)
Signed-off-by: jukejian <jukejian@bytedance.com> Co-authored-by: root <root@n37-042-050.byted.org> (cherry picked from commit 264b6dc) Signed-off-by: Binglin Chang <decstery@gmail.com>
Signed-off-by: jukejian <jukejian@bytedance.com> Co-authored-by: root <root@n37-042-050.byted.org>
Signed-off-by: jukejian <jukejian@bytedance.com> Co-authored-by: root <root@n37-042-050.byted.org>
Signed-off-by: jukejian <jukejian@bytedance.com> Co-authored-by: root <root@n37-042-050.byted.org>
Signed-off-by: jukejian <jukejian@bytedance.com> Co-authored-by: root <root@n37-042-050.byted.org>
Fixes #issue
support prepare statement
What type of PR is this:
Does this PR entail a change in behavior?
Checklist:
Bugfix cherry-pick branch check: