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

Function ExtractSchemaToBind

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

Source from the content-addressed store, hash-verified

979namespace {
980
981Result<std::shared_ptr<Schema>> ExtractSchemaToBind(const acero::Declaration& declr) {
982 std::shared_ptr<Schema> bind_schema;
983 if (declr.factory_name == "scan") {
984 const auto& opts = checked_cast<const dataset::ScanNodeOptions&>(*(declr.options));
985 bind_schema = opts.dataset->schema();
986 } else if (declr.factory_name == "filter") {
987 auto input_declr = std::get<acero::Declaration>(declr.inputs[0]);
988 ARROW_ASSIGN_OR_RAISE(bind_schema, ExtractSchemaToBind(input_declr));
989 } else if (declr.factory_name == "named_table") {
990 const auto& opts = checked_cast<const acero::NamedTableNodeOptions&>(*declr.options);
991 bind_schema = opts.schema;
992 } else if (declr.factory_name == "sink") {
993 // Note that the sink has no output_schema
994 return bind_schema;
995 } else {
996 return Status::Invalid("Schema extraction failed, unsupported factory ",
997 declr.factory_name);
998 }
999 return bind_schema;
1000}
1001
1002Result<std::unique_ptr<substrait::ReadRel>> NamedTableRelationConverter(
1003 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