Skip to content

GH-33953: [Java] Pass custom headers on every request - #33967

Merged
lidavidm merged 12 commits into
apache:mainfrom
aiguofer:pass_custom_headers_on_do_get
Feb 27, 2023
Merged

lidavidm merged 12 commits into
apache:mainfrom
aiguofer:pass_custom_headers_on_do_get

Conversation

@aiguofer

@aiguofer aiguofer commented Feb 1, 2023 •

Copy link
Copy Markdown
Contributor

Rationale for this change

Some flight requests don't send custom headers. This PR should fix that.

What changes are included in this PR?

Ensure custom headers are sent across on every request.

Are these changes tested?

No

Are there any user-facing changes?

Custom headers should now be attached to every call.

@aiguofer
aiguofer requested a review from lidavidm as a code owner February 1, 2023 06:05
@github-actions

github-actions Bot commented Feb 1, 2023

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Feb 1, 2023

Copy link
Copy Markdown

⚠️ GitHub issue #33953 has been automatically assigned in GitHub to PR creator.

@aiguofer

aiguofer commented Feb 1, 2023

Copy link
Copy Markdown
Contributor Author

Unsure what that failure is... maybe the ManagedChannel shutdown is not being propagated to other channels? Or maybe it's not waiting long enough for the shutdown to complete (there's a hardcoded 5 sec wait there I believe)

@lidavidm

lidavidm commented Feb 2, 2023

Copy link
Copy Markdown
Member

It'll be a while before I can review here but that test is known to be flaky

@aiguofer

aiguofer commented Feb 3, 2023

Copy link
Copy Markdown
Contributor Author

Great, good to know! We're currently using a JDBC driver jar I built with these changes for development of our service so we're not currently blocked. Hoping these changes can make it into the next release so we can have users use a published jar once we get to beta. I really appreciate your help and time!

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add unit tests here?

@aiguofer

aiguofer commented Feb 3, 2023

Copy link
Copy Markdown
Contributor Author

Sure I'll take a stab at writing some unit tests. I was thinking maybe something like ConnectionTest with a middleware that checks for the specific header values.

@aiguofer
aiguofer force-pushed the pass_custom_headers_on_do_get branch from 7db9f18 to 8de0537 Compare February 24, 2023 23:38
@aiguofer

Copy link
Copy Markdown
Contributor Author

@lidavidm Now that I'm a bit more familiar with the code base I was able to write some better unit tests. I moved the tests to flight-core, removed the use of rules, and I'm now testing each specific flight method instead of using the JDBC connection proxy.

@aiguofer

Copy link
Copy Markdown
Contributor Author

for the future... is there some command I can run to auto-format code to checkstyle? I haven't thought about checkstyles compliance in years, this should be automated.

@lidavidm

Copy link
Copy Markdown
Member

for the future... is there some command I can run to auto-format code to checkstyle? I haven't thought about checkstyles compliance in years, this should be automated.

Unfortunately no. I would much prefer if we could switch to a formatter like google-java-format rather than checkstyle but that would be a somewhat disruptive refactor.

That said - feel free to raise an issue and get opinions from other Java contributors.

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is great, thank you!

@lidavidm

Copy link
Copy Markdown
Member

Actually, I filed apache/arrow-java#213 for checkstyle - feel free to chime in there

@lidavidm
lidavidm merged commit 969dd29 into apache:main Feb 27, 2023
@ursabot

ursabot commented Feb 28, 2023

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = 06f28d2 and contender = 969dd29. 969dd29 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.79% ⬆️0.15%] test-mac-arm
[Finished ⬇️1.53% ⬆️2.04%] ursa-i9-9960x
[Failed ⬇️0.29% ⬆️0.03%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 969dd290 ec2-t3-xlarge-us-east-2
[Failed] 969dd290 test-mac-arm
[Finished] 969dd290 ursa-i9-9960x
[Failed] 969dd290 ursa-thinkcentre-m75q
[Finished] 06f28d20 ec2-t3-xlarge-us-east-2
[Finished] 06f28d20 test-mac-arm
[Finished] 06f28d20 ursa-i9-9960x
[Finished] 06f28d20 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
…3967)

### Rationale for this change

Some flight requests don't send custom headers. This PR should fix that.

### What changes are included in this PR?

Ensure custom headers are sent across on every request.

### Are these changes tested?

No

### Are there any user-facing changes?

Custom headers should now be attached to every call.

* Closes: apache#33953
* Closes: apache#33839

Authored-by: Diego Fernandez <diego.fernandez@dbtlabs.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] JDBC driver does not send custom headers on DoGet [Java][FlightRPC] FlightCallHeaders added to FlightClient::getStream aren't attached to call

3 participants