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

Function ToProto

cpp/src/arrow/engine/substrait/expression_internal.cc:1131–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1129} // namespace
1130
1131Result<std::unique_ptr<substrait::Expression::Literal>> ToProto(
1132 const Datum& datum, ExtensionSet* ext_set,
1133 const ConversionOptions& conversion_options) {
1134 if (!datum.is_scalar()) {
1135 return Status::NotImplemented("representing ", datum.ToString(),
1136 " as a substrait::Expression::Literal");
1137 }
1138
1139 auto out = std::make_unique<substrait::Expression::Literal>();
1140
1141 if (datum.scalar()->is_valid) {
1142 RETURN_NOT_OK(
1143 (ScalarToProtoImpl{out.get(), ext_set, conversion_options})(*datum.scalar()));
1144 } else {
1145 ARROW_ASSIGN_OR_RAISE(auto type, ToProto(*datum.type(), /*nullable=*/true, ext_set,
1146 conversion_options));
1147 out->set_allocated_null(type.release());
1148 }
1149
1150 return out;
1151}
1152
1153namespace {
1154

Callers 2

EncodeSubstraitCallFunction · 0.70
DatumToLiteralsFunction · 0.70

Calls 15

MakeStructFieldReferenceFunction · 0.85
CallNotNullFunction · 0.85
MakeListElementReferenceFunction · 0.85
DatumToLiteralsFunction · 0.85
EncodeSubstraitCallFunction · 0.85
is_scalarMethod · 0.80
IsBoundMethod · 0.80
literalMethod · 0.80
callMethod · 0.80
backMethod · 0.80
indicesMethod · 0.80
is_unsafeMethod · 0.80

Tested by

no test coverage detected