// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: substrait/plan.proto

#include "substrait/plan.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG
namespace substrait {
constexpr PlanRel::PlanRel(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : _oneof_case_{}{}
struct PlanRelDefaultTypeInternal {
  constexpr PlanRelDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~PlanRelDefaultTypeInternal() {}
  union {
    PlanRel _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PlanRelDefaultTypeInternal _PlanRel_default_instance_;
constexpr Plan::Plan(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : extension_uris_()
  , extensions_()
  , relations_()
  , expected_type_urls_()
  , advanced_extensions_(nullptr){}
struct PlanDefaultTypeInternal {
  constexpr PlanDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~PlanDefaultTypeInternal() {}
  union {
    Plan _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PlanDefaultTypeInternal _Plan_default_instance_;
}  // namespace substrait
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_substrait_2fplan_2eproto[2];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_substrait_2fplan_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_substrait_2fplan_2eproto = nullptr;

const uint32_t TableStruct_substrait_2fplan_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::substrait::PlanRel, _internal_metadata_),
  ~0u,  // no _extensions_
  PROTOBUF_FIELD_OFFSET(::substrait::PlanRel, _oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
  ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
  PROTOBUF_FIELD_OFFSET(::substrait::PlanRel, rel_type_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::substrait::Plan, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::substrait::Plan, extension_uris_),
  PROTOBUF_FIELD_OFFSET(::substrait::Plan, extensions_),
  PROTOBUF_FIELD_OFFSET(::substrait::Plan, relations_),
  PROTOBUF_FIELD_OFFSET(::substrait::Plan, advanced_extensions_),
  PROTOBUF_FIELD_OFFSET(::substrait::Plan, expected_type_urls_),
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, -1, sizeof(::substrait::PlanRel)},
  { 9, -1, -1, sizeof(::substrait::Plan)},
};

static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::substrait::_PlanRel_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::substrait::_Plan_default_instance_),
};

const char descriptor_table_protodef_substrait_2fplan_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n\024substrait/plan.proto\022\tsubstrait\032\027subst"
  "rait/algebra.proto\032%substrait/extensions"
  "/extensions.proto\"c\n\007PlanRel\022\"\n\003rel\030\001 \001("
  "\0132\016.substrait.RelH\000R\003rel\022(\n\004root\030\002 \001(\0132\022"
  ".substrait.RelRootH\000R\004rootB\n\n\010rel_type\"\343"
  "\002\n\004Plan\022O\n\016extension_uris\030\001 \003(\0132(.substr"
  "ait.extensions.SimpleExtensionURIR\rexten"
  "sionUris\022P\n\nextensions\030\002 \003(\01320.substrait"
  ".extensions.SimpleExtensionDeclarationR\n"
  "extensions\0220\n\trelations\030\003 \003(\0132\022.substrai"
  "t.PlanRelR\trelations\022X\n\023advanced_extensi"
  "ons\030\004 \001(\0132\'.substrait.extensions.Advance"
  "dExtensionR\022advancedExtensions\022,\n\022expect"
  "ed_type_urls\030\005 \003(\tR\020expectedTypeUrlsB+\n\022"
  "io.substrait.protoP\001\252\002\022Substrait.Protobu"
  "fb\006proto3"
  ;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_substrait_2fplan_2eproto_deps[2] = {
  &::descriptor_table_substrait_2falgebra_2eproto,
  &::descriptor_table_substrait_2fextensions_2fextensions_2eproto,
};
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_substrait_2fplan_2eproto_once;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_substrait_2fplan_2eproto = {
  false, false, 609, descriptor_table_protodef_substrait_2fplan_2eproto, "substrait/plan.proto", 
  &descriptor_table_substrait_2fplan_2eproto_once, descriptor_table_substrait_2fplan_2eproto_deps, 2, 2,
  schemas, file_default_instances, TableStruct_substrait_2fplan_2eproto::offsets,
  file_level_metadata_substrait_2fplan_2eproto, file_level_enum_descriptors_substrait_2fplan_2eproto, file_level_service_descriptors_substrait_2fplan_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_substrait_2fplan_2eproto_getter() {
  return &descriptor_table_substrait_2fplan_2eproto;
}

// Force running AddDescriptors() at dynamic initialization time.
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_substrait_2fplan_2eproto(&descriptor_table_substrait_2fplan_2eproto);
namespace substrait {

// ===================================================================

class PlanRel::_Internal {
 public:
  static const ::substrait::Rel& rel(const PlanRel* msg);
  static const ::substrait::RelRoot& root(const PlanRel* msg);
};

const ::substrait::Rel&
PlanRel::_Internal::rel(const PlanRel* msg) {
  return *msg->rel_type_.rel_;
}
const ::substrait::RelRoot&
PlanRel::_Internal::root(const PlanRel* msg) {
  return *msg->rel_type_.root_;
}
void PlanRel::set_allocated_rel(::substrait::Rel* rel) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_rel_type();
  if (rel) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
        ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
            ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
                reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(rel));
    if (message_arena != submessage_arena) {
      rel = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, rel, submessage_arena);
    }
    set_has_rel();
    rel_type_.rel_ = rel;
  }
  // @@protoc_insertion_point(field_set_allocated:substrait.PlanRel.rel)
}
void PlanRel::clear_rel() {
  if (_internal_has_rel()) {
    if (GetArenaForAllocation() == nullptr) {
      delete rel_type_.rel_;
    }
    clear_has_rel_type();
  }
}
void PlanRel::set_allocated_root(::substrait::RelRoot* root) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_rel_type();
  if (root) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
        ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
            ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
                reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(root));
    if (message_arena != submessage_arena) {
      root = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, root, submessage_arena);
    }
    set_has_root();
    rel_type_.root_ = root;
  }
  // @@protoc_insertion_point(field_set_allocated:substrait.PlanRel.root)
}
void PlanRel::clear_root() {
  if (_internal_has_root()) {
    if (GetArenaForAllocation() == nullptr) {
      delete rel_type_.root_;
    }
    clear_has_rel_type();
  }
}
PlanRel::PlanRel(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:substrait.PlanRel)
}
PlanRel::PlanRel(const PlanRel& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  clear_has_rel_type();
  switch (from.rel_type_case()) {
    case kRel: {
      _internal_mutable_rel()->::substrait::Rel::MergeFrom(from._internal_rel());
      break;
    }
    case kRoot: {
      _internal_mutable_root()->::substrait::RelRoot::MergeFrom(from._internal_root());
      break;
    }
    case REL_TYPE_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:substrait.PlanRel)
}

