// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: greptime/v1/prom.proto

#include "greptime/v1/prom.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 _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;

namespace greptime {
namespace v1 {
PROTOBUF_CONSTEXPR PromqlRequest::PromqlRequest(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_.header_)*/nullptr
  , /*decltype(_impl_.promql_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_._oneof_case_)*/{}} {}
struct PromqlRequestDefaultTypeInternal {
  PROTOBUF_CONSTEXPR PromqlRequestDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~PromqlRequestDefaultTypeInternal() {}
  union {
    PromqlRequest _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PromqlRequestDefaultTypeInternal _PromqlRequest_default_instance_;
PROTOBUF_CONSTEXPR PromqlResponse::PromqlResponse(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_.body_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.header_)*/nullptr
  , /*decltype(_impl_._cached_size_)*/{}} {}
struct PromqlResponseDefaultTypeInternal {
  PROTOBUF_CONSTEXPR PromqlResponseDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~PromqlResponseDefaultTypeInternal() {}
  union {
    PromqlResponse _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PromqlResponseDefaultTypeInternal _PromqlResponse_default_instance_;
PROTOBUF_CONSTEXPR PromInstantQuery::PromInstantQuery(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_.query_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.time_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.lookback_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_._cached_size_)*/{}} {}
struct PromInstantQueryDefaultTypeInternal {
  PROTOBUF_CONSTEXPR PromInstantQueryDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~PromInstantQueryDefaultTypeInternal() {}
  union {
    PromInstantQuery _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PromInstantQueryDefaultTypeInternal _PromInstantQuery_default_instance_;
PROTOBUF_CONSTEXPR PromRangeQuery::PromRangeQuery(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_.query_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.start_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.end_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.step_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.lookback_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_._cached_size_)*/{}} {}
struct PromRangeQueryDefaultTypeInternal {
  PROTOBUF_CONSTEXPR PromRangeQueryDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~PromRangeQueryDefaultTypeInternal() {}
  union {
    PromRangeQuery _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PromRangeQueryDefaultTypeInternal _PromRangeQuery_default_instance_;
}  // namespace v1
}  // namespace greptime
static ::_pb::Metadata file_level_metadata_greptime_2fv1_2fprom_2eproto[4];
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_greptime_2fv1_2fprom_2eproto = nullptr;
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_greptime_2fv1_2fprom_2eproto = nullptr;

const uint32_t TableStruct_greptime_2fv1_2fprom_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromqlRequest, _internal_metadata_),
  ~0u,  // no _extensions_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromqlRequest, _impl_._oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromqlRequest, _impl_.header_),
  ::_pbi::kInvalidFieldOffsetTag,
  ::_pbi::kInvalidFieldOffsetTag,
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromqlRequest, _impl_.promql_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromqlResponse, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromqlResponse, _impl_.header_),
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromqlResponse, _impl_.body_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromInstantQuery, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromInstantQuery, _impl_.query_),
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromInstantQuery, _impl_.time_),
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromInstantQuery, _impl_.lookback_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromRangeQuery, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromRangeQuery, _impl_.query_),
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromRangeQuery, _impl_.start_),
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromRangeQuery, _impl_.end_),
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromRangeQuery, _impl_.step_),
  PROTOBUF_FIELD_OFFSET(::greptime::v1::PromRangeQuery, _impl_.lookback_),
};
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, -1, sizeof(::greptime::v1::PromqlRequest)},
  { 10, -1, -1, sizeof(::greptime::v1::PromqlResponse)},
  { 18, -1, -1, sizeof(::greptime::v1::PromInstantQuery)},
  { 27, -1, -1, sizeof(::greptime::v1::PromRangeQuery)},
};

static const ::_pb::Message* const file_default_instances[] = {
  &::greptime::v1::_PromqlRequest_default_instance_._instance,
  &::greptime::v1::_PromqlResponse_default_instance_._instance,
  &::greptime::v1::_PromInstantQuery_default_instance_._instance,
  &::greptime::v1::_PromRangeQuery_default_instance_._instance,
};

