MCPcopy Create free account
hub / github.com/apache/arrow / TestVarStdMultiBatch

Function TestVarStdMultiBatch

cpp/src/arrow/acero/aggregate_node_test.cc:146–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void TestVarStdMultiBatch(const std::string& var_std_func_name) {
147 std::shared_ptr<Schema> in_schema = schema({field("value", float64())});
148 std::shared_ptr<Table> in_table = TableFromJSON(in_schema, {R"([
149 [1],
150 [2],
151 [3]
152 ])",
153 R"([
154 [4],
155 [4],
156 [4]
157 ])"});
158
159 ASSERT_OK_AND_ASSIGN(std::shared_ptr<Table> actual,
160 TableGroupBy(in_table, {{var_std_func_name, {"value"}, "x"}}, {},
161 /*use_threads=*/false));
162
163 ASSERT_OK_AND_ASSIGN(auto var_scalar, actual->column(0)->GetScalar(0));
164 // the next assertion will fail if only the second batch affects the result
165 ASSERT_NE(0, std::dynamic_pointer_cast<DoubleScalar>(var_scalar)->value);
166}
167
168TEST(GroupByConvenienceFunc, VarianceMultiBatch) { TestVarStdMultiBatch("variance"); }
169

Callers 1

TESTFunction · 0.85

Calls 5

TableFromJSONFunction · 0.85
TableGroupByFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
schemaFunction · 0.50
fieldFunction · 0.50

Tested by

no test coverage detected