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

yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


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

commit aa8dc4fab7e272fcb9f2f3e38ae5f4b771fcae99
Author: Yi Hu <[email protected]>
AuthorDate: Wed Jan 18 17:13:13 2023 -0500

    Set maxConnections optional in incoming schema for JdbcSchemaIOProvider 
(#25062)
---
 .../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;

Reply via email to