apache / apache/arrow-java

[Java][FlightRPC] Flight SQL JDBC driver parameter getting an exception: parameter ordinal 1 out of range

未關閉
#121 15 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
94
分支
152
平均合併
3 天 16 小時
30 天內合併 PR
11

描述

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

```
protected AvaticaParameter getParameter(int param) throws SQLException {
try {
return (AvaticaParameter)this.getSignature().parameters.get(param - 1);
} catch (IndexOutOfBoundsException var3) {
throw AvaticaConnection.HELPER.toSQLException(AvaticaConnection.HELPER.createException("parameter ordinal " + param + " out of range"));
}
}
```

Getting this exception

My code:
```
public static void handleSqlStatements() throws SQLException {
String url = "jdbc:arrow-flight://localhost:5000;useEncryption=false;useServerPrepStmts=false;";
String sql = "select * from MixedTypeDB.`Table` where OID=?"; // Example SQL query
System.out.println("SQL query: " + sql); // Debugging: Log the query

try (var connection = DriverManager.getConnection(url)) {
ArrowFlightPreparedStatement pstmt = (ArrowFlightPreparedStatement)connection.prepareStatement(sql);
ParameterMetaData metadata = pstmt.getParameterMetaData();
pstmt.setInt(1, 12345); // crashing here

System.out.println("Executing SQL query: " + sql);

try (final ResultSet rs = pstmt.executeQuery()) {
}
} catch (SQLException e) {
e.printStackTrace();
}
}
```

```

org.apache.arrow
flight-sql-jdbc-driver
13.0.0

```

### Component(s)

Java

貢獻指南

開啟貢獻指南

研究方向

從 issue 中所示的 getParameter(int param) 入口點開始,使用 Flight SQL JDBC URL、預備查詢和 setInt(1, 12345),透過 handleSqlStatements() 重現該失敗。追蹤預備語句如何取得其參數清單,並驗證範例查詢接受 ordinal 1,且執行時不會出現超出範圍例外。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java, sql
領域
backend, database
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。