Skip to content

Conversation

@toddmeng-db
Copy link
Contributor

@toddmeng-db toddmeng-db commented Aug 7, 2025

Changes to make DatabricksCompositeReader Unit tests. Should make unit tests for DatabricksReader easier, too.

Changes made:

  1. Move reader-related files to Readers folder (Readers, Cloudfetch, poller)
  2. IHiveServer2Statement extends IActivityTracer - this lets us pass the interface instead of the concrete DatabricksStatement, which better follows dependency-inversion and makes mocking easier
  3. Adds OperationStatusPoller interface
  4. Adds DatabricksCompositeReader Unit tests

@toddmeng-db toddmeng-db changed the title Toddmeng db/reader tests Reader Unit Tests Aug 7, 2025
CurtHagenlocher pushed a commit that referenced this pull request Aug 8, 2025
… and StatusPoller to Stop/Dispose Appropriately (#3217)

### Motivation
The following cases are not properly stopping or disposing the status
poller:
1.  If the DatabricksCompositeReader is explicitly disposed by the user
2. CloudFetchReader is done returning results
3. Edge case terminal operation status (timedout_state, unknown_state)

In addition:
- When DatabricksOperationStatusPoller.Dispose(), it may cancel the
GetOperationStatusRequest in the client. If the input buffer has data
and cancellation is triggered, it leaves the TCLI client with
unconsumed/unsent data in the buffer, breaking subsequent requests
(fixed in this PR)

### Fixes

DatabricksOperationStatusPollerLogic is now more appropriately managed
by DatabricksCompositeReader (moved out of BaseDatabricksReader) to
handle all cases where null results (indicating completion) are
returned.

Disposing DatabricksCompositeReader appropriately disposes the
activeReader and statusPoller


#### TODO
Follow-up PR - when statement is disposed, it should also dispose the
reader (the poller is currently stopped when operationhandle is set to
null, but this should also happen explicitly)

Need add some unit testing (follow up pr:
#3243)
@toddmeng-db toddmeng-db closed this Aug 8, 2025
ianmcook pushed a commit to adbc-drivers/databricks that referenced this pull request Oct 22, 2025
… and StatusPoller to Stop/Dispose Appropriately (#3217)

### Motivation
The following cases are not properly stopping or disposing the status
poller:
1.  If the DatabricksCompositeReader is explicitly disposed by the user
2. CloudFetchReader is done returning results
3. Edge case terminal operation status (timedout_state, unknown_state)

In addition:
- When DatabricksOperationStatusPoller.Dispose(), it may cancel the
GetOperationStatusRequest in the client. If the input buffer has data
and cancellation is triggered, it leaves the TCLI client with
unconsumed/unsent data in the buffer, breaking subsequent requests
(fixed in this PR)

### Fixes

DatabricksOperationStatusPollerLogic is now more appropriately managed
by DatabricksCompositeReader (moved out of BaseDatabricksReader) to
handle all cases where null results (indicating completion) are
returned.

Disposing DatabricksCompositeReader appropriately disposes the
activeReader and statusPoller


#### TODO
Follow-up PR - when statement is disposed, it should also dispose the
reader (the poller is currently stopped when operationhandle is set to
null, but this should also happen explicitly)

Need add some unit testing (follow up pr:
apache/arrow-adbc#3243)
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.

1 participant