You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/11/09 12:57:52 UTC
[arrow-adbc] branch main updated: refactor(java/driver/jdbc): use upstream JDBC utilities (#167)
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-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 90b89e9 refactor(java/driver/jdbc): use upstream JDBC utilities (#167)
90b89e9 is described below
commit 90b89e9f29b5fe9670b03232f8e967fb747c314c
Author: David Li <li...@gmail.com>
AuthorDate: Wed Nov 9 07:57:47 2022 -0500
refactor(java/driver/jdbc): use upstream JDBC utilities (#167)
Remove the JDBC parameter binder in favor of the one contributed
as part of Arrow 10.0.0.
---
.../adbc/driver/flightsql/FlightSqlStatement.java | 11 +-
java/driver/jdbc-util/pom.xml | 58 ---
.../arrow/adbc/driver/jdbc/util/ColumnBinder.java | 57 ---
.../jdbc/util/ColumnBinderArrowTypeVisitor.java | 170 -------
.../arrow/adbc/driver/jdbc/util/ColumnBinders.java | 202 --------
.../adbc/driver/jdbc/util/JdbcParameterBinder.java | 158 ------
.../driver/jdbc/util/JdbcParameterBinderTest.java | 310 ------------
.../driver/jdbc/util/MockPreparedStatement.java | 531 ---------------------
java/driver/jdbc/pom.xml | 4 -
.../arrow/adbc/driver/jdbc/JdbcBindReader.java | 2 +-
.../arrow/adbc/driver/jdbc/JdbcStatement.java | 2 +-
java/pom.xml | 8 +-
12 files changed, 4 insertions(+), 1509 deletions(-)
diff --git a/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlStatement.java b/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlStatement.java
index 2fadced..70d4dfe 100644
--- a/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlStatement.java
+++ b/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlStatement.java
@@ -19,7 +19,6 @@ package org.apache.arrow.adbc.driver.flightsql;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.google.protobuf.ByteString;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -208,15 +207,7 @@ public class FlightSqlStatement implements AdbcStatement {
throw AdbcException.invalidState("[Flight SQL] Must setSqlQuery() before execute");
}
return execute(
- (preparedStatement) -> {
- // XXX(ARROW-17199): why does this throw SQLException?
- try {
- return preparedStatement.execute();
- } catch (SQLException e) {
- throw FlightSqlDriverUtil.fromSqlException(e);
- }
- },
- (client) -> client.execute(sqlQuery));
+ FlightSqlClient.PreparedStatement::execute, (client) -> client.execute(sqlQuery));
}
@Override
diff --git a/java/driver/jdbc-util/pom.xml b/java/driver/jdbc-util/pom.xml
deleted file mode 100644
index 1385ae6..0000000
--- a/java/driver/jdbc-util/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>arrow-adbc-java-root</artifactId>
- <groupId>org.apache.arrow.adbc</groupId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <artifactId>adbc-driver-jdbc-util</artifactId>
- <packaging>jar</packaging>
- <name>Arrow ADBC Driver JDBC Util</name>
- <description>Utilities for working with Arrow and JDBC.</description>
-
- <dependencies>
- <!-- Arrow -->
- <dependency>
- <groupId>org.apache.arrow</groupId>
- <artifactId>arrow-jdbc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.arrow</groupId>
- <artifactId>arrow-memory-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.arrow</groupId>
- <artifactId>arrow-vector</artifactId>
- </dependency>
-
- <!-- Testing -->
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.arrow.adbc</groupId>
- <artifactId>adbc-driver-validation</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinder.java b/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinder.java
deleted file mode 100644
index 3f64fc9..0000000
--- a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.arrow.adbc.driver.jdbc.util;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import org.apache.arrow.vector.FieldVector;
-import org.apache.arrow.vector.types.pojo.ArrowType;
-import org.apache.arrow.vector.types.pojo.Field;
-
-/** A helper to bind values from an Arrow vector to a JDBC PreparedStatement. */
-@FunctionalInterface
-public interface ColumnBinder {
- /**
- * Bind the given row to the given parameter.
- *
- * @param statement The staement to bind to
- * @param vector The vector to pull data from
- * @param parameterIndex The parameter to bind to
- * @param rowIndex The row to bind
- * @throws SQLException if an error occurs
- */
- void bind(PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException;
-
- /**
- * Get an instance of the default binder for a type.
- *
- * @throws UnsupportedOperationException if the type is not supported.
- */
- static ColumnBinder forType(ArrowType type) {
- return type.accept(new ColumnBinderArrowTypeVisitor(/*nullable=*/ true));
- }
-
- /**
- * Get an instance of the default binder for a type, accounting for nullability.
- *
- * @throws UnsupportedOperationException if the type is not supported.
- */
- static ColumnBinder forField(Field field) {
- return field.getType().accept(new ColumnBinderArrowTypeVisitor(field.isNullable()));
- }
-}
diff --git a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinderArrowTypeVisitor.java b/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinderArrowTypeVisitor.java
deleted file mode 100644
index 976a87b..0000000
--- a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinderArrowTypeVisitor.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.arrow.adbc.driver.jdbc.util;
-
-import org.apache.arrow.vector.types.pojo.ArrowType;
-
-final class ColumnBinderArrowTypeVisitor implements ArrowType.ArrowTypeVisitor<ColumnBinder> {
- private final boolean nullable;
-
- public ColumnBinderArrowTypeVisitor(boolean nullable) {
- this.nullable = nullable;
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Null type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Struct type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.List type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.LargeList type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.FixedSizeList type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Union type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Map type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Int type) {
- switch (type.getBitWidth()) {
- case 8:
- if (type.getIsSigned()) {
- return nullable
- ? ColumnBinders.NullableTinyIntBinder.INSTANCE
- : ColumnBinders.TinyIntBinder.INSTANCE;
- } else {
- throw new UnsupportedOperationException(
- "No column binder implemented for unsigned type " + type);
- }
- case 16:
- if (type.getIsSigned()) {
- return nullable
- ? ColumnBinders.NullableSmallIntBinder.INSTANCE
- : ColumnBinders.SmallIntBinder.INSTANCE;
- } else {
- throw new UnsupportedOperationException(
- "No column binder implemented for unsigned type " + type);
- }
- case 32:
- if (type.getIsSigned()) {
- return nullable
- ? ColumnBinders.NullableIntBinder.INSTANCE
- : ColumnBinders.IntBinder.INSTANCE;
- } else {
- throw new UnsupportedOperationException(
- "No column binder implemented for unsigned type " + type);
- }
- case 64:
- if (type.getIsSigned()) {
- return nullable
- ? ColumnBinders.NullableBigIntBinder.INSTANCE
- : ColumnBinders.BigIntBinder.INSTANCE;
- } else {
- throw new UnsupportedOperationException(
- "No column binder implemented for unsigned type " + type);
- }
- }
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.FloatingPoint type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Utf8 type) {
- return ColumnBinders.NullableVarCharBinder.INSTANCE;
- }
-
- @Override
- public ColumnBinder visit(ArrowType.LargeUtf8 type) {
- return ColumnBinders.NullableLargeVarCharBinder.INSTANCE;
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Binary type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.LargeBinary type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.FixedSizeBinary type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Bool type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Decimal type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Date type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Time type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Timestamp type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Interval type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-
- @Override
- public ColumnBinder visit(ArrowType.Duration type) {
- throw new UnsupportedOperationException("No column binder implemented for type " + type);
- }
-}
diff --git a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinders.java b/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinders.java
deleted file mode 100644
index 2ab5117..0000000
--- a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/ColumnBinders.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.arrow.adbc.driver.jdbc.util;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Types;
-import org.apache.arrow.vector.BigIntVector;
-import org.apache.arrow.vector.FieldVector;
-import org.apache.arrow.vector.IntVector;
-import org.apache.arrow.vector.LargeVarCharVector;
-import org.apache.arrow.vector.SmallIntVector;
-import org.apache.arrow.vector.TinyIntVector;
-import org.apache.arrow.vector.VarCharVector;
-
-/** Column binder implementations. */
-final class ColumnBinders {
- // While tedious to define all of these, this avoids unnecessary boxing/unboxing and limits the
- // call depth compared to trying to be generic with lambdas (hopefully makes inlining easier).
- // We can consider code templating like arrow-vector for maintenance.
-
- // ------------------------------------------------------------
- // Int8
-
- enum NullableTinyIntBinder implements ColumnBinder {
- INSTANCE;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- if (vector.isNull(rowIndex)) {
- statement.setNull(parameterIndex, Types.TINYINT);
- } else {
- statement.setByte(parameterIndex, ((TinyIntVector) vector).get(rowIndex));
- }
- }
- }
-
- enum TinyIntBinder implements ColumnBinder {
- INSTANCE;
-
- private static final long BYTE_WIDTH = 1;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- final byte value = vector.getDataBuffer().getByte(rowIndex * BYTE_WIDTH);
- statement.setByte(parameterIndex, value);
- }
- }
-
- // ------------------------------------------------------------
- // Int16
-
- enum NullableSmallIntBinder implements ColumnBinder {
- INSTANCE;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- if (vector.isNull(rowIndex)) {
- statement.setNull(parameterIndex, Types.SMALLINT);
- } else {
- statement.setShort(parameterIndex, ((SmallIntVector) vector).get(rowIndex));
- }
- }
- }
-
- enum SmallIntBinder implements ColumnBinder {
- INSTANCE;
-
- private static final long BYTE_WIDTH = 2;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- final byte value = vector.getDataBuffer().getByte(rowIndex * BYTE_WIDTH);
- statement.setByte(parameterIndex, value);
- }
- }
-
- // ------------------------------------------------------------
- // Int32
-
- enum NullableIntBinder implements ColumnBinder {
- INSTANCE;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- if (vector.isNull(rowIndex)) {
- statement.setNull(parameterIndex, Types.INTEGER);
- } else {
- statement.setInt(parameterIndex, ((IntVector) vector).get(rowIndex));
- }
- }
- }
-
- enum IntBinder implements ColumnBinder {
- INSTANCE;
-
- private static final long BYTE_WIDTH = 4;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- final int value = vector.getDataBuffer().getInt(rowIndex * BYTE_WIDTH);
- statement.setInt(parameterIndex, value);
- }
- }
-
- // ------------------------------------------------------------
- // Int64
-
- enum NullableBigIntBinder implements ColumnBinder {
- INSTANCE;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- if (vector.isNull(rowIndex)) {
- statement.setNull(parameterIndex, Types.BIGINT);
- } else {
- statement.setLong(parameterIndex, ((BigIntVector) vector).get(rowIndex));
- }
- }
- }
-
- enum BigIntBinder implements ColumnBinder {
- INSTANCE;
-
- private static final long BYTE_WIDTH = 4;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- final long value = vector.getDataBuffer().getLong(rowIndex * BYTE_WIDTH);
- statement.setLong(parameterIndex, value);
- }
- }
-
- // ------------------------------------------------------------
- // String, LargeString
-
- // TODO: we may be able to do this generically via ElementAddressableVector
- // TODO: make this non-singleton so we don't have to allocate when using getDataPointer?
- // TODO: avoid getObject and just use the byte[] directly (or, can we directly get a String from
- // an ArrowBuf?)
- enum NullableVarCharBinder implements ColumnBinder {
- INSTANCE;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- if (vector.isNull(rowIndex)) {
- statement.setNull(parameterIndex, Types.VARCHAR);
- } else {
- statement.setString(
- parameterIndex, ((VarCharVector) vector).getObject(rowIndex).toString());
- }
- }
- }
-
- enum NullableLargeVarCharBinder implements ColumnBinder {
- INSTANCE;
-
- @Override
- public void bind(
- PreparedStatement statement, FieldVector vector, int parameterIndex, int rowIndex)
- throws SQLException {
- if (vector.isNull(rowIndex)) {
- statement.setNull(parameterIndex, Types.VARCHAR);
- } else {
- statement.setString(
- parameterIndex, ((LargeVarCharVector) vector).getObject(rowIndex).toString());
- }
- }
- }
-}
diff --git a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/JdbcParameterBinder.java b/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/JdbcParameterBinder.java
deleted file mode 100644
index f67622a..0000000
--- a/java/driver/jdbc-util/src/main/java/org/apache/arrow/adbc/driver/jdbc/util/JdbcParameterBinder.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.arrow.adbc.driver.jdbc.util;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.arrow.util.Preconditions;
-import org.apache.arrow.vector.FieldVector;
-import org.apache.arrow.vector.VectorSchemaRoot;
-
-/**
- * Helper to bind values from an Arrow {@link VectorSchemaRoot} to a JDBC {@link PreparedStatement}.
- */
-public class JdbcParameterBinder {
- private final PreparedStatement statement;
- private final VectorSchemaRoot root;
- private final ColumnBinder[] binders;
- private final int[] parameterIndices;
- private final int[] columnIndices;
- private int nextRowIndex;
-
- JdbcParameterBinder(
- final PreparedStatement statement,
- final VectorSchemaRoot root,
- final ColumnBinder[] binders,
- int[] parameterIndices,
- int[] columnIndices) {
- Preconditions.checkArgument(
- parameterIndices.length == columnIndices.length,
- "Length of parameter indices and column indices must match");
- this.statement = statement;
- this.root = root;
- this.binders = binders;
- this.parameterIndices = parameterIndices;
- this.columnIndices = columnIndices;
- this.nextRowIndex = 0;
- }
-
- /**
- * Create a builder.
- *
- * @param statement The statement to bind to.
- * @param root The root to pull data from.
- */
- public static Builder builder(final PreparedStatement statement, final VectorSchemaRoot root) {
- return new Builder(statement, root);
- }
-
- /** Reset the binder (so the root can be updated with new data). */
- public void reset() {
- nextRowIndex = 0;
- }
-
- /**
- * Bind the next row to the statement.
- *
- * @return true if a row was bound, false if rows were exhausted
- */
- public boolean next() throws SQLException {
- if (nextRowIndex >= root.getRowCount()) {
- return false;
- }
- for (int i = 0; i < parameterIndices.length; i++) {
- final int parameterIndex = parameterIndices[i];
- final int columnIndex = columnIndices[i];
- final FieldVector vector = root.getVector(columnIndex);
- binders[i].bind(statement, vector, parameterIndex, nextRowIndex);
- }
- nextRowIndex++;
- return true;
- }
-
- private static class Binding {
- int columnIndex;
- ColumnBinder binder;
-
- Binding(int columnIndex, ColumnBinder binder) {
- this.columnIndex = columnIndex;
- this.binder = binder;
- }
- }
-
- /** A builder for a {@link JdbcParameterBinder}. */
- public static class Builder {
- private final PreparedStatement statement;
- private final VectorSchemaRoot root;
- // Parameter index -> (Column Index, Binder)
- private final Map<Integer, Binding> bindings;
-
- Builder(PreparedStatement statement, VectorSchemaRoot root) {
- this.statement = statement;
- this.root = root;
- this.bindings = new HashMap<>();
- }
-
- /** Bind each column to the corresponding parameter in order. */
- public Builder bindAll() {
- for (int i = 0; i < root.getFieldVectors().size(); i++) {
- bind(/*parameterIndex=*/ i + 1, /*columnIndex=*/ i);
- }
- return this;
- }
-
- /** Bind the given parameter to the given column using the default binder. */
- public Builder bind(int parameterIndex, int columnIndex) {
- return bind(
- parameterIndex,
- columnIndex,
- ColumnBinder.forField(root.getVector(columnIndex).getField()));
- }
-
- /** Bind the given parameter to the given column using the given binder. */
- public Builder bind(int parameterIndex, int columnIndex, ColumnBinder binder) {
- Preconditions.checkArgument(
- parameterIndex > 0, "parameterIndex %d must be positive", parameterIndex);
- bindings.put(parameterIndex, new Binding(columnIndex, binder));
- return this;
- }
-
- /** Build the binder. */
- public JdbcParameterBinder build() {
- ColumnBinder[] binders = new ColumnBinder[bindings.size()];
- int[] parameterIndices = new int[bindings.size()];
- int[] columnIndices = new int[bindings.size()];
- final Stream<Map.Entry<Integer, Binding>> sortedBindings =
- bindings.entrySet().stream()
- .sorted(Comparator.comparingInt(entry -> entry.getValue().columnIndex));
- int index = 0;
- for (Map.Entry<Integer, Binding> entry :
- (Iterable<Map.Entry<Integer, Binding>>) sortedBindings::iterator) {
- binders[index] = entry.getValue().binder;
- parameterIndices[index] = entry.getKey();
- columnIndices[index] = entry.getValue().columnIndex;
- index++;
- }
- return new JdbcParameterBinder(statement, root, binders, parameterIndices, columnIndices);
- }
- }
-}
diff --git a/java/driver/jdbc-util/src/test/java/org/apache/arrow/adbc/driver/jdbc/util/JdbcParameterBinderTest.java b/java/driver/jdbc-util/src/test/java/org/apache/arrow/adbc/driver/jdbc/util/JdbcParameterBinderTest.java
deleted file mode 100644
index f08750c..0000000
--- a/java/driver/jdbc-util/src/test/java/org/apache/arrow/adbc/driver/jdbc/util/JdbcParameterBinderTest.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.arrow.adbc.driver.jdbc.util;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.Collections;
-import org.apache.arrow.memory.BufferAllocator;
-import org.apache.arrow.memory.RootAllocator;
-import org.apache.arrow.vector.BigIntVector;
-import org.apache.arrow.vector.IntVector;
-import org.apache.arrow.vector.SmallIntVector;
-import org.apache.arrow.vector.TinyIntVector;
-import org.apache.arrow.vector.VectorSchemaRoot;
-import org.apache.arrow.vector.types.pojo.ArrowType;
-import org.apache.arrow.vector.types.pojo.Field;
-import org.apache.arrow.vector.types.pojo.Schema;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class JdbcParameterBinderTest {
- BufferAllocator allocator;
-
- @BeforeEach
- void beforeEach() {
- allocator = new RootAllocator();
- }
-
- @AfterEach
- void afterEach() {
- allocator.close();
- }
-
- @Test
- void bindOrder() throws SQLException {
- final Schema schema =
- new Schema(
- Arrays.asList(
- Field.nullable("ints0", new ArrowType.Int(32, true)),
- Field.nullable("ints1", new ArrowType.Int(32, true)),
- Field.nullable("ints2", new ArrowType.Int(32, true))));
- try (final MockPreparedStatement statement = new MockPreparedStatement();
- final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
- final JdbcParameterBinder binder =
- JdbcParameterBinder.builder(statement, root)
- .bind(/*paramIndex=*/ 1, /*colIndex=*/ 2)
- .bind(/*paramIndex=*/ 2, /*colIndex=*/ 0)
- .build();
- assertThat(binder.next()).isFalse();
-
- final IntVector ints0 = (IntVector) root.getVector(0);
- final IntVector ints1 = (IntVector) root.getVector(1);
- final IntVector ints2 = (IntVector) root.getVector(2);
- ints0.setSafe(0, 4);
- ints0.setNull(1);
- ints1.setNull(0);
- ints1.setSafe(1, -8);
- ints2.setNull(0);
- ints2.setSafe(1, 12);
- root.setRowCount(2);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.INTEGER);
- assertThat(statement.getParamValue(2)).isInstanceOf(Integer.class).isEqualTo(4);
- assertThat(statement.getParam(3)).isNull();
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isInstanceOf(Integer.class).isEqualTo(12);
- assertThat(statement.getParamValue(2)).isNull();
- assertThat(statement.getParamType(2)).isEqualTo(Types.INTEGER);
- assertThat(statement.getParam(3)).isNull();
- assertThat(binder.next()).isFalse();
-
- binder.reset();
-
- ints0.setNull(0);
- ints0.setSafe(1, -2);
- ints2.setNull(0);
- ints2.setSafe(1, 6);
- root.setRowCount(2);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.INTEGER);
- assertThat(statement.getParamValue(2)).isNull();
- assertThat(statement.getParamType(2)).isEqualTo(Types.INTEGER);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isInstanceOf(Integer.class).isEqualTo(6);
- assertThat(statement.getParamValue(2)).isInstanceOf(Integer.class).isEqualTo(-2);
- assertThat(statement.getParam(3)).isNull();
- assertThat(binder.next()).isFalse();
- }
- }
-
- @Test
- void customBinder() throws SQLException {
- final Schema schema =
- new Schema(Collections.singletonList(Field.nullable("ints0", new ArrowType.Int(32, true))));
-
- try (final MockPreparedStatement statement = new MockPreparedStatement();
- final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
- final JdbcParameterBinder binder =
- JdbcParameterBinder.builder(statement, root)
- .bind(
- /*paramIndex=*/ 1,
- /*colIndex=*/ 0,
- (statement1, vector, parameterIndex, rowIndex) -> {
- Integer value = ((IntVector) vector).getObject(rowIndex);
- if (value == null) {
- statement1.setString(parameterIndex, "null");
- } else {
- statement1.setString(parameterIndex, Integer.toString(value));
- }
- })
- .build();
- assertThat(binder.next()).isFalse();
-
- final IntVector ints = (IntVector) root.getVector(0);
- ints.setSafe(0, 4);
- ints.setNull(1);
-
- root.setRowCount(2);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo("4");
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo("null");
- assertThat(binder.next()).isFalse();
- }
- }
-
- @Test
- void int8() throws SQLException {
- final Schema schema =
- new Schema(Collections.singletonList(Field.nullable("ints", new ArrowType.Int(8, true))));
- try (final MockPreparedStatement statement = new MockPreparedStatement();
- final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
- final JdbcParameterBinder binder =
- JdbcParameterBinder.builder(statement, root).bindAll().build();
- assertThat(binder.next()).isFalse();
-
- final TinyIntVector ints = (TinyIntVector) root.getVector(0);
- ints.setSafe(0, Byte.MIN_VALUE);
- ints.setSafe(1, Byte.MAX_VALUE);
- ints.setNull(2);
- root.setRowCount(3);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Byte.MIN_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Byte.MAX_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.TINYINT);
- assertThat(binder.next()).isFalse();
-
- binder.reset();
-
- ints.setNull(0);
- ints.setSafe(1, 2);
- root.setRowCount(2);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.TINYINT);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo((byte) 2);
- assertThat(binder.next()).isFalse();
- }
- }
-
- @Test
- void int16() throws SQLException {
- final Schema schema =
- new Schema(Collections.singletonList(Field.nullable("ints", new ArrowType.Int(16, true))));
- try (final MockPreparedStatement statement = new MockPreparedStatement();
- final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
- final JdbcParameterBinder binder =
- JdbcParameterBinder.builder(statement, root).bindAll().build();
- assertThat(binder.next()).isFalse();
-
- final SmallIntVector ints = (SmallIntVector) root.getVector(0);
- ints.setSafe(0, Short.MIN_VALUE);
- ints.setSafe(1, Short.MAX_VALUE);
- ints.setNull(2);
- root.setRowCount(3);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Short.MIN_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Short.MAX_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.SMALLINT);
- assertThat(binder.next()).isFalse();
-
- binder.reset();
-
- ints.setNull(0);
- ints.setSafe(1, 2);
- root.setRowCount(2);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.SMALLINT);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo((short) 2);
- assertThat(binder.next()).isFalse();
- }
- }
-
- @Test
- void int32() throws SQLException {
- final Schema schema =
- new Schema(Collections.singletonList(Field.nullable("ints", new ArrowType.Int(32, true))));
- try (final MockPreparedStatement statement = new MockPreparedStatement();
- final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
- final JdbcParameterBinder binder =
- JdbcParameterBinder.builder(statement, root).bindAll().build();
- assertThat(binder.next()).isFalse();
-
- final IntVector ints = (IntVector) root.getVector(0);
- ints.setSafe(0, Integer.MIN_VALUE);
- ints.setSafe(1, Integer.MAX_VALUE);
- ints.setNull(2);
- root.setRowCount(3);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Integer.MIN_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Integer.MAX_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.INTEGER);
- assertThat(binder.next()).isFalse();
-
- binder.reset();
-
- ints.setNull(0);
- ints.setSafe(1, 2);
- root.setRowCount(2);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.INTEGER);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(2);
- assertThat(binder.next()).isFalse();
- }
- }
-
- @Test
- void int64() throws SQLException {
- final Schema schema =
- new Schema(Collections.singletonList(Field.nullable("ints", new ArrowType.Int(64, true))));
- try (final MockPreparedStatement statement = new MockPreparedStatement();
- final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
- final JdbcParameterBinder binder =
- JdbcParameterBinder.builder(statement, root).bindAll().build();
- assertThat(binder.next()).isFalse();
-
- final BigIntVector ints = (BigIntVector) root.getVector(0);
- ints.setSafe(0, Long.MIN_VALUE);
- ints.setSafe(1, Long.MAX_VALUE);
- ints.setNull(2);
- root.setRowCount(3);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Long.MIN_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(Long.MAX_VALUE);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.BIGINT);
- assertThat(binder.next()).isFalse();
-
- binder.reset();
-
- ints.setNull(0);
- ints.setSafe(1, 2);
- root.setRowCount(2);
-
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isNull();
- assertThat(statement.getParamType(1)).isEqualTo(Types.BIGINT);
- assertThat(binder.next()).isTrue();
- assertThat(statement.getParamValue(1)).isEqualTo(2L);
- assertThat(binder.next()).isFalse();
- }
- }
-}
diff --git a/java/driver/jdbc-util/src/test/java/org/apache/arrow/adbc/driver/jdbc/util/MockPreparedStatement.java b/java/driver/jdbc-util/src/test/java/org/apache/arrow/adbc/driver/jdbc/util/MockPreparedStatement.java
deleted file mode 100644
index d456f38..0000000
--- a/java/driver/jdbc-util/src/test/java/org/apache/arrow/adbc/driver/jdbc/util/MockPreparedStatement.java
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.arrow.adbc.driver.jdbc.util;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Map;
-
-/** A PreparedStatement that just stores parameters set on it. */
-class MockPreparedStatement implements PreparedStatement {
- static class ParameterHolder {
- final Object value;
- final Integer sqlType;
-
- ParameterHolder(Object value, Integer sqlType) {
- this.value = value;
- this.sqlType = sqlType;
- }
- }
-
- private final Map<Integer, ParameterHolder> parameters;
-
- MockPreparedStatement() {
- parameters = new HashMap<>();
- }
-
- ParameterHolder getParam(int index) {
- return parameters.get(index);
- }
-
- Object getParamValue(int index) {
- return parameters.get(index).value;
- }
-
- Integer getParamType(int index) {
- return parameters.get(index).sqlType;
- }
-
- @Override
- public ResultSet executeQuery() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int executeUpdate() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setNull(int parameterIndex, int sqlType) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(null, sqlType));
- }
-
- @Override
- public void setBoolean(int parameterIndex, boolean x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setByte(int parameterIndex, byte x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setShort(int parameterIndex, short x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setInt(int parameterIndex, int x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setLong(int parameterIndex, long x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setFloat(int parameterIndex, float x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setDouble(int parameterIndex, double x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setString(int parameterIndex, String x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setBytes(int parameterIndex, byte[] x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setDate(int parameterIndex, Date x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setTime(int parameterIndex, Time x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- @Deprecated
- public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void clearParameters() throws SQLException {
- parameters.clear();
- }
-
- @Override
- public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, targetSqlType));
- }
-
- @Override
- public void setObject(int parameterIndex, Object x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public boolean execute() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void addBatch() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setCharacterStream(int parameterIndex, Reader reader, int length)
- throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(reader, null));
- }
-
- @Override
- public void setRef(int parameterIndex, Ref x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setBlob(int parameterIndex, Blob x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setClob(int parameterIndex, Clob x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setArray(int parameterIndex, Array x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public ResultSetMetaData getMetaData() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {}
-
- @Override
- public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {}
-
- @Override
- public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {}
-
- @Override
- public void setURL(int parameterIndex, URL x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public ParameterMetaData getParameterMetaData() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setRowId(int parameterIndex, RowId x) throws SQLException {
- parameters.put(parameterIndex, new ParameterHolder(x, null));
- }
-
- @Override
- public void setNString(int parameterIndex, String value) throws SQLException {}
-
- @Override
- public void setNCharacterStream(int parameterIndex, Reader value, long length)
- throws SQLException {}
-
- @Override
- public void setNClob(int parameterIndex, NClob value) throws SQLException {}
-
- @Override
- public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {}
-
- @Override
- public void setBlob(int parameterIndex, InputStream inputStream, long length)
- throws SQLException {}
-
- @Override
- public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {}
-
- @Override
- public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {}
-
- @Override
- public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)
- throws SQLException {}
-
- @Override
- public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {}
-
- @Override
- public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {}
-
- @Override
- public void setCharacterStream(int parameterIndex, Reader reader, long length)
- throws SQLException {}
-
- @Override
- public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {}
-
- @Override
- public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {}
-
- @Override
- public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {}
-
- @Override
- public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {}
-
- @Override
- public void setClob(int parameterIndex, Reader reader) throws SQLException {}
-
- @Override
- public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {}
-
- @Override
- public void setNClob(int parameterIndex, Reader reader) throws SQLException {}
-
- @Override
- public ResultSet executeQuery(String sql) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int executeUpdate(String sql) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void close() throws SQLException {}
-
- @Override
- public int getMaxFieldSize() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setMaxFieldSize(int max) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getMaxRows() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setMaxRows(int max) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setEscapeProcessing(boolean enable) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getQueryTimeout() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setQueryTimeout(int seconds) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void cancel() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public SQLWarning getWarnings() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void clearWarnings() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setCursorName(String name) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean execute(String sql) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ResultSet getResultSet() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getUpdateCount() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean getMoreResults() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setFetchDirection(int direction) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getFetchDirection() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setFetchSize(int rows) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getFetchSize() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getResultSetConcurrency() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getResultSetType() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void addBatch(String sql) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void clearBatch() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int[] executeBatch() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Connection getConnection() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean getMoreResults(int current) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ResultSet getGeneratedKeys() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int executeUpdate(String sql, String[] columnNames) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean execute(String sql, int[] columnIndexes) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean execute(String sql, String[] columnNames) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getResultSetHoldability() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isClosed() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setPoolable(boolean poolable) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isPoolable() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void closeOnCompletion() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isCloseOnCompletion() throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public <T> T unwrap(Class<T> iface) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isWrapperFor(Class<?> iface) throws SQLException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/java/driver/jdbc/pom.xml b/java/driver/jdbc/pom.xml
index 4b8051c..8a3d1c1 100644
--- a/java/driver/jdbc/pom.xml
+++ b/java/driver/jdbc/pom.xml
@@ -42,10 +42,6 @@
<groupId>org.apache.arrow.adbc</groupId>
<artifactId>adbc-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.arrow.adbc</groupId>
- <artifactId>adbc-driver-jdbc-util</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.arrow.adbc</groupId>
<artifactId>adbc-driver-manager</artifactId>
diff --git a/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcBindReader.java b/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcBindReader.java
index da32f5d..9b314d5 100644
--- a/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcBindReader.java
+++ b/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcBindReader.java
@@ -22,9 +22,9 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.arrow.adapter.jdbc.ArrowVectorIterator;
+import org.apache.arrow.adapter.jdbc.JdbcParameterBinder;
import org.apache.arrow.adapter.jdbc.JdbcToArrow;
import org.apache.arrow.adapter.jdbc.JdbcToArrowUtils;
-import org.apache.arrow.adbc.driver.jdbc.util.JdbcParameterBinder;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.VectorUnloader;
diff --git a/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcStatement.java b/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcStatement.java
index ab63cf7..ba3f30e 100644
--- a/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcStatement.java
+++ b/java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcStatement.java
@@ -29,12 +29,12 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.LongStream;
import org.apache.arrow.adapter.jdbc.JdbcFieldInfo;
+import org.apache.arrow.adapter.jdbc.JdbcParameterBinder;
import org.apache.arrow.adapter.jdbc.JdbcToArrowUtils;
import org.apache.arrow.adbc.core.AdbcException;
import org.apache.arrow.adbc.core.AdbcStatement;
import org.apache.arrow.adbc.core.AdbcStatusCode;
import org.apache.arrow.adbc.core.BulkIngestMode;
-import org.apache.arrow.adbc.driver.jdbc.util.JdbcParameterBinder;
import org.apache.arrow.adbc.sql.SqlQuirks;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.util.AutoCloseables;
diff --git a/java/pom.xml b/java/pom.xml
index 9383b2f..97a8968 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -28,7 +28,7 @@
<url>https://arrow.apache.org/</url>
<properties>
- <dep.arrow.version>9.0.0</dep.arrow.version>
+ <dep.arrow.version>10.0.0</dep.arrow.version>
<adbc.version>1.0.0-SNAPSHOT</adbc.version>
</properties>
@@ -71,7 +71,6 @@
<module>driver/flight-sql</module>
<module>driver/flight-sql-validation</module>
<module>driver/jdbc</module>
- <module>driver/jdbc-util</module>
<module>driver/jdbc-validation-derby</module>
<module>driver/jdbc-validation-postgresql</module>
<module>driver/validation</module>
@@ -124,11 +123,6 @@
<artifactId>adbc-driver-jdbc</artifactId>
<version>${adbc.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.arrow.adbc</groupId>
- <artifactId>adbc-driver-jdbc-util</artifactId>
- <version>${adbc.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.arrow.adbc</groupId>
<artifactId>adbc-driver-validation</artifactId>