This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-java.git
The following commit(s) were added to refs/heads/main by this push:
new 9cfa6ffc GH-848: TypedValue should be treated as Nullable in bind
function in AvaticaParameterBinder (#849)
9cfa6ffc is described below
commit 9cfa6ffc314e148afd196a89f2d5b12ec35c1bc2
Author: XenoAmess <[email protected]>
AuthorDate: Fri Oct 3 16:06:40 2025 +0800
GH-848: TypedValue should be treated as Nullable in bind function in
AvaticaParameterBinder (#849)
## What's Changed
Closes #848.
---
.../org/apache/arrow/driver/jdbc/utils/AvaticaParameterBinder.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/AvaticaParameterBinder.java
b/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/AvaticaParameterBinder.java
index 4c2a9b86..0fd99de5 100644
---
a/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/AvaticaParameterBinder.java
+++
b/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/AvaticaParameterBinder.java
@@ -44,6 +44,7 @@ import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.types.pojo.ArrowType;
import org.apache.calcite.avatica.remote.TypedValue;
+import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Convert Avatica PreparedStatement parameters from a list of TypedValue to
Arrow and bind them to
@@ -108,9 +109,9 @@ public class AvaticaParameterBinder {
* @param typedValue TypedValue to bind to the vector.
* @param index Vector index to bind the value at.
*/
- private void bind(FieldVector vector, TypedValue typedValue, int index) {
+ private void bind(FieldVector vector, @Nullable TypedValue typedValue, int
index) {
try {
- if (typedValue.value == null) {
+ if (typedValue == null || typedValue.value == null) {
if (vector.getField().isNullable()) {
vector.setNull(index);
} else {
@@ -127,7 +128,7 @@ public class AvaticaParameterBinder {
throw new UnsupportedOperationException(
String.format(
"Binding value of type %s is not yet supported for expected
Arrow type %s",
- typedValue.type, vector.getField().getType()));
+ typedValue == null ? "null" : typedValue.type,
vector.getField().getType()));
}
}