| 106 | } |
| 107 | |
| 108 | Result<std::shared_ptr<acero::ExecPlan>> PlanFromTestCase( |
| 109 | const FunctionTestCase& test_case, std::shared_ptr<Table>* output_table) { |
| 110 | ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Table> input_table, |
| 111 | GetInputTable(test_case.arguments, test_case.data_types)); |
| 112 | ARROW_ASSIGN_OR_RAISE( |
| 113 | std::shared_ptr<Buffer> substrait, |
| 114 | internal::CreateScanProjectSubstrait( |
| 115 | test_case.function_id, input_table, test_case.arguments, test_case.options, |
| 116 | test_case.data_types, *test_case.expected_output_type)); |
| 117 | std::shared_ptr<acero::SinkNodeConsumer> consumer = |
| 118 | std::make_shared<acero::TableSinkNodeConsumer>(output_table, default_memory_pool()); |
| 119 | |
| 120 | // Mock table provider that ignores the table name and returns input_table |
| 121 | NamedTableProvider table_provider = [input_table](const std::vector<std::string>&, |
| 122 | const Schema&) { |
| 123 | std::shared_ptr<acero::ExecNodeOptions> options = |
| 124 | std::make_shared<acero::TableSourceNodeOptions>(input_table); |
| 125 | return acero::Declaration("table_source", {}, options, "mock_source"); |
| 126 | }; |
| 127 | |
| 128 | ConversionOptions conversion_options; |
| 129 | conversion_options.named_table_provider = std::move(table_provider); |
| 130 | |
| 131 | ARROW_ASSIGN_OR_RAISE( |
| 132 | std::shared_ptr<acero::ExecPlan> plan, |
| 133 | DeserializePlan(*substrait, std::move(consumer), default_extension_id_registry(), |
| 134 | /*ext_set_out=*/nullptr, conversion_options)); |
| 135 | return plan; |
| 136 | } |
| 137 | |
| 138 | void CheckValidTestCases(const std::vector<FunctionTestCase>& valid_cases) { |
| 139 | for (const FunctionTestCase& test_case : valid_cases) { |
no test coverage detected