Skip to content

Conversation

@birschick-bq
Copy link
Contributor

@birschick-bq birschick-bq commented Oct 8, 2025

C# Thrift-based drivers using HTTP transport don't throw AdbcException with AdbcStatusCode of Unauthorized.

As a best practice, drivers should indicate if the connection encountered an authentication or authorization error when attempting to open. Connection should throw an AdbcException with Status == AdbcStatusCode.Unauthorized.

This handles all Apache (Hive, Impala, Spark) and Databricks drivers that use HTTP transport.

Notes:

  • required an update to Thrift version 0.22.0 (then also System.Text.Json 9.0.0)

closes #3550

@github-actions github-actions bot added this to the ADBC Libraries 21 milestone Oct 8, 2025
@birschick-bq birschick-bq changed the title fix:(csharp/src): handle HTTP authorization exception for Thrift-based drivers fix(csharp/src): handle HTTP authorization exception for Thrift-based drivers Oct 8, 2025
Copy link
Contributor

@CurtHagenlocher CurtHagenlocher left a comment

Choose a reason for hiding this comment

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

Thanks, this is great -- and the bug in AdbcException is a bit embarrassing. I left two questions.

</ItemGroup>
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net6.0'))">
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a specific need to update System.Text.Json and ApacheThrift (or benefit from updating them)? And why System.Text.Json 9.0.0 vs 9.0.9?

If there's not a specific need to update package versions then I'd just as soon not do it as it can be mildly disruptive downstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the Apache.Thrift to version 0.22.0 because I needed the changes I made to set the InnerException on TTransportExeptions. Otherwise, I would just have to look at the text of the exception message.

Well to use Thrift 0.22.0, it updates the Microsoft.Extension.Loggin.Console to >= 9.0.0 which in turn requires System.Text.JSon >= 9.0.0

https://www.nuget.org/packages/ApacheThrift/0.22.0#dependencies-body-tab

I could not find a way to keep System.Text.Json to 8.0.5

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, if we need the new version then we need the new version. We should use the same version of System.Text.Json throughout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. Set the System.Text.Json to version 9.0.9 in all referencing projects.

@CurtHagenlocher CurtHagenlocher merged commit 8f852e9 into apache:main Oct 9, 2025
6 checks passed
@birschick-bq birschick-bq deleted the dev/birschick-bq/fix-connection-error-status branch October 9, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C# Thrift-based drivers using HTTP transport don't throw AdbcException with AdbcStatusCode of Unauthorized

2 participants