| 129 | } |
| 130 | |
| 131 | void CheckRoundTripResult(const std::shared_ptr<Table> expected_table, |
| 132 | std::shared_ptr<Buffer>& buf, |
| 133 | const std::vector<int>& include_columns = {}, |
| 134 | const ConversionOptions& conversion_options = {}, |
| 135 | const compute::SortOptions* sort_options = NULLPTR) { |
| 136 | std::shared_ptr<ExtensionIdRegistry> sp_ext_id_reg = MakeExtensionIdRegistry(); |
| 137 | ExtensionIdRegistry* ext_id_reg = sp_ext_id_reg.get(); |
| 138 | ExtensionSet ext_set(ext_id_reg); |
| 139 | ASSERT_OK_AND_ASSIGN(auto sink_decls, DeserializePlans( |
| 140 | *buf, [] { return kNullConsumer; }, |
| 141 | ext_id_reg, &ext_set, conversion_options)); |
| 142 | auto& other_declrs = std::get<acero::Declaration>(sink_decls[0].inputs[0]); |
| 143 | |
| 144 | ASSERT_OK_AND_ASSIGN(auto output_table, |
| 145 | acero::DeclarationToTable(other_declrs, /*use_threads=*/false)); |
| 146 | |
| 147 | if (!include_columns.empty()) { |
| 148 | ASSERT_OK_AND_ASSIGN(output_table, output_table->SelectColumns(include_columns)); |
| 149 | } |
| 150 | if (sort_options) { |
| 151 | ASSERT_OK_AND_ASSIGN(auto sort_indices, |
| 152 | SortIndices(output_table, std::move(*sort_options))); |
| 153 | ASSERT_OK_AND_ASSIGN(auto maybe_table, |
| 154 | compute::Take(output_table, std::move(sort_indices), |
| 155 | compute::TakeOptions::NoBoundsCheck())); |
| 156 | output_table = maybe_table.table(); |
| 157 | } |
| 158 | ASSERT_OK_AND_ASSIGN(output_table, output_table->CombineChunks()); |
| 159 | ASSERT_OK_AND_ASSIGN(auto merged_expected, expected_table->CombineChunks()); |
| 160 | engine::AssertTablesEqualIgnoringOrder(merged_expected, output_table); |
| 161 | } |
| 162 | |
| 163 | const std::shared_ptr<Schema> kBoringSchema = schema({ |
| 164 | field("bool", boolean()), |
no test coverage detected