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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 77ca1f052a Revert "[bugfix](array) fix element revert on error in 
DataTypeArray::from_string (#16434)"
77ca1f052a is described below

commit 77ca1f052aac7f1a371a91dfd44170c14b455cdd
Author: morningman <[email protected]>
AuthorDate: Thu Feb 9 22:12:26 2023 +0800

    Revert "[bugfix](array) fix element revert on error in 
DataTypeArray::from_string (#16434)"
    
    This reverts commit f94f14ef6219be8ae0b688742ef9c49ba3cf24f7.
---
 be/src/vec/data_types/data_type_array.cpp          |  6 +-
 .../load/insert/test_array_insert_into_select.out  | 13 -----
 .../insert/test_array_insert_into_select.groovy    | 65 ----------------------
 3 files changed, 2 insertions(+), 82 deletions(-)

diff --git a/be/src/vec/data_types/data_type_array.cpp 
b/be/src/vec/data_types/data_type_array.cpp
index 97af5ac720..6827cb3779 100644
--- a/be/src/vec/data_types/data_type_array.cpp
+++ b/be/src/vec/data_types/data_type_array.cpp
@@ -267,8 +267,6 @@ Status DataTypeArray::from_string(ReadBuffer& rb, IColumn* 
column) const {
         StringRef element(rb.position(), rb.count());
         bool has_quota = false;
         if (!next_element_from_string(rb, element, has_quota)) {
-            // we should do array element column revert if error
-            nested_column.pop_back(element_num);
             return Status::InvalidArgument("Cannot read array element from 
text '{}'",
                                            element.to_string());
         }
@@ -296,8 +294,8 @@ Status DataTypeArray::from_string(ReadBuffer& rb, IColumn* 
column) const {
         ReadBuffer read_buffer(const_cast<char*>(element.data), element.size);
         auto st = nested->from_string(read_buffer, &nested_column);
         if (!st.ok()) {
-            // we should do array element column revert if error
-            nested_column.pop_back(element_num);
+            // we should do revert if error
+            array_column->pop_back(element_num);
             return st;
         }
         ++element_num;
diff --git a/regression-test/data/load/insert/test_array_insert_into_select.out 
b/regression-test/data/load/insert/test_array_insert_into_select.out
deleted file mode 100644
index 2dcf990314..0000000000
--- a/regression-test/data/load/insert/test_array_insert_into_select.out
+++ /dev/null
@@ -1,13 +0,0 @@
--- This file is automatically generated. You should know what you did if you 
want to edit this
--- !select_string --
-0      [{"a":"1","b":"2","c":"3",}, {"a":"1","b":"2"}]
-1      ['{"a":"1","b":"2","c":"3",}', '{"a":"1","b":"2"}']
-2      [{"a":"1","b":"2"}]
-3      []
-
--- !select_array --
-0      \N
-1      ['{"a":"1","b":"2","c":"3",}', '{"a":"1","b":"2"}']
-2      \N
-3      []
-
diff --git 
a/regression-test/suites/load/insert/test_array_insert_into_select.groovy 
b/regression-test/suites/load/insert/test_array_insert_into_select.groovy
deleted file mode 100644
index f171ae3220..0000000000
--- a/regression-test/suites/load/insert/test_array_insert_into_select.groovy
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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_array_insert_into_select", "load") {
-    // create table with string
-    sql "DROP TABLE IF EXISTS tstring"
-    sql """
-        CREATE TABLE `tstring` (
-            `id` INT,
-            `data` STRING
-        ) ENGINE=OLAP
-        DUPLICATE KEY(`id`)
-        COMMENT 'OLAP'
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1");
-    """
-
-    // insert invalid row 0
-    sql """INSERT INTO tstring VALUES (0, '[{"a":"1","b":"2","c":"3",}, 
{"a":"1","b":"2"}]')"""
-    // insert valid row 1
-    sql """INSERT INTO tstring VALUES (1, '[\\'{"a":"1","b":"2","c":"3",}\\', 
\\'{"a":"1","b":"2"}\\']')"""
-    // insert invalid row 2
-    sql """INSERT INTO tstring VALUES (2, '[{"a":"1","b":"2"}]')"""
-    // insert valid row 3
-    sql """INSERT INTO tstring VALUES (3, '[]')"""
-
-    // check data in tstring
-    qt_select_string "SELECT * FROM tstring ORDER BY id"
-
-
-    // create table with array
-    sql "DROP TABLE IF EXISTS tarray"
-    sql """
-        CREATE TABLE `tarray` (
-            `id` INT,
-            `data` ARRAY<STRING>
-        ) ENGINE=OLAP
-        DUPLICATE KEY(`id`)
-        COMMENT 'OLAP'
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1");
-    """
-
-    // insert rows to tarray
-    sql "INSERT INTO tarray SELECT * FROM tstring"
-
-    // check data in tarray
-    qt_select_array "SELECT * FROM tarray ORDER BY id"
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to