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(flight): add sql-info helpers #4266

Merged
merged 10 commits into from
May 27, 2023
Merged

feat(flight): add sql-info helpers #4266

merged 10 commits into from
May 27, 2023

Conversation

roeap
Copy link
Contributor

@roeap roeap commented May 23, 2023

Which issue does this PR close?

Closes #4256

Rationale for this change

see #4256

What changes are included in this PR?

  • ported and slightly adopted sql info related structs and enums from iOx
  • show how they can be used in example server
  • tests
  • docs

@alamb, here a first draft of how it might look like with SqlInfoList et al. an feedback if this is going in the right direction is highly appreciated.

Are there any user-facing changes?

Users can now use SqlInfoList to easily implement flight sql methods related to communicating server capabilities.

@github-actions github-actions bot added arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate labels May 23, 2023
Comment on lines 309 to 312
pub fn flight_info(
ticket: Option<Ticket>,
flight_descriptor: Option<FlightDescriptor>,
) -> FlightInfo {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I have the most doubts if this is going a bit too far? On one hand the logic should mostly be static if one implements "vanilla" flight-sql, but if still wanted to keep the option to adjust the ticket and descriptor to ones liking. with that flexibility, there is an argument though to just include it in the example server, and stick to just exposing the schema method.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the reason you are including this function because it is somewhat challenging to create a FlightInfo (especially the magic dance to encode the schema).

I wonder if we could get a similar effect by adding some builder style structures to FlightInfo, so constructing one could look like:

let flight_info = FlightInfoBuilder::new()
  .with_schema(schema),
  .with_ticket(ticket)
  .build()

That might help other people work with these structures and we could avoid this specific API.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Filed #4281 to track the idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great idea - should I remove this here then, or should we just go-ahead with the PR you build on top of this in include this?

Copy link
Contributor

Choose a reason for hiding this comment

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

For this PR, I recommend we move flight_info out of SqlInfoBuilder and into the callsite(s) where it is needed.

I hope to bash out the FlightInfoBuilder later today or over the weekend and can update the callsites then

Thank you for your help with this

@roeap roeap changed the title feat: baseline sql-info helpers feat(flight): add sql-info helpers May 23, 2023
@alamb
Copy link
Contributor

alamb commented May 24, 2023

Thanks @roeap ! I plan to give this a look and review tomorrow morning!

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @roeap -- this looks very nice (though of course I am biased) -- sorry for the delay in review.

arrow-flight/src/sql/sql_info.rs Outdated Show resolved Hide resolved
Comment on lines 309 to 312
pub fn flight_info(
ticket: Option<Ticket>,
flight_descriptor: Option<FlightDescriptor>,
) -> FlightInfo {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the reason you are including this function because it is somewhat challenging to create a FlightInfo (especially the magic dance to encode the schema).

I wonder if we could get a similar effect by adding some builder style structures to FlightInfo, so constructing one could look like:

let flight_info = FlightInfoBuilder::new()
  .with_schema(schema),
  .with_ticket(ticket)
  .build()

That might help other people work with these structures and we could avoid this specific API.

What do you think?

@roeap roeap marked this pull request as ready for review May 26, 2023 17:56
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @roeap -- this looks awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FlightSQL: Add helpers to create CommandGetSqlInfo responses (SqlInfoValue and builders)
2 participants