#![allow(unused_imports)]
#![allow(unused_extern_crates)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments, clippy::type_complexity))]
#![cfg_attr(rustfmt, rustfmt_skip)]
extern crate thrift;
use thrift::OrderedFloat;
use std::cell::RefCell;
use std::collections::{BTreeMap, BTreeSet};
use std::convert::{From, TryFrom};
use std::default::Default;
use std::error::Error;
use std::fmt;
use std::fmt::{Display, Formatter};
use std::rc::Rc;
use thrift::{ApplicationError, ApplicationErrorKind, ProtocolError, ProtocolErrorKind, TThriftClient};
use thrift::protocol::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType, TInputProtocol, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType};
use thrift::protocol::field_id;
use thrift::protocol::verify_expected_message_type;
use thrift::protocol::verify_expected_sequence_number;
use thrift::protocol::verify_expected_service_call;
use thrift::protocol::verify_required_field_exists;
use thrift::server::TProcessor;
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum TExtArgumentType {
Int8 = 0,
Int16 = 1,
Int32 = 2,
Int64 = 3,
Float = 4,
Double = 5,
Void = 6,
PInt8 = 7,
PInt16 = 8,
PInt32 = 9,
PInt64 = 10,
PFloat = 11,
PDouble = 12,
Bool = 13,
ArrayInt8 = 14,
ArrayInt16 = 15,
ArrayInt32 = 16,
ArrayInt64 = 17,
ArrayFloat = 18,
ArrayDouble = 19,
GeoPoint = 20,
Cursor = 21,
}
impl TExtArgumentType {
pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
o_prot.write_i32(*self as i32)
}
pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TExtArgumentType> {
let enum_value = i_prot.read_i32()?;
TExtArgumentType::try_from(enum_value) }
}
impl TryFrom<i32> for TExtArgumentType {
type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
match i {
0 => Ok(TExtArgumentType::Int8),
1 => Ok(TExtArgumentType::Int16),
2 => Ok(TExtArgumentType::Int32),
3 => Ok(TExtArgumentType::Int64),
4 => Ok(TExtArgumentType::Float),
5 => Ok(TExtArgumentType::Double),
6 => Ok(TExtArgumentType::Void),
7 => Ok(TExtArgumentType::PInt8),
8 => Ok(TExtArgumentType::PInt16),
9 => Ok(TExtArgumentType::PInt32),
10 => Ok(TExtArgumentType::PInt64),
11 => Ok(TExtArgumentType::PFloat),
12 => Ok(TExtArgumentType::PDouble),
13 => Ok(TExtArgumentType::Bool),
14 => Ok(TExtArgumentType::ArrayInt8),
15 => Ok(TExtArgumentType::ArrayInt16),
16 => Ok(TExtArgumentType::ArrayInt32),
17 => Ok(TExtArgumentType::ArrayInt64),
18 => Ok(TExtArgumentType::ArrayFloat),
19 => Ok(TExtArgumentType::ArrayDouble),
20 => Ok(TExtArgumentType::GeoPoint),
21 => Ok(TExtArgumentType::Cursor),
_ => {
Err(
thrift::Error::Protocol(
ProtocolError::new(
ProtocolErrorKind::InvalidData,
format!("cannot convert enum constant {} to TExtArgumentType", i)
)
)
)
},
}
}
}
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum TOutputBufferSizeType {
KUserSpecifiedConstantParameter = 0,
KUserSpecifiedRowMultiplier = 1,
KConstant = 2,
}
impl TOutputBufferSizeType {
pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
o_prot.write_i32(*self as i32)
}
pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TOutputBufferSizeType> {
let enum_value = i_prot.read_i32()?;
TOutputBufferSizeType::try_from(enum_value) }
}
impl TryFrom<i32> for TOutputBufferSizeType {
type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
match i {
0 => Ok(TOutputBufferSizeType::KUserSpecifiedConstantParameter),
1 => Ok(TOutputBufferSizeType::KUserSpecifiedRowMultiplier),
2 => Ok(TOutputBufferSizeType::KConstant),
_ => {
Err(
thrift::Error::Protocol(
ProtocolError::new(
ProtocolErrorKind::InvalidData,
format!("cannot convert enum constant {} to TOutputBufferSizeType", i)
)
)
)
},
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TUserDefinedFunction {
pub name: Option<String>,
pub arg_types: Option<Vec<TExtArgumentType>>,
pub ret_type: Option<TExtArgumentType>,
}
impl TUserDefinedFunction {
pub fn new<F1, F2, F3>(name: F1, arg_types: F2, ret_type: F3) -> TUserDefinedFunction where F1: Into<Option<String>>, F2: Into<Option<Vec<TExtArgumentType>>>, F3: Into<Option<TExtArgumentType>> {
TUserDefinedFunction {
name: name.into(),
arg_types: arg_types.into(),
ret_type: ret_type.into(),
}
}
pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TUserDefinedFunction> {
i_prot.read_struct_begin()?;
let mut f_1: Option<String> = Some("".to_owned());
let mut f_2: Option<Vec<TExtArgumentType>> = Some(Vec::new());
let mut f_3: Option<TExtArgumentType> = None;
loop {
let field_ident = i_prot.read_field_begin()?;
if field_ident.field_type == TType::Stop {
break;
}
let field_id = field_id(&field_ident)?;
match field_id {
1 => {
let val = i_prot.read_string()?;
f_1 = Some(val);
},
2 => {
let list_ident = i_prot.read_list_begin()?;
let mut val: Vec<TExtArgumentType> = Vec::with_capacity(list_ident.size as usize);
for _ in 0..list_ident.size {
let list_elem_0 = TExtArgumentType::read_from_in_protocol(i_prot)?;
val.push(list_elem_0);
}
i_prot.read_list_end()?;
f_2 = Some(val);
},
3 => {
let val = TExtArgumentType::read_from_in_protocol(i_prot)?;
f_3 = Some(val);
},
_ => {
i_prot.skip(field_ident.field_type)?;
},
};
i_prot.read_field_end()?;
}
i_prot.read_struct_end()?;
let ret = TUserDefinedFunction {
name: f_1,
arg_types: f_2,
ret_type: f_3,
};
Ok(ret)
}
pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
let struct_ident = TStructIdentifier::new("TUserDefinedFunction");
o_prot.write_struct_begin(&struct_ident)?;
if let Some(ref fld_var) = self.name {
o_prot.write_field_begin(&TFieldIdentifier::new("name", TType::String, 1))?;
o_prot.write_string(fld_var)?;
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(ref fld_var) = self.arg_types {
o_prot.write_field_begin(&TFieldIdentifier::new("argTypes", TType::List, 2))?;
o_prot.write_list_begin(&TListIdentifier::new(TType::I32, fld_var.len() as i32))?;
for e in fld_var {
e.write_to_out_protocol(o_prot)?;
o_prot.write_list_end()?;
}
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(ref fld_var) = self.ret_type {
o_prot.write_field_begin(&TFieldIdentifier::new("retType", TType::I32, 3))?;
fld_var.write_to_out_protocol(o_prot)?;
o_prot.write_field_end()?;
()
} else {
()
}
o_prot.write_field_stop()?;
o_prot.write_struct_end()
}
}
impl Default for TUserDefinedFunction {
fn default() -> Self {
TUserDefinedFunction{
name: Some("".to_owned()),
arg_types: Some(Vec::new()),
ret_type: None,
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TUserDefinedTableFunction {
pub name: Option<String>,
pub sizer_type: Option<TOutputBufferSizeType>,
pub sizer_arg_pos: Option<i32>,
pub input_arg_types: Option<Vec<TExtArgumentType>>,
pub output_arg_types: Option<Vec<TExtArgumentType>>,
pub sql_arg_types: Option<Vec<TExtArgumentType>>,
}
impl TUserDefinedTableFunction {
pub fn new<F1, F2, F3, F4, F5, F6>(name: F1, sizer_type: F2, sizer_arg_pos: F3, input_arg_types: F4, output_arg_types: F5, sql_arg_types: F6) -> TUserDefinedTableFunction where F1: Into<Option<String>>, F2: Into<Option<TOutputBufferSizeType>>, F3: Into<Option<i32>>, F4: Into<Option<Vec<TExtArgumentType>>>, F5: Into<Option<Vec<TExtArgumentType>>>, F6: Into<Option<Vec<TExtArgumentType>>> {
TUserDefinedTableFunction {
name: name.into(),
sizer_type: sizer_type.into(),
sizer_arg_pos: sizer_arg_pos.into(),
input_arg_types: input_arg_types.into(),
output_arg_types: output_arg_types.into(),
sql_arg_types: sql_arg_types.into(),
}
}
pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TUserDefinedTableFunction> {
i_prot.read_struct_begin()?;
let mut f_1: Option<String> = Some("".to_owned());
let mut f_2: Option<TOutputBufferSizeType> = None;
let mut f_3: Option<i32> = Some(0);
let mut f_4: Option<Vec<TExtArgumentType>> = Some(Vec::new());
let mut f_5: Option<Vec<TExtArgumentType>> = Some(Vec::new());
let mut f_6: Option<Vec<TExtArgumentType>> = Some(Vec::new());
loop {
let field_ident = i_prot.read_field_begin()?;
if field_ident.field_type == TType::Stop {
break;
}
let field_id = field_id(&field_ident)?;
match field_id {
1 => {
let val = i_prot.read_string()?;
f_1 = Some(val);
},
2 => {
let val = TOutputBufferSizeType::read_from_in_protocol(i_prot)?;
f_2 = Some(val);
},
3 => {
let val = i_prot.read_i32()?;
f_3 = Some(val);
},
4 => {
let list_ident = i_prot.read_list_begin()?;
let mut val: Vec<TExtArgumentType> = Vec::with_capacity(list_ident.size as usize);
for _ in 0..list_ident.size {
let list_elem_1 = TExtArgumentType::read_from_in_protocol(i_prot)?;
val.push(list_elem_1);
}
i_prot.read_list_end()?;
f_4 = Some(val);
},
5 => {
let list_ident = i_prot.read_list_begin()?;
let mut val: Vec<TExtArgumentType> = Vec::with_capacity(list_ident.size as usize);
for _ in 0..list_ident.size {
let list_elem_2 = TExtArgumentType::read_from_in_protocol(i_prot)?;
val.push(list_elem_2);
}
i_prot.read_list_end()?;
f_5 = Some(val);
},
6 => {
let list_ident = i_prot.read_list_begin()?;
let mut val: Vec<TExtArgumentType> = Vec::with_capacity(list_ident.size as usize);
for _ in 0..list_ident.size {
let list_elem_3 = TExtArgumentType::read_from_in_protocol(i_prot)?;
val.push(list_elem_3);
}
i_prot.read_list_end()?;
f_6 = Some(val);
},
_ => {
i_prot.skip(field_ident.field_type)?;
},
};
i_prot.read_field_end()?;
}
i_prot.read_struct_end()?;
let ret = TUserDefinedTableFunction {
name: f_1,
sizer_type: f_2,
sizer_arg_pos: f_3,
input_arg_types: f_4,
output_arg_types: f_5,
sql_arg_types: f_6,
};
Ok(ret)
}
pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
let struct_ident = TStructIdentifier::new("TUserDefinedTableFunction");
o_prot.write_struct_begin(&struct_ident)?;
if let Some(ref fld_var) = self.name {
o_prot.write_field_begin(&TFieldIdentifier::new("name", TType::String, 1))?;
o_prot.write_string(fld_var)?;
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(ref fld_var) = self.sizer_type {
o_prot.write_field_begin(&TFieldIdentifier::new("sizerType", TType::I32, 2))?;
fld_var.write_to_out_protocol(o_prot)?;
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(fld_var) = self.sizer_arg_pos {
o_prot.write_field_begin(&TFieldIdentifier::new("sizerArgPos", TType::I32, 3))?;
o_prot.write_i32(fld_var)?;
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(ref fld_var) = self.input_arg_types {
o_prot.write_field_begin(&TFieldIdentifier::new("inputArgTypes", TType::List, 4))?;
o_prot.write_list_begin(&TListIdentifier::new(TType::I32, fld_var.len() as i32))?;
for e in fld_var {
e.write_to_out_protocol(o_prot)?;
o_prot.write_list_end()?;
}
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(ref fld_var) = self.output_arg_types {
o_prot.write_field_begin(&TFieldIdentifier::new("outputArgTypes", TType::List, 5))?;
o_prot.write_list_begin(&TListIdentifier::new(TType::I32, fld_var.len() as i32))?;
for e in fld_var {
e.write_to_out_protocol(o_prot)?;
o_prot.write_list_end()?;
}
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(ref fld_var) = self.sql_arg_types {
o_prot.write_field_begin(&TFieldIdentifier::new("sqlArgTypes", TType::List, 6))?;
o_prot.write_list_begin(&TListIdentifier::new(TType::I32, fld_var.len() as i32))?;
for e in fld_var {
e.write_to_out_protocol(o_prot)?;
o_prot.write_list_end()?;
}
o_prot.write_field_end()?;
()
} else {
()
}
o_prot.write_field_stop()?;
o_prot.write_struct_end()
}
}
impl Default for TUserDefinedTableFunction {
fn default() -> Self {
TUserDefinedTableFunction{
name: Some("".to_owned()),
sizer_type: None,
sizer_arg_pos: Some(0),
input_arg_types: Some(Vec::new()),
output_arg_types: Some(Vec::new()),
sql_arg_types: Some(Vec::new()),
}
}
}