-
Notifications
You must be signed in to change notification settings - Fork 763
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
[ISSUE-2457] Add support for CTAS(Create Table As Select) statement #3400
Conversation
Thanks for the contribution! Please review the labels and make any necessary changes. |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/databend/databend/4N4KUCXQbkenQrLoByPpCdZKHkPe [Deployment for 148faec canceled] |
This pull request has merge conflicts that must be resolved before it can be merged. @junli1026 please rebase it 🙏 |
Codecov Report
@@ Coverage Diff @@
## main #3400 +/- ##
======================================
- Coverage 61% 61% -1%
======================================
Files 609 610 +1
Lines 34059 34185 +126
======================================
+ Hits 20971 20995 +24
- Misses 13088 13190 +102
Continue to review full report at Codecov.
|
Thanks @dantengsky for adding the 'query' field in the sql parser. It is very helpful! |
@Mergifyio update |
✅ Branch has been successfully updated |
look great to me, thanks @junli1026 ! do we need to clarify(in doc) that the "append columns" semantic of MySQL CTAS are not supported(by design) in our impl? from https://dev.mysql.com/doc/refman/8.0/en/create-table-select.html,
personally, I never used this feature of MySQL. not mention this in the doc is ok for me. |
Yes, it is! but it is contributed by @AngleNet in PR #3356, thanks @AngleNet ! |
CREATE TABLE db2.test2 LIKE db1.test1; | ||
INSERT INTO db2.test2 VALUES (3, 5); | ||
SELECT a+b FROM db2.test2; | ||
-- test 'create table as select' statement, expect db2.test3 has the data from db1.test1 with casting | ||
CREATE TABLE db2.test3(x Varchar, y Varchar) AS SELECT * FROM db1.test1; |
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.
Looks great 👍
Do you have the plan change this test to
CREATE TABLE db1.test1(a INT, b INT) ENGINE=MEMORY;
... ...
CREATE TABLE db2.test3(x Varchar, y Varchar) ENGINE=FUSE AS SELECT * FROM db1.test1;
... ...
🤔
@dantengsky |
Thank you @dantengsky all the same for pointing me to @AngleNet Thank you @AngleNet for you contribution ! |
/LGTM |
Wait for another reviewer approval |
/LGTM Thank you @junli1026 ! |
CI Passed |
I hereby agree to the terms of the CLA available at: https://databend.rs/policies/cla/
Summary
Add support for create table as select statement
Changelog
Related Issues
Fixes #2457
Test Plan
Unit Tests
Stateless Tests
DOC