-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[Enhancement] (nereids)implement showCreateViewCommand in nereids #43145
base: master
Are you sure you want to change the base?
Conversation
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
run buildall |
TPC-H: Total hot run time: 41125 ms
|
TPC-DS: Total hot run time: 196089 ms
|
ClickBench: Total hot run time: 33.02 s
|
} | ||
|
||
@Override | ||
public void run(ConnectContext ctx, StmtExecutor executor) throws Exception { |
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.
ShowCreateTableStmt's analyze method needs to be re-implemented in nereids. For example, add a private void validate(ConnectContext ctx) throws UserException method to do the job, and call it at the beginning of run method. BTW, the TableNameInfo class has analyze method to do the validation. You'd better keep TableNameInfo as a class member and call its analyze method in the new validate function
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.
Thanks for your comment. I have updated the PR, please review
TableIf view = db.getTableOrMetaException(viewName); | ||
|
||
if (!(view instanceof View)) { | ||
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_OBJECT, effectiveDbName, viewName, "VIEW"); |
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.
pls use more user friendly error message, take old planner as referenceErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_OBJECT, showStmt.getDb(), showStmt.getTable(), "VIEW", "Use 'SHOW CREATE TABLE '" + table.getName());
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.
Thanks for your comment. I have updated the PR, please review
|
||
if (createViewStmt.isEmpty()) { | ||
ShowResultSet resultSet = new ShowResultSet(VIEW_META_DATA, rows); | ||
executor.sendResultSet(resultSet); |
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.
don't call executor.sendResultSet(resultSet) when holding the readlock.
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.
Thanks for your comment. I have updated the PR, please review
260945b
to
eb53ca0
Compare
eb53ca0
to
4e0bd5e
Compare
|
||
// Fetch the catalog, database, and view metadata | ||
Env env = Env.getCurrentEnv(); | ||
DatabaseIf db = env.getCatalogMgr().getCatalogOrAnalysisException(effectiveCatalog) |
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.
keep behavior same as old code:
DatabaseIf db = env.getCatalogMgr().getCatalogOrAnalysisException(effectiveCatalog) | |
DatabaseIf db = ctx.getEnv().getCatalogMgr().getCatalogOrAnalysisException(tblNameInfo.getCtl()) | |
.getDbOrAnalysisException(tblNameInfo.getDb()); |
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.
done - please review
4e0bd5e
to
357d855
Compare
run buildall |
3 similar comments
run buildall |
run buildall |
run buildall |
97a2302
to
473ce44
Compare
run buildall |
run p0 |
run buildall |
TPC-H: Total hot run time: 40248 ms
|
TPC-DS: Total hot run time: 191975 ms
|
ClickBench: Total hot run time: 33.5 s
|
run p0 |
Issue Number: close #42737
implement showCreateViewCommand in nereids
Regression Test results:
2024-11-16 11:34:36.933 INFO [suite-thread-1] (Suite.groovy:387) - Execute sql:
CREATE TABLE IF NOT EXISTS table_for_view_test_2 (
key_field
INT COMMENT "Key field",value
STRING COMMENT "Value field")
DISTRIBUTED BY HASH(key_field) BUCKETS 3
PROPERTIES ("replication_num" = "1");
2024-11-16 11:34:36.951 INFO [suite-thread-1] (Suite.groovy:387) - Execute sql:
CREATE VIEW IF NOT EXISTS view_show_create_view_2 AS
SELECT key_field, value FROM table_for_view_test_2
2024-11-16 11:34:36.972 INFO [suite-thread-1] (Suite.groovy:717) - start check3321af53-2873-470e-8231-a57b05fd54e8
2024-11-16 11:34:36.977 INFO [suite-thread-1] (Suite.groovy:721) - start profile run3321af53-2873-470e-8231-a57b05fd54e8
2024-11-16 11:34:36.978 INFO [suite-thread-1] (Suite.groovy:387) - Execute sql: --3321af53-2873-470e-8231-a57b05fd54e8
show create view
view_show_create_view_2
;2024-11-16 11:34:36.983 INFO [suite-thread-1] (HttpCliAction.groovy:106) - url : http://127.0.0.1:8030/rest/v1/query_profile
2024-11-16 11:34:36.983 INFO [suite-thread-1] (HttpCliAction.groovy:107) - body: null
2024-11-16 11:34:36.983 INFO [suite-thread-1] (HttpCliAction.groovy:108) - op: get
2024-11-16 11:34:36.997 INFO [suite-thread-1] (HttpCliAction.groovy:106) - url : http://127.0.0.1:8030/rest/v1/query_profile/62b9319064f74716-ae9ac1d92192244e
2024-11-16 11:34:36.997 INFO [suite-thread-1] (HttpCliAction.groovy:107) - body: null
2024-11-16 11:34:36.997 INFO [suite-thread-1] (HttpCliAction.groovy:108) - op: get
2024-11-16 11:34:37.069 INFO [suite-thread-1] (Suite.groovy:726) - start profile check3321af53-2873-470e-8231-a57b05fd54e8
2024-11-16 11:34:37.071 INFO [suite-thread-1] (Suite.groovy:727) - Summary:
- Profile ID: 62b9319064f74716-ae9ac1d92192244e
- Task Type: QUERY
- Start Time: 2024-11-16 11:34:36
- End Time: 2024-11-16 11:34:36
- Total: 2ms
- Task State: EOF
- User: root
- Default Catalog: internal
- Default Db: regression_test_nereids_p0_show
- Sql Statement: --3321af53-2873-470e-8231-a57b05fd54e8
show create view
view_show_create_view_2
;- Distributed Plan: N/A
Execution Summary:
- Parse SQL Time: 0ms
- Nereids Analysis Time: N/A
- Nereids Rewrite Time: N/A
- Nereids Optimize Time: N/A
- Nereids Translate Time: N/A
- Nereids Distribute Time: N/A
- Workload Group:
- Analysis Time: N/A
- Plan Time: N/A
- JoinReorder Time: N/A
- CreateSingleNode Time: N/A
- QueryDistributed Time: N/A
- Init Scan Node Time: N/A
- Finalize Scan Node Time: N/A
- Get Splits Time: N/A
- Get Partitions Time: N/A
- Get Partition Files Time: N/A
- Create Scan Range Time: N/A
- Get Partition Version Time: N/A
- Get Partition Version Count (hasData): N/A
- Get Partition Version Count: N/A
- Get Table Version Time: N/A
- Get Table Version Count: N/A
- Schedule Time: N/A
- Fragment Assign Time: N/A
- Fragment Serialize Time: N/A
- Fragment RPC Phase1 Time: N/A
- Fragment RPC Phase2 Time: N/A
- Fragment Compressed Size: 0.00
- Fragment RPC Count: 0
- Schedule Time Of BE: {}
- Wait and Fetch Result Time: N/A
- Fetch Result Time: 0ms
- Write Result Time: 0ms
- Doris Version: c9a412b
- Is Nereids: Yes
- Is Cached: No
- Total Instances Num: 0
- Instances Num Per BE:
- Parallel Fragment Exec Instance Num: 4
- Trace ID:
- Transaction Commit Time: N/A
- System Message: N/A
- Executed By Frontend: N/A
- Nereids GarbageCollect Time: -1ms
- Nereids BeFoldConst Time: 0ms
Changed Session Variables:
2024-11-16 11:34:37.079 INFO [suite-thread-1] (Suite.groovy:1316) - Execute tag: cmd, sql: show create view
view_show_create_view_2
;2024-11-16 11:34:37.086 INFO [suite-thread-1] (Suite.groovy:387) - Execute sql: DROP VIEW IF EXISTS
view_show_create_view_2
2024-11-16 11:34:37.094 INFO [suite-thread-1] (Suite.groovy:387) - Execute sql: DROP TABLE IF EXISTS
table_for_view_test_2
2024-11-16 11:34:37.104 INFO [suite-thread-1] (ScriptContext.groovy:120) - Run test_show_create_view in /root/doris/doris/regression-test/suites/nereids_p0/show/test_show_create_view.groovy succeed
2024-11-16 11:34:58.005 INFO [main] (RegressionTest.groovy:281) - Start to run single scripts
2024-11-16 11:36:25.056 INFO [main] (RegressionTest.groovy:410) - Success suites:
/root/doris/doris/regression-test/suites/nereids_p0/show/test_show_create_view.groovy: group=query,arrow_flight_sql,p0, name=test_show_create_view
2024-11-16 11:36:25.058 INFO [main] (RegressionTest.groovy:492) - All suites success.