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

Support adding a single new table factory to SessionStateBuilder #12552

Closed
Tracked by #12550
alamb opened this issue Sep 20, 2024 · 3 comments · Fixed by #12563
Closed
Tracked by #12550

Support adding a single new table factory to SessionStateBuilder #12552

alamb opened this issue Sep 20, 2024 · 3 comments · Fixed by #12563
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Sep 20, 2024

Is your feature request related to a problem or challenge?

Part of #12550

While working on https://github.com/datafusion-contrib/datafusion-dft I want to register various types of extensions while configuring the SessionContext, ideally adding each extension to the SessionStateBuilder each time.

However, I found that there were a few APIs missing on SessionStateBuilder so I had to implement my own workaround builder here: https://github.com/datafusion-contrib/datafusion-dft/blob/8247555f9464058c1ac3370196739ac2b19343ee/src/extensions/builder.rs#L84-L98

SessionStateBuilder has SessionStateBuilder::with_table_factories method to set all the table factories, but no way to just append a new table factory

Describe the solution you'd like

I would like a way to append just a single new TableFactory to the list of factories being constructed

Also it should have

  1. Documentation
  2. Tests (ideally a doc test with an example of how to use to use it)

Describe alternatives you've considered

I recommend adding a new function SessionStateBuilder::with_table_factory that works like this:

let state = SessionStateBuilder::new() 
  .with_table_factory("DELTA", factory1)
  .wth_table_facotry("ICEBERG", facotry2)
  // resulting state has both factory1 and factory2
  .build()

Additional context

No response

@alamb
Copy link
Contributor Author

alamb commented Sep 20, 2024

I think this is a good first issue as it is clearly described and straightforward to implement. It would be a good introduction to DataFusion I think

@alamb alamb added the good first issue Good for newcomers label Sep 20, 2024
@alamb alamb changed the title Improve SessionStateBuilder to add a single new table_factory Support adding a single new table factory to SessionStateBuilder Sep 20, 2024
@Weijun-H
Copy link
Member

\take

@alamb
Copy link
Contributor Author

alamb commented Sep 21, 2024

\take

BTW since you are now a committer, I think you can also just assign github issues directly to yourself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants