// Copyright 2023 Greptime Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryContext {
    #[prost(string, tag = "1")]
    pub current_catalog: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub current_schema: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub timezone: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "5")]
    pub extensions: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    #[prost(uint32, tag = "6")]
    pub channel: u32,
    #[prost(message, optional, tag = "7")]
    pub snapshot_seqs: ::core::option::Option<SnapshotSequences>,
    /// Explain options for the query.
    #[prost(message, optional, tag = "8")]
    pub explain: ::core::option::Option<ExplainOptions>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SnapshotSequences {
    /// Mappings of the RegionId to the minimal sequence of SST file to scan.
    #[prost(map = "uint64, uint64", tag = "1")]
    pub sst_min_sequences: ::std::collections::HashMap<u64, u64>,
    /// mapping of RegionId to SequenceNumber, for snapshot read, meaning that the
    /// read should only container data that was committed before (and include) the
    /// given sequence number
    #[prost(map = "uint64, uint64", tag = "7")]
    pub snapshot_seqs: ::std::collections::HashMap<u64, u64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExplainOptions {
    /// Whether to enable verbose explain output.
    #[prost(bool, tag = "1")]
    pub verbose: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader {
    /// The `catalog` that is selected to be used in this request.
    #[prost(string, tag = "1")]
    pub catalog: ::prost::alloc::string::String,
    /// The `schema` that is selected to be used in this request.
    #[prost(string, tag = "2")]
    pub schema: ::prost::alloc::string::String,
    /// The `authorization` header, much like http's authorization header.
    #[prost(message, optional, tag = "3")]
    pub authorization: ::core::option::Option<AuthHeader>,
    /// The `dbname` for the request
    #[prost(string, tag = "4")]
    pub dbname: ::prost::alloc::string::String,
    /// Encoded trace_id & span_id, follow the w3c Trace Context
    /// <https://www.w3.org/TR/trace-context/#header-name>
    #[prost(map = "string, string", tag = "5")]
    pub tracing_context: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// The `timezone` for the request
    #[prost(string, tag = "6")]
    pub timezone: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ResponseHeader {
    #[prost(message, optional, tag = "1")]
    pub status: ::core::option::Option<Status>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Status {
    /// Corresponding to the `StatusCode` definition of GreptimeDB
    #[prost(uint32, tag = "1")]
    pub status_code: u32,
    #[prost(string, tag = "2")]
    pub err_msg: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthHeader {
    #[prost(oneof = "auth_header::AuthScheme", tags = "1, 2")]
    pub auth_scheme: ::core::option::Option<auth_header::AuthScheme>,
}
/// Nested message and enum types in `AuthHeader`.
pub mod auth_header {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum AuthScheme {
        #[prost(message, tag = "1")]
        Basic(super::Basic),
        #[prost(message, tag = "2")]
        Token(super::Token),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Basic {
    #[prost(string, tag = "1")]
    pub username: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub password: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Token {
    #[prost(string, tag = "1")]
    pub token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TableName {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub table_name: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AffectedRows {
    #[prost(uint32, tag = "1")]
    pub value: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Metrics {
    #[prost(bytes = "vec", tag = "1")]
    pub metrics: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExpireAfter {
    #[prost(int64, tag = "1")]
    pub value: i64,
}
/// Eval Interval in seconds
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EvalInterval {
    #[prost(int64, tag = "1")]
    pub seconds: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FlightMetadata {
    #[prost(message, optional, tag = "1")]
    pub affected_rows: ::core::option::Option<AffectedRows>,
    #[prost(message, optional, tag = "2")]
    pub metrics: ::core::option::Option<Metrics>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct IntervalMonthDayNano {
    #[prost(int32, tag = "1")]
    pub months: i32,
    #[prost(int32, tag = "2")]
    pub days: i32,
    #[prost(int64, tag = "3")]
    pub nanoseconds: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TimeRange {
    #[prost(int64, tag = "1")]
    pub start: i64,
    #[prost(int64, tag = "2")]
    pub end: i64,
}
/// / Truncate partially by time ranges
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TimeRanges {
    #[prost(enumeration = "TimeUnit", tag = "1")]
    pub time_unit: i32,
    #[prost(message, repeated, tag = "2")]
    pub time_ranges: ::prost::alloc::vec::Vec<TimeRange>,
}
/// (hi: high 64 bits, lo: low 64 bits) are used to keep the decimal128 value.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Decimal128 {
    #[prost(int64, tag = "1")]
    pub hi: i64,
    #[prost(int64, tag = "2")]
    pub lo: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StructField {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(enumeration = "ColumnDataType", tag = "2")]
    pub datatype: i32,
    #[prost(message, optional, tag = "3")]
    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
}
/// Type extension for some complex types
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ColumnDataTypeExtension {
    #[prost(oneof = "column_data_type_extension::TypeExt", tags = "1, 2, 3, 4, 5, 6, 7")]
    pub type_ext: ::core::option::Option<column_data_type_extension::TypeExt>,
}
/// Nested message and enum types in `ColumnDataTypeExtension`.
pub mod column_data_type_extension {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum TypeExt {
        #[prost(message, tag = "1")]
        DecimalType(super::DecimalTypeExtension),
        /// Marks the binary column in proto is actually a JSON column.
        /// Deprecated
        #[prost(enumeration = "super::JsonTypeExtension", tag = "2")]
        JsonType(i32),
        #[prost(message, tag = "3")]
        VectorType(super::VectorTypeExtension),
        #[prost(message, tag = "4")]
        ListType(::prost::alloc::boxed::Box<super::ListTypeExtension>),
        #[prost(message, tag = "5")]
        StructType(super::StructTypeExtension),
        /// Marks the data type is a logical json data
        #[prost(message, tag = "6")]
        JsonNativeType(::prost::alloc::boxed::Box<super::JsonNativeTypeExtension>),
        #[prost(message, tag = "7")]
        DictionaryType(::prost::alloc::boxed::Box<super::DictionaryTypeExtension>),
    }
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DecimalTypeExtension {
    #[prost(int32, tag = "1")]
    pub precision: i32,
    #[prost(int32, tag = "2")]
    pub scale: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct VectorTypeExtension {
    #[prost(uint32, tag = "1")]
    pub dim: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTypeExtension {
    #[prost(enumeration = "ColumnDataType", tag = "1")]
    pub datatype: i32,
    #[prost(message, optional, boxed, tag = "2")]
    pub datatype_extension: ::core::option::Option<
        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StructTypeExtension {
    #[prost(message, repeated, tag = "1")]
    pub fields: ::prost::alloc::vec::Vec<StructField>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JsonNativeTypeExtension {
    #[prost(enumeration = "ColumnDataType", tag = "1")]
    pub datatype: i32,
    #[prost(message, optional, boxed, tag = "2")]
    pub datatype_extension: ::core::option::Option<
        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DictionaryTypeExtension {
    #[prost(enumeration = "ColumnDataType", tag = "1")]
    pub key_datatype: i32,
    #[prost(message, optional, boxed, tag = "2")]
    pub key_datatype_extension: ::core::option::Option<
        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
    >,
    #[prost(enumeration = "ColumnDataType", tag = "3")]
    pub value_datatype: i32,
    #[prost(message, optional, boxed, tag = "4")]
    pub value_datatype_extension: ::core::option::Option<
        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
    >,
}
/// Additional options for the column.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ColumnOptions {
    /// Supported keys:
    /// "fulltext":
    /// A JSON encoded string containing full-text search options for the column.
    ///
    /// ```text
    ///   The fulltext options JSON structure:
    ///   {
    ///     "enable": bool,          // Indicates whether full-text search is
    ///                              // enabled for the column.
    ///
    ///     "analyzer": string,      // The language-specific text analyzer to
    ///                              // use for indexing and searching text.
    ///                              // Supported values: \["English" (Default), "Chinese"\].
    ///
    ///     "case-sensitive": bool   // Indicates whether the text should be treated
    ///                              // as case-sensitive during full-text search.
    ///   }
    ///
    ///   Example:
    ///   "fulltext": "{\"enable\": true, \"analyzer\": \"English\", \"case-sensitive\": false}"
    /// ```
    #[prost(map = "string, string", tag = "1")]
    pub options: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ArrowIpc {
    #[prost(bytes = "bytes", tag = "1")]
    pub schema: ::prost::bytes::Bytes,
    #[prost(bytes = "bytes", tag = "2")]
    pub data_header: ::prost::bytes::Bytes,
    #[prost(bytes = "bytes", tag = "3")]
    pub payload: ::prost::bytes::Bytes,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PartitionExprVersion {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SemanticType {
    Tag = 0,
    Field = 1,
    Timestamp = 2,
}
impl SemanticType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Tag => "TAG",
            Self::Field => "FIELD",
            Self::Timestamp => "TIMESTAMP",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TAG" => Some(Self::Tag),
            "FIELD" => Some(Self::Field),
            "TIMESTAMP" => Some(Self::Timestamp),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ColumnDataType {
    Boolean = 0,
    Int8 = 1,
    Int16 = 2,
    Int32 = 3,
    Int64 = 4,
    Uint8 = 5,
    Uint16 = 6,
    Uint32 = 7,
    Uint64 = 8,
    Float32 = 9,
    Float64 = 10,
    Binary = 11,
    String = 12,
    Date = 13,
    Datetime = 14,
    TimestampSecond = 15,
    TimestampMillisecond = 16,
    TimestampMicrosecond = 17,
    TimestampNanosecond = 18,
    TimeSecond = 19,
    TimeMillisecond = 20,
    TimeMicrosecond = 21,
    TimeNanosecond = 22,
    IntervalYearMonth = 23,
    IntervalDayTime = 24,
    IntervalMonthDayNano = 25,
    Decimal128 = 30,
    Json = 31,
    Vector = 32,
    List = 40,
    Struct = 41,
    Dictionary = 42,
}
impl ColumnDataType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Boolean => "BOOLEAN",
            Self::Int8 => "INT8",
            Self::Int16 => "INT16",
            Self::Int32 => "INT32",
            Self::Int64 => "INT64",
            Self::Uint8 => "UINT8",
            Self::Uint16 => "UINT16",
            Self::Uint32 => "UINT32",
            Self::Uint64 => "UINT64",
            Self::Float32 => "FLOAT32",
            Self::Float64 => "FLOAT64",
            Self::Binary => "BINARY",
            Self::String => "STRING",
            Self::Date => "DATE",
            Self::Datetime => "DATETIME",
            Self::TimestampSecond => "TIMESTAMP_SECOND",
            Self::TimestampMillisecond => "TIMESTAMP_MILLISECOND",
            Self::TimestampMicrosecond => "TIMESTAMP_MICROSECOND",
            Self::TimestampNanosecond => "TIMESTAMP_NANOSECOND",
            Self::TimeSecond => "TIME_SECOND",
            Self::TimeMillisecond => "TIME_MILLISECOND",
            Self::TimeMicrosecond => "TIME_MICROSECOND",
            Self::TimeNanosecond => "TIME_NANOSECOND",
            Self::IntervalYearMonth => "INTERVAL_YEAR_MONTH",
            Self::IntervalDayTime => "INTERVAL_DAY_TIME",
            Self::IntervalMonthDayNano => "INTERVAL_MONTH_DAY_NANO",
            Self::Decimal128 => "DECIMAL128",
            Self::Json => "JSON",
            Self::Vector => "VECTOR",
            Self::List => "LIST",
            Self::Struct => "STRUCT",
            Self::Dictionary => "DICTIONARY",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "BOOLEAN" => Some(Self::Boolean),
            "INT8" => Some(Self::Int8),
            "INT16" => Some(Self::Int16),
            "INT32" => Some(Self::Int32),
            "INT64" => Some(Self::Int64),
            "UINT8" => Some(Self::Uint8),
            "UINT16" => Some(Self::Uint16),
            "UINT32" => Some(Self::Uint32),
            "UINT64" => Some(Self::Uint64),
            "FLOAT32" => Some(Self::Float32),
            "FLOAT64" => Some(Self::Float64),
            "BINARY" => Some(Self::Binary),
            "STRING" => Some(Self::String),
            "DATE" => Some(Self::Date),
            "DATETIME" => Some(Self::Datetime),
            "TIMESTAMP_SECOND" => Some(Self::TimestampSecond),
            "TIMESTAMP_MILLISECOND" => Some(Self::TimestampMillisecond),
            "TIMESTAMP_MICROSECOND" => Some(Self::TimestampMicrosecond),
            "TIMESTAMP_NANOSECOND" => Some(Self::TimestampNanosecond),
            "TIME_SECOND" => Some(Self::TimeSecond),
            "TIME_MILLISECOND" => Some(Self::TimeMillisecond),
            "TIME_MICROSECOND" => Some(Self::TimeMicrosecond),
            "TIME_NANOSECOND" => Some(Self::TimeNanosecond),
            "INTERVAL_YEAR_MONTH" => Some(Self::IntervalYearMonth),
            "INTERVAL_DAY_TIME" => Some(Self::IntervalDayTime),
            "INTERVAL_MONTH_DAY_NANO" => Some(Self::IntervalMonthDayNano),
            "DECIMAL128" => Some(Self::Decimal128),
            "JSON" => Some(Self::Json),
            "VECTOR" => Some(Self::Vector),
            "LIST" => Some(Self::List),
            "STRUCT" => Some(Self::Struct),
            "DICTIONARY" => Some(Self::Dictionary),
            _ => None,
        }
    }
}
/// / Time Unit for timestamp
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TimeUnit {
    /// The default time unit is MILLISECOND
    Millisecond = 0,
    Second = 1,
    Microsecond = 2,
    Nanosecond = 3,
}
impl TimeUnit {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Millisecond => "MILLISECOND",
            Self::Second => "SECOND",
            Self::Microsecond => "MICROSECOND",
            Self::Nanosecond => "NANOSECOND",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "MILLISECOND" => Some(Self::Millisecond),
            "SECOND" => Some(Self::Second),
            "MICROSECOND" => Some(Self::Microsecond),
            "NANOSECOND" => Some(Self::Nanosecond),
            _ => None,
        }
    }
}
/// Deprecated
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum JsonTypeExtension {
    JsonBinary = 0,
}
impl JsonTypeExtension {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::JsonBinary => "JSON_BINARY",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "JSON_BINARY" => Some(Self::JsonBinary),
            _ => None,
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Rows {
    #[prost(message, repeated, tag = "1")]
    pub schema: ::prost::alloc::vec::Vec<ColumnSchema>,
    #[prost(message, repeated, tag = "2")]
    pub rows: ::prost::alloc::vec::Vec<Row>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ColumnSchema {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
    #[prost(enumeration = "ColumnDataType", tag = "2")]
    pub datatype: i32,
    #[prost(enumeration = "SemanticType", tag = "3")]
    pub semantic_type: i32,
    /// Extension for ColumnDataType.
    #[prost(message, optional, tag = "4")]
    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
    /// Additional column options.
    #[prost(message, optional, tag = "5")]
    pub options: ::core::option::Option<ColumnOptions>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Row {
    #[prost(message, repeated, tag = "1")]
    pub values: ::prost::alloc::vec::Vec<Value>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Value {
    #[prost(
        oneof = "value::ValueData",
        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 31, 40, 41, 42"
    )]
    pub value_data: ::core::option::Option<value::ValueData>,
}
/// Nested message and enum types in `Value`.
pub mod value {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ValueData {
        #[prost(int32, tag = "1")]
        I8Value(i32),
        #[prost(int32, tag = "2")]
        I16Value(i32),
        #[prost(int32, tag = "3")]
        I32Value(i32),
        #[prost(int64, tag = "4")]
        I64Value(i64),
        #[prost(uint32, tag = "5")]
        U8Value(u32),
        #[prost(uint32, tag = "6")]
        U16Value(u32),
        #[prost(uint32, tag = "7")]
        U32Value(u32),
        #[prost(uint64, tag = "8")]
        U64Value(u64),
        #[prost(float, tag = "9")]
        F32Value(f32),
        #[prost(double, tag = "10")]
        F64Value(f64),
        #[prost(bool, tag = "11")]
        BoolValue(bool),
        #[prost(bytes, tag = "12")]
        BinaryValue(::prost::alloc::vec::Vec<u8>),
        #[prost(string, tag = "13")]
        StringValue(::prost::alloc::string::String),
        #[prost(int32, tag = "14")]
        DateValue(i32),
        #[prost(int64, tag = "15")]
        DatetimeValue(i64),
        #[prost(int64, tag = "16")]
        TimestampSecondValue(i64),
        #[prost(int64, tag = "17")]
        TimestampMillisecondValue(i64),
        #[prost(int64, tag = "18")]
        TimestampMicrosecondValue(i64),
        #[prost(int64, tag = "19")]
        TimestampNanosecondValue(i64),
        #[prost(int64, tag = "20")]
        TimeSecondValue(i64),
        #[prost(int64, tag = "21")]
        TimeMillisecondValue(i64),
        #[prost(int64, tag = "22")]
        TimeMicrosecondValue(i64),
        #[prost(int64, tag = "23")]
        TimeNanosecondValue(i64),
        #[prost(int32, tag = "24")]
        IntervalYearMonthValue(i32),
        #[prost(int64, tag = "25")]
        IntervalDayTimeValue(i64),
        #[prost(message, tag = "26")]
        IntervalMonthDayNanoValue(super::IntervalMonthDayNano),
        #[prost(message, tag = "31")]
        Decimal128Value(super::Decimal128),
        #[prost(message, tag = "40")]
        ListValue(super::ListValue),
        #[prost(message, tag = "41")]
        StructValue(super::StructValue),
        #[prost(message, tag = "42")]
        JsonValue(super::JsonValue),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListValue {
    #[prost(message, repeated, tag = "1")]
    pub items: ::prost::alloc::vec::Vec<Value>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StructValue {
    #[prost(message, repeated, tag = "2")]
    pub items: ::prost::alloc::vec::Vec<Value>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JsonValue {
    #[prost(oneof = "json_value::Value", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
    pub value: ::core::option::Option<json_value::Value>,
}
/// Nested message and enum types in `JsonValue`.
pub mod json_value {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Value {
        #[prost(bool, tag = "1")]
        Boolean(bool),
        #[prost(int64, tag = "2")]
        Int(i64),
        #[prost(uint64, tag = "3")]
        Uint(u64),
        #[prost(double, tag = "4")]
        Float(f64),
        #[prost(string, tag = "5")]
        Str(::prost::alloc::string::String),
        #[prost(message, tag = "6")]
        Array(super::JsonList),
        #[prost(message, tag = "7")]
        Object(super::JsonObject),
        #[prost(bytes, tag = "8")]
        Variant(::prost::alloc::vec::Vec<u8>),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JsonList {
    #[prost(message, repeated, tag = "1")]
    pub items: ::prost::alloc::vec::Vec<JsonValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JsonObject {
    #[prost(message, repeated, tag = "1")]
    pub entries: ::prost::alloc::vec::Vec<json_object::Entry>,
}
/// Nested message and enum types in `JsonObject`.
pub mod json_object {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Entry {
        #[prost(string, tag = "1")]
        pub key: ::prost::alloc::string::String,
        #[prost(message, optional, tag = "2")]
        pub value: ::core::option::Option<super::JsonValue>,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Column {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
    #[prost(enumeration = "SemanticType", tag = "2")]
    pub semantic_type: i32,
    /// The array of non-null values in this column.
    ///
    /// For example: suppose there is a column "foo" that contains some int32
    /// values (1, 2, 3, 4, 5, null, 7, 8, 9, null);
    /// column:
    /// column_name: foo
    /// semantic_type: Tag
    /// values: 1, 2, 3, 4, 5, 7, 8, 9
    /// null_masks: 00100000 00000010
    #[prost(message, optional, tag = "3")]
    pub values: ::core::option::Option<column::Values>,
    /// Mask maps the positions of null values.
    /// If a bit in null_mask is 1, it indicates that the column value at that
    /// position is null.
    #[prost(bytes = "vec", tag = "4")]
    pub null_mask: ::prost::alloc::vec::Vec<u8>,
    /// Helpful in creating vector from column.
    #[prost(enumeration = "ColumnDataType", tag = "5")]
    pub datatype: i32,
    /// Extension for ColumnDataType.
    #[prost(message, optional, tag = "6")]
    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
    /// Additional column options.
    #[prost(message, optional, tag = "7")]
    pub options: ::core::option::Option<ColumnOptions>,
}
/// Nested message and enum types in `Column`.
pub mod column {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Values {
        #[prost(int32, repeated, tag = "1")]
        pub i8_values: ::prost::alloc::vec::Vec<i32>,
        #[prost(int32, repeated, tag = "2")]
        pub i16_values: ::prost::alloc::vec::Vec<i32>,
        #[prost(int32, repeated, tag = "3")]
        pub i32_values: ::prost::alloc::vec::Vec<i32>,
        #[prost(int64, repeated, tag = "4")]
        pub i64_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(uint32, repeated, tag = "5")]
        pub u8_values: ::prost::alloc::vec::Vec<u32>,
        #[prost(uint32, repeated, tag = "6")]
        pub u16_values: ::prost::alloc::vec::Vec<u32>,
        #[prost(uint32, repeated, tag = "7")]
        pub u32_values: ::prost::alloc::vec::Vec<u32>,
        #[prost(uint64, repeated, tag = "8")]
        pub u64_values: ::prost::alloc::vec::Vec<u64>,
        #[prost(float, repeated, tag = "9")]
        pub f32_values: ::prost::alloc::vec::Vec<f32>,
        #[prost(double, repeated, tag = "10")]
        pub f64_values: ::prost::alloc::vec::Vec<f64>,
        #[prost(bool, repeated, tag = "11")]
        pub bool_values: ::prost::alloc::vec::Vec<bool>,
        #[prost(bytes = "vec", repeated, tag = "12")]
        pub binary_values: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
        #[prost(string, repeated, tag = "13")]
        pub string_values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
        #[prost(int32, repeated, tag = "14")]
        pub date_values: ::prost::alloc::vec::Vec<i32>,
        #[prost(int64, repeated, tag = "15")]
        pub datetime_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "16")]
        pub timestamp_second_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "17")]
        pub timestamp_millisecond_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "18")]
        pub timestamp_microsecond_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "19")]
        pub timestamp_nanosecond_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "20")]
        pub time_second_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "21")]
        pub time_millisecond_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "22")]
        pub time_microsecond_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int64, repeated, tag = "23")]
        pub time_nanosecond_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(int32, repeated, tag = "24")]
        pub interval_year_month_values: ::prost::alloc::vec::Vec<i32>,
        #[prost(int64, repeated, tag = "25")]
        pub interval_day_time_values: ::prost::alloc::vec::Vec<i64>,
        #[prost(message, repeated, tag = "26")]
        pub interval_month_day_nano_values: ::prost::alloc::vec::Vec<
            super::IntervalMonthDayNano,
        >,
        #[prost(message, repeated, tag = "31")]
        pub decimal128_values: ::prost::alloc::vec::Vec<super::Decimal128>,
        #[prost(message, repeated, tag = "40")]
        pub list_values: ::prost::alloc::vec::Vec<super::ListValue>,
        #[prost(message, repeated, tag = "41")]
        pub struct_values: ::prost::alloc::vec::Vec<super::StructValue>,
        #[prost(message, repeated, tag = "42")]
        pub json_values: ::prost::alloc::vec::Vec<Values>,
    }
}
/// "Data Definition Language" requests, that create, modify or delete the
/// database structures but not the data. `DdlRequest` could carry more
/// information than plain SQL, for example, the "table_id" in `CreateTableExpr`.
/// So create a new DDL expr if you need it.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DdlRequest {
    #[prost(oneof = "ddl_request::Expr", tags = "1, 2, 3, 4, 7, 8, 9, 10, 11, 12, 13")]
    pub expr: ::core::option::Option<ddl_request::Expr>,
}
/// Nested message and enum types in `DdlRequest`.
pub mod ddl_request {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Expr {
        #[prost(message, tag = "1")]
        CreateDatabase(super::CreateDatabaseExpr),
        #[prost(message, tag = "2")]
        CreateTable(super::CreateTableExpr),
        #[prost(message, tag = "3")]
        AlterTable(super::AlterTableExpr),
        #[prost(message, tag = "4")]
        DropTable(super::DropTableExpr),
        #[prost(message, tag = "7")]
        TruncateTable(super::TruncateTableExpr),
        #[prost(message, tag = "8")]
        CreateFlow(super::CreateFlowExpr),
        #[prost(message, tag = "9")]
        DropFlow(super::DropFlowExpr),
        #[prost(message, tag = "10")]
        CreateView(super::CreateViewExpr),
        #[prost(message, tag = "11")]
        DropView(super::DropViewExpr),
        #[prost(message, tag = "12")]
        AlterDatabase(super::AlterDatabaseExpr),
        #[prost(message, tag = "13")]
        CommentOn(super::CommentOnExpr),
    }
}
/// Create a flow to run the SQL when new data arrives.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateFlowExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub flow_name: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "3")]
    pub source_table_names: ::prost::alloc::vec::Vec<TableName>,
    #[prost(message, optional, tag = "4")]
    pub sink_table_name: ::core::option::Option<TableName>,
    #[prost(bool, tag = "5")]
    pub or_replace: bool,
    #[prost(bool, tag = "6")]
    pub create_if_not_exists: bool,
    /// Expire data older than the given duration seconds.
    #[prost(message, optional, tag = "7")]
    pub expire_after: ::core::option::Option<ExpireAfter>,
    #[prost(message, optional, tag = "11")]
    pub eval_interval: ::core::option::Option<EvalInterval>,
    #[prost(string, tag = "8")]
    pub comment: ::prost::alloc::string::String,
    #[prost(string, tag = "9")]
    pub sql: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "10")]
    pub flow_options: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
/// Drop a flow.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropFlowExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub flow_name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub flow_id: ::core::option::Option<FlowId>,
    #[prost(bool, tag = "5")]
    pub drop_if_exists: bool,
}
/// Create a view
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateViewExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub view_name: ::prost::alloc::string::String,
    #[prost(bytes = "vec", tag = "4")]
    pub logical_plan: ::prost::alloc::vec::Vec<u8>,
    #[prost(bool, tag = "5")]
    pub create_if_not_exists: bool,
    #[prost(bool, tag = "6")]
    pub or_replace: bool,
    #[prost(message, repeated, tag = "7")]
    pub table_names: ::prost::alloc::vec::Vec<TableName>,
    #[prost(string, repeated, tag = "8")]
    pub columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(string, repeated, tag = "9")]
    pub plan_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(string, tag = "10")]
    pub definition: ::prost::alloc::string::String,
}
/// Drop a view
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropViewExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub view_name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub view_id: ::core::option::Option<TableId>,
    #[prost(bool, tag = "5")]
    pub drop_if_exists: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTableExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub table_name: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub desc: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "5")]
    pub column_defs: ::prost::alloc::vec::Vec<ColumnDef>,
    #[prost(string, tag = "6")]
    pub time_index: ::prost::alloc::string::String,
    #[prost(string, repeated, tag = "7")]
    pub primary_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(bool, tag = "8")]
    pub create_if_not_exists: bool,
    #[prost(map = "string, string", tag = "9")]
    pub table_options: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    #[prost(message, optional, tag = "10")]
    pub table_id: ::core::option::Option<TableId>,
    #[prost(string, tag = "12")]
    pub engine: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlterTableExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub table_name: ::prost::alloc::string::String,
    #[prost(
        oneof = "alter_table_expr::Kind",
        tags = "4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18"
    )]
    pub kind: ::core::option::Option<alter_table_expr::Kind>,
}
/// Nested message and enum types in `AlterTableExpr`.
pub mod alter_table_expr {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "4")]
        AddColumns(super::AddColumns),
        #[prost(message, tag = "5")]
        DropColumns(super::DropColumns),
        #[prost(message, tag = "6")]
        RenameTable(super::RenameTable),
        #[prost(message, tag = "7")]
        ModifyColumnTypes(super::ModifyColumnTypes),
        #[prost(message, tag = "8")]
        SetTableOptions(super::SetTableOptions),
        #[prost(message, tag = "11")]
        UnsetTableOptions(super::UnsetTableOptions),
        /// Deprecated: use set_indexes instead.
        #[prost(message, tag = "12")]
        SetIndex(super::SetIndex),
        /// Deprecated: use unset_indexes instead.
        #[prost(message, tag = "13")]
        UnsetIndex(super::UnsetIndex),
        #[prost(message, tag = "14")]
        DropDefaults(super::DropDefaults),
        #[prost(message, tag = "15")]
        SetIndexes(super::SetIndexes),
        #[prost(message, tag = "16")]
        UnsetIndexes(super::UnsetIndexes),
        #[prost(message, tag = "17")]
        SetDefaults(super::SetDefaults),
        #[prost(message, tag = "18")]
        Repartition(super::Repartition),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropDefault {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetIndexes {
    #[prost(message, repeated, tag = "1")]
    pub set_indexes: ::prost::alloc::vec::Vec<SetIndex>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnsetIndexes {
    #[prost(message, repeated, tag = "1")]
    pub unset_indexes: ::prost::alloc::vec::Vec<UnsetIndex>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetDefault {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
    /// The JSON representation of the default `Expr`.
    #[prost(bytes = "vec", tag = "2")]
    pub default_constraint: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetIndex {
    #[prost(oneof = "set_index::Options", tags = "1, 2, 3")]
    pub options: ::core::option::Option<set_index::Options>,
}
/// Nested message and enum types in `SetIndex`.
pub mod set_index {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Options {
        #[prost(message, tag = "1")]
        Fulltext(super::SetFulltext),
        #[prost(message, tag = "2")]
        Inverted(super::SetInverted),
        #[prost(message, tag = "3")]
        Skipping(super::SetSkipping),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsetIndex {
    #[prost(oneof = "unset_index::Options", tags = "1, 2, 3")]
    pub options: ::core::option::Option<unset_index::Options>,
}
/// Nested message and enum types in `UnsetIndex`.
pub mod unset_index {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Options {
        #[prost(message, tag = "1")]
        Fulltext(super::UnsetFulltext),
        #[prost(message, tag = "2")]
        Inverted(super::UnsetInverted),
        #[prost(message, tag = "3")]
        Skipping(super::UnsetSkipping),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Repartition {
    /// Deprecated: use `source.partition_exprs.exprs` instead.
    #[deprecated]
    #[prost(string, repeated, tag = "1")]
    pub from_partition_exprs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(string, repeated, tag = "2")]
    pub into_partition_exprs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(oneof = "repartition::Source", tags = "3, 4")]
    pub source: ::core::option::Option<repartition::Source>,
}
/// Nested message and enum types in `Repartition`.
pub mod repartition {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Source {
        #[prost(message, tag = "3")]
        PartitionExprs(super::PartitionExprs),
        #[prost(message, tag = "4")]
        Unpartitioned(super::UnpartitionedSource),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PartitionExprs {
    /// The partition expressions serialized in JSON format.
    #[prost(string, repeated, tag = "1")]
    pub exprs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnpartitionedSource {
    /// Partition columns for unpartitioned/single-region.
    #[prost(string, repeated, tag = "1")]
    pub partition_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropTableExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub table_name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub table_id: ::core::option::Option<TableId>,
    #[prost(bool, tag = "5")]
    pub drop_if_exists: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDatabaseExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub create_if_not_exists: bool,
    #[prost(map = "string, string", tag = "4")]
    pub options: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TruncateTableExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub table_name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub table_id: ::core::option::Option<TableId>,
    /// if empty, truncate entire table, else only truncate time ranges
    #[prost(message, optional, tag = "5")]
    pub time_ranges: ::core::option::Option<TimeRanges>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropDatabaseExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub drop_if_exists: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddColumns {
    #[prost(message, repeated, tag = "1")]
    pub add_columns: ::prost::alloc::vec::Vec<AddColumn>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DropDefaults {
    #[prost(message, repeated, tag = "1")]
    pub drop_defaults: ::prost::alloc::vec::Vec<DropDefault>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetDefaults {
    #[prost(message, repeated, tag = "1")]
    pub set_defaults: ::prost::alloc::vec::Vec<SetDefault>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DropColumns {
    #[prost(message, repeated, tag = "1")]
    pub drop_columns: ::prost::alloc::vec::Vec<DropColumn>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyColumnTypes {
    #[prost(message, repeated, tag = "1")]
    pub modify_column_types: ::prost::alloc::vec::Vec<ModifyColumnType>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RenameTable {
    #[prost(string, tag = "1")]
    pub new_table_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddColumn {
    #[prost(message, optional, tag = "1")]
    pub column_def: ::core::option::Option<ColumnDef>,
    #[prost(message, optional, tag = "3")]
    pub location: ::core::option::Option<AddColumnLocation>,
    #[prost(bool, tag = "4")]
    pub add_if_not_exists: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyColumnType {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
    #[prost(enumeration = "ColumnDataType", tag = "2")]
    pub target_type: i32,
    #[prost(message, optional, tag = "3")]
    pub target_type_extension: ::core::option::Option<ColumnDataTypeExtension>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Option {
    #[prost(string, tag = "1")]
    pub key: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub value: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetTableOptions {
    #[prost(message, repeated, tag = "1")]
    pub table_options: ::prost::alloc::vec::Vec<Option>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsetTableOptions {
    #[prost(string, repeated, tag = "1")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropColumn {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TableId {
    #[prost(uint32, tag = "1")]
    pub id: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FlowId {
    #[prost(uint32, tag = "1")]
    pub id: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ColumnDef {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(enumeration = "ColumnDataType", tag = "2")]
    pub data_type: i32,
    #[prost(bool, tag = "3")]
    pub is_nullable: bool,
    #[prost(bytes = "vec", tag = "4")]
    pub default_constraint: ::prost::alloc::vec::Vec<u8>,
    #[prost(enumeration = "SemanticType", tag = "5")]
    pub semantic_type: i32,
    #[prost(string, tag = "6")]
    pub comment: ::prost::alloc::string::String,
    /// Extension for ColumnDataType.
    #[prost(message, optional, tag = "7")]
    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
    /// Additional column options.
    #[prost(message, optional, tag = "8")]
    pub options: ::core::option::Option<ColumnOptions>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AddColumnLocation {
    #[prost(enumeration = "add_column_location::LocationType", tag = "1")]
    pub location_type: i32,
    #[prost(string, tag = "2")]
    pub after_column_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `AddColumnLocation`.
pub mod add_column_location {
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum LocationType {
        First = 0,
        After = 1,
    }
    impl LocationType {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::First => "FIRST",
                Self::After => "AFTER",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "FIRST" => Some(Self::First),
                "AFTER" => Some(Self::After),
                _ => None,
            }
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetFulltext {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
    #[prost(bool, tag = "2")]
    pub enable: bool,
    #[prost(enumeration = "Analyzer", tag = "3")]
    pub analyzer: i32,
    #[prost(bool, tag = "4")]
    pub case_sensitive: bool,
    #[prost(enumeration = "FulltextBackend", tag = "5")]
    pub backend: i32,
    /// The granularity for the fulltext index (for bloom backend only).
    #[prost(uint64, tag = "6")]
    pub granularity: u64,
    /// The false positive rate for the fulltext index (for bloom backend only).
    #[prost(double, tag = "7")]
    pub false_positive_rate: f64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsetFulltext {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetInverted {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsetInverted {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetSkipping {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
    #[prost(bool, tag = "2")]
    pub enable: bool,
    #[prost(uint64, tag = "3")]
    pub granularity: u64,
    #[prost(enumeration = "SkippingIndexType", tag = "4")]
    pub skipping_index_type: i32,
    #[prost(double, tag = "5")]
    pub false_positive_rate: f64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsetSkipping {
    #[prost(string, tag = "1")]
    pub column_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlterDatabaseExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(oneof = "alter_database_expr::Kind", tags = "3, 4")]
    pub kind: ::core::option::Option<alter_database_expr::Kind>,
}
/// Nested message and enum types in `AlterDatabaseExpr`.
pub mod alter_database_expr {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "3")]
        SetDatabaseOptions(super::SetDatabaseOptions),
        #[prost(message, tag = "4")]
        UnsetDatabaseOptions(super::UnsetDatabaseOptions),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetDatabaseOptions {
    #[prost(message, repeated, tag = "1")]
    pub set_database_options: ::prost::alloc::vec::Vec<Option>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsetDatabaseOptions {
    #[prost(string, repeated, tag = "1")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// The create trigger expression.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTriggerExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub trigger_name: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub create_if_not_exists: bool,
    /// The SQL statement to be executed periodically.
    #[prost(string, tag = "4")]
    pub sql: ::prost::alloc::string::String,
    /// The channels for sending notifications.
    #[prost(message, repeated, tag = "5")]
    pub channels: ::prost::alloc::vec::Vec<NotifyChannel>,
    /// The user-defined labels.
    #[prost(map = "string, string", tag = "6")]
    pub labels: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// The user-defined annotations.
    #[prost(map = "string, string", tag = "7")]
    pub annotations: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    #[prost(message, optional, tag = "8")]
    pub interval: ::core::option::Option<::prost_types::Duration>,
    /// The raw interval expression, e.g., '1 minute'::INTERVAL.
    #[prost(string, tag = "9")]
    pub raw_interval_expr: ::prost::alloc::string::String,
    /// The duration that the condition must be met continuously before firing the
    /// trigger.
    #[prost(message, optional, tag = "10")]
    pub r#for: ::core::option::Option<::prost_types::Duration>,
    /// The raw SQL expression for 'for' duration, e.g., '5 minutes'::INTERVAL.
    #[prost(string, tag = "11")]
    pub for_raw_expr: ::prost::alloc::string::String,
    /// The duration to keep firing after the condition is no longer met.
    #[prost(message, optional, tag = "12")]
    pub keep_firing_for: ::core::option::Option<::prost_types::Duration>,
    /// The raw SQL expression for 'keep_firing_for' duration, e.g.,
    /// '10 minutes'::INTERVAL.
    #[prost(string, tag = "13")]
    pub keep_firing_for_raw_expr: ::prost::alloc::string::String,
}
/// The notification channel for trigger.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NotifyChannel {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(oneof = "notify_channel::ChannelType", tags = "2")]
    pub channel_type: ::core::option::Option<notify_channel::ChannelType>,
}
/// Nested message and enum types in `NotifyChannel`.
pub mod notify_channel {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ChannelType {
        #[prost(message, tag = "2")]
        Webhook(super::WebhookOptions),
    }
}
/// The options for webhook.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebhookOptions {
    #[prost(string, tag = "1")]
    pub url: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "2")]
    pub opts: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropTriggerExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub trigger_name: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub drop_if_exists: bool,
}
/// Comment on a table, column, or flow
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CommentOnExpr {
    #[prost(string, tag = "1")]
    pub catalog_name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub schema_name: ::prost::alloc::string::String,
    #[prost(enumeration = "CommentObjectType", tag = "3")]
    pub object_type: i32,
    #[prost(string, tag = "4")]
    pub object_name: ::prost::alloc::string::String,
    /// Column name (only for Column comments)
    #[prost(string, tag = "5")]
    pub column_name: ::prost::alloc::string::String,
    /// The comment text (null to remove comment)
    #[prost(string, tag = "6")]
    pub comment: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Analyzer {
    English = 0,
    Chinese = 1,
}
impl Analyzer {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::English => "ENGLISH",
            Self::Chinese => "CHINESE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ENGLISH" => Some(Self::English),
            "CHINESE" => Some(Self::Chinese),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum FulltextBackend {
    Tantivy = 0,
    Bloom = 1,
}
impl FulltextBackend {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Tantivy => "TANTIVY",
            Self::Bloom => "BLOOM",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TANTIVY" => Some(Self::Tantivy),
            "BLOOM" => Some(Self::Bloom),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SkippingIndexType {
    BloomFilter = 0,
}
impl SkippingIndexType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::BloomFilter => "BLOOM_FILTER",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "BLOOM_FILTER" => Some(Self::BloomFilter),
            _ => None,
        }
    }
}
/// The type of object to comment on
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CommentObjectType {
    Table = 0,
    Column = 1,
    Flow = 2,
}
impl CommentObjectType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Table => "TABLE",
            Self::Column => "COLUMN",
            Self::Flow => "FLOW",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TABLE" => Some(Self::Table),
            "COLUMN" => Some(Self::Column),
            "FLOW" => Some(Self::Flow),
            _ => None,
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PromqlRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    #[prost(oneof = "promql_request::Promql", tags = "2, 3")]
    pub promql: ::core::option::Option<promql_request::Promql>,
}
/// Nested message and enum types in `PromqlRequest`.
pub mod promql_request {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Promql {
        #[prost(message, tag = "2")]
        InstantQuery(super::PromInstantQuery),
        #[prost(message, tag = "3")]
        RangeQuery(super::PromRangeQuery),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PromqlResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    /// absolutely same format as Prometheus in JSON
    #[prost(bytes = "vec", tag = "2")]
    pub body: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PromInstantQuery {
    #[prost(string, tag = "1")]
    pub query: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub time: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub lookback: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PromRangeQuery {
    #[prost(string, tag = "1")]
    pub query: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub start: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub end: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub step: ::prost::alloc::string::String,
    #[prost(string, tag = "5")]
    pub lookback: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod prometheus_gateway_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// PrometheusGateway behaves absolutely the same as Prometheus HTTP API
    #[derive(Debug, Clone)]
    pub struct PrometheusGatewayClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl PrometheusGatewayClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> PrometheusGatewayClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> PrometheusGatewayClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            PrometheusGatewayClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        pub async fn handle(
            &mut self,
            request: impl tonic::IntoRequest<super::PromqlRequest>,
        ) -> std::result::Result<tonic::Response<super::PromqlResponse>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/greptime.v1.PrometheusGateway/Handle",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("greptime.v1.PrometheusGateway", "Handle"));
            self.inner.unary(req, path, codec).await
        }
    }
}
/// Generated server implementations.
pub mod prometheus_gateway_server {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with PrometheusGatewayServer.
    #[async_trait]
    pub trait PrometheusGateway: std::marker::Send + std::marker::Sync + 'static {
        async fn handle(
            &self,
            request: tonic::Request<super::PromqlRequest>,
        ) -> std::result::Result<tonic::Response<super::PromqlResponse>, tonic::Status>;
    }
    /// PrometheusGateway behaves absolutely the same as Prometheus HTTP API
    #[derive(Debug)]
    pub struct PrometheusGatewayServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> PrometheusGatewayServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.max_decoding_message_size = Some(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for PrometheusGatewayServer<T>
    where
        T: PrometheusGateway,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.PrometheusGateway/Handle" => {
                    #[allow(non_camel_case_types)]
                    struct HandleSvc<T: PrometheusGateway>(pub Arc<T>);
                    impl<
                        T: PrometheusGateway,
                    > tonic::server::UnaryService<super::PromqlRequest>
                    for HandleSvc<T> {
                        type Response = super::PromqlResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::PromqlRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as PrometheusGateway>::handle(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = HandleSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        let mut response = http::Response::new(
                            tonic::body::Body::default(),
                        );
                        let headers = response.headers_mut();
                        headers
                            .insert(
                                tonic::Status::GRPC_STATUS,
                                (tonic::Code::Unimplemented as i32).into(),
                            );
                        headers
                            .insert(
                                http::header::CONTENT_TYPE,
                                tonic::metadata::GRPC_CONTENT_TYPE,
                            );
                        Ok(response)
                    })
                }
            }
        }
    }
    impl<T> Clone for PrometheusGatewayServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    /// Generated gRPC service name
    pub const SERVICE_NAME: &str = "greptime.v1.PrometheusGateway";
    impl<T> tonic::server::NamedService for PrometheusGatewayServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GreptimeRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    #[prost(oneof = "greptime_request::Request", tags = "2, 3, 4, 5, 6, 7")]
    pub request: ::core::option::Option<greptime_request::Request>,
}
/// Nested message and enum types in `GreptimeRequest`.
pub mod greptime_request {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Request {
        #[prost(message, tag = "2")]
        Inserts(super::InsertRequests),
        #[prost(message, tag = "3")]
        Query(super::QueryRequest),
        #[prost(message, tag = "4")]
        Ddl(super::DdlRequest),
        #[prost(message, tag = "5")]
        Deletes(super::DeleteRequests),
        #[prost(message, tag = "6")]
        RowInserts(super::RowInsertRequests),
        #[prost(message, tag = "7")]
        RowDeletes(super::RowDeleteRequests),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GreptimeResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[prost(oneof = "greptime_response::Response", tags = "2")]
    pub response: ::core::option::Option<greptime_response::Response>,
}
/// Nested message and enum types in `GreptimeResponse`.
pub mod greptime_response {
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Response {
        #[prost(message, tag = "2")]
        AffectedRows(super::AffectedRows),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct QueryRequest {
    #[prost(oneof = "query_request::Query", tags = "1, 2, 3, 4")]
    pub query: ::core::option::Option<query_request::Query>,
}
/// Nested message and enum types in `QueryRequest`.
pub mod query_request {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Query {
        #[prost(string, tag = "1")]
        Sql(::prost::alloc::string::String),
        #[prost(bytes, tag = "2")]
        LogicalPlan(::prost::alloc::vec::Vec<u8>),
        #[prost(message, tag = "3")]
        PromRangeQuery(super::PromRangeQuery),
        #[prost(message, tag = "4")]
        InsertIntoPlan(super::InsertIntoPlan),
    }
}
/// A temporary solution for executing insert into table SELECT .. with logical plan
/// since substrait to logical plan doesn't support dml yet.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InsertIntoPlan {
    #[prost(message, optional, tag = "1")]
    pub table_name: ::core::option::Option<TableName>,
    #[prost(bytes = "vec", tag = "2")]
    pub logical_plan: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InsertRequests {
    #[prost(message, repeated, tag = "1")]
    pub inserts: ::prost::alloc::vec::Vec<InsertRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InsertRequest {
    #[prost(string, tag = "1")]
    pub table_name: ::prost::alloc::string::String,
    /// Data is represented here.
    #[prost(message, repeated, tag = "3")]
    pub columns: ::prost::alloc::vec::Vec<Column>,
    /// The row_count of all columns, which include null and non-null values.
    ///
    /// Note: the row_count of all columns in a InsertRequest must be same.
    #[prost(uint32, tag = "4")]
    pub row_count: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRequests {
    #[prost(message, repeated, tag = "1")]
    pub deletes: ::prost::alloc::vec::Vec<DeleteRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRequest {
    /// The table name to delete from. Catalog name and schema name are in the
    /// `RequestHeader`.
    #[prost(string, tag = "1")]
    pub table_name: ::prost::alloc::string::String,
    /// The data to delete, indexed by key columns.
    #[prost(message, repeated, tag = "3")]
    pub key_columns: ::prost::alloc::vec::Vec<Column>,
    /// The row count of all columns above.
    #[prost(uint32, tag = "4")]
    pub row_count: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RowInsertRequests {
    #[prost(message, repeated, tag = "1")]
    pub inserts: ::prost::alloc::vec::Vec<RowInsertRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RowInsertRequest {
    #[prost(string, tag = "1")]
    pub table_name: ::prost::alloc::string::String,
    /// Data is represented here.
    #[prost(message, optional, tag = "2")]
    pub rows: ::core::option::Option<Rows>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RowDeleteRequests {
    #[prost(message, repeated, tag = "1")]
    pub deletes: ::prost::alloc::vec::Vec<RowDeleteRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RowDeleteRequest {
    /// The table name to delete from. Catalog name and schema name are in the
    /// `RequestHeader`.
    #[prost(string, tag = "1")]
    pub table_name: ::prost::alloc::string::String,
    /// The data to delete.
    #[prost(message, optional, tag = "2")]
    pub rows: ::core::option::Option<Rows>,
}
/// Generated client implementations.
pub mod greptime_database_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    #[derive(Debug, Clone)]
    pub struct GreptimeDatabaseClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl GreptimeDatabaseClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> GreptimeDatabaseClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> GreptimeDatabaseClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            GreptimeDatabaseClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        pub async fn handle(
            &mut self,
            request: impl tonic::IntoRequest<super::GreptimeRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GreptimeResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/greptime.v1.GreptimeDatabase/Handle",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("greptime.v1.GreptimeDatabase", "Handle"));
            self.inner.unary(req, path, codec).await
        }
        pub async fn handle_requests(
            &mut self,
            request: impl tonic::IntoStreamingRequest<Message = super::GreptimeRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GreptimeResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/greptime.v1.GreptimeDatabase/HandleRequests",
            );
            let mut req = request.into_streaming_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("greptime.v1.GreptimeDatabase", "HandleRequests"),
                );
            self.inner.client_streaming(req, path, codec).await
        }
    }
}
/// Generated server implementations.
pub mod greptime_database_server {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with GreptimeDatabaseServer.
    #[async_trait]
    pub trait GreptimeDatabase: std::marker::Send + std::marker::Sync + 'static {
        async fn handle(
            &self,
            request: tonic::Request<super::GreptimeRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GreptimeResponse>,
            tonic::Status,
        >;
        async fn handle_requests(
            &self,
            request: tonic::Request<tonic::Streaming<super::GreptimeRequest>>,
        ) -> std::result::Result<
            tonic::Response<super::GreptimeResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct GreptimeDatabaseServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> GreptimeDatabaseServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.max_decoding_message_size = Some(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for GreptimeDatabaseServer<T>
    where
        T: GreptimeDatabase,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.GreptimeDatabase/Handle" => {
                    #[allow(non_camel_case_types)]
                    struct HandleSvc<T: GreptimeDatabase>(pub Arc<T>);
                    impl<
                        T: GreptimeDatabase,
                    > tonic::server::UnaryService<super::GreptimeRequest>
                    for HandleSvc<T> {
                        type Response = super::GreptimeResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::GreptimeRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as GreptimeDatabase>::handle(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = HandleSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/greptime.v1.GreptimeDatabase/HandleRequests" => {
                    #[allow(non_camel_case_types)]
                    struct HandleRequestsSvc<T: GreptimeDatabase>(pub Arc<T>);
                    impl<
                        T: GreptimeDatabase,
                    > tonic::server::ClientStreamingService<super::GreptimeRequest>
                    for HandleRequestsSvc<T> {
                        type Response = super::GreptimeResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                tonic::Streaming<super::GreptimeRequest>,
                            >,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as GreptimeDatabase>::handle_requests(&inner, request)
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = HandleRequestsSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.client_streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        let mut response = http::Response::new(
                            tonic::body::Body::default(),
                        );
                        let headers = response.headers_mut();
                        headers
                            .insert(
                                tonic::Status::GRPC_STATUS,
                                (tonic::Code::Unimplemented as i32).into(),
                            );
                        headers
                            .insert(
                                http::header::CONTENT_TYPE,
                                tonic::metadata::GRPC_CONTENT_TYPE,
                            );
                        Ok(response)
                    })
                }
            }
        }
    }
    impl<T> Clone for GreptimeDatabaseServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    /// Generated gRPC service name
    pub const SERVICE_NAME: &str = "greptime.v1.GreptimeDatabase";
    impl<T> tonic::server::NamedService for GreptimeDatabaseServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthCheckRequest {}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthCheckResponse {}
/// Generated client implementations.
pub mod health_check_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    #[derive(Debug, Clone)]
    pub struct HealthCheckClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl HealthCheckClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> HealthCheckClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> HealthCheckClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            HealthCheckClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        pub async fn health_check(
            &mut self,
            request: impl tonic::IntoRequest<super::HealthCheckRequest>,
        ) -> std::result::Result<
            tonic::Response<super::HealthCheckResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/greptime.v1.HealthCheck/HealthCheck",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("greptime.v1.HealthCheck", "HealthCheck"));
            self.inner.unary(req, path, codec).await
        }
    }
}
/// Generated server implementations.
pub mod health_check_server {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with HealthCheckServer.
    #[async_trait]
    pub trait HealthCheck: std::marker::Send + std::marker::Sync + 'static {
        async fn health_check(
            &self,
            request: tonic::Request<super::HealthCheckRequest>,
        ) -> std::result::Result<
            tonic::Response<super::HealthCheckResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct HealthCheckServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> HealthCheckServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.max_decoding_message_size = Some(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for HealthCheckServer<T>
    where
        T: HealthCheck,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.HealthCheck/HealthCheck" => {
                    #[allow(non_camel_case_types)]
                    struct HealthCheckSvc<T: HealthCheck>(pub Arc<T>);
                    impl<
                        T: HealthCheck,
                    > tonic::server::UnaryService<super::HealthCheckRequest>
                    for HealthCheckSvc<T> {
                        type Response = super::HealthCheckResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::HealthCheckRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as HealthCheck>::health_check(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = HealthCheckSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        let mut response = http::Response::new(
                            tonic::body::Body::default(),
                        );
                        let headers = response.headers_mut();
                        headers
                            .insert(
                                tonic::Status::GRPC_STATUS,
                                (tonic::Code::Unimplemented as i32).into(),
                            );
                        headers
                            .insert(
                                http::header::CONTENT_TYPE,
                                tonic::metadata::GRPC_CONTENT_TYPE,
                            );
                        Ok(response)
                    })
                }
            }
        }
    }
    impl<T> Clone for HealthCheckServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    /// Generated gRPC service name
    pub const SERVICE_NAME: &str = "greptime.v1.HealthCheck";
    impl<T> tonic::server::NamedService for HealthCheckServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
/// Write hint of the mutation.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WriteHint {
    #[prost(enumeration = "PrimaryKeyEncoding", tag = "1")]
    pub primary_key_encoding: i32,
}
/// Mutation contains updates to a set of rows.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Mutation {
    /// Type of this mutation.
    #[prost(enumeration = "OpType", tag = "1")]
    pub op_type: i32,
    /// Start WAL sequence of this mutation.
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    /// Row updates to write to the WAL.
    #[prost(message, optional, tag = "3")]
    pub rows: ::core::option::Option<Rows>,
    /// Write hint of the mutation.
    #[prost(message, optional, tag = "4")]
    pub write_hint: ::core::option::Option<WriteHint>,
}
/// A WAL entry contains a list of mutations for a region to write.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WalEntry {
    /// List of mutations for a region.
    #[prost(message, repeated, tag = "1")]
    pub mutations: ::prost::alloc::vec::Vec<Mutation>,
    /// List of bulk insert requests.
    #[prost(message, repeated, tag = "2")]
    pub bulk_entries: ::prost::alloc::vec::Vec<BulkWalEntry>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BulkWalEntry {
    /// Start WAL sequence of this entry.
    #[prost(uint64, tag = "1")]
    pub sequence: u64,
    /// Max timestamp value.
    #[prost(int64, tag = "2")]
    pub max_ts: i64,
    /// Min timestamp value.
    #[prost(int64, tag = "3")]
    pub min_ts: i64,
    /// Timestamp column index.
    #[prost(uint32, tag = "4")]
    pub timestamp_index: u32,
    #[prost(oneof = "bulk_wal_entry::Body", tags = "5")]
    pub body: ::core::option::Option<bulk_wal_entry::Body>,
}
/// Nested message and enum types in `BulkWalEntry`.
pub mod bulk_wal_entry {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Body {
        #[prost(message, tag = "5")]
        ArrowIpc(super::ArrowIpc),
    }
}
/// Type of operation to rows.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OpType {
    /// Delete rows.
    Delete = 0,
    /// Put rows.
    Put = 1,
}
impl OpType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Delete => "DELETE",
            Self::Put => "PUT",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "DELETE" => Some(Self::Delete),
            "PUT" => Some(Self::Put),
            _ => None,
        }
    }
}
/// Encoding of primary key.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PrimaryKeyEncoding {
    Dense = 0,
    Sparse = 1,
}
impl PrimaryKeyEncoding {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Dense => "DENSE",
            Self::Sparse => "SPARSE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "DENSE" => Some(Self::Dense),
            "SPARSE" => Some(Self::Sparse),
            _ => None,
        }
    }
}
