Skip to content

Commit

Permalink
fix arrow func test error when global variable initialized uncorrectly (
Browse files Browse the repository at this point in the history
#426)

reason: TrimOptions/SliceOptions should not be global variables, which
depend on other static variables to be initialized earlier.
  • Loading branch information
jingshi-ant authored Dec 24, 2024
1 parent 4ec3301 commit 90a3d1e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions engine/operator/arrow_func_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ namespace scql::engine::op {
struct ArrowFuncTestCase {
std::vector<test::NamedTensor> ins;
std::string func_name;
arrow::compute::FunctionOptions* func_opt = nullptr;
std::shared_ptr<arrow::compute::FunctionOptions> func_opt;
std::vector<test::NamedTensor> expect_outs;
};

arrow::compute::TrimOptions trim_options(" ");
arrow::compute::SliceOptions slice_options(4 /* start */, 10 /* stop */,
1 /* step */);

class ArrowFuncTest
: public testing::TestWithParam<
std::tuple<test::SpuRuntimeTestCase, ArrowFuncTestCase>> {
Expand Down Expand Up @@ -66,7 +62,7 @@ INSTANTIATE_TEST_SUITE_P(
R"json(["alice ", " Bob", " CAROL ",
" "])json"))},
.func_name = "utf8_trim",
.func_opt = &trim_options,
.func_opt = std::make_shared<arrow::compute::TrimOptions>(" "),
.expect_outs = {test::NamedTensor(
"out", TensorFrom(arrow::large_utf8(),
R"json(["alice", "Bob", "CAROL",
Expand All @@ -77,7 +73,8 @@ INSTANTIATE_TEST_SUITE_P(
R"json(["alice", "Bob", "CAROL",
"AA#Bb.cc"])json"))},
.func_name = "utf8_slice_codeunits",
.func_opt = &slice_options,
.func_opt = std::make_shared<arrow::compute::SliceOptions>(4 /* start */, 10 /* stop */,
1 /* step */),
.expect_outs = {test::NamedTensor(
"out", TensorFrom(arrow::large_utf8(),
R"json(["e", "", "L",
Expand Down

0 comments on commit 90a3d1e

Please sign in to comment.