const char descriptor_table_protodef_greptime_2fv1_2fprom_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n\026greptime/v1/prom.proto\022\013greptime.v1\032\030g"
  "reptime/v1/common.proto\"\261\001\n\rPromqlReques"
  "t\022*\n\006header\030\001 \001(\0132\032.greptime.v1.RequestH"
  "eader\0226\n\rinstant_query\030\002 \001(\0132\035.greptime."
  "v1.PromInstantQueryH\000\0222\n\013range_query\030\003 \001"
  "(\0132\033.greptime.v1.PromRangeQueryH\000B\010\n\006pro"
  "mql\"K\n\016PromqlResponse\022+\n\006header\030\001 \001(\0132\033."
  "greptime.v1.ResponseHeader\022\014\n\004body\030\002 \001(\014"
  "\"A\n\020PromInstantQuery\022\r\n\005query\030\001 \001(\t\022\014\n\004t"
  "ime\030\002 \001(\t\022\020\n\010lookback\030\003 \001(\t\"[\n\016PromRange"
  "Query\022\r\n\005query\030\001 \001(\t\022\r\n\005start\030\002 \001(\t\022\013\n\003e"
  "nd\030\003 \001(\t\022\014\n\004step\030\004 \001(\t\022\020\n\010lookback\030\005 \001(\t"
  "2V\n\021PrometheusGateway\022A\n\006Handle\022\032.grepti"
  "me.v1.PromqlRequest\032\033.greptime.v1.Promql"
  "ResponseBS\n\016io.greptime.v1B\nPrometheusZ5"
  "github.com/GreptimeTeam/greptime-proto/g"
  "o/greptime/v1b\006proto3"
  ;
static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2fprom_2eproto_deps[1] = {
  &::descriptor_table_greptime_2fv1_2fcommon_2eproto,
};
static ::_pbi::once_flag descriptor_table_greptime_2fv1_2fprom_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2fprom_2eproto = {
    false, false, 661, descriptor_table_protodef_greptime_2fv1_2fprom_2eproto,
    "greptime/v1/prom.proto",
    &descriptor_table_greptime_2fv1_2fprom_2eproto_once, descriptor_table_greptime_2fv1_2fprom_2eproto_deps, 1, 4,
    schemas, file_default_instances, TableStruct_greptime_2fv1_2fprom_2eproto::offsets,
    file_level_metadata_greptime_2fv1_2fprom_2eproto, file_level_enum_descriptors_greptime_2fv1_2fprom_2eproto,
    file_level_service_descriptors_greptime_2fv1_2fprom_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_greptime_2fv1_2fprom_2eproto_getter() {
  return &descriptor_table_greptime_2fv1_2fprom_2eproto;
}

// Force running AddDescriptors() at dynamic initialization time.
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_greptime_2fv1_2fprom_2eproto(&descriptor_table_greptime_2fv1_2fprom_2eproto);
namespace greptime {
namespace v1 {

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

class PromqlRequest::_Internal {
 public:
  static const ::greptime::v1::RequestHeader& header(const PromqlRequest* msg);
  static const ::greptime::v1::PromInstantQuery& instant_query(const PromqlRequest* msg);
  static const ::greptime::v1::PromRangeQuery& range_query(const PromqlRequest* msg);
};

const ::greptime::v1::RequestHeader&
PromqlRequest::_Internal::header(const PromqlRequest* msg) {
  return *msg->_impl_.header_;
}
const ::greptime::v1::PromInstantQuery&
PromqlRequest::_Internal::instant_query(const PromqlRequest* msg) {
  return *msg->_impl_.promql_.instant_query_;
}
const ::greptime::v1::PromRangeQuery&
PromqlRequest::_Internal::range_query(const PromqlRequest* msg) {
  return *msg->_impl_.promql_.range_query_;
}
void PromqlRequest::clear_header() {
  if (GetArenaForAllocation() == nullptr && _impl_.header_ != nullptr) {
    delete _impl_.header_;
  }
  _impl_.header_ = nullptr;
}
void PromqlRequest::set_allocated_instant_query(::greptime::v1::PromInstantQuery* instant_query) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_promql();
  if (instant_query) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(instant_query);
    if (message_arena != submessage_arena) {
      instant_query = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, instant_query, submessage_arena);
    }
    set_has_instant_query();
    _impl_.promql_.instant_query_ = instant_query;
  }
  // @@protoc_insertion_point(field_set_allocated:greptime.v1.PromqlRequest.instant_query)
}
void PromqlRequest::set_allocated_range_query(::greptime::v1::PromRangeQuery* range_query) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_promql();
  if (range_query) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(range_query);
    if (message_arena != submessage_arena) {
      range_query = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, range_query, submessage_arena);
    }
    set_has_range_query();
    _impl_.promql_.range_query_ = range_query;
  }
  // @@protoc_insertion_point(field_set_allocated:greptime.v1.PromqlRequest.range_query)
}
PromqlRequest::PromqlRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:greptime.v1.PromqlRequest)
}
PromqlRequest::PromqlRequest(const PromqlRequest& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  PromqlRequest* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_.header_){nullptr}
    , decltype(_impl_.promql_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , /*decltype(_impl_._oneof_case_)*/{}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  if (from._internal_has_header()) {
    _this->_impl_.header_ = new ::greptime::v1::RequestHeader(*from._impl_.header_);
  }
  clear_has_promql();
  switch (from.promql_case()) {
    case kInstantQuery: {
      _this->_internal_mutable_instant_query()->::greptime::v1::PromInstantQuery::MergeFrom(
          from._internal_instant_query());
      break;
    }
    case kRangeQuery: {
      _this->_internal_mutable_range_query()->::greptime::v1::PromRangeQuery::MergeFrom(
          from._internal_range_query());
      break;
    }
    case PROMQL_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:greptime.v1.PromqlRequest)
}

inline void PromqlRequest::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_.header_){nullptr}
    , decltype(_impl_.promql_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , /*decltype(_impl_._oneof_case_)*/{}
  };
  clear_has_promql();
}

PromqlRequest::~PromqlRequest() {
  // @@protoc_insertion_point(destructor:greptime.v1.PromqlRequest)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void PromqlRequest::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (this != internal_default_instance()) delete _impl_.header_;
  if (has_promql()) {
    clear_promql();
  }
}

void PromqlRequest::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void PromqlRequest::clear_promql() {
// @@protoc_insertion_point(one_of_clear_start:greptime.v1.PromqlRequest)
  switch (promql_case()) {
    case kInstantQuery: {
      if (GetArenaForAllocation() == nullptr) {
        delete _impl_.promql_.instant_query_;
      }
      break;
    }
    case kRangeQuery: {
      if (GetArenaForAllocation() == nullptr) {
        delete _impl_.promql_.range_query_;
      }
      break;
    }
    case PROMQL_NOT_SET: {
      break;
    }
  }
  _impl_._oneof_case_[0] = PROMQL_NOT_SET;
}


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

  if (GetArenaForAllocation() == nullptr && _impl_.header_ != nullptr) {
    delete _impl_.header_;
  }
  _impl_.header_ = nullptr;
  clear_promql();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* PromqlRequest::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // .greptime.v1.RequestHeader header = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_header(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .greptime.v1.PromInstantQuery instant_query = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_instant_query(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .greptime.v1.PromRangeQuery range_query = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_range_query(), 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* PromqlRequest::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.PromqlRequest)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // .greptime.v1.RequestHeader header = 1;
  if (this->_internal_has_header()) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(1, _Internal::header(this),
        _Internal::header(this).GetCachedSize(), target, stream);
  }

  // .greptime.v1.PromInstantQuery instant_query = 2;
  if (_internal_has_instant_query()) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(2, _Internal::instant_query(this),
        _Internal::instant_query(this).GetCachedSize(), target, stream);
  }

  // .greptime.v1.PromRangeQuery range_query = 3;
  if (_internal_has_range_query()) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(3, _Internal::range_query(this),
        _Internal::range_query(this).GetCachedSize(), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::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:greptime.v1.PromqlRequest)
  return target;
}

size_t PromqlRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:greptime.v1.PromqlRequest)
  size_t total_size = 0;

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

  // .greptime.v1.RequestHeader header = 1;
  if (this->_internal_has_header()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *_impl_.header_);
  }

  switch (promql_case()) {
    // .greptime.v1.PromInstantQuery instant_query = 2;
    case kInstantQuery: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.promql_.instant_query_);
      break;
    }
    // .greptime.v1.PromRangeQuery range_query = 3;
    case kRangeQuery: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.promql_.range_query_);
      break;
    }
    case PROMQL_NOT_SET: {
      break;
    }
  }
  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

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


void PromqlRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<PromqlRequest*>(&to_msg);
  auto& from = static_cast<const PromqlRequest&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:greptime.v1.PromqlRequest)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (from._internal_has_header()) {
    _this->_internal_mutable_header()->::greptime::v1::RequestHeader::MergeFrom(
        from._internal_header());
  }
  switch (from.promql_case()) {
    case kInstantQuery: {
      _this->_internal_mutable_instant_query()->::greptime::v1::PromInstantQuery::MergeFrom(
          from._internal_instant_query());
      break;
    }
    case kRangeQuery: {
      _this->_internal_mutable_range_query()->::greptime::v1::PromRangeQuery::MergeFrom(
          from._internal_range_query());
      break;
    }
    case PROMQL_NOT_SET: {
      break;
    }
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

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

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

void PromqlRequest::InternalSwap(PromqlRequest* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_.header_, other->_impl_.header_);
  swap(_impl_.promql_, other->_impl_.promql_);
  swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
}

::PROTOBUF_NAMESPACE_ID::Metadata PromqlRequest::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_greptime_2fv1_2fprom_2eproto_getter, &descriptor_table_greptime_2fv1_2fprom_2eproto_once,
      file_level_metadata_greptime_2fv1_2fprom_2eproto[0]);
}

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

class PromqlResponse::_Internal {
 public:
  static const ::greptime::v1::ResponseHeader& header(const PromqlResponse* msg);
};

const ::greptime::v1::ResponseHeader&
PromqlResponse::_Internal::header(const PromqlResponse* msg) {
  return *msg->_impl_.header_;
}
void PromqlResponse::clear_header() {
  if (GetArenaForAllocation() == nullptr && _impl_.header_ != nullptr) {
    delete _impl_.header_;
  }
  _impl_.header_ = nullptr;
}
PromqlResponse::PromqlResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:greptime.v1.PromqlResponse)
}
PromqlResponse::PromqlResponse(const PromqlResponse& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  PromqlResponse* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_.body_){}
    , decltype(_impl_.header_){nullptr}
    , /*decltype(_impl_._cached_size_)*/{}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  _impl_.body_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.body_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_body().empty()) {
    _this->_impl_.body_.Set(from._internal_body(), 
      _this->GetArenaForAllocation());
  }
  if (from._internal_has_header()) {
    _this->_impl_.header_ = new ::greptime::v1::ResponseHeader(*from._impl_.header_);
  }
  // @@protoc_insertion_point(copy_constructor:greptime.v1.PromqlResponse)
}

inline void PromqlResponse::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_.body_){}
    , decltype(_impl_.header_){nullptr}
    , /*decltype(_impl_._cached_size_)*/{}
  };
  _impl_.body_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.body_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

PromqlResponse::~PromqlResponse() {
  // @@protoc_insertion_point(destructor:greptime.v1.PromqlResponse)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void PromqlResponse::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.body_.Destroy();
  if (this != internal_default_instance()) delete _impl_.header_;
}

void PromqlResponse::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

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

  _impl_.body_.ClearToEmpty();
  if (GetArenaForAllocation() == nullptr && _impl_.header_ != nullptr) {
    delete _impl_.header_;
  }
  _impl_.header_ = nullptr;
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* PromqlResponse::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // .greptime.v1.ResponseHeader header = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_header(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // bytes body = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_body();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          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* PromqlResponse::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.PromqlResponse)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // .greptime.v1.ResponseHeader header = 1;
  if (this->_internal_has_header()) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(1, _Internal::header(this),
        _Internal::header(this).GetCachedSize(), target, stream);
  }

  // bytes body = 2;
  if (!this->_internal_body().empty()) {
    target = stream->WriteBytesMaybeAliased(
        2, this->_internal_body(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::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:greptime.v1.PromqlResponse)
  return target;
}

size_t PromqlResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:greptime.v1.PromqlResponse)
  size_t total_size = 0;

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

  // bytes body = 2;
  if (!this->_internal_body().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
        this->_internal_body());
  }

  // .greptime.v1.ResponseHeader header = 1;
  if (this->_internal_has_header()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *_impl_.header_);
  }

  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

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


void PromqlResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<PromqlResponse*>(&to_msg);
  auto& from = static_cast<const PromqlResponse&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:greptime.v1.PromqlResponse)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (!from._internal_body().empty()) {
    _this->_internal_set_body(from._internal_body());
  }
  if (from._internal_has_header()) {
    _this->_internal_mutable_header()->::greptime::v1::ResponseHeader::MergeFrom(
        from._internal_header());
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

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

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

void PromqlResponse::InternalSwap(PromqlResponse* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.body_, lhs_arena,
      &other->_impl_.body_, rhs_arena
  );
  swap(_impl_.header_, other->_impl_.header_);
}

::PROTOBUF_NAMESPACE_ID::Metadata PromqlResponse::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_greptime_2fv1_2fprom_2eproto_getter, &descriptor_table_greptime_2fv1_2fprom_2eproto_once,
      file_level_metadata_greptime_2fv1_2fprom_2eproto[1]);
}

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

class PromInstantQuery::_Internal {
 public:
};

PromInstantQuery::PromInstantQuery(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:greptime.v1.PromInstantQuery)
}
PromInstantQuery::PromInstantQuery(const PromInstantQuery& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  PromInstantQuery* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_.query_){}
    , decltype(_impl_.time_){}
    , decltype(_impl_.lookback_){}
    , /*decltype(_impl_._cached_size_)*/{}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  _impl_.query_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.query_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_query().empty()) {
    _this->_impl_.query_.Set(from._internal_query(), 
      _this->GetArenaForAllocation());
  }
  _impl_.time_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.time_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_time().empty()) {
    _this->_impl_.time_.Set(from._internal_time(), 
      _this->GetArenaForAllocation());
  }
  _impl_.lookback_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.lookback_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_lookback().empty()) {
    _this->_impl_.lookback_.Set(from._internal_lookback(), 
      _this->GetArenaForAllocation());
  }
  // @@protoc_insertion_point(copy_constructor:greptime.v1.PromInstantQuery)
}

inline void PromInstantQuery::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_.query_){}
    , decltype(_impl_.time_){}
    , decltype(_impl_.lookback_){}
    , /*decltype(_impl_._cached_size_)*/{}
  };
  _impl_.query_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.query_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.time_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.time_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.lookback_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.lookback_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

PromInstantQuery::~PromInstantQuery() {
  // @@protoc_insertion_point(destructor:greptime.v1.PromInstantQuery)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void PromInstantQuery::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.query_.Destroy();
  _impl_.time_.Destroy();
  _impl_.lookback_.Destroy();
}

void PromInstantQuery::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

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

  _impl_.query_.ClearToEmpty();
  _impl_.time_.ClearToEmpty();
  _impl_.lookback_.ClearToEmpty();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* PromInstantQuery::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // string query = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_query();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromInstantQuery.query"));
        } else
          goto handle_unusual;
        continue;
      // string time = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_time();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromInstantQuery.time"));
        } else
          goto handle_unusual;
        continue;
      // string lookback = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          auto str = _internal_mutable_lookback();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromInstantQuery.lookback"));
        } 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* PromInstantQuery::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.PromInstantQuery)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // string query = 1;
  if (!this->_internal_query().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_query().data(), static_cast<int>(this->_internal_query().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromInstantQuery.query");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_query(), target);
  }

  // string time = 2;
  if (!this->_internal_time().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_time().data(), static_cast<int>(this->_internal_time().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromInstantQuery.time");
    target = stream->WriteStringMaybeAliased(
        2, this->_internal_time(), target);
  }

  // string lookback = 3;
  if (!this->_internal_lookback().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_lookback().data(), static_cast<int>(this->_internal_lookback().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromInstantQuery.lookback");
    target = stream->WriteStringMaybeAliased(
        3, this->_internal_lookback(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::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:greptime.v1.PromInstantQuery)
  return target;
}

size_t PromInstantQuery::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:greptime.v1.PromInstantQuery)
  size_t total_size = 0;

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

  // string query = 1;
  if (!this->_internal_query().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_query());
  }

  // string time = 2;
  if (!this->_internal_time().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_time());
  }

  // string lookback = 3;
  if (!this->_internal_lookback().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_lookback());
  }

  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

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


