Skip to content

[Java] jdbc:arrow-flight-sql executeQuery behaves incorrectly #38785

Description

@xinyiZzz

Describe the bug, including details regarding any error messages, version, and platform.

Arrow Version 13.0.0
I use the following code to connect to flight sql server to execute query, two unexpected behaviors occur:

  1. acceptPutPreparedStatementUpdate of the flight server is called, and flightStream.getRoot().getRowCount() == 0 is true. but query is not an Update statement.
  • Shouldn't acceptPutPreparedStatementUpdate be called?

I'm using Python DB-API 2.0 cursor.execute(sql) and cursor.fetchallarrow() which does not call acceptPutPreparedStatementUpdate after calling createPreparedStatement.

  1. The FlightEndpoint returned by getFlightInfoPreparedStatement is another flight server, but not fetch result from other flight server. Instead, getStreamStatement of the current flight server is called.
  • Why is there no fetch result from another flight server?
  • Why is getStreamStatement called instead of getStreamPreparedStatement?

Actual calling sequence:

  1. createPreparedStatement
  2. acceptPutPreparedStatementUpdate
  3. getFlightInfoPreparedStatement
  4. getStreamStatement
  5. closePreparedStatement

I'm looking for help, thanks!

Connection conn = null;
Statement stmt = null;
Class.forName("org.apache.arrow.driver.jdbc.ArrowFlightJdbcDriver");
try {
conn = DriverManager.getConnection("jdbc:arrow-flight-sql://xx:xx?useServerPrepStmts=false&cachePrepStmts=true&useSSL=false&useEncryption=false", "root", "");
String sql = "select * from clickbench.hits limit 50";
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
int rowNum = rs.getRow();
System.out.println(rowNum);
rs.close();
stmt.close();
conn.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}

Component(s)

FlightRPC

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions