github-actions[bot] commented on code in PR #68596:
URL: https://github.com/apache/doris/pull/68596#discussion_r4129115918
##########
be/src/format/arrow/arrow_block_convertor.cpp:
##########
@@ -341,6 +341,25 @@ Status ArrowBlockConvertor::init() {
return Status::OK();
}
+Status ArrowFlightArrowBlockConvertor::convert_to_arrow(const Block& block,
arrow::MemoryPool* pool,
+
std::shared_ptr<arrow::RecordBatch>* result,
+ size_t start_row,
size_t end_row) const {
+ std::shared_ptr<arrow::RecordBatch> batch;
+ RETURN_IF_ERROR(ArrowBlockConvertor::convert_to_arrow(block, pool, &batch,
start_row, end_row));
+ // String builders accept arbitrary bytes, but Flight UTF-8 values must be
valid per row,
+ // including nested children. Validate before publishing the batch to the
reader.
+ for (int i = 0; i < batch->num_columns(); ++i) {
+ auto status = batch->column(i)->ValidateFull();
Review Comment:
[P2] Limit full validation to UTF-8-bearing arrays. Both Flight readers call
this for every batch, including binary- or decimal-only results. In the pinned
Arrow version, `ValidateFull()` scans every binary offset, every decimal value,
and nullable bitmaps even when no string can contain invalid UTF-8. This adds
an avoidable per-row pass on the result thread for those queries. Could this
check recurse only into arrays containing STRING/LARGE_STRING leaves, including
nested ones?
##########
regression-test/suites/arrow_flight_sql_p0/test_flight_utf8_validation.groovy:
##########
@@ -0,0 +1,76 @@
+// 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.
+
+suite("test_flight_utf8_validation", "arrow_flight_sql") {
+ sql "DROP TABLE IF EXISTS flight_utf8_input"
+ sql """CREATE TABLE flight_utf8_input (id INT, encoded STRING)
+ DUPLICATE KEY(id) DISTRIBUTED BY HASH(id) BUCKETS 1
+ PROPERTIES ("replication_num" = "1")"""
+ sql """INSERT INTO flight_utf8_input VALUES
+ (1, '616263'), (2, 'E4B8ADF09F9880'), (3, ''), (4, NULL),
+ (5, '84'), (6, 'C0AF'), (7, 'EDA080'), (8, 'F4908080'),
+ (9, 'C2'), (10, 'A2')"""
+
+ // TestAction uses the current JDBC connection, so explicitly bind it to
Flight.
+ def flightUrl =
context.getArrowFlightSqlConnection().getMetaData().getURL()
+ connect(context.config.jdbcUser, context.config.jdbcPassword, flightUrl) {
Review Comment:
[P2] Run these assertions through the authenticated Flight connection. This
`connect` call has two independent setup failures: it passes MySQL
`jdbcUser`/`jdbcPassword` although `getArrowFlightSqlConnection()` uses
`extArrowFlightSqlUser`/`extArrowFlightSqlPassword`, so distinct accounts fail
before any UTF-8 check; and with `enableTLS=true`, `SuiteContext.connect`
returns a URL before invoking its closure, so the suite can pass without
running any of its assertions. Please use the existing Flight connection or fix
both the credential selection and the helper's TLS branch.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]