Skip to content

Conversation

@toddmeng-db
Copy link
Contributor

@toddmeng-db toddmeng-db commented Jun 25, 2025

This is because there is a bug on runtime-side:

Sometimes TSparkDirectResults.TFetchResultsResp.TRowSet could be non-link responses (ARROW_BASED_SET), but still TSparkDirectResults.TGetResultSetMetadataResp.ResultFormat == URL_BASED_SET

This PR gets around that by directly inspecting the results. Since we do not always have DirectResults, we make an additional FetchResult call to determine whether to use CloudFetchReader or arrow-based DatabricksReader. Only if the result contains links does it decide to use CloudFetchReader.

This test does not pass in 11.3, 10.4 DBR until this commit.
dotnet test --filter "FullyQualifiedName~LZ4DecompressionCapabilityTest"

Remaining work:

Remaining work: need to update status polling to start earlier, ideally should be managed by new DatabricksCompositeReader

@toddmeng-db toddmeng-db force-pushed the toddmeng-db/hybrid-read branch 14 times, most recently from 886f1db to 41ebff4 Compare June 25, 2025 06:03
@toddmeng-db toddmeng-db changed the title treat initial results as directresults feat(csharp/src/Drivers/Databricks): Fix for older DBR versions incorrect ResultFormat Jun 25, 2025
@toddmeng-db toddmeng-db force-pushed the toddmeng-db/hybrid-read branch 3 times, most recently from e85ddab to 65584da Compare June 25, 2025 18:47
@toddmeng-db toddmeng-db marked this pull request as ready for review June 26, 2025 18:37
@github-actions github-actions bot added this to the ADBC Libraries 19 milestone Jun 26, 2025
@toddmeng-db toddmeng-db force-pushed the toddmeng-db/hybrid-read branch 2 times, most recently from 4984bcb to 5544441 Compare June 26, 2025 20:54
@toddmeng-db toddmeng-db marked this pull request as draft June 26, 2025 23:11
@toddmeng-db toddmeng-db marked this pull request as ready for review June 27, 2025 20:09
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! Just a few small things.

// Process direct results first, if available
if (_statement.HasDirectResults && _statement.DirectResults?.ResultSet?.Results?.ResultLinks?.Count > 0)
if (_statement.HasDirectResults && _statement.DirectResults?.ResultSet?.Results?.ResultLinks?.Count > 0 ||
(_initialResults?.Results?.ResultLinks?.Count > 0))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: fix indentation

/// </summary>
public sealed class DatabricksCompositeReader : TracingReader
{

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra blank line


public override Schema Schema { get { return _schema; } }


Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra blank line

/// A composite reader for Databricks that delegates to either CloudFetchReader or DatabricksReader
/// based on CloudFetch configuration and result set characteristics.
/// </summary>
public sealed class DatabricksCompositeReader : TracingReader
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public sealed class DatabricksCompositeReader : TracingReader
internal sealed class DatabricksCompositeReader : TracingReader

@toddmeng-db toddmeng-db force-pushed the toddmeng-db/hybrid-read branch from 5544441 to ce1d237 Compare June 30, 2025 20:14
@CurtHagenlocher CurtHagenlocher merged commit ba2efd0 into apache:main Jul 1, 2025
6 checks passed
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.

2 participants