Skip to content
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

Add session and statement state for all query types #2413

Closed

Conversation

penghuo
Copy link
Collaborator

@penghuo penghuo commented Nov 2, 2023

Description

  1. create session and statement for all the queryType.

Issues Resolved

#2401

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

}
JSONObject result = new JSONObject();
result.put(STATUS_FIELD, statementState.getState());
result.put(ERROR_FIELD, Optional.of(statement.getStatementModel().getError()).orElse(""));
Copy link
Member

Choose a reason for hiding this comment

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

is error written to result index or statement model in request index?
Are these different cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

both, Flint spark job,

  • write result, state, error, to result index.
  • write state and error to request index.

@kaituo please help confirm also.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

Copy link

codecov bot commented Nov 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.56%. Comparing base (2f2ecd2) to head (d45376c).
Report is 207 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2413      +/-   ##
============================================
+ Coverage     95.54%   95.56%   +0.01%     
- Complexity     4985     4987       +2     
============================================
  Files           478      478              
  Lines         13883    13919      +36     
  Branches        931      931              
============================================
+ Hits          13265    13301      +36     
  Misses          598      598              
  Partials         20       20              
Flag Coverage Δ
sql-engine 95.56% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator Author

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

@kaituo two questions.

  1. should we add a new StatementState cancelling and Spark job update it as cancelled?
  2. what is the required configuration of REPL job, we have following configurations now, do we need more?
    • config.put(FLINT_JOB_REQUEST_INDEX, DATASOURCE_TO_REQUEST_INDEX.apply(datasourceName));
    • config.put(FLINT_JOB_SESSION_ID, sessionId);

@kaituo
Copy link
Contributor

kaituo commented Nov 2, 2023

@kaituo two questions.

1. should we add a new StatementState `cancelling` and Spark job update it as `cancelled`?

2. what is the required configuration of REPL job, we have following configurations now, do we need more?
   
   * config.put(FLINT_JOB_REQUEST_INDEX, DATASOURCE_TO_REQUEST_INDEX.apply(datasourceName));
   * config.put(FLINT_JOB_SESSION_ID, sessionId);
  1. Can you just update it as cancelled? If you cancel before repl pick the statement up or after repl finishes the statement, repl doesn't need to do anything else. If you cancel after repl picks it up and before repl finishes, repl may change your state, which I think is fine.

  2. I also need these two:

    val dataSource = conf.get("spark.flint.datasource.name", "unknown")
    val wait = conf.get("spark.flint.job.type", "continue")

createSessionAndStatement(
dispatchQueryRequest,
dispatchQueryRequest.getApplicationId(),
DROP_INDEX_JOB_ID,
Copy link
Contributor

Choose a reason for hiding this comment

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

does that mean there is only one job id for all DML queries? Would it cause issues if there is a concurrent DML running?

dispatchQueryRequest,
dispatchQueryRequest.getApplicationId(),
jobId,
SessionType.BATCH,
Copy link
Contributor

Choose a reason for hiding this comment

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

should the type be streaming?

@Swiddis
Copy link
Collaborator

Swiddis commented Jan 7, 2025

Closing as stale -- reopen if needed

@Swiddis Swiddis closed this Jan 7, 2025
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.

4 participants