You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by jo...@apache.org on 2023/01/20 14:51:40 UTC

[beam] branch release-2.45.0 updated: Set maxConnections optional in incoming schema for JdbcSchemaIOProvider (#25062) (#25066)

This is an automated email from the ASF dual-hosted git repository.

johncasey pushed a commit to branch release-2.45.0
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/release-2.45.0 by this push:
     new dbc10db9b66 Set maxConnections optional in incoming schema for JdbcSchemaIOProvider (#25062) (#25066)
dbc10db9b66 is described below

commit dbc10db9b66e528137df0a166fbdbb4c7511cb30
Author: Yi Hu <ya...@google.com>
AuthorDate: Fri Jan 20 09:51:33 2023 -0500

    Set maxConnections optional in incoming schema for JdbcSchemaIOProvider (#25062) (#25066)
---
 .../java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java
index 5076f4a1029..77ec4082f6f 100644
--- a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java
+++ b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java
@@ -175,9 +175,11 @@ public class JdbcSchemaIOProvider implements SchemaIOProvider {
         dataSourceConfiguration = dataSourceConfiguration.withConnectionInitSqls(initSqls);
       }
 
-      @Nullable Integer maxConnections = config.getInt32("maxConnections");
-      if (maxConnections != null) {
-        dataSourceConfiguration = dataSourceConfiguration.withMaxConnections(maxConnections);
+      if (config.getSchema().hasField("maxConnections")) {
+        @Nullable Integer maxConnections = config.getInt32("maxConnections");
+        if (maxConnections != null) {
+          dataSourceConfiguration = dataSourceConfiguration.withMaxConnections(maxConnections);
+        }
       }
 
       return dataSourceConfiguration;