-
Notifications
You must be signed in to change notification settings - Fork 40
[PECOBLR-384] Add implementation for fetching statement status for async execution #824
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
688cf75
Add support for configuring HTTP connection pool size
gopalldb 2e6bfaa
Changes for default value
gopalldb 8ee0fa1
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 5f7d0c1
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 2e28c9e
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb a720802
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb e88657b
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 2670e43
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb c4925ee
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 5a5f1de
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb bf41453
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb b81f4ad
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 1e790a4
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 5ed0c08
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 73029b4
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb ffc2aae
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 7cf9cc8
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb f55ca04
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb ceb2fcb
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 77552fc
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 0690dea
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 638a11a
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 5da3b1e
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 8dbee51
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 5c72ef9
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb b769422
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb 89e0242
Add implementation for fetching execution status for async execution
gopalldb 7da658f
Addres feedbacks for renaming class
gopalldb 980b0ab
rename variable
gopalldb 47a7fbe
cleanup redundant pkg name
gopalldb b936507
address feedbacks and fix deprecated typo
gopalldb 2feeba2
fix lint
gopalldb b1263ca
add changelog
gopalldb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.databricks.jdbc.api; | ||
|
|
||
| /** | ||
| * Represents the possible states of a SQL statement execution in Databricks. This enum is used to | ||
| * track the progress and status of SQL statements executed through the Databricks JDBC API. | ||
| */ | ||
| public enum ExecutionState { | ||
| // The statement is in a pending state and has not yet started executing. | ||
| PENDING, | ||
| // The statement is currently executing. | ||
| RUNNING, | ||
| // The statement has completed successfully. | ||
| SUCCEEDED, | ||
| // The statement has completed with an error. | ||
| FAILED, | ||
| // The statement has been closed and is no longer available. | ||
| CLOSED, | ||
| // The statement has been cancelled by the user. | ||
| ABORTED; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/databricks/jdbc/api/IExecutionStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package com.databricks.jdbc.api; | ||
|
|
||
| public interface IExecutionStatus { | ||
| /** | ||
| * Returns the error message if the statement execution failed. | ||
| * | ||
| * @return the error message, or null if there was no error | ||
| */ | ||
| String getErrorMessage(); | ||
|
|
||
| /** | ||
| * Returns the SQL state code if the statement execution failed. | ||
| * | ||
| * @return the SQL state code, or null if there was no error | ||
| */ | ||
| String getSqlState(); | ||
|
|
||
| /** | ||
| * Returns the current state of the statement execution. | ||
| * | ||
| * @return the current state of the statement execution | ||
| */ | ||
| ExecutionState getExecutionState(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/com/databricks/jdbc/api/impl/ExecutionStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package com.databricks.jdbc.api.impl; | ||
|
|
||
| import com.databricks.jdbc.api.ExecutionState; | ||
| import com.databricks.jdbc.api.IExecutionStatus; | ||
| import com.databricks.jdbc.model.core.StatementStatus; | ||
| import com.databricks.sdk.service.sql.StatementState; | ||
|
|
||
| /** | ||
| * This class implements the IStatementStatus interface and provides a default implementation for | ||
| * the methods defined in the interface. It is used to represent the status of a SQL statement | ||
| * execution in Databricks. | ||
| */ | ||
| class ExecutionStatus implements IExecutionStatus { | ||
| private final ExecutionState state; | ||
| private final String errorMessage; | ||
| private final String sqlState; | ||
| private final StatementStatus sdkStatus; | ||
|
|
||
| public ExecutionStatus(StatementStatus status) { | ||
| this.state = getStateFromSdkState(status.getState()); | ||
| this.errorMessage = status.getError() != null ? status.getError().getMessage() : null; | ||
| this.sqlState = status.getSqlState(); | ||
| this.sdkStatus = status; | ||
| } | ||
|
|
||
| @Override | ||
| public String getErrorMessage() { | ||
| return errorMessage; | ||
| } | ||
|
|
||
| @Override | ||
| public String getSqlState() { | ||
| return sqlState; | ||
| } | ||
|
|
||
| @Override | ||
| public ExecutionState getExecutionState() { | ||
| return state; | ||
| } | ||
|
|
||
| StatementStatus getSdkStatus() { | ||
| return sdkStatus; | ||
| } | ||
|
|
||
| private ExecutionState getStateFromSdkState(StatementState state) { | ||
| if (state == null) { | ||
| return ExecutionState.PENDING; | ||
| } | ||
| // Map the SDK statement state to the JDBC statement state | ||
| switch (state) { | ||
| case PENDING: | ||
| return ExecutionState.PENDING; | ||
| case RUNNING: | ||
| return ExecutionState.RUNNING; | ||
| case SUCCEEDED: | ||
| return ExecutionState.SUCCEEDED; | ||
| case FAILED: | ||
| return ExecutionState.FAILED; | ||
| case CANCELED: | ||
| return ExecutionState.ABORTED; | ||
| case CLOSED: | ||
| return ExecutionState.CLOSED; | ||
| // should never reach here | ||
| default: | ||
| throw new IllegalArgumentException("Unknown statement execution state: " + state); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should we move to
com.databricks.jdbc.common?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.
Wanted to keep public facing and public documented interfaces and enums in a single place.