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

Function ValidateNumProjectNodes

cpp/src/arrow/engine/substrait/serde_test.cc:222–233  ·  view source on GitHub ↗

Validate the number of expected ProjectNodes Project nodes are sometimes added by emit elements and we may want to verify that we are not adding too many

Source from the content-addressed store, hash-verified

220/// Project nodes are sometimes added by emit elements and we may want to
221/// verify that we are not adding too many
222void ValidateNumProjectNodes(int expected_projections, const std::shared_ptr<Buffer>& buf,
223 const ConversionOptions& conversion_options) {
224 std::shared_ptr<ExtensionIdRegistry> sp_ext_id_reg = MakeExtensionIdRegistry();
225 ExtensionIdRegistry* ext_id_reg = sp_ext_id_reg.get();
226 ExtensionSet ext_set(ext_id_reg);
227 ASSERT_OK_AND_ASSIGN(auto sink_decls, DeserializePlans(
228 *buf, [] { return kNullConsumer; },
229 ext_id_reg, &ext_set, conversion_options));
230 auto& other_declrs = std::get<acero::Declaration>(sink_decls[0].inputs[0]);
231 int num_projections = CountProjectNodeOptionsInDeclarations(other_declrs);
232 ASSERT_EQ(num_projections, expected_projections);
233}
234
235TEST(Substrait, SupportedTypes) {
236 auto ExpectEq = [](std::string_view json, std::shared_ptr<DataType> expected_type) {

Callers 2

TESTFunction · 0.85
serde_test.ccFile · 0.85

Calls 3

MakeExtensionIdRegistryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected