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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
