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

Method FromStructExpression

cpp/src/arrow/dataset/scanner.cc:811–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

809} // namespace
810
811Result<ProjectionDescr> ProjectionDescr::FromStructExpression(
812 const compute::Expression& projection, const Schema& dataset_schema) {
813 ARROW_ASSIGN_OR_RAISE(compute::Expression bound_expression,
814 projection.Bind(dataset_schema));
815
816 if (bound_expression.type()->id() != Type::STRUCT) {
817 return Status::Invalid("Projection ", projection.ToString(),
818 " cannot yield record batches");
819 }
820 std::shared_ptr<Schema> projection_schema =
821 ::arrow::schema(checked_cast<const StructType&>(*bound_expression.type()).fields(),
822 dataset_schema.metadata());
823
824 return ProjectionDescr{std::move(bound_expression), std::move(projection_schema)};
825}
826
827Result<ProjectionDescr> ProjectionDescr::FromExpressions(
828 std::vector<compute::Expression> exprs, std::vector<std::string> names,

Callers

nothing calls this directly

Calls 7

InvalidFunction · 0.50
schemaFunction · 0.50
idMethod · 0.45
typeMethod · 0.45
ToStringMethod · 0.45
fieldsMethod · 0.45
metadataMethod · 0.45

Tested by

no test coverage detected