void PromInstantQuery::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<PromInstantQuery*>(&to_msg);
  auto& from = static_cast<const PromInstantQuery&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:greptime.v1.PromInstantQuery)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (!from._internal_query().empty()) {
    _this->_internal_set_query(from._internal_query());
  }
  if (!from._internal_time().empty()) {
    _this->_internal_set_time(from._internal_time());
  }
  if (!from._internal_lookback().empty()) {
    _this->_internal_set_lookback(from._internal_lookback());
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

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

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

void PromInstantQuery::InternalSwap(PromInstantQuery* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.query_, lhs_arena,
      &other->_impl_.query_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.time_, lhs_arena,
      &other->_impl_.time_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.lookback_, lhs_arena,
      &other->_impl_.lookback_, rhs_arena
  );
}

::PROTOBUF_NAMESPACE_ID::Metadata PromInstantQuery::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_greptime_2fv1_2fprom_2eproto_getter, &descriptor_table_greptime_2fv1_2fprom_2eproto_once,
      file_level_metadata_greptime_2fv1_2fprom_2eproto[2]);
}

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

class PromRangeQuery::_Internal {
 public:
};

PromRangeQuery::PromRangeQuery(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:greptime.v1.PromRangeQuery)
}
PromRangeQuery::PromRangeQuery(const PromRangeQuery& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  PromRangeQuery* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_.query_){}
    , decltype(_impl_.start_){}
    , decltype(_impl_.end_){}
    , decltype(_impl_.step_){}
    , decltype(_impl_.lookback_){}
    , /*decltype(_impl_._cached_size_)*/{}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  _impl_.query_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.query_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_query().empty()) {
    _this->_impl_.query_.Set(from._internal_query(), 
      _this->GetArenaForAllocation());
  }
  _impl_.start_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.start_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_start().empty()) {
    _this->_impl_.start_.Set(from._internal_start(), 
      _this->GetArenaForAllocation());
  }
  _impl_.end_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.end_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_end().empty()) {
    _this->_impl_.end_.Set(from._internal_end(), 
      _this->GetArenaForAllocation());
  }
  _impl_.step_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.step_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_step().empty()) {
    _this->_impl_.step_.Set(from._internal_step(), 
      _this->GetArenaForAllocation());
  }
  _impl_.lookback_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.lookback_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (!from._internal_lookback().empty()) {
    _this->_impl_.lookback_.Set(from._internal_lookback(), 
      _this->GetArenaForAllocation());
  }
  // @@protoc_insertion_point(copy_constructor:greptime.v1.PromRangeQuery)
}

inline void PromRangeQuery::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_.query_){}
    , decltype(_impl_.start_){}
    , decltype(_impl_.end_){}
    , decltype(_impl_.step_){}
    , decltype(_impl_.lookback_){}
    , /*decltype(_impl_._cached_size_)*/{}
  };
  _impl_.query_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.query_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.start_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.start_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.end_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.end_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.step_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.step_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.lookback_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.lookback_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

PromRangeQuery::~PromRangeQuery() {
  // @@protoc_insertion_point(destructor:greptime.v1.PromRangeQuery)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void PromRangeQuery::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.query_.Destroy();
  _impl_.start_.Destroy();
  _impl_.end_.Destroy();
  _impl_.step_.Destroy();
  _impl_.lookback_.Destroy();
}

