Skip to content
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

feat: Expose catalog through table func context #2172

Merged
merged 5 commits into from
Nov 29, 2023
Merged

Conversation

scsmithr
Copy link
Member

@scsmithr scsmithr commented Nov 28, 2023

Exposes the session catalog through the table func context provider.

Also a bit of refactoring here and there.

@scsmithr scsmithr changed the title Sean/table func catalog feat: Expose catalog through table func context Nov 28, 2023
@scsmithr scsmithr marked this pull request as ready for review November 28, 2023 18:31
Comment on lines +154 to +166
// Note that we're not changing out the catalog stored on the context
// here. The session's catalog will get swapped out at the beginning of
// the next query execution.
//
// TODO: We should be returning _what_ was updated from metastore
// instead of needing to do this. Sean has a stash working on this.
let new_catalog = SessionCatalog::new(
state,
ResolveConfig {
default_schema_oid: 0,
session_schema_oid: 0,
},
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been looking at this & i don't think i fully understand the ResolveConfig and what's happening here.

AFAIK, the ResolveConfig is just a config object containing the global schema and session ids?

Why are we setting them to 0 here? Is this just a temporary workaround?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's pretty much it. The resolve config here is set to zeros since we don't actually need them, we're just creating a new session catalog to pull out the new table entry that metastore just created.

And sqlbuiltins is now importing quite a few crates which make it tricky to import into the catalog crate (cycle) and so I had to resort to the resolve config. I want to look at possibly splitting up sqlbuiltins to avoid that cycle, but figured it'd be a bit of a refactor.

@scsmithr scsmithr merged commit 89c485e into main Nov 29, 2023
10 checks passed
@scsmithr scsmithr deleted the sean/table-func-catalog branch November 29, 2023 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants