GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — bigquery-jdbc: Storage Write batch throws NPE for setObject(index, null) · Issue #14066 · googleapis/google-cloud-java Closed DescriptionIssue DetailsWith Google BigQuery JDBC driver 1.2.0, a batch insert using the BigQuery Storage Write API throws a NullPointerException when a parameter is bound using PreparedStatement.setObject(index, null). The issue was reproduced using a nullable STRING column. The expected behaviour is for the driver to insert SQL The equivalent batch succeeds when I searched the existing issues but did not find one describing this failure. Environment
GCP environment:
DependenciesRelevant library versions:
ReproducerSteps to reproduce
CREATE TABLE `<PROJECT_ID>.<DATASET_ID>.jdbc_null_repro` (
value STRING
);
import com.google.cloud.bigquery.jdbc.BigQueryDriver; import java.sql.Connection; import java.sql.PreparedStatement; import java.util.Properties; public final class BigQueryNullBatchReproducer { private static final String PROJECT_ID = "<PROJECT_ID>"; private static final String DATASET_ID = "<DATASET_ID>"; private static final String SERVICE_ACCOUNT_JSON = "<SERVICE_ACCOUNT_JSON_PATH>"; public static void main(String[] args) throws Exception { String jdbcUrl = "jdbc:bigquery://https://bigquery.googleapis.com:443" + ";ProjectId=" + PROJECT_ID; Properties properties = new Properties(); properties.setProperty("OAuthType", "0"); properties.setProperty("OAuthPvtKeyPath", SERVICE_ACCOUNT_JSON); properties.setProperty("EnableWriteAPI", "true"); properties.setProperty("SWA_ActivationRowCount", "1"); String sql = "INSERT INTO `" + PROJECT_ID + "." + DATASET_ID + ".jdbc_null_repro` (value) VALUES (?)"; BigQueryDriver driver = new BigQueryDriver(); try (Connection connection = driver.connect(jdbcUrl, properties); PreparedStatement statement = connection.prepareStatement(sql)) { statement.setObject(1, null); statement.addBatch(); statement.executeBatch(); } } }
Expected result: one row containing SQL Actual result: the Storage Write API path throws a Logs and Stack TraceUnrelated SLF4J and gRPC initialization messages have been omitted. Behavior
The exception appears to originate from the Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |