| 144 | } |
| 145 | |
| 146 | void 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 | |
| 168 | TEST(GroupByConvenienceFunc, VarianceMultiBatch) { TestVarStdMultiBatch("variance"); } |
| 169 |
no test coverage detected