void PromRangeQuery::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

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

  _impl_.query_.ClearToEmpty();
  _impl_.start_.ClearToEmpty();
  _impl_.end_.ClearToEmpty();
  _impl_.step_.ClearToEmpty();
  _impl_.lookback_.ClearToEmpty();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* PromRangeQuery::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // string query = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_query();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromRangeQuery.query"));
        } else
          goto handle_unusual;
        continue;
      // string start = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_start();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromRangeQuery.start"));
        } else
          goto handle_unusual;
        continue;
      // string end = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          auto str = _internal_mutable_end();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromRangeQuery.end"));
        } else
          goto handle_unusual;
        continue;
      // string step = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          auto str = _internal_mutable_step();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromRangeQuery.step"));
        } else
          goto handle_unusual;
        continue;
      // string lookback = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
          auto str = _internal_mutable_lookback();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          CHK_(::_pbi::VerifyUTF8(str, "greptime.v1.PromRangeQuery.lookback"));
        } 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* PromRangeQuery::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.PromRangeQuery)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // string query = 1;
  if (!this->_internal_query().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_query().data(), static_cast<int>(this->_internal_query().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromRangeQuery.query");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_query(), target);
  }

  // string start = 2;
  if (!this->_internal_start().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_start().data(), static_cast<int>(this->_internal_start().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromRangeQuery.start");
    target = stream->WriteStringMaybeAliased(
        2, this->_internal_start(), target);
  }

  // string end = 3;
  if (!this->_internal_end().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_end().data(), static_cast<int>(this->_internal_end().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromRangeQuery.end");
    target = stream->WriteStringMaybeAliased(
        3, this->_internal_end(), target);
  }

  // string step = 4;
  if (!this->_internal_step().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_step().data(), static_cast<int>(this->_internal_step().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromRangeQuery.step");
    target = stream->WriteStringMaybeAliased(
        4, this->_internal_step(), target);
  }

  // string lookback = 5;
  if (!this->_internal_lookback().empty()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_lookback().data(), static_cast<int>(this->_internal_lookback().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "greptime.v1.PromRangeQuery.lookback");
    target = stream->WriteStringMaybeAliased(
        5, this->_internal_lookback(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::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:greptime.v1.PromRangeQuery)
  return target;
}

size_t PromRangeQuery::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:greptime.v1.PromRangeQuery)
  size_t total_size = 0;

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

  // string query = 1;
  if (!this->_internal_query().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_query());
  }

  // string start = 2;
  if (!this->_internal_start().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_start());
  }

  // string end = 3;
  if (!this->_internal_end().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_end());
  }

  // string step = 4;
  if (!this->_internal_step().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_step());
  }

  // string lookback = 5;
  if (!this->_internal_lookback().empty()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_lookback());
  }

  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

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


void PromRangeQuery::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<PromRangeQuery*>(&to_msg);
  auto& from = static_cast<const PromRangeQuery&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:greptime.v1.PromRangeQuery)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (!from._internal_query().empty()) {
    _this->_internal_set_query(from._internal_query());
  }
  if (!from._internal_start().empty()) {
    _this->_internal_set_start(from._internal_start());
  }
  if (!from._internal_end().empty()) {
    _this->_internal_set_end(from._internal_end());
  }
  if (!from._internal_step().empty()) {
    _this->_internal_set_step(from._internal_step());
  }
  if (!from._internal_lookback().empty()) {
    _this->_internal_set_lookback(from._internal_lookback());
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

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

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

void PromRangeQuery::InternalSwap(PromRangeQuery* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.query_, lhs_arena,
      &other->_impl_.query_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.start_, lhs_arena,
      &other->_impl_.start_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.end_, lhs_arena,
      &other->_impl_.end_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.step_, lhs_arena,
      &other->_impl_.step_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.lookback_, lhs_arena,
      &other->_impl_.lookback_, rhs_arena
  );
}

::PROTOBUF_NAMESPACE_ID::Metadata PromRangeQuery::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_greptime_2fv1_2fprom_2eproto_getter, &descriptor_table_greptime_2fv1_2fprom_2eproto_once,
      file_level_metadata_greptime_2fv1_2fprom_2eproto[3]);
}

// @@protoc_insertion_point(namespace_scope)
}  // namespace v1
}  // namespace greptime
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::greptime::v1::PromqlRequest*
Arena::CreateMaybeMessage< ::greptime::v1::PromqlRequest >(Arena* arena) {
  return Arena::CreateMessageInternal< ::greptime::v1::PromqlRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::greptime::v1::PromqlResponse*
Arena::CreateMaybeMessage< ::greptime::v1::PromqlResponse >(Arena* arena) {
  return Arena::CreateMessageInternal< ::greptime::v1::PromqlResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::greptime::v1::PromInstantQuery*
Arena::CreateMaybeMessage< ::greptime::v1::PromInstantQuery >(Arena* arena) {
  return Arena::CreateMessageInternal< ::greptime::v1::PromInstantQuery >(arena);
}
template<> PROTOBUF_NOINLINE ::greptime::v1::PromRangeQuery*
Arena::CreateMaybeMessage< ::greptime::v1::PromRangeQuery >(Arena* arena) {
  return Arena::CreateMessageInternal< ::greptime::v1::PromRangeQuery >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

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