inline void PlanRel::SharedCtor() {
clear_has_rel_type();
}

PlanRel::~PlanRel() {
  // @@protoc_insertion_point(destructor:substrait.PlanRel)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

inline void PlanRel::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (has_rel_type()) {
    clear_rel_type();
  }
}

void PlanRel::ArenaDtor(void* object) {
  PlanRel* _this = reinterpret_cast< PlanRel* >(object);
  (void)_this;
}
void PlanRel::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void PlanRel::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void PlanRel::clear_rel_type() {
// @@protoc_insertion_point(one_of_clear_start:substrait.PlanRel)
  switch (rel_type_case()) {
    case kRel: {
      if (GetArenaForAllocation() == nullptr) {
        delete rel_type_.rel_;
      }
      break;
    }
    case kRoot: {
      if (GetArenaForAllocation() == nullptr) {
        delete rel_type_.root_;
      }
      break;
    }
    case REL_TYPE_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = REL_TYPE_NOT_SET;
}


void PlanRel::Clear() {
// @@protoc_insertion_point(message_clear_start:substrait.PlanRel)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  clear_rel_type();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* PlanRel::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // .substrait.Rel rel = 1 [json_name = "rel"];
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_rel(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .substrait.RelRoot root = 2 [json_name = "root"];
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_root(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* PlanRel::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:substrait.PlanRel)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // .substrait.Rel rel = 1 [json_name = "rel"];
  if (_internal_has_rel()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        1, _Internal::rel(this), target, stream);
  }

  // .substrait.RelRoot root = 2 [json_name = "root"];
  if (_internal_has_root()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::root(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:substrait.PlanRel)
  return target;
}

size_t PlanRel::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:substrait.PlanRel)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  switch (rel_type_case()) {
    // .substrait.Rel rel = 1 [json_name = "rel"];
    case kRel: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *rel_type_.rel_);
      break;
    }
    // .substrait.RelRoot root = 2 [json_name = "root"];
    case kRoot: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *rel_type_.root_);
      break;
    }
    case REL_TYPE_NOT_SET: {
      break;
    }
  }
  return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
}

const ::PROTOBUF_NAMESPACE_ID::Message::ClassData PlanRel::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
    PlanRel::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*PlanRel::GetClassData() const { return &_class_data_; }

void PlanRel::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
                      const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  static_cast<PlanRel *>(to)->MergeFrom(
      static_cast<const PlanRel &>(from));
}


void PlanRel::MergeFrom(const PlanRel& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:substrait.PlanRel)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  switch (from.rel_type_case()) {
    case kRel: {
      _internal_mutable_rel()->::substrait::Rel::MergeFrom(from._internal_rel());
      break;
    }
    case kRoot: {
      _internal_mutable_root()->::substrait::RelRoot::MergeFrom(from._internal_root());
      break;
    }
    case REL_TYPE_NOT_SET: {
      break;
    }
  }
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

void PlanRel::CopyFrom(const PlanRel& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:substrait.PlanRel)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool PlanRel::IsInitialized() const {
  return true;
}

void PlanRel::InternalSwap(PlanRel* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(rel_type_, other->rel_type_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
}

::PROTOBUF_NAMESPACE_ID::Metadata PlanRel::GetMetadata() const {
  return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
      &descriptor_table_substrait_2fplan_2eproto_getter, &descriptor_table_substrait_2fplan_2eproto_once,
      file_level_metadata_substrait_2fplan_2eproto[0]);
}

// ===================================================================

class Plan::_Internal {
 public:
  static const ::substrait::extensions::AdvancedExtension& advanced_extensions(const Plan* msg);
};

const ::substrait::extensions::AdvancedExtension&
Plan::_Internal::advanced_extensions(const Plan* msg) {
  return *msg->advanced_extensions_;
}
void Plan::clear_extension_uris() {
  extension_uris_.Clear();
}
void Plan::clear_extensions() {
  extensions_.Clear();
}
void Plan::clear_advanced_extensions() {
  if (GetArenaForAllocation() == nullptr && advanced_extensions_ != nullptr) {
    delete advanced_extensions_;
  }
  advanced_extensions_ = nullptr;
}
Plan::Plan(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
  extension_uris_(arena),
  extensions_(arena),
  relations_(arena),
  expected_type_urls_(arena) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:substrait.Plan)
}
Plan::Plan(const Plan& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      extension_uris_(from.extension_uris_),
      extensions_(from.extensions_),
      relations_(from.relations_),
      expected_type_urls_(from.expected_type_urls_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  if (from._internal_has_advanced_extensions()) {
    advanced_extensions_ = new ::substrait::extensions::AdvancedExtension(*from.advanced_extensions_);
  } else {
    advanced_extensions_ = nullptr;
  }
  // @@protoc_insertion_point(copy_constructor:substrait.Plan)
}

inline void Plan::SharedCtor() {
advanced_extensions_ = nullptr;
}

Plan::~Plan() {
  // @@protoc_insertion_point(destructor:substrait.Plan)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

inline void Plan::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (this != internal_default_instance()) delete advanced_extensions_;
}

void Plan::ArenaDtor(void* object) {
  Plan* _this = reinterpret_cast< Plan* >(object);
  (void)_this;
}
void Plan::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Plan::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Plan::Clear() {
// @@protoc_insertion_point(message_clear_start:substrait.Plan)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  extension_uris_.Clear();
  extensions_.Clear();
  relations_.Clear();
  expected_type_urls_.Clear();
  if (GetArenaForAllocation() == nullptr && advanced_extensions_ != nullptr) {
    delete advanced_extensions_;
  }
  advanced_extensions_ = nullptr;
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* Plan::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // repeated .substrait.extensions.SimpleExtensionURI extension_uris = 1 [json_name = "extensionUris"];
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_extension_uris(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
        } else
          goto handle_unusual;
        continue;
      // repeated .substrait.extensions.SimpleExtensionDeclaration extensions = 2 [json_name = "extensions"];
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_extensions(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
        } else
          goto handle_unusual;
        continue;
      // repeated .substrait.PlanRel relations = 3 [json_name = "relations"];
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_relations(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
        } else
          goto handle_unusual;
        continue;
      // .substrait.extensions.AdvancedExtension advanced_extensions = 4 [json_name = "advancedExtensions"];
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          ptr = ctx->ParseMessage(_internal_mutable_advanced_extensions(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated string expected_type_urls = 5 [json_name = "expectedTypeUrls"];
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
          ptr -= 1;
          do {
            ptr += 1;
            auto str = _internal_add_expected_type_urls();
            ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
            CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "substrait.Plan.expected_type_urls"));
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Plan::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:substrait.Plan)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated .substrait.extensions.SimpleExtensionURI extension_uris = 1 [json_name = "extensionUris"];
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_extension_uris_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(1, this->_internal_extension_uris(i), target, stream);
  }

  // repeated .substrait.extensions.SimpleExtensionDeclaration extensions = 2 [json_name = "extensions"];
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_extensions_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(2, this->_internal_extensions(i), target, stream);
  }

  // repeated .substrait.PlanRel relations = 3 [json_name = "relations"];
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_relations_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(3, this->_internal_relations(i), target, stream);
  }

  // .substrait.extensions.AdvancedExtension advanced_extensions = 4 [json_name = "advancedExtensions"];
  if (this->_internal_has_advanced_extensions()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        4, _Internal::advanced_extensions(this), target, stream);
  }

  // repeated string expected_type_urls = 5 [json_name = "expectedTypeUrls"];
  for (int i = 0, n = this->_internal_expected_type_urls_size(); i < n; i++) {
    const auto& s = this->_internal_expected_type_urls(i);
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      s.data(), static_cast<int>(s.length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "substrait.Plan.expected_type_urls");
    target = stream->WriteString(5, s, target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:substrait.Plan)
  return target;
}

