-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add Create Schema functionality in SQL #1959
Conversation
I'm working on this and im wondering why |
This has surprisingly been a bit of a pain. Currently having issues with getting the schema registration to work. At the moment its not clear to me what the issue is. |
datafusion/src/execution/context.rs
Outdated
"test".into(), | ||
Arc::new(DataFrameImpl::new(self.state.clone(), &plan)), | ||
)?; | ||
let schem_reg_res = catalog.register_schema(&schema_name, schema); |
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.
It's not clear to me why registering schema here isnt working. I reregister the catalog below just in case but still has no effect. I wasnt expecting to have to reregister. Still digging deep into the implementations to get better idea whats going on.
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 know theres a lot of fluff right now that im using for debugging purposes)
Got this working. Just need to resolve conflicts. @alamb do you have preference on whether to leave this PR as is or if i can also add |
4e44f4d
to
ff3aabb
Compare
Ah need to do ballista update still |
I suggest we do it in a follow on PR to keep this one smaller.
seems reasonable (sorry for the delayed replies -- I am only inline intermittently this week) |
0ec8628
to
877ccd6
Compare
@alamb i believe this is ready now |
table: parts[2], | ||
}, | ||
_ => Self::Bare { table: s }, | ||
} | ||
} |
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.
👍🏻! It's helpful to me!
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.
LGTM
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 good to me -- thanks @doki23 and @matthewmturner !
@@ -2907,6 +2947,29 @@ mod tests { | |||
assert_eq!(Weak::strong_count(&catalog_weak), 0); | |||
} | |||
|
|||
#[tokio::test] | |||
async fn sql_create_schema() -> Result<()> { | |||
// the information schema used to introduce cyclic Arcs |
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.
not sure what this comment means
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.
oops that may have been straggling comment from a copy paste, sry about that. i can remove in subsequent PR
if_not_exists, | ||
.. | ||
}) => { | ||
// sqlparser doesnt accept database / catalog as parameter to CREATE SCHEMA |
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.
maybe worth a ticket to sqlparser to support this? Or maybe just a PR :)
|
||
let schema = catalog.schema(&schema_name); | ||
|
||
match (if_not_exists, schema) { |
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.
👍
Which issue does this PR close?
Task 1 for #1877
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?