You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "goutamadwant (via GitHub)" <gi...@apache.org> on 2026/09/13 23:05:54 UTC

[PR] [Feature][Connector-V2] Support OpenMLDB multi-table source [seatunnel]

goutamadwant opened a new pull request, #12303:
URL: https://github.com/apache/seatunnel/pull/12303

   ### Purpose of this pull request
   
   Related to #10425, covering the OpenMldb source only.
   
   Add multi-table reads using the common `tables_configs` option. Each query declares its result schema and output table identity and can override the source database. Connection settings remain shared.
   
   The reader changes also address correctness problems encountered while validating this path: SQL NULL handling, nullable metadata, reused row arrays, shared executor ownership, and cluster queries taking the offline-job execution path.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes.
   
   Before, one source accepted one root-level `sql` query and used the SDK's input-schema discovery. Separate queries with different result schemas required separate source configurations.
   
   After, one source can read multiple queries sequentially through `tables_configs`:
   
   - Each entry requires `sql`, a unique `schema.table`, and non-empty `schema.fields`; `database` is optional per entry.
   - Result columns are matched to configured field names, including SQL aliases, case-sensitively. Incorrect names, counts, or types fail the read.
   - Rows carry their output table identity. Batch completion is reported only after all queries succeed, including empty results.
   - SQL NULL values remain null for all supported types, and closing one reader does not close another reader's connection.
   - Cluster reads query online table rows directly instead of submitting an offline job.
   
   Existing root-level `sql` configurations remain supported. Their input-schema and positional-mapping limitations are documented. No connector options are removed, connection defaults are unchanged, and the SDK remains at 0.6.3.
   
   This does not add parallelism, CDC, exactly-once delivery, or a consistent snapshot across tables. Streaming mode continues to repeat the configured queries and can emit duplicates.
   
   English and Chinese source documentation include configuration examples and validation rules.
   
   ### How was this patch tested?
   
   - 29 connector unit tests passed on both Java 8 and Java 11.
   - The Java 11 connector dependency reactor passed `verify`: 506 tests, no failures, errors, or skipped tests.
   
   ```shell
   ./mvnw -o -pl seatunnel-connectors-v2/connector-openmldb -am verify
   ```
   
   - Five added integration tests passed against OpenMLDB 0.6.3 in each combination of Java 8/11 and standalone/cluster mode: 20 successful test executions. These were run through JUnit Platform in a compatible Linux amd64 container against real servers, separately from Maven verification.
   - Coverage includes different databases and schemas, reordered aliases, all supported nullable types, zero/false/empty-string values, empty results, reader isolation, query failures, and completion behavior.
   - The integration tests also verify 1,101 complete, unique rows, using four partitions in cluster mode.
   
   `OpenMldbSourceIT` is opt-in with `-Dopenmldb.integration=true`. Its class documentation lists the standalone and ZooKeeper connection properties. It requires a disposable server and a Linux amd64 runtime compatible with the pinned SDK's native library.
   
   Zeta/Flink/Spark engine E2E validation remains pending. The real-server connector tests above do not replace that matrix; this change should remain draft while those checks are completed.
   
   ### Check list
   
   - [x] License notice reviewed: no new dependencies or JAR binaries.
   - [x] English and Chinese connector documentation updated.
   - [x] Compatibility reviewed: no configuration migration required; reader behavior corrections are described above.
   - [x] Existing connector registration reviewed: plugin mapping, distribution configuration, CI labels, and plugin configuration require no changes.
   - [x] Unit tests and opt-in real-server connector integration tests added.
   - [ ] Engine E2E testcase and Zeta/Flink/Spark validation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Support OpenMLDB multi-table source [seatunnel]

Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #12303:
URL: https://github.com/apache/seatunnel/pull/12303#issuecomment-5673467332

   @DanielLeens Update in 1e436ea42:
   
   Renamed the opt-in integration test to `TestOpenMldbSourceIT` to satisfy the repository naming rule, without changing its gate or behavior. The naming check and 29 module tests pass; the live integration test remains intentionally skipped. Fresh CI has been triggered. The opt-in reproduction command should now use the new class name; live database and engine E2E verification remain separate.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Support OpenMLDB multi-table source [seatunnel]

Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on code in PR #12303:
URL: https://github.com/apache/seatunnel/pull/12303#discussion_r4002299435


