| 490 | } // namespace |
| 491 | |
| 492 | Result<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 | |
| 512 | Result<std::shared_ptr<Schema>> FromProto(const substrait::NamedStruct& named_struct, |
| 513 | const ExtensionSet& ext_set, |