branch-2.1: [fix](hive)Fixed the issue of reading hive table with empty lzo files #43979 (#44063)

Cherry-picked from #43979

Co-authored-by: wuwenchi <wuwenchi@selectdb.com>
This commit is contained in:
github-actions[bot]
2024-11-16 16:14:50 +08:00
committed by GitHub
parent 269c2c844b
commit 48e33bfb2a
3 changed files with 42 additions and 0 deletions

View File

@ -103,6 +103,7 @@ Status LzopDecompressor::decompress(uint8_t* input, size_t input_len, size_t* in
ptr = get_uint32(ptr, &uncompressed_size);
left_input_len -= sizeof(uint32_t);
if (uncompressed_size == 0) {
*input_bytes_read += sizeof(uint32_t);
*stream_end = true;
return Status::OK();
}

View File

@ -0,0 +1,41 @@
// 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_user_empty_lzo","external,hive,tvf,external_docker") {
String hdfs_port = context.config.otherConfigs.get("hive2HdfsPort")
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
def hdfsUserName = "doris"
def defaultFS = "hdfs://${externalEnvIp}:${hdfs_port}"
def uri = ""
String enabled = context.config.otherConfigs.get("enableHiveTest")
if (enabled != null && enabled.equalsIgnoreCase("true")) {
try {
// it's a empty data file
uri = "${defaultFS}" + "/user/doris/preinstalled_data/user_empty_lzo/part-m-00000.lzo"
test {
sql """ select * from HDFS(
"uri" = "${uri}",
"hadoop.username" = "${hdfsUserName}",
"format" = "csv"); """
exception """The first line is empty, can not parse column numbers"""
}
} finally {
}
}
}