size_t Plan::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:substrait.Plan)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated .substrait.extensions.SimpleExtensionURI extension_uris = 1 [json_name = "extensionUris"];
  total_size += 1UL * this->_internal_extension_uris_size();
  for (const auto& msg : this->extension_uris_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // repeated .substrait.extensions.SimpleExtensionDeclaration extensions = 2 [json_name = "extensions"];
  total_size += 1UL * this->_internal_extensions_size();
  for (const auto& msg : this->extensions_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // repeated .substrait.PlanRel relations = 3 [json_name = "relations"];
  total_size += 1UL * this->_internal_relations_size();
  for (const auto& msg : this->relations_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // repeated string expected_type_urls = 5 [json_name = "expectedTypeUrls"];
  total_size += 1 *
      ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(expected_type_urls_.size());
  for (int i = 0, n = expected_type_urls_.size(); i < n; i++) {
    total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
      expected_type_urls_.Get(i));
  }

  // .substrait.extensions.AdvancedExtension advanced_extensions = 4 [json_name = "advancedExtensions"];
  if (this->_internal_has_advanced_extensions()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *advanced_extensions_);
  }

  return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
}

const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Plan::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
    Plan::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Plan::GetClassData() const { return &_class_data_; }

void Plan::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
                      const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  static_cast<Plan *>(to)->MergeFrom(
      static_cast<const Plan &>(from));
}


void Plan::MergeFrom(const Plan& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:substrait.Plan)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  extension_uris_.MergeFrom(from.extension_uris_);
  extensions_.MergeFrom(from.extensions_);
  relations_.MergeFrom(from.relations_);
  expected_type_urls_.MergeFrom(from.expected_type_urls_);
  if (from._internal_has_advanced_extensions()) {
    _internal_mutable_advanced_extensions()->::substrait::extensions::AdvancedExtension::MergeFrom(from._internal_advanced_extensions());
  }
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

void Plan::CopyFrom(const Plan& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:substrait.Plan)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Plan::IsInitialized() const {
  return true;
}

void Plan::InternalSwap(Plan* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  extension_uris_.InternalSwap(&other->extension_uris_);
  extensions_.InternalSwap(&other->extensions_);
  relations_.InternalSwap(&other->relations_);
  expected_type_urls_.InternalSwap(&other->expected_type_urls_);
  swap(advanced_extensions_, other->advanced_extensions_);
}

::PROTOBUF_NAMESPACE_ID::Metadata Plan::GetMetadata() const {
  return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
      &descriptor_table_substrait_2fplan_2eproto_getter, &descriptor_table_substrait_2fplan_2eproto_once,
      file_level_metadata_substrait_2fplan_2eproto[1]);
}

// @@protoc_insertion_point(namespace_scope)
}  // namespace substrait
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::substrait::PlanRel* Arena::CreateMaybeMessage< ::substrait::PlanRel >(Arena* arena) {
  return Arena::CreateMessageInternal< ::substrait::PlanRel >(arena);
}
template<> PROTOBUF_NOINLINE ::substrait::Plan* Arena::CreateMaybeMessage< ::substrait::Plan >(Arena* arena) {
  return Arena::CreateMessageInternal< ::substrait::Plan >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
