-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Add builder API for CreateExternalTable to reduce verbosity #19066
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: Add builder API for CreateExternalTable to reduce verbosity #19066
Conversation
Implements apache#19039 This PR adds a builder pattern for CreateExternalTable that reduces code verbosity and improves readability.
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.
Thank you @AryanBagade -- this looks really nice to me 🙏 ❤️
|
@alamb The CI failure was due to the merge from main bringing in new tests (lines 502, 541) that still used the old |
|
CI failure is due to Should be fixed soon |
|
Failure is unrelated to this PR: |
|
Thank you @AryanBagade 🙏 |
Which issue does this PR close?
CreateExternalTableto reduce redundancy and make the code easier to understand #19039.Rationale for this change
As per the Issue #19039, many examples of verbose
CreateExternalTableinitialization were found throughout the codebase. The current approach requires specifying all 14 fields even when most use default values, making it:This PR implements a builder API to address these issues.
What changes are included in this PR?
CreateExternalTableBuilderwith required parameters enforced at compile-timebuilder(name, location, file_type, schema).with_*()methods (following DataFusion's builder conventions)Example transformation:
Before
After
Are these changes tested?
Yup, all existing tests pass:
Are there any user-facing changes?
No breaking changes.
The builder API is new one and its for internal code cleanup and reducing redundancy and verboseness