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

pabloem 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 412a593  [BEAM-8033] Throwing an error if a dataSourceProviderFn is 
defined twice in a transform
     new 54f02d8  Merge pull request #15963 from [BEAM-8033] Throwing an error 
if a dataSourceProviderFn is defined twice
412a593 is described below

commit 412a593b4fb02fdb92ef9f15bebcb60cbe0ca605
Author: Pablo Estrada <[email protected]>
AuthorDate: Thu Nov 11 22:45:53 2021 -0800

    [BEAM-8033] Throwing an error if a dataSourceProviderFn is defined twice in 
a transform
---
 .../io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java 
b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
index c43b552..83f620f 100644
--- a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
+++ b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
@@ -848,6 +848,11 @@ public class JdbcIO {
 
     public ReadAll<ParameterT, OutputT> withDataSourceProviderFn(
         SerializableFunction<Void, DataSource> dataSourceProviderFn) {
+      if (getDataSourceProviderFn() != null) {
+        throw new IllegalArgumentException(
+            "A dataSourceConfiguration or dataSourceProviderFn has "
+                + "already been provided, and does not need to be provided 
again.");
+      }
       return toBuilder().setDataSourceProviderFn(dataSourceProviderFn).build();
     }
 

Reply via email to