-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add ICompressionCodecFactory support to Flight record batch readers #285
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,15 +27,18 @@ public class FlightClient | |
| internal static readonly Empty EmptyInstance = new Empty(); | ||
|
|
||
| private readonly FlightService.FlightServiceClient _client; | ||
| private readonly ArrowContext _context; | ||
|
|
||
| public FlightClient(ChannelBase grpcChannel) | ||
| public FlightClient(ChannelBase grpcChannel, ArrowContext context = null) | ||
| { | ||
| _client = new FlightService.FlightServiceClient(grpcChannel); | ||
| _context = context; | ||
| } | ||
|
|
||
| public FlightClient(CallInvoker callInvoker) | ||
| public FlightClient(CallInvoker callInvoker, ArrowContext context = null) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For binary backwards compatibility, can you instead add a second constructor with the additional parameter? This one is trickier because the DI mechanism doesn't like having two constructors that both match what it's looking for, so we need to use a factory method instead:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would then also be good to add a test which exercises this code path. You could clone the existing This will also demonstrate to users how to use an |
||
| { | ||
| _client = new FlightService.FlightServiceClient(callInvoker); | ||
| _context = context; | ||
| } | ||
|
|
||
| public AsyncServerStreamingCall<FlightInfo> ListFlights(FlightCriteria criteria = null, Metadata headers = null) | ||
|
|
@@ -77,7 +80,7 @@ public FlightRecordBatchStreamingCall GetStream(FlightTicket ticket, Metadata he | |
| public FlightRecordBatchStreamingCall GetStream(FlightTicket ticket, Metadata headers, System.DateTime? deadline, CancellationToken cancellationToken = default) | ||
| { | ||
| var stream = _client.DoGet(ticket.ToProtocol(), headers, deadline, cancellationToken); | ||
| var responseStream = new FlightClientRecordBatchStreamReader(stream.ResponseStream); | ||
| var responseStream = new FlightClientRecordBatchStreamReader(stream.ResponseStream, _context); | ||
| return new FlightRecordBatchStreamingCall(responseStream, stream.ResponseHeadersAsync, stream.GetStatus, stream.GetTrailers, stream.Dispose); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,11 @@ namespace Apache.Arrow.Flight.Server | |
| { | ||
| public class FlightServerRecordBatchStreamReader : FlightRecordBatchStreamReader | ||
| { | ||
| public FlightServerRecordBatchStreamReader(IAsyncStreamReader<FlightData> flightDataStream) : base(new StreamReader<FlightData, Protocol.FlightData>(flightDataStream, data => data.ToProtocol())) | ||
| public FlightServerRecordBatchStreamReader(IAsyncStreamReader<FlightData> flightDataStream, ArrowContext context = null) : base(new StreamReader<FlightData, Protocol.FlightData>(flightDataStream, data => data.ToProtocol()), context) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For binary backwards compatibility, can you instead add a second public constructor with the additional parameter? i.e. |
||
| { | ||
| } | ||
|
|
||
| internal FlightServerRecordBatchStreamReader(IAsyncStreamReader<Protocol.FlightData> flightDataStream) : base(flightDataStream) | ||
| internal FlightServerRecordBatchStreamReader(IAsyncStreamReader<Protocol.FlightData> flightDataStream, ArrowContext context = null) : base(flightDataStream, context) | ||
| { | ||
| } | ||
|
|
||
|
|
||
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.
For binary backwards compatibility, can you instead add a second public constructor with the additional parameter? i.e.