##########
seatunnel-connectors-v2/connector-openmldb/src/main/java/org/apache/seatunnel/connectors/seatunnel/openmldb/source/OpenMldbReadClient.java:
##########
@@ -0,0 +1,209 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.openmldb.source;
+
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.api.table.type.SqlType;
+import org.apache.seatunnel.connectors.seatunnel.openmldb.config.OpenMldbParameters;
+import org.apache.seatunnel.connectors.seatunnel.openmldb.config.OpenMldbSqlExecutor;
+
+import com._4paradigm.openmldb.DataType;
+import com._4paradigm.openmldb.Date;
+import com._4paradigm.openmldb.ResultSet;
+import com._4paradigm.openmldb.SQLRouter;
+import com._4paradigm.openmldb.Schema;
+import com._4paradigm.openmldb.Status;
+import com._4paradigm.openmldb.sdk.SqlException;
+
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+import java.util.HashMap;
+import java.util.Map;
+
+/** Owns the native resources needed to read nullable query results with SDK 0.6.3. */
+class OpenMldbReadClient implements AutoCloseable {
+    private SQLRouter router;
+
+    OpenMldbReadClient(OpenMldbParameters parameters) throws SqlException {
+        router = OpenMldbSqlExecutor.createReader(parameters);
+    }
+
+    synchronized Query execute(
+            String database, String sql, SeaTunnelRowType rowType, boolean matchByName)
+            throws SQLException {
+        if (router == null) {
+            throw new SQLException("OpenMldb reader is closed");
+        }
+        Status status = new Status();
+        ResultSet result = null;
+        try {
+            // Query the online tables directly; ExecuteSQL can submit an offline job in cluster
+            // mode.
+            result = router.ExecuteSQLParameterized(database, sql, null, status);

Review Comment:
   `ExecuteSQLParameterized` uses OpenMLDB's batch-query path. In the pinned 0.6.3 server, `TabletImpl::ProcessQuery` truncates output after `scan_max_bytes_size`—2 MiB by default—but returns `kOk`. This code therefore accepts a partial result, and the bounded reader subsequently signals successful end-of-input, silently losing rows for ordinary query results above 2 MiB. The 1,101-row integration case remains below that byte limit. Please use a path that can exhaust or paginate the result, or otherwise prevent a truncated response from being reported as complete.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Support OpenMLDB multi-table source [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12303:
URL: https://github.com/apache/seatunnel/pull/12303


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Connector-V2] Support OpenMLDB multi-table source [seatunnel]

Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on code in PR #12303:
URL: https://github.com/apache/seatunnel/pull/12303#discussion_r4002299435


##########
seatunnel-connectors-v2/connector-openmldb/src/main/java/org/apache/seatunnel/connectors/seatunnel/openmldb/source/OpenMldbReadClient.java:
##########
@@ -0,0 +1,209 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.openmldb.source;
+
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.api.table.type.SqlType;
+import org.apache.seatunnel.connectors.seatunnel.openmldb.config.OpenMldbParameters;
+import org.apache.seatunnel.connectors.seatunnel.openmldb.config.OpenMldbSqlExecutor;
+
+import com._4paradigm.openmldb.DataType;
+import com._4paradigm.openmldb.Date;
+import com._4paradigm.openmldb.ResultSet;
+import com._4paradigm.openmldb.SQLRouter;
+import com._4paradigm.openmldb.Schema;
+import com._4paradigm.openmldb.Status;
+import com._4paradigm.openmldb.sdk.SqlException;
+
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+import java.util.HashMap;
+import java.util.Map;
+
+/** Owns the native resources needed to read nullable query results with SDK 0.6.3. */
+class OpenMldbReadClient implements AutoCloseable {
+    private SQLRouter router;
+
+    OpenMldbReadClient(OpenMldbParameters parameters) throws SqlException {
+        router = OpenMldbSqlExecutor.createReader(parameters);
+    }
+
+    synchronized Query execute(
+            String database, String sql, SeaTunnelRowType rowType, boolean matchByName)
+            throws SQLException {
+        if (router == null) {
+            throw new SQLException("OpenMldb reader is closed");
+        }
+        Status status = new Status();
+        ResultSet result = null;
+        try {
+            // Query the online tables directly; ExecuteSQL can submit an offline job in cluster
+            // mode.
+            result = router.ExecuteSQLParameterized(database, sql, null, status);

Review Comment:
   `ExecuteSQLParameterized` uses OpenMLDB's batch-query path. In the pinned 0.6.3 server, `TabletImpl::ProcessQuery` truncates output after `scan_max_bytes_size`—2 MiB by default—but returns `kOk`. This code therefore accepts a partial result, and the bounded reader subsequently signals successful end-of-input, silently losing rows for ordinary query results above 2 MiB. The 1,101-row integration case remains below that byte limit. Please use a path that can exhaust or paginate the result, or otherwise prevent a truncated response from being reported as complete.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org