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

Function ExtractSchemaToBind

cpp/src/arrow/engine/substrait/relation_internal.cc:993–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

991namespace {
992
993Result<std::shared_ptr<Schema>> ExtractSchemaToBind(const acero::Declaration& declr) {
994 std::shared_ptr<Schema> bind_schema;
995 if (declr.factory_name == "scan") {
996 const auto& opts = checked_cast<const dataset::ScanNodeOptions&>(*(declr.options));
997 bind_schema = opts.dataset->schema();
998 } else if (declr.factory_name == "filter") {
999 auto input_declr = std::get<acero::Declaration>(declr.inputs[0]);
1000 ARROW_ASSIGN_OR_RAISE(bind_schema, ExtractSchemaToBind(input_declr));
1001 } else if (declr.factory_name == "named_table") {
1002 const auto& opts = checked_cast<const acero::NamedTableNodeOptions&>(*declr.options);
1003 bind_schema = opts.schema;
1004 } else if (declr.factory_name == "sink") {
1005 // Note that the sink has no output_schema
1006 return bind_schema;
1007 } else {
1008 return Status::Invalid("Schema extraction failed, unsupported factory ",
1009 declr.factory_name);
1010 }
1011 return bind_schema;
1012}
1013
1014Result<std::unique_ptr<substrait::ReadRel>> NamedTableRelationConverter(
1015 const std::shared_ptr<Schema>& schema, const acero::Declaration& declaration,

Callers

nothing calls this directly

Calls 3

ARROW_ASSIGN_OR_RAISEFunction · 0.70
InvalidFunction · 0.50
schemaMethod · 0.45

Tested by

no test coverage detected