Files
doris/be/test/runtime/user_function_cache_test.cpp
zy-kkk 3e4ee3c1e6 [fix](jdbc catalog) fix jdbc driver cache load error (#23656)
log error:
`W20230830 11:19:47.495721 3046231 status.h:363] meet error status: [INTERNAL_ERROR]user function's name should be function_id.checksum[.file_name].file_type, now the all split parts are by delimiter(.): 7119053928154065546.20c8228267b6c9ce620fddb39467d3eb.postgresql-42.5.0.jar`

When the jdbc driver had `.` in its name we failed to split it properly
2023-08-31 10:17:15 +08:00

47 lines
1.6 KiB
C++

// 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.
#include "runtime/user_function_cache.h"
#include <gtest/gtest-message.h>
#include <gtest/gtest-test-part.h>
#include <string>
#include "gtest/gtest.h"
namespace doris {
class UserFunctionCacheTest : public ::testing::Test {
protected:
UserFunctionCache ufc;
};
TEST_F(UserFunctionCacheTest, SplitStringByChecksumTest) {
// Test valid string format
std::string valid_str =
"7119053928154065546.20c8228267b6c9ce620fddb39467d3eb.postgresql-42.5.0.jar";
auto result = ufc._split_string_by_checksum(valid_str);
ASSERT_EQ(result.size(), 4);
EXPECT_EQ(result[0], "7119053928154065546");
EXPECT_EQ(result[1], "20c8228267b6c9ce620fddb39467d3eb");
EXPECT_EQ(result[2], "postgresql-42.5.0");
EXPECT_EQ(result[3], "jar");
}
} // namespace doris