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

Enable setting FlightDescriptor on FlightDataEncoderBuilder #3855

Closed
alexwilcoxson-rel opened this issue Mar 13, 2023 · 2 comments · Fixed by #4101
Closed

Enable setting FlightDescriptor on FlightDataEncoderBuilder #3855

alexwilcoxson-rel opened this issue Mar 13, 2023 · 2 comments · Fixed by #4101
Labels
arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers

Comments

@alexwilcoxson-rel
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
When using FlightDataEncoder to send arrow batches to a flight do_put endpoint, FlightDescriptor cannot easily be set on first message. https://arrow.apache.org/docs/format/Flight.html#uploading-data

Describe the solution you'd like
On FlightDataEncoderBuilder a with_flight_descriptor method would be nice. The FlightDescriptor would then be set on the first FlightData retrieved from the encoder.

Describe alternatives you've considered
Here is a workaround, I may be missing something simpler

let mut encoder = FlightDataEncoderBuilder::new()
    .with_schema(schema.clone())
    .build(stream);

let mut first_flight_data = encoder
    .next()
    .await
    .expect("no flight data")
    .expect("flight data was error");
first_flight_data.flight_descriptor = Some(FlightDescriptor {
    r#type: DescriptorType::Path.into(),
    path: vec!["table_name".to_string()],
    cmd: Bytes::default(),
});
let put_stream = stream::once(async { Ok(first_flight_data) }).chain(encoder);
@alexwilcoxson-rel alexwilcoxson-rel added the enhancement Any new improvement worthy of a entry in the changelog label Mar 13, 2023
@alamb alamb added the arrow-flight Changes to the arrow-flight crate label Mar 16, 2023
@alamb
Copy link
Contributor

alamb commented Mar 16, 2023

Thanks for the suggestion @alexwilcoxson-rel -- I agree this sounds like a nice addition to the API.

Given the request is well specified and the code is fairly easy to test, I think this would be a good first issue for someone to work on if they wanted, so marking it thusly

@alamb alamb added the good first issue Good for newcomers label Mar 16, 2023
@tustvold tustvold added the arrow Changes to the arrow crate label May 5, 2023
@tustvold
Copy link
Contributor

tustvold commented May 5, 2023

label_issue.py automatically added labels {'arrow'} from #4101

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 enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants