使用Arrow Flight SQL 协议连接Doris,报预编译未实现错误,Doris版本2.1.2,arrow相关驱动版本15.0.2,使用其他驱动版本也一样。
Java代码如下:
try {
Class.forName("org.apache.arrow.driver.jdbc.ArrowFlightJdbcDriver");
String DB_URL = "jdbc:arrow-flight-sql://192.168.72.128:9091?useServerPrepStmts=false"
+ "&cachePrepStmts=true&useSSL=false&useEncryption=false";
String USER = "root";
String PASS = "123456";
Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
Statement stmt = conn.createStatement();
ResultSet resultSet = stmt.executeQuery("select 1");
while (resultSet.next()) {
String col1 = resultSet.getString(1);
System.out.println(col1);
}
resultSet.close();
stmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
报错信息如下:
java.sql.SQLException: Error while executing SQL "select 1": CreatePreparedStatement not implemented
at cfjd.org.apache.calcite.avatica.Helper.createException(Helper.java:56)
at cfjd.org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at cfjd.org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
at cfjd.org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
at org.example.Main.main(Main.java:24)
Caused by: cfjd.org.apache.arrow.flight.FlightRuntimeException: UNIMPLEMENTED: CreatePreparedStatement not implemented
at cfjd.org.apache.arrow.flight.CallStatus.toRuntimeException(CallStatus.java:131)
at cfjd.org.apache.arrow.flight.grpc.StatusUtils.fromGrpcRuntimeException(StatusUtils.java:164)
at cfjd.org.apache.arrow.flight.grpc.StatusUtils$1.next(StatusUtils.java:250)
at cfjd.org.apache.arrow.flight.sql.FlightSqlClient$PreparedStatement.<init>(FlightSqlClient.java:941)
at cfjd.org.apache.arrow.flight.sql.FlightSqlClient.prepare(FlightSqlClient.java:728)
at cfjd.org.apache.arrow.flight.sql.FlightSqlClient.prepare(FlightSqlClient.java:708)
at org.apache.arrow.driver.jdbc.client.ArrowFlightSqlClientHandler.prepare(ArrowFlightSqlClientHandler.java:232)
at org.apache.arrow.driver.jdbc.ArrowFlightMetaImpl.prepareForHandle(ArrowFlightMetaImpl.java:165)
at org.apache.arrow.driver.jdbc.ArrowFlightMetaImpl.prepareAndExecute(ArrowFlightMetaImpl.java:196)
at cfjd.org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:677)
at cfjd.org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:157)
... 2 more