Skip to content

[PECOBLR-384] Add implementation for fetching statement status for async execution#824

Merged
gopalldb merged 33 commits into
mainfrom
gopalldb/async-status
May 15, 2025
Merged

[PECOBLR-384] Add implementation for fetching statement status for async execution#824
gopalldb merged 33 commits into
mainfrom
gopalldb/async-status

Conversation

@gopalldb

Copy link
Copy Markdown
Collaborator

Description

Changes contain:

  1. New interface for IStatementStatus, removed dependency on SDK class for public facing statementStatus
  2. Marked existing method as Deprecated, cannot change that as Celonis might be using the same. Will ask Celonis to move to new code
  3. Test cases

The documentation will be added for the new interface.

Testing

Updated unit tests

Additional Notes to the Reviewer

* the methods defined in the interface. It is used to represent the status of a SQL statement
* execution in Databricks.
*/
class StatementStatus implements IStatementStatus {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we rename this class to avoid confusion and FQN everywhere with com.databricks.jdbc.model.core.StatementStatus

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,24 @@
package com.databricks.jdbc.api;

public interface IStatementStatus {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need this interface? seems like there cannot be any other implementation other than the one below?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is more for hiding impl details from the client. We will only document interface methods.

@jayantsing-db jayantsing-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm (barring @vikrantpuppala comment). some minor comments.

Comment on lines +45 to +46
* @return The current {@link StatementStatus} of the statement @Deprecated Use {@link
* #getExecutionStatus()} instead.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice. how does this tag work? When the users try to use, does it display the warning?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it will display compile warnings as well as javadoc warning

*
* @return the current state of the statement execution
*/
StatementState getState();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: if we decide to keep the interface, can we rename this method to getStatementState? that way looks more consistent with getSqlState

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,20 @@
package com.databricks.jdbc.api;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should we move this to com.databricks.jdbc.common?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is public facing and will be documented. Don't want to move public facing to common.

Comment on lines +9 to +19
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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: i think these are same for both thrift and sql execution but just confirming?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes

// Constructor for SEA result set
public DatabricksResultSet(
StatementStatus statementStatus,
com.databricks.jdbc.model.core.StatementStatus statementStatus,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: maybe keep the import com.databricks.jdbc.model.core.StatementStatus to keep it concise?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,20 @@
package com.databricks.jdbc.api;

Copy link
Copy Markdown
Collaborator

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?

Copy link
Copy Markdown
Collaborator Author

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.

return state;
}

com.databricks.jdbc.model.core.StatementStatus getSdkStatus() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess this is for backward compatibility?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes

@gopalldb gopalldb merged commit eaef770 into databricks:main May 15, 2025
15 of 16 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.

3 participants