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

Function ToProto

cpp/src/arrow/engine/substrait/type_internal.cc:492–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490} // namespace
491
492Result<std::unique_ptr<substrait::Type>> ToProto(
493 const DataType& type, bool nullable, ExtensionSet* ext_set,
494 const ConversionOptions& conversion_options) {
495 // From Substrait's perspective the "dictionary type" is just an encoding. As a result,
496 // we lose that information on conversion and just convert the value type.
497 if (type.id() == Type::DICTIONARY) {
498 const auto& dict_type = checked_cast<const DictionaryType&>(type);
499 return ToProto(*dict_type.value_type(), nullable, ext_set, conversion_options);
500 }
501 // Ditto for REE
502 if (type.id() == Type::RUN_END_ENCODED) {
503 const auto& ree_type = checked_cast<const RunEndEncodedType&>(type);
504 return ToProto(*ree_type.value_type(), nullable, ext_set, conversion_options);
505 }
506 auto out = std::make_unique<substrait::Type>();
507 RETURN_NOT_OK(
508 (DataTypeToProtoImpl{out.get(), nullable, ext_set, conversion_options})(type));
509 return out;
510}
511
512Result<std::shared_ptr<Schema>> FromProto(const substrait::NamedStruct& named_struct,
513 const ExtensionSet& ext_set,

Callers 4

CreateReadFunction · 0.70
CreateProjectFunction · 0.70
CreateAggFunction · 0.70
SerializeExpressionsFunction · 0.70

Calls 10

InvalidFunction · 0.50
idMethod · 0.45
value_typeMethod · 0.45
getMethod · 0.45
metadataMethod · 0.45
ReserveMethod · 0.45
num_fieldsMethod · 0.45
fieldsMethod · 0.45
releaseMethod · 0.45

Tested by 3

CreateReadFunction · 0.56
CreateProjectFunction · 0.56
CreateAggFunction · 0.56