Skip to content

Commit

Permalink
append regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
hubgeter committed Sep 12, 2023
1 parent 16026b1 commit 6ac4c2c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
2 changes: 1 addition & 1 deletion be/src/exec/text_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ bool TextConverter::_write_data(const TypeDescriptor& type_desc,
kv = i;
continue;
}
if (i == len || data[i] == _collection_delimiter) {
if ((i == slice.size || slice[i] == collection_delimiter)&& i >= kv + 1) {
ranges.push_back({from, kv, i - 1});
from = i + 1;
kv = from;
Expand Down
4 changes: 2 additions & 2 deletions be/src/vec/data_types/serde/data_type_map_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ Status DataTypeMapSerDe::deserialize_one_cell_from_hive_text(IColumn& column, Sl
kv = i;
continue;
}
if (i == slice.size || slice[i] == collection_delimiter) {
key_slices.push_back({slice.data + from, kv - from});
if ((i == slice.size || slice[i] == collection_delimiter)&& i >= kv + 1) {
key_slices.push_back({slice.data + from, kv - from});
value_slices.push_back({slice.data + kv + 1, i - 1 - kv});
from = i + 1;
kv = from;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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_text_garbled_file", "p2,external,hive,external_remote,external_remote_hive") {
//test hive garbled files , prevent be hanged

String enabled = context.config.otherConfigs.get("enableExternalHiveTest")
if (enabled != null && enabled.equalsIgnoreCase("true")) {
String extHiveHmsHost = context.config.otherConfigs.get("extHiveHmsHost")
String extHiveHmsPort = context.config.otherConfigs.get("extHiveHmsPort")
String catalog_name = "test_text_garbled_file"
sql """drop catalog if exists ${catalog_name};"""
sql """
create catalog if not exists ${catalog_name} properties (
'type'='hms',
'hadoop.username' = 'hadoop',
'hive.metastore.uris' = 'thrift://${extHiveHmsHost}:${extHiveHmsPort}'
);
"""
logger.info("catalog " + catalog_name + " created")
sql """switch ${catalog_name};"""
logger.info("switched to catalog " + catalog_name)


order_qt_garbled_file """
select * from ${catalog_name}.multi_catalog.test_csv_format_error;
"""


}
}

0 comments on commit 6ac4c2c

Please sign in to comment.