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

Use JDBC cursors for SQL client streaming #208

Open
vietj opened this issue Feb 2, 2021 · 0 comments
Open

Use JDBC cursors for SQL client streaming #208

vietj opened this issue Feb 2, 2021 · 0 comments

Comments

@vietj
Copy link
Contributor

vietj commented Feb 2, 2021

The implementation of the SQL client streaming with JDBC will load the entire results set in memory. Here is a short description on how to proceed for the implementation:

JDBCPreparedQuery has an optional cursorId and fetch values indicating whether the query should or not use a cursor to execute the query

We likely need a Map<String, JDBCPreparedQuery<?, ?>> that keeps the prepared queries holding the ResultSet

When a non null cursorId is provided

  • the action should be created the first time and the action should create the ResultSet that holds a cursor. This ResultSet is cached on the action so it can be reused multiple times
    -the action should be looked up in the map and reused instead of being created otherwise

When an action is executed and provides its result it gives a boolean indicating whether the end has been reached:

  private <R> void handle(JDBCQueryAction<?, R> action, QueryResultHandler<R> handler, Promise<Boolean> promise) {
    Future<JDBCResponse<R>> fut = conn.schedule(action);
    fut.onComplete(ar -> {
      if (ar.succeeded()) {
        ar.result()
          .handle(handler);
        boolean suspended = false; // Set to true for result set still having results
        promise.complete(suspended);
      } else {
        promise.fail(ar.cause());
      }
    });
  }
@vietj vietj added this to the 4.0.2 milestone Feb 2, 2021
@vietj vietj modified the milestones: 4.0.2, 4.0.3 Feb 5, 2021
@vietj vietj modified the milestones: 4.0.3, 4.0.4 Mar 15, 2021
@vietj vietj modified the milestones: 4.1.0, 4.1.1 Jun 1, 2021
@vietj vietj modified the milestones: 4.1.1, 4.2.0 Jul 2, 2021
@vietj vietj modified the milestones: 4.2.0, 4.2.1, 4.2.2 Oct 28, 2021
@vietj vietj modified the milestones: 4.2.2, 4.2.3 Dec 14, 2021
@vietj vietj modified the milestones: 4.2.5, 4.2.6 Feb 16, 2022
@vietj vietj modified the milestones: 4.2.6, 4.2.7 Mar 17, 2022
@vietj vietj modified the milestones: 4.3.1, 4.3.2 May 25, 2022
@vietj vietj modified the milestones: 4.3.3, 4.3.4 Aug 9, 2022
@vietj vietj modified the milestones: 4.3.4, 4.3.5 Oct 1, 2022
@vietj vietj modified the milestones: 4.3.5, 4.4.0 Nov 18, 2022
@vietj vietj modified the milestones: 4.4.0, 4.4.1 Mar 2, 2023
@vietj vietj modified the milestones: 4.4.1, 4.4.2 Mar 31, 2023
@vietj vietj modified the milestones: 4.4.2, 4.4.3 May 12, 2023
@vietj vietj modified the milestones: 4.4.3, 4.4.4-SNAPSHOT, 4.4.4 Jun 7, 2023
@vietj vietj modified the milestones: 4.4.4, 4.4.5 Jun 22, 2023
@vietj vietj modified the milestones: 4.4.5, 4.4.6 Aug 30, 2023
@vietj vietj modified the milestones: 4.4.6, 4.5.0 Sep 12, 2023
@tsegismont tsegismont assigned tsegismont and unassigned pmlopes Nov 6, 2023
@tsegismont tsegismont modified the milestones: 4.5.0, 5.0.0 Nov 6, 2023
@tsegismont tsegismont removed this from the 5.0.0 milestone Jul 18, 2024
@tsegismont tsegismont removed their assignment Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants