-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Minor: add flags for temporary ddl #12561
base: main
Are you sure you want to change the base?
Conversation
0e03cba
to
a023c22
Compare
sorry, i took a bit longer than i was hoping with this one as i tried to get it to require minimal changes in the diff but as it is an api change i ended up spending quite a lot of time reading code. I have some questions and i'm super open to feedback, i'll self-review a few places where i was especially confused |
a023c22
to
2cb1e93
Compare
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 @hailelagi . I think we should add some sqllogictest tests for this change. Perhaps in ddl.slt. In order to ensure the generation of correct logical plans, we can add tests similar to the following.
set datafusion.explain.logical_plan_only=true;
explain create temp table t(a int);
datafusion/sql/src/parser.rs
Outdated
@@ -704,6 +706,10 @@ impl<'a> DFParser<'a> { | |||
self.parser | |||
.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); | |||
let table_name = self.parser.parse_object_name(true)?; | |||
let temporary = self |
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 am not sure if we need the temporary flag for an external table, as sqlparser-rs does not support it.
If we want to support it, the syntax is best as create temp external table table_name ...
or create external table temp table_name ...
.
When specifying columns, the current syntax is not user-friendly.
create external table table_name temporary(a int) STORED AS csv location '/tmp';
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.
would it make sense to create an issue in sqlparser-rs
for this? @jonahgao ?
Signed-off-by: Haile Lagi <[email protected]>
2cb1e93
to
7ac494c
Compare
Which issue does this PR close?
Closes #12463
Rationale for this change
This introduces a new flag option
temporary
on theDdlStatement
of:CreateMemoryTable
,CreateExternalTable
These flags enable an implementation built on DF to define the semantics of a temporary table.
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?