[Java][FlightRPC] Flight SQL JDBC driver parameter getting an exception: parameter ordinal 1 out of range
- Ngôn ngữ chính
- Java
- Star
- 94
- Fork
- 152
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
### 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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với điểm vào getParameter(int param) được hiển thị trong issue và tái hiện lỗi thông qua handleSqlStatements() bằng cách sử dụng URL JDBC của Flight SQL, truy vấn đã chuẩn bị và setInt(1, 12345). Theo dõi cách prepared statement lấy danh sách tham số của nó và xác minh rằng truy vấn ví dụ chấp nhận ordinal 1 và thực thi mà không gặp ngoại lệ ngoài phạm vi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, sql
- Lĩnh vực
- backend, database
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100