risingwave_pb/
expr.rs

1// This file is @generated by prost-build.
2#[derive(prost_helpers::AnyPB)]
3#[derive(Eq, Hash)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct ExprNode {
6    /// Only use this field for function call. For other types of expression, it should be UNSPECIFIED.
7    #[prost(enumeration = "expr_node::Type", tag = "1")]
8    pub function_type: i32,
9    #[prost(message, optional, tag = "3")]
10    pub return_type: ::core::option::Option<super::data::DataType>,
11    #[prost(oneof = "expr_node::RexNode", tags = "4, 5, 6, 7, 8")]
12    pub rex_node: ::core::option::Option<expr_node::RexNode>,
13}
14/// Nested message and enum types in `ExprNode`.
15pub mod expr_node {
16    #[derive(prost_helpers::AnyPB)]
17    #[derive(Eq, Hash)]
18    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
19    pub struct NowRexNode {}
20    /// TODO: move this into `FunctionCall`.
21    #[derive(prost_helpers::AnyPB)]
22    #[derive(
23        Clone,
24        Copy,
25        Debug,
26        PartialEq,
27        Eq,
28        Hash,
29        PartialOrd,
30        Ord,
31        ::prost::Enumeration
32    )]
33    #[repr(i32)]
34    pub enum Type {
35        /// Used for `InputRef`, `Constant`, and `UserDefinedFunction`.
36        Unspecified = 0,
37        /// arithmetics operators
38        Add = 3,
39        Subtract = 4,
40        Multiply = 5,
41        Divide = 6,
42        Modulus = 7,
43        /// comparison operators
44        Equal = 8,
45        NotEqual = 9,
46        LessThan = 10,
47        LessThanOrEqual = 11,
48        GreaterThan = 12,
49        GreaterThanOrEqual = 13,
50        Greatest = 14,
51        Least = 15,
52        /// logical operators
53        And = 21,
54        Or = 22,
55        Not = 23,
56        In = 24,
57        Some = 25,
58        All = 26,
59        /// bitwise operators
60        BitwiseAnd = 31,
61        BitwiseOr = 32,
62        BitwiseXor = 33,
63        BitwiseNot = 34,
64        BitwiseShiftLeft = 35,
65        BitwiseShiftRight = 36,
66        /// date/time functions
67        Extract = 101,
68        DatePart = 102,
69        TumbleStart = 103,
70        MakeDate = 113,
71        MakeTime = 114,
72        MakeTimestamp = 115,
73        DateBin = 116,
74        /// From f64 to timestamp.
75        /// e.g. `select to_timestamp(1672044740.0)`
76        SecToTimestamptz = 104,
77        AtTimeZone = 105,
78        DateTrunc = 106,
79        /// Parse text to timestamp by format string.
80        /// e.g. `select to_timestamp('2022 08 21', 'YYYY MM DD')`
81        CharToTimestamptz = 107,
82        CharToDate = 111,
83        /// Performs a cast with additional timezone information.
84        CastWithTimeZone = 108,
85        AddWithTimeZone = 109,
86        SubtractWithTimeZone = 110,
87        MakeTimestamptz = 112,
88        /// other functions
89        Cast = 201,
90        Substr = 202,
91        Length = 203,
92        Like = 204,
93        ILike = 279,
94        SimilarToEscape = 284,
95        Upper = 205,
96        Lower = 206,
97        Trim = 207,
98        Replace = 208,
99        Position = 209,
100        Ltrim = 210,
101        Rtrim = 211,
102        Case = 212,
103        /// Optimize case-when expression to constant lookup
104        /// when arms are in a large scale with simple form
105        ConstantLookup = 624,
106        /// ROUND(numeric, integer) -> numeric
107        RoundDigit = 213,
108        /// ROUND(numeric) -> numeric
109        /// ROUND(double precision) -> double precision
110        Round = 214,
111        Ascii = 215,
112        Translate = 216,
113        Coalesce = 217,
114        ConcatWs = 218,
115        ConcatWsVariadic = 285,
116        Abs = 219,
117        SplitPart = 220,
118        Ceil = 221,
119        Floor = 222,
120        ToChar = 223,
121        Md5 = 224,
122        CharLength = 225,
123        Repeat = 226,
124        ConcatOp = 227,
125        ByteaConcatOp = 290,
126        Concat = 286,
127        ConcatVariadic = 287,
128        /// BOOL_OUT is different from CAST-bool-to-varchar in PostgreSQL.
129        BoolOut = 228,
130        OctetLength = 229,
131        BitLength = 230,
132        Overlay = 231,
133        RegexpMatch = 232,
134        RegexpReplace = 280,
135        RegexpCount = 281,
136        RegexpSplitToArray = 282,
137        RegexpEq = 283,
138        Pow = 233,
139        Exp = 234,
140        Chr = 235,
141        StartsWith = 236,
142        Initcap = 237,
143        Lpad = 238,
144        Rpad = 239,
145        Reverse = 240,
146        /// duplicated with POSITION
147        Strpos = 241,
148        ToAscii = 242,
149        ToHex = 243,
150        QuoteIdent = 244,
151        Sin = 245,
152        Cos = 246,
153        Tan = 247,
154        Cot = 248,
155        Asin = 249,
156        Acos = 250,
157        Atan = 251,
158        Atan2 = 252,
159        Sind = 253,
160        Cosd = 254,
161        Cotd = 255,
162        Tand = 256,
163        Asind = 257,
164        Sqrt = 258,
165        Degrees = 259,
166        Radians = 260,
167        Cosh = 261,
168        Tanh = 262,
169        Coth = 263,
170        Asinh = 264,
171        Acosh = 265,
172        Atanh = 266,
173        Sinh = 267,
174        Acosd = 268,
175        Atand = 269,
176        Atan2d = 270,
177        Trunc = 271,
178        Ln = 272,
179        Log10 = 273,
180        Cbrt = 274,
181        Sign = 275,
182        Scale = 276,
183        MinScale = 277,
184        TrimScale = 278,
185        /// Boolean comparison
186        IsTrue = 301,
187        IsNotTrue = 302,
188        IsFalse = 303,
189        IsNotFalse = 304,
190        IsNull = 305,
191        IsNotNull = 306,
192        IsDistinctFrom = 307,
193        IsNotDistinctFrom = 308,
194        /// string/bytea expressions
195        Encode = 310,
196        Decode = 311,
197        Sha1 = 312,
198        Sha224 = 313,
199        Sha256 = 314,
200        Sha384 = 315,
201        Sha512 = 316,
202        Left = 317,
203        Right = 318,
204        Format = 319,
205        FormatVariadic = 326,
206        PgwireSend = 320,
207        PgwireRecv = 321,
208        ConvertFrom = 322,
209        ConvertTo = 323,
210        Decrypt = 324,
211        Encrypt = 325,
212        InetAton = 328,
213        InetNtoa = 329,
214        QuoteLiteral = 330,
215        QuoteNullable = 331,
216        Hmac = 332,
217        SecureCompare = 333,
218        GetBit = 334,
219        GetByte = 335,
220        SetBit = 336,
221        SetByte = 337,
222        BitCount = 338,
223        /// Constraints Check
224        CheckNotNull = 350,
225        /// Unary operators
226        Neg = 401,
227        /// Nested selection operators
228        Field = 501,
229        /// Array expression.
230        Array = 521,
231        ArrayAccess = 522,
232        Row = 523,
233        ArrayToString = 524,
234        ArrayRangeAccess = 525,
235        /// Array functions
236        ArrayCat = 531,
237        ArrayAppend = 532,
238        ArrayPrepend = 533,
239        FormatType = 534,
240        ArrayDistinct = 535,
241        ArrayLength = 536,
242        Cardinality = 537,
243        ArrayRemove = 538,
244        ArrayPositions = 539,
245        TrimArray = 540,
246        StringToArray = 541,
247        ArrayPosition = 542,
248        ArrayReplace = 543,
249        ArrayDims = 544,
250        ArrayTransform = 545,
251        ArrayMin = 546,
252        ArrayMax = 547,
253        ArraySum = 548,
254        ArraySort = 549,
255        ArrayContains = 550,
256        ArrayContained = 551,
257        ArrayFlatten = 552,
258        /// Int256 functions
259        HexToInt256 = 560,
260        /// jsonb -> int, jsonb -> text that returns jsonb
261        JsonbAccess = 600,
262        /// jsonb ->> int, jsonb ->> text that returns text
263        JsonbAccessStr = 601,
264        /// jsonb #> text\[\] -> jsonb
265        JsonbExtractPath = 627,
266        JsonbExtractPathVariadic = 613,
267        /// jsonb #>> text\[\] -> text
268        JsonbExtractPathText = 628,
269        JsonbExtractPathTextVariadic = 614,
270        JsonbTypeof = 602,
271        JsonbArrayLength = 603,
272        IsJson = 604,
273        JsonbConcat = 605,
274        JsonbObject = 606,
275        JsonbPretty = 607,
276        /// jsonb @> jsonb
277        JsonbContains = 608,
278        /// jsonb <@ jsonb
279        JsonbContained = 609,
280        /// jsonb ? text
281        JsonbExists = 610,
282        /// jsonb ?| text\[\]
283        JsonbExistsAny = 611,
284        /// jsonb ?& text\[\]
285        JsonbExistsAll = 612,
286        /// see SUBTRACT for:
287        /// jsonb - text -> jsonb
288        /// jsonb - text\[\] -> jsonb
289        /// jsonb - integer -> jsonb
290        ///
291        /// jsonb #- text\[\] -> jsonb
292        JsonbDeletePath = 615,
293        JsonbStripNulls = 616,
294        ToJsonb = 617,
295        JsonbBuildArray = 618,
296        JsonbBuildArrayVariadic = 625,
297        JsonbBuildObject = 619,
298        JsonbBuildObjectVariadic = 626,
299        JsonbPathExists = 620,
300        JsonbPathMatch = 621,
301        JsonbPathQueryArray = 622,
302        JsonbPathQueryFirst = 623,
303        JsonbPopulateRecord = 629,
304        JsonbToRecord = 630,
305        JsonbSet = 631,
306        JsonbPopulateMap = 632,
307        JsonbToArray = 633,
308        /// Map functions
309        MapFromEntries = 700,
310        MapAccess = 701,
311        MapKeys = 702,
312        MapValues = 703,
313        MapEntries = 704,
314        MapFromKeyValues = 705,
315        MapLength = 706,
316        MapContains = 707,
317        MapCat = 708,
318        MapInsert = 709,
319        MapDelete = 710,
320        MapFilter = 711,
321        /// Vector functions
322        L2Distance = 750,
323        CosineDistance = 751,
324        L1Distance = 752,
325        InnerProduct = 753,
326        VecConcat = 754,
327        L2Norm = 755,
328        L2Normalize = 756,
329        Subvector = 757,
330        /// Internal function for schema change
331        CompositeCast = 800,
332        /// Non-pure functions below (> 1000)
333        /// ------------------------
334        /// Internal functions
335        Vnode = 1101,
336        TestFeature = 1102,
337        VnodeUser = 1103,
338        License = 1104,
339        /// Non-deterministic functions
340        Proctime = 2023,
341        PgSleep = 2024,
342        PgSleepFor = 2025,
343        PgSleepUntil = 2026,
344        Random = 2027,
345        /// System administration functions
346        CastRegclass = 2100,
347        /// System information functions
348        PgGetIndexdef = 2400,
349        ColDescription = 2401,
350        PgGetViewdef = 2402,
351        PgGetUserbyid = 2403,
352        PgIndexesSize = 2404,
353        PgRelationSize = 2405,
354        PgGetSerialSequence = 2406,
355        PgIndexColumnHasProperty = 2410,
356        HasTablePrivilege = 2407,
357        HasAnyColumnPrivilege = 2408,
358        HasSchemaPrivilege = 2409,
359        PgIsInRecovery = 2411,
360        RwRecoveryStatus = 2412,
361        RwEpochToTs = 2413,
362        PgTableIsVisible = 2414,
363        HasFunctionPrivilege = 2415,
364        HasDatabasePrivilege = 2416,
365        RwClusterId = 2417,
366        RwFragmentVnodes = 2418,
367        RwActorVnodes = 2419,
368        /// EXTERNAL
369        IcebergTransform = 2201,
370        /// AI model functions
371        OpenaiEmbedding = 2501,
372    }
373    impl Type {
374        /// String value of the enum field names used in the ProtoBuf definition.
375        ///
376        /// The values are not transformed in any way and thus are considered stable
377        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
378        pub fn as_str_name(&self) -> &'static str {
379            match self {
380                Self::Unspecified => "UNSPECIFIED",
381                Self::Add => "ADD",
382                Self::Subtract => "SUBTRACT",
383                Self::Multiply => "MULTIPLY",
384                Self::Divide => "DIVIDE",
385                Self::Modulus => "MODULUS",
386                Self::Equal => "EQUAL",
387                Self::NotEqual => "NOT_EQUAL",
388                Self::LessThan => "LESS_THAN",
389                Self::LessThanOrEqual => "LESS_THAN_OR_EQUAL",
390                Self::GreaterThan => "GREATER_THAN",
391                Self::GreaterThanOrEqual => "GREATER_THAN_OR_EQUAL",
392                Self::Greatest => "GREATEST",
393                Self::Least => "LEAST",
394                Self::And => "AND",
395                Self::Or => "OR",
396                Self::Not => "NOT",
397                Self::In => "IN",
398                Self::Some => "SOME",
399                Self::All => "ALL",
400                Self::BitwiseAnd => "BITWISE_AND",
401                Self::BitwiseOr => "BITWISE_OR",
402                Self::BitwiseXor => "BITWISE_XOR",
403                Self::BitwiseNot => "BITWISE_NOT",
404                Self::BitwiseShiftLeft => "BITWISE_SHIFT_LEFT",
405                Self::BitwiseShiftRight => "BITWISE_SHIFT_RIGHT",
406                Self::Extract => "EXTRACT",
407                Self::DatePart => "DATE_PART",
408                Self::TumbleStart => "TUMBLE_START",
409                Self::MakeDate => "MAKE_DATE",
410                Self::MakeTime => "MAKE_TIME",
411                Self::MakeTimestamp => "MAKE_TIMESTAMP",
412                Self::DateBin => "DATE_BIN",
413                Self::SecToTimestamptz => "SEC_TO_TIMESTAMPTZ",
414                Self::AtTimeZone => "AT_TIME_ZONE",
415                Self::DateTrunc => "DATE_TRUNC",
416                Self::CharToTimestamptz => "CHAR_TO_TIMESTAMPTZ",
417                Self::CharToDate => "CHAR_TO_DATE",
418                Self::CastWithTimeZone => "CAST_WITH_TIME_ZONE",
419                Self::AddWithTimeZone => "ADD_WITH_TIME_ZONE",
420                Self::SubtractWithTimeZone => "SUBTRACT_WITH_TIME_ZONE",
421                Self::MakeTimestamptz => "MAKE_TIMESTAMPTZ",
422                Self::Cast => "CAST",
423                Self::Substr => "SUBSTR",
424                Self::Length => "LENGTH",
425                Self::Like => "LIKE",
426                Self::ILike => "I_LIKE",
427                Self::SimilarToEscape => "SIMILAR_TO_ESCAPE",
428                Self::Upper => "UPPER",
429                Self::Lower => "LOWER",
430                Self::Trim => "TRIM",
431                Self::Replace => "REPLACE",
432                Self::Position => "POSITION",
433                Self::Ltrim => "LTRIM",
434                Self::Rtrim => "RTRIM",
435                Self::Case => "CASE",
436                Self::ConstantLookup => "CONSTANT_LOOKUP",
437                Self::RoundDigit => "ROUND_DIGIT",
438                Self::Round => "ROUND",
439                Self::Ascii => "ASCII",
440                Self::Translate => "TRANSLATE",
441                Self::Coalesce => "COALESCE",
442                Self::ConcatWs => "CONCAT_WS",
443                Self::ConcatWsVariadic => "CONCAT_WS_VARIADIC",
444                Self::Abs => "ABS",
445                Self::SplitPart => "SPLIT_PART",
446                Self::Ceil => "CEIL",
447                Self::Floor => "FLOOR",
448                Self::ToChar => "TO_CHAR",
449                Self::Md5 => "MD5",
450                Self::CharLength => "CHAR_LENGTH",
451                Self::Repeat => "REPEAT",
452                Self::ConcatOp => "CONCAT_OP",
453                Self::ByteaConcatOp => "BYTEA_CONCAT_OP",
454                Self::Concat => "CONCAT",
455                Self::ConcatVariadic => "CONCAT_VARIADIC",
456                Self::BoolOut => "BOOL_OUT",
457                Self::OctetLength => "OCTET_LENGTH",
458                Self::BitLength => "BIT_LENGTH",
459                Self::Overlay => "OVERLAY",
460                Self::RegexpMatch => "REGEXP_MATCH",
461                Self::RegexpReplace => "REGEXP_REPLACE",
462                Self::RegexpCount => "REGEXP_COUNT",
463                Self::RegexpSplitToArray => "REGEXP_SPLIT_TO_ARRAY",
464                Self::RegexpEq => "REGEXP_EQ",
465                Self::Pow => "POW",
466                Self::Exp => "EXP",
467                Self::Chr => "CHR",
468                Self::StartsWith => "STARTS_WITH",
469                Self::Initcap => "INITCAP",
470                Self::Lpad => "LPAD",
471                Self::Rpad => "RPAD",
472                Self::Reverse => "REVERSE",
473                Self::Strpos => "STRPOS",
474                Self::ToAscii => "TO_ASCII",
475                Self::ToHex => "TO_HEX",
476                Self::QuoteIdent => "QUOTE_IDENT",
477                Self::Sin => "SIN",
478                Self::Cos => "COS",
479                Self::Tan => "TAN",
480                Self::Cot => "COT",
481                Self::Asin => "ASIN",
482                Self::Acos => "ACOS",
483                Self::Atan => "ATAN",
484                Self::Atan2 => "ATAN2",
485                Self::Sind => "SIND",
486                Self::Cosd => "COSD",
487                Self::Cotd => "COTD",
488                Self::Tand => "TAND",
489                Self::Asind => "ASIND",
490                Self::Sqrt => "SQRT",
491                Self::Degrees => "DEGREES",
492                Self::Radians => "RADIANS",
493                Self::Cosh => "COSH",
494                Self::Tanh => "TANH",
495                Self::Coth => "COTH",
496                Self::Asinh => "ASINH",
497                Self::Acosh => "ACOSH",
498                Self::Atanh => "ATANH",
499                Self::Sinh => "SINH",
500                Self::Acosd => "ACOSD",
501                Self::Atand => "ATAND",
502                Self::Atan2d => "ATAN2D",
503                Self::Trunc => "TRUNC",
504                Self::Ln => "LN",
505                Self::Log10 => "LOG10",
506                Self::Cbrt => "CBRT",
507                Self::Sign => "SIGN",
508                Self::Scale => "SCALE",
509                Self::MinScale => "MIN_SCALE",
510                Self::TrimScale => "TRIM_SCALE",
511                Self::IsTrue => "IS_TRUE",
512                Self::IsNotTrue => "IS_NOT_TRUE",
513                Self::IsFalse => "IS_FALSE",
514                Self::IsNotFalse => "IS_NOT_FALSE",
515                Self::IsNull => "IS_NULL",
516                Self::IsNotNull => "IS_NOT_NULL",
517                Self::IsDistinctFrom => "IS_DISTINCT_FROM",
518                Self::IsNotDistinctFrom => "IS_NOT_DISTINCT_FROM",
519                Self::Encode => "ENCODE",
520                Self::Decode => "DECODE",
521                Self::Sha1 => "SHA1",
522                Self::Sha224 => "SHA224",
523                Self::Sha256 => "SHA256",
524                Self::Sha384 => "SHA384",
525                Self::Sha512 => "SHA512",
526                Self::Left => "LEFT",
527                Self::Right => "RIGHT",
528                Self::Format => "FORMAT",
529                Self::FormatVariadic => "FORMAT_VARIADIC",
530                Self::PgwireSend => "PGWIRE_SEND",
531                Self::PgwireRecv => "PGWIRE_RECV",
532                Self::ConvertFrom => "CONVERT_FROM",
533                Self::ConvertTo => "CONVERT_TO",
534                Self::Decrypt => "DECRYPT",
535                Self::Encrypt => "ENCRYPT",
536                Self::InetAton => "INET_ATON",
537                Self::InetNtoa => "INET_NTOA",
538                Self::QuoteLiteral => "QUOTE_LITERAL",
539                Self::QuoteNullable => "QUOTE_NULLABLE",
540                Self::Hmac => "HMAC",
541                Self::SecureCompare => "SECURE_COMPARE",
542                Self::GetBit => "GET_BIT",
543                Self::GetByte => "GET_BYTE",
544                Self::SetBit => "SET_BIT",
545                Self::SetByte => "SET_BYTE",
546                Self::BitCount => "BIT_COUNT",
547                Self::CheckNotNull => "CHECK_NOT_NULL",
548                Self::Neg => "NEG",
549                Self::Field => "FIELD",
550                Self::Array => "ARRAY",
551                Self::ArrayAccess => "ARRAY_ACCESS",
552                Self::Row => "ROW",
553                Self::ArrayToString => "ARRAY_TO_STRING",
554                Self::ArrayRangeAccess => "ARRAY_RANGE_ACCESS",
555                Self::ArrayCat => "ARRAY_CAT",
556                Self::ArrayAppend => "ARRAY_APPEND",
557                Self::ArrayPrepend => "ARRAY_PREPEND",
558                Self::FormatType => "FORMAT_TYPE",
559                Self::ArrayDistinct => "ARRAY_DISTINCT",
560                Self::ArrayLength => "ARRAY_LENGTH",
561                Self::Cardinality => "CARDINALITY",
562                Self::ArrayRemove => "ARRAY_REMOVE",
563                Self::ArrayPositions => "ARRAY_POSITIONS",
564                Self::TrimArray => "TRIM_ARRAY",
565                Self::StringToArray => "STRING_TO_ARRAY",
566                Self::ArrayPosition => "ARRAY_POSITION",
567                Self::ArrayReplace => "ARRAY_REPLACE",
568                Self::ArrayDims => "ARRAY_DIMS",
569                Self::ArrayTransform => "ARRAY_TRANSFORM",
570                Self::ArrayMin => "ARRAY_MIN",
571                Self::ArrayMax => "ARRAY_MAX",
572                Self::ArraySum => "ARRAY_SUM",
573                Self::ArraySort => "ARRAY_SORT",
574                Self::ArrayContains => "ARRAY_CONTAINS",
575                Self::ArrayContained => "ARRAY_CONTAINED",
576                Self::ArrayFlatten => "ARRAY_FLATTEN",
577                Self::HexToInt256 => "HEX_TO_INT256",
578                Self::JsonbAccess => "JSONB_ACCESS",
579                Self::JsonbAccessStr => "JSONB_ACCESS_STR",
580                Self::JsonbExtractPath => "JSONB_EXTRACT_PATH",
581                Self::JsonbExtractPathVariadic => "JSONB_EXTRACT_PATH_VARIADIC",
582                Self::JsonbExtractPathText => "JSONB_EXTRACT_PATH_TEXT",
583                Self::JsonbExtractPathTextVariadic => "JSONB_EXTRACT_PATH_TEXT_VARIADIC",
584                Self::JsonbTypeof => "JSONB_TYPEOF",
585                Self::JsonbArrayLength => "JSONB_ARRAY_LENGTH",
586                Self::IsJson => "IS_JSON",
587                Self::JsonbConcat => "JSONB_CONCAT",
588                Self::JsonbObject => "JSONB_OBJECT",
589                Self::JsonbPretty => "JSONB_PRETTY",
590                Self::JsonbContains => "JSONB_CONTAINS",
591                Self::JsonbContained => "JSONB_CONTAINED",
592                Self::JsonbExists => "JSONB_EXISTS",
593                Self::JsonbExistsAny => "JSONB_EXISTS_ANY",
594                Self::JsonbExistsAll => "JSONB_EXISTS_ALL",
595                Self::JsonbDeletePath => "JSONB_DELETE_PATH",
596                Self::JsonbStripNulls => "JSONB_STRIP_NULLS",
597                Self::ToJsonb => "TO_JSONB",
598                Self::JsonbBuildArray => "JSONB_BUILD_ARRAY",
599                Self::JsonbBuildArrayVariadic => "JSONB_BUILD_ARRAY_VARIADIC",
600                Self::JsonbBuildObject => "JSONB_BUILD_OBJECT",
601                Self::JsonbBuildObjectVariadic => "JSONB_BUILD_OBJECT_VARIADIC",
602                Self::JsonbPathExists => "JSONB_PATH_EXISTS",
603                Self::JsonbPathMatch => "JSONB_PATH_MATCH",
604                Self::JsonbPathQueryArray => "JSONB_PATH_QUERY_ARRAY",
605                Self::JsonbPathQueryFirst => "JSONB_PATH_QUERY_FIRST",
606                Self::JsonbPopulateRecord => "JSONB_POPULATE_RECORD",
607                Self::JsonbToRecord => "JSONB_TO_RECORD",
608                Self::JsonbSet => "JSONB_SET",
609                Self::JsonbPopulateMap => "JSONB_POPULATE_MAP",
610                Self::JsonbToArray => "JSONB_TO_ARRAY",
611                Self::MapFromEntries => "MAP_FROM_ENTRIES",
612                Self::MapAccess => "MAP_ACCESS",
613                Self::MapKeys => "MAP_KEYS",
614                Self::MapValues => "MAP_VALUES",
615                Self::MapEntries => "MAP_ENTRIES",
616                Self::MapFromKeyValues => "MAP_FROM_KEY_VALUES",
617                Self::MapLength => "MAP_LENGTH",
618                Self::MapContains => "MAP_CONTAINS",
619                Self::MapCat => "MAP_CAT",
620                Self::MapInsert => "MAP_INSERT",
621                Self::MapDelete => "MAP_DELETE",
622                Self::MapFilter => "MAP_FILTER",
623                Self::L2Distance => "L2_DISTANCE",
624                Self::CosineDistance => "COSINE_DISTANCE",
625                Self::L1Distance => "L1_DISTANCE",
626                Self::InnerProduct => "INNER_PRODUCT",
627                Self::VecConcat => "VEC_CONCAT",
628                Self::L2Norm => "L2_NORM",
629                Self::L2Normalize => "L2_NORMALIZE",
630                Self::Subvector => "SUBVECTOR",
631                Self::CompositeCast => "COMPOSITE_CAST",
632                Self::Vnode => "VNODE",
633                Self::TestFeature => "TEST_FEATURE",
634                Self::VnodeUser => "VNODE_USER",
635                Self::License => "LICENSE",
636                Self::Proctime => "PROCTIME",
637                Self::PgSleep => "PG_SLEEP",
638                Self::PgSleepFor => "PG_SLEEP_FOR",
639                Self::PgSleepUntil => "PG_SLEEP_UNTIL",
640                Self::Random => "RANDOM",
641                Self::CastRegclass => "CAST_REGCLASS",
642                Self::PgGetIndexdef => "PG_GET_INDEXDEF",
643                Self::ColDescription => "COL_DESCRIPTION",
644                Self::PgGetViewdef => "PG_GET_VIEWDEF",
645                Self::PgGetUserbyid => "PG_GET_USERBYID",
646                Self::PgIndexesSize => "PG_INDEXES_SIZE",
647                Self::PgRelationSize => "PG_RELATION_SIZE",
648                Self::PgGetSerialSequence => "PG_GET_SERIAL_SEQUENCE",
649                Self::PgIndexColumnHasProperty => "PG_INDEX_COLUMN_HAS_PROPERTY",
650                Self::HasTablePrivilege => "HAS_TABLE_PRIVILEGE",
651                Self::HasAnyColumnPrivilege => "HAS_ANY_COLUMN_PRIVILEGE",
652                Self::HasSchemaPrivilege => "HAS_SCHEMA_PRIVILEGE",
653                Self::PgIsInRecovery => "PG_IS_IN_RECOVERY",
654                Self::RwRecoveryStatus => "RW_RECOVERY_STATUS",
655                Self::RwEpochToTs => "RW_EPOCH_TO_TS",
656                Self::PgTableIsVisible => "PG_TABLE_IS_VISIBLE",
657                Self::HasFunctionPrivilege => "HAS_FUNCTION_PRIVILEGE",
658                Self::HasDatabasePrivilege => "HAS_DATABASE_PRIVILEGE",
659                Self::RwClusterId => "RW_CLUSTER_ID",
660                Self::RwFragmentVnodes => "RW_FRAGMENT_VNODES",
661                Self::RwActorVnodes => "RW_ACTOR_VNODES",
662                Self::IcebergTransform => "ICEBERG_TRANSFORM",
663                Self::OpenaiEmbedding => "OPENAI_EMBEDDING",
664            }
665        }
666        /// Creates an enum from field names used in the ProtoBuf definition.
667        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
668            match value {
669                "UNSPECIFIED" => Some(Self::Unspecified),
670                "ADD" => Some(Self::Add),
671                "SUBTRACT" => Some(Self::Subtract),
672                "MULTIPLY" => Some(Self::Multiply),
673                "DIVIDE" => Some(Self::Divide),
674                "MODULUS" => Some(Self::Modulus),
675                "EQUAL" => Some(Self::Equal),
676                "NOT_EQUAL" => Some(Self::NotEqual),
677                "LESS_THAN" => Some(Self::LessThan),
678                "LESS_THAN_OR_EQUAL" => Some(Self::LessThanOrEqual),
679                "GREATER_THAN" => Some(Self::GreaterThan),
680                "GREATER_THAN_OR_EQUAL" => Some(Self::GreaterThanOrEqual),
681                "GREATEST" => Some(Self::Greatest),
682                "LEAST" => Some(Self::Least),
683                "AND" => Some(Self::And),
684                "OR" => Some(Self::Or),
685                "NOT" => Some(Self::Not),
686                "IN" => Some(Self::In),
687                "SOME" => Some(Self::Some),
688                "ALL" => Some(Self::All),
689                "BITWISE_AND" => Some(Self::BitwiseAnd),
690                "BITWISE_OR" => Some(Self::BitwiseOr),
691                "BITWISE_XOR" => Some(Self::BitwiseXor),
692                "BITWISE_NOT" => Some(Self::BitwiseNot),
693                "BITWISE_SHIFT_LEFT" => Some(Self::BitwiseShiftLeft),
694                "BITWISE_SHIFT_RIGHT" => Some(Self::BitwiseShiftRight),
695                "EXTRACT" => Some(Self::Extract),
696                "DATE_PART" => Some(Self::DatePart),
697                "TUMBLE_START" => Some(Self::TumbleStart),
698                "MAKE_DATE" => Some(Self::MakeDate),
699                "MAKE_TIME" => Some(Self::MakeTime),
700                "MAKE_TIMESTAMP" => Some(Self::MakeTimestamp),
701                "DATE_BIN" => Some(Self::DateBin),
702                "SEC_TO_TIMESTAMPTZ" => Some(Self::SecToTimestamptz),
703                "AT_TIME_ZONE" => Some(Self::AtTimeZone),
704                "DATE_TRUNC" => Some(Self::DateTrunc),
705                "CHAR_TO_TIMESTAMPTZ" => Some(Self::CharToTimestamptz),
706                "CHAR_TO_DATE" => Some(Self::CharToDate),
707                "CAST_WITH_TIME_ZONE" => Some(Self::CastWithTimeZone),
708                "ADD_WITH_TIME_ZONE" => Some(Self::AddWithTimeZone),
709                "SUBTRACT_WITH_TIME_ZONE" => Some(Self::SubtractWithTimeZone),
710                "MAKE_TIMESTAMPTZ" => Some(Self::MakeTimestamptz),
711                "CAST" => Some(Self::Cast),
712                "SUBSTR" => Some(Self::Substr),
713                "LENGTH" => Some(Self::Length),
714                "LIKE" => Some(Self::Like),
715                "I_LIKE" => Some(Self::ILike),
716                "SIMILAR_TO_ESCAPE" => Some(Self::SimilarToEscape),
717                "UPPER" => Some(Self::Upper),
718                "LOWER" => Some(Self::Lower),
719                "TRIM" => Some(Self::Trim),
720                "REPLACE" => Some(Self::Replace),
721                "POSITION" => Some(Self::Position),
722                "LTRIM" => Some(Self::Ltrim),
723                "RTRIM" => Some(Self::Rtrim),
724                "CASE" => Some(Self::Case),
725                "CONSTANT_LOOKUP" => Some(Self::ConstantLookup),
726                "ROUND_DIGIT" => Some(Self::RoundDigit),
727                "ROUND" => Some(Self::Round),
728                "ASCII" => Some(Self::Ascii),
729                "TRANSLATE" => Some(Self::Translate),
730                "COALESCE" => Some(Self::Coalesce),
731                "CONCAT_WS" => Some(Self::ConcatWs),
732                "CONCAT_WS_VARIADIC" => Some(Self::ConcatWsVariadic),
733                "ABS" => Some(Self::Abs),
734                "SPLIT_PART" => Some(Self::SplitPart),
735                "CEIL" => Some(Self::Ceil),
736                "FLOOR" => Some(Self::Floor),
737                "TO_CHAR" => Some(Self::ToChar),
738                "MD5" => Some(Self::Md5),
739                "CHAR_LENGTH" => Some(Self::CharLength),
740                "REPEAT" => Some(Self::Repeat),
741                "CONCAT_OP" => Some(Self::ConcatOp),
742                "BYTEA_CONCAT_OP" => Some(Self::ByteaConcatOp),
743                "CONCAT" => Some(Self::Concat),
744                "CONCAT_VARIADIC" => Some(Self::ConcatVariadic),
745                "BOOL_OUT" => Some(Self::BoolOut),
746                "OCTET_LENGTH" => Some(Self::OctetLength),
747                "BIT_LENGTH" => Some(Self::BitLength),
748                "OVERLAY" => Some(Self::Overlay),
749                "REGEXP_MATCH" => Some(Self::RegexpMatch),
750                "REGEXP_REPLACE" => Some(Self::RegexpReplace),
751                "REGEXP_COUNT" => Some(Self::RegexpCount),
752                "REGEXP_SPLIT_TO_ARRAY" => Some(Self::RegexpSplitToArray),
753                "REGEXP_EQ" => Some(Self::RegexpEq),
754                "POW" => Some(Self::Pow),
755                "EXP" => Some(Self::Exp),
756                "CHR" => Some(Self::Chr),
757                "STARTS_WITH" => Some(Self::StartsWith),
758                "INITCAP" => Some(Self::Initcap),
759                "LPAD" => Some(Self::Lpad),
760                "RPAD" => Some(Self::Rpad),
761                "REVERSE" => Some(Self::Reverse),
762                "STRPOS" => Some(Self::Strpos),
763                "TO_ASCII" => Some(Self::ToAscii),
764                "TO_HEX" => Some(Self::ToHex),
765                "QUOTE_IDENT" => Some(Self::QuoteIdent),
766                "SIN" => Some(Self::Sin),
767                "COS" => Some(Self::Cos),
768                "TAN" => Some(Self::Tan),
769                "COT" => Some(Self::Cot),
770                "ASIN" => Some(Self::Asin),
771                "ACOS" => Some(Self::Acos),
772                "ATAN" => Some(Self::Atan),
773                "ATAN2" => Some(Self::Atan2),
774                "SIND" => Some(Self::Sind),
775                "COSD" => Some(Self::Cosd),
776                "COTD" => Some(Self::Cotd),
777                "TAND" => Some(Self::Tand),
778                "ASIND" => Some(Self::Asind),
779                "SQRT" => Some(Self::Sqrt),
780                "DEGREES" => Some(Self::Degrees),
781                "RADIANS" => Some(Self::Radians),
782                "COSH" => Some(Self::Cosh),
783                "TANH" => Some(Self::Tanh),
784                "COTH" => Some(Self::Coth),
785                "ASINH" => Some(Self::Asinh),
786                "ACOSH" => Some(Self::Acosh),
787                "ATANH" => Some(Self::Atanh),
788                "SINH" => Some(Self::Sinh),
789                "ACOSD" => Some(Self::Acosd),
790                "ATAND" => Some(Self::Atand),
791                "ATAN2D" => Some(Self::Atan2d),
792                "TRUNC" => Some(Self::Trunc),
793                "LN" => Some(Self::Ln),
794                "LOG10" => Some(Self::Log10),
795                "CBRT" => Some(Self::Cbrt),
796                "SIGN" => Some(Self::Sign),
797                "SCALE" => Some(Self::Scale),
798                "MIN_SCALE" => Some(Self::MinScale),
799                "TRIM_SCALE" => Some(Self::TrimScale),
800                "IS_TRUE" => Some(Self::IsTrue),
801                "IS_NOT_TRUE" => Some(Self::IsNotTrue),
802                "IS_FALSE" => Some(Self::IsFalse),
803                "IS_NOT_FALSE" => Some(Self::IsNotFalse),
804                "IS_NULL" => Some(Self::IsNull),
805                "IS_NOT_NULL" => Some(Self::IsNotNull),
806                "IS_DISTINCT_FROM" => Some(Self::IsDistinctFrom),
807                "IS_NOT_DISTINCT_FROM" => Some(Self::IsNotDistinctFrom),
808                "ENCODE" => Some(Self::Encode),
809                "DECODE" => Some(Self::Decode),
810                "SHA1" => Some(Self::Sha1),
811                "SHA224" => Some(Self::Sha224),
812                "SHA256" => Some(Self::Sha256),
813                "SHA384" => Some(Self::Sha384),
814                "SHA512" => Some(Self::Sha512),
815                "LEFT" => Some(Self::Left),
816                "RIGHT" => Some(Self::Right),
817                "FORMAT" => Some(Self::Format),
818                "FORMAT_VARIADIC" => Some(Self::FormatVariadic),
819                "PGWIRE_SEND" => Some(Self::PgwireSend),
820                "PGWIRE_RECV" => Some(Self::PgwireRecv),
821                "CONVERT_FROM" => Some(Self::ConvertFrom),
822                "CONVERT_TO" => Some(Self::ConvertTo),
823                "DECRYPT" => Some(Self::Decrypt),
824                "ENCRYPT" => Some(Self::Encrypt),
825                "INET_ATON" => Some(Self::InetAton),
826                "INET_NTOA" => Some(Self::InetNtoa),
827                "QUOTE_LITERAL" => Some(Self::QuoteLiteral),
828                "QUOTE_NULLABLE" => Some(Self::QuoteNullable),
829                "HMAC" => Some(Self::Hmac),
830                "SECURE_COMPARE" => Some(Self::SecureCompare),
831                "GET_BIT" => Some(Self::GetBit),
832                "GET_BYTE" => Some(Self::GetByte),
833                "SET_BIT" => Some(Self::SetBit),
834                "SET_BYTE" => Some(Self::SetByte),
835                "BIT_COUNT" => Some(Self::BitCount),
836                "CHECK_NOT_NULL" => Some(Self::CheckNotNull),
837                "NEG" => Some(Self::Neg),
838                "FIELD" => Some(Self::Field),
839                "ARRAY" => Some(Self::Array),
840                "ARRAY_ACCESS" => Some(Self::ArrayAccess),
841                "ROW" => Some(Self::Row),
842                "ARRAY_TO_STRING" => Some(Self::ArrayToString),
843                "ARRAY_RANGE_ACCESS" => Some(Self::ArrayRangeAccess),
844                "ARRAY_CAT" => Some(Self::ArrayCat),
845                "ARRAY_APPEND" => Some(Self::ArrayAppend),
846                "ARRAY_PREPEND" => Some(Self::ArrayPrepend),
847                "FORMAT_TYPE" => Some(Self::FormatType),
848                "ARRAY_DISTINCT" => Some(Self::ArrayDistinct),
849                "ARRAY_LENGTH" => Some(Self::ArrayLength),
850                "CARDINALITY" => Some(Self::Cardinality),
851                "ARRAY_REMOVE" => Some(Self::ArrayRemove),
852                "ARRAY_POSITIONS" => Some(Self::ArrayPositions),
853                "TRIM_ARRAY" => Some(Self::TrimArray),
854                "STRING_TO_ARRAY" => Some(Self::StringToArray),
855                "ARRAY_POSITION" => Some(Self::ArrayPosition),
856                "ARRAY_REPLACE" => Some(Self::ArrayReplace),
857                "ARRAY_DIMS" => Some(Self::ArrayDims),
858                "ARRAY_TRANSFORM" => Some(Self::ArrayTransform),
859                "ARRAY_MIN" => Some(Self::ArrayMin),
860                "ARRAY_MAX" => Some(Self::ArrayMax),
861                "ARRAY_SUM" => Some(Self::ArraySum),
862                "ARRAY_SORT" => Some(Self::ArraySort),
863                "ARRAY_CONTAINS" => Some(Self::ArrayContains),
864                "ARRAY_CONTAINED" => Some(Self::ArrayContained),
865                "ARRAY_FLATTEN" => Some(Self::ArrayFlatten),
866                "HEX_TO_INT256" => Some(Self::HexToInt256),
867                "JSONB_ACCESS" => Some(Self::JsonbAccess),
868                "JSONB_ACCESS_STR" => Some(Self::JsonbAccessStr),
869                "JSONB_EXTRACT_PATH" => Some(Self::JsonbExtractPath),
870                "JSONB_EXTRACT_PATH_VARIADIC" => Some(Self::JsonbExtractPathVariadic),
871                "JSONB_EXTRACT_PATH_TEXT" => Some(Self::JsonbExtractPathText),
872                "JSONB_EXTRACT_PATH_TEXT_VARIADIC" => {
873                    Some(Self::JsonbExtractPathTextVariadic)
874                }
875                "JSONB_TYPEOF" => Some(Self::JsonbTypeof),
876                "JSONB_ARRAY_LENGTH" => Some(Self::JsonbArrayLength),
877                "IS_JSON" => Some(Self::IsJson),
878                "JSONB_CONCAT" => Some(Self::JsonbConcat),
879                "JSONB_OBJECT" => Some(Self::JsonbObject),
880                "JSONB_PRETTY" => Some(Self::JsonbPretty),
881                "JSONB_CONTAINS" => Some(Self::JsonbContains),
882                "JSONB_CONTAINED" => Some(Self::JsonbContained),
883                "JSONB_EXISTS" => Some(Self::JsonbExists),
884                "JSONB_EXISTS_ANY" => Some(Self::JsonbExistsAny),
885                "JSONB_EXISTS_ALL" => Some(Self::JsonbExistsAll),
886                "JSONB_DELETE_PATH" => Some(Self::JsonbDeletePath),
887                "JSONB_STRIP_NULLS" => Some(Self::JsonbStripNulls),
888                "TO_JSONB" => Some(Self::ToJsonb),
889                "JSONB_BUILD_ARRAY" => Some(Self::JsonbBuildArray),
890                "JSONB_BUILD_ARRAY_VARIADIC" => Some(Self::JsonbBuildArrayVariadic),
891                "JSONB_BUILD_OBJECT" => Some(Self::JsonbBuildObject),
892                "JSONB_BUILD_OBJECT_VARIADIC" => Some(Self::JsonbBuildObjectVariadic),
893                "JSONB_PATH_EXISTS" => Some(Self::JsonbPathExists),
894                "JSONB_PATH_MATCH" => Some(Self::JsonbPathMatch),
895                "JSONB_PATH_QUERY_ARRAY" => Some(Self::JsonbPathQueryArray),
896                "JSONB_PATH_QUERY_FIRST" => Some(Self::JsonbPathQueryFirst),
897                "JSONB_POPULATE_RECORD" => Some(Self::JsonbPopulateRecord),
898                "JSONB_TO_RECORD" => Some(Self::JsonbToRecord),
899                "JSONB_SET" => Some(Self::JsonbSet),
900                "JSONB_POPULATE_MAP" => Some(Self::JsonbPopulateMap),
901                "JSONB_TO_ARRAY" => Some(Self::JsonbToArray),
902                "MAP_FROM_ENTRIES" => Some(Self::MapFromEntries),
903                "MAP_ACCESS" => Some(Self::MapAccess),
904                "MAP_KEYS" => Some(Self::MapKeys),
905                "MAP_VALUES" => Some(Self::MapValues),
906                "MAP_ENTRIES" => Some(Self::MapEntries),
907                "MAP_FROM_KEY_VALUES" => Some(Self::MapFromKeyValues),
908                "MAP_LENGTH" => Some(Self::MapLength),
909                "MAP_CONTAINS" => Some(Self::MapContains),
910                "MAP_CAT" => Some(Self::MapCat),
911                "MAP_INSERT" => Some(Self::MapInsert),
912                "MAP_DELETE" => Some(Self::MapDelete),
913                "MAP_FILTER" => Some(Self::MapFilter),
914                "L2_DISTANCE" => Some(Self::L2Distance),
915                "COSINE_DISTANCE" => Some(Self::CosineDistance),
916                "L1_DISTANCE" => Some(Self::L1Distance),
917                "INNER_PRODUCT" => Some(Self::InnerProduct),
918                "VEC_CONCAT" => Some(Self::VecConcat),
919                "L2_NORM" => Some(Self::L2Norm),
920                "L2_NORMALIZE" => Some(Self::L2Normalize),
921                "SUBVECTOR" => Some(Self::Subvector),
922                "COMPOSITE_CAST" => Some(Self::CompositeCast),
923                "VNODE" => Some(Self::Vnode),
924                "TEST_FEATURE" => Some(Self::TestFeature),
925                "VNODE_USER" => Some(Self::VnodeUser),
926                "LICENSE" => Some(Self::License),
927                "PROCTIME" => Some(Self::Proctime),
928                "PG_SLEEP" => Some(Self::PgSleep),
929                "PG_SLEEP_FOR" => Some(Self::PgSleepFor),
930                "PG_SLEEP_UNTIL" => Some(Self::PgSleepUntil),
931                "RANDOM" => Some(Self::Random),
932                "CAST_REGCLASS" => Some(Self::CastRegclass),
933                "PG_GET_INDEXDEF" => Some(Self::PgGetIndexdef),
934                "COL_DESCRIPTION" => Some(Self::ColDescription),
935                "PG_GET_VIEWDEF" => Some(Self::PgGetViewdef),
936                "PG_GET_USERBYID" => Some(Self::PgGetUserbyid),
937                "PG_INDEXES_SIZE" => Some(Self::PgIndexesSize),
938                "PG_RELATION_SIZE" => Some(Self::PgRelationSize),
939                "PG_GET_SERIAL_SEQUENCE" => Some(Self::PgGetSerialSequence),
940                "PG_INDEX_COLUMN_HAS_PROPERTY" => Some(Self::PgIndexColumnHasProperty),
941                "HAS_TABLE_PRIVILEGE" => Some(Self::HasTablePrivilege),
942                "HAS_ANY_COLUMN_PRIVILEGE" => Some(Self::HasAnyColumnPrivilege),
943                "HAS_SCHEMA_PRIVILEGE" => Some(Self::HasSchemaPrivilege),
944                "PG_IS_IN_RECOVERY" => Some(Self::PgIsInRecovery),
945                "RW_RECOVERY_STATUS" => Some(Self::RwRecoveryStatus),
946                "RW_EPOCH_TO_TS" => Some(Self::RwEpochToTs),
947                "PG_TABLE_IS_VISIBLE" => Some(Self::PgTableIsVisible),
948                "HAS_FUNCTION_PRIVILEGE" => Some(Self::HasFunctionPrivilege),
949                "HAS_DATABASE_PRIVILEGE" => Some(Self::HasDatabasePrivilege),
950                "RW_CLUSTER_ID" => Some(Self::RwClusterId),
951                "RW_FRAGMENT_VNODES" => Some(Self::RwFragmentVnodes),
952                "RW_ACTOR_VNODES" => Some(Self::RwActorVnodes),
953                "ICEBERG_TRANSFORM" => Some(Self::IcebergTransform),
954                "OPENAI_EMBEDDING" => Some(Self::OpenaiEmbedding),
955                _ => None,
956            }
957        }
958    }
959    #[derive(prost_helpers::AnyPB)]
960    #[derive(::enum_as_inner::EnumAsInner)]
961    #[derive(Eq, Hash)]
962    #[derive(Clone, PartialEq, ::prost::Oneof)]
963    pub enum RexNode {
964        #[prost(uint32, tag = "4")]
965        InputRef(u32),
966        #[prost(message, tag = "5")]
967        Constant(super::super::data::Datum),
968        #[prost(message, tag = "6")]
969        FuncCall(super::FunctionCall),
970        #[prost(message, tag = "7")]
971        Udf(::prost::alloc::boxed::Box<super::UserDefinedFunction>),
972        #[prost(message, tag = "8")]
973        Now(NowRexNode),
974    }
975}
976#[derive(prost_helpers::AnyPB)]
977#[derive(Clone, PartialEq, ::prost::Message)]
978pub struct TableFunction {
979    #[prost(enumeration = "table_function::Type", tag = "1")]
980    pub function_type: i32,
981    #[prost(message, repeated, tag = "2")]
982    pub args: ::prost::alloc::vec::Vec<ExprNode>,
983    #[prost(message, optional, tag = "3")]
984    pub return_type: ::core::option::Option<super::data::DataType>,
985    /// optional. only used when the type is USER_DEFINED.
986    #[prost(message, optional, tag = "4")]
987    pub udf: ::core::option::Option<UserDefinedFunctionMetadata>,
988}
989/// Nested message and enum types in `TableFunction`.
990pub mod table_function {
991    #[derive(prost_helpers::AnyPB)]
992    #[derive(
993        Clone,
994        Copy,
995        Debug,
996        PartialEq,
997        Eq,
998        Hash,
999        PartialOrd,
1000        Ord,
1001        ::prost::Enumeration
1002    )]
1003    #[repr(i32)]
1004    pub enum Type {
1005        Unspecified = 0,
1006        GenerateSeries = 1,
1007        Unnest = 2,
1008        RegexpMatches = 3,
1009        Range = 4,
1010        GenerateSubscripts = 5,
1011        /// buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE
1012        PgExpandarray = 6,
1013        PgGetKeywords = 18,
1014        /// Jsonb functions
1015        JsonbArrayElements = 10,
1016        JsonbArrayElementsText = 11,
1017        JsonbEach = 12,
1018        JsonbEachText = 13,
1019        JsonbObjectKeys = 14,
1020        JsonbPathQuery = 15,
1021        JsonbPopulateRecordset = 16,
1022        JsonbToRecordset = 17,
1023        /// file scan
1024        FileScan = 19,
1025        /// postgres query
1026        PostgresQuery = 20,
1027        /// mysql query
1028        MysqlQuery = 21,
1029        /// Internal backfill table function
1030        InternalBackfillProgress = 30,
1031        /// Internal source backfill table function
1032        InternalSourceBackfillProgress = 31,
1033        /// Internal channel delta stats table function
1034        InternalGetChannelDeltaStats = 32,
1035        /// User defined table function
1036        UserDefined = 100,
1037    }
1038    impl Type {
1039        /// String value of the enum field names used in the ProtoBuf definition.
1040        ///
1041        /// The values are not transformed in any way and thus are considered stable
1042        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1043        pub fn as_str_name(&self) -> &'static str {
1044            match self {
1045                Self::Unspecified => "UNSPECIFIED",
1046                Self::GenerateSeries => "GENERATE_SERIES",
1047                Self::Unnest => "UNNEST",
1048                Self::RegexpMatches => "REGEXP_MATCHES",
1049                Self::Range => "RANGE",
1050                Self::GenerateSubscripts => "GENERATE_SUBSCRIPTS",
1051                Self::PgExpandarray => "_PG_EXPANDARRAY",
1052                Self::PgGetKeywords => "PG_GET_KEYWORDS",
1053                Self::JsonbArrayElements => "JSONB_ARRAY_ELEMENTS",
1054                Self::JsonbArrayElementsText => "JSONB_ARRAY_ELEMENTS_TEXT",
1055                Self::JsonbEach => "JSONB_EACH",
1056                Self::JsonbEachText => "JSONB_EACH_TEXT",
1057                Self::JsonbObjectKeys => "JSONB_OBJECT_KEYS",
1058                Self::JsonbPathQuery => "JSONB_PATH_QUERY",
1059                Self::JsonbPopulateRecordset => "JSONB_POPULATE_RECORDSET",
1060                Self::JsonbToRecordset => "JSONB_TO_RECORDSET",
1061                Self::FileScan => "FILE_SCAN",
1062                Self::PostgresQuery => "POSTGRES_QUERY",
1063                Self::MysqlQuery => "MYSQL_QUERY",
1064                Self::InternalBackfillProgress => "INTERNAL_BACKFILL_PROGRESS",
1065                Self::InternalSourceBackfillProgress => {
1066                    "INTERNAL_SOURCE_BACKFILL_PROGRESS"
1067                }
1068                Self::InternalGetChannelDeltaStats => "INTERNAL_GET_CHANNEL_DELTA_STATS",
1069                Self::UserDefined => "USER_DEFINED",
1070            }
1071        }
1072        /// Creates an enum from field names used in the ProtoBuf definition.
1073        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1074            match value {
1075                "UNSPECIFIED" => Some(Self::Unspecified),
1076                "GENERATE_SERIES" => Some(Self::GenerateSeries),
1077                "UNNEST" => Some(Self::Unnest),
1078                "REGEXP_MATCHES" => Some(Self::RegexpMatches),
1079                "RANGE" => Some(Self::Range),
1080                "GENERATE_SUBSCRIPTS" => Some(Self::GenerateSubscripts),
1081                "_PG_EXPANDARRAY" => Some(Self::PgExpandarray),
1082                "PG_GET_KEYWORDS" => Some(Self::PgGetKeywords),
1083                "JSONB_ARRAY_ELEMENTS" => Some(Self::JsonbArrayElements),
1084                "JSONB_ARRAY_ELEMENTS_TEXT" => Some(Self::JsonbArrayElementsText),
1085                "JSONB_EACH" => Some(Self::JsonbEach),
1086                "JSONB_EACH_TEXT" => Some(Self::JsonbEachText),
1087                "JSONB_OBJECT_KEYS" => Some(Self::JsonbObjectKeys),
1088                "JSONB_PATH_QUERY" => Some(Self::JsonbPathQuery),
1089                "JSONB_POPULATE_RECORDSET" => Some(Self::JsonbPopulateRecordset),
1090                "JSONB_TO_RECORDSET" => Some(Self::JsonbToRecordset),
1091                "FILE_SCAN" => Some(Self::FileScan),
1092                "POSTGRES_QUERY" => Some(Self::PostgresQuery),
1093                "MYSQL_QUERY" => Some(Self::MysqlQuery),
1094                "INTERNAL_BACKFILL_PROGRESS" => Some(Self::InternalBackfillProgress),
1095                "INTERNAL_SOURCE_BACKFILL_PROGRESS" => {
1096                    Some(Self::InternalSourceBackfillProgress)
1097                }
1098                "INTERNAL_GET_CHANNEL_DELTA_STATS" => {
1099                    Some(Self::InternalGetChannelDeltaStats)
1100                }
1101                "USER_DEFINED" => Some(Self::UserDefined),
1102                _ => None,
1103            }
1104        }
1105    }
1106}
1107/// Reference to an upstream column, containing its index and data type.
1108#[derive(prost_helpers::AnyPB)]
1109#[derive(Eq, Hash)]
1110#[derive(Clone, PartialEq, ::prost::Message)]
1111pub struct InputRef {
1112    #[prost(uint32, tag = "1")]
1113    pub index: u32,
1114    #[prost(message, optional, tag = "2")]
1115    pub r#type: ::core::option::Option<super::data::DataType>,
1116}
1117#[derive(prost_helpers::AnyPB)]
1118#[derive(Clone, PartialEq, ::prost::Message)]
1119pub struct Constant {
1120    #[prost(message, optional, tag = "1")]
1121    pub datum: ::core::option::Option<super::data::Datum>,
1122    #[prost(message, optional, tag = "2")]
1123    pub r#type: ::core::option::Option<super::data::DataType>,
1124}
1125/// The items which can occur in the select list of `ProjectSet` operator.
1126///
1127/// When there are table functions in the SQL query `SELECT ...`, it will be planned as `ProjectSet`.
1128/// Otherwise it will be planned as `Project`.
1129///
1130/// # Examples
1131///
1132/// ```sql
1133/// # Project
1134/// select 1;
1135///
1136/// # ProjectSet
1137/// select unnest(array\[1,2,3\]);
1138///
1139/// # ProjectSet (table function & usual expression)
1140/// select unnest(array\[1,2,3\]), 1;
1141///
1142/// # ProjectSet (multiple table functions)
1143/// select unnest(array\[1,2,3\]), unnest(array\[4,5\]);
1144///
1145/// # ProjectSet over ProjectSet (table function as parameters of table function)
1146/// select unnest(regexp_matches(v1, 'a(\d)c(\d)', 'g')) from t;
1147///
1148/// # Project over ProjectSet (table function as parameters of usual function)
1149/// select unnest(regexp_matches(v1, 'a(\d)c(\d)', 'g')) from t;
1150/// ```
1151#[derive(prost_helpers::AnyPB)]
1152#[derive(Clone, PartialEq, ::prost::Message)]
1153pub struct ProjectSetSelectItem {
1154    #[prost(oneof = "project_set_select_item::SelectItem", tags = "1, 2")]
1155    pub select_item: ::core::option::Option<project_set_select_item::SelectItem>,
1156}
1157/// Nested message and enum types in `ProjectSetSelectItem`.
1158pub mod project_set_select_item {
1159    #[derive(prost_helpers::AnyPB)]
1160    #[derive(Clone, PartialEq, ::prost::Oneof)]
1161    pub enum SelectItem {
1162        #[prost(message, tag = "1")]
1163        Expr(super::ExprNode),
1164        #[prost(message, tag = "2")]
1165        TableFunction(super::TableFunction),
1166    }
1167}
1168#[derive(prost_helpers::AnyPB)]
1169#[derive(Eq, Hash)]
1170#[derive(Clone, PartialEq, ::prost::Message)]
1171pub struct FunctionCall {
1172    #[prost(message, repeated, tag = "1")]
1173    pub children: ::prost::alloc::vec::Vec<ExprNode>,
1174}
1175/// Aggregate Function Calls for Aggregation
1176#[derive(prost_helpers::AnyPB)]
1177#[derive(Clone, PartialEq, ::prost::Message)]
1178pub struct AggCall {
1179    #[prost(enumeration = "agg_call::Kind", tag = "1")]
1180    pub kind: i32,
1181    #[prost(message, repeated, tag = "2")]
1182    pub args: ::prost::alloc::vec::Vec<InputRef>,
1183    #[prost(message, optional, tag = "3")]
1184    pub return_type: ::core::option::Option<super::data::DataType>,
1185    #[prost(bool, tag = "4")]
1186    pub distinct: bool,
1187    #[prost(message, repeated, tag = "5")]
1188    pub order_by: ::prost::alloc::vec::Vec<super::common::ColumnOrder>,
1189    #[prost(message, optional, tag = "6")]
1190    pub filter: ::core::option::Option<ExprNode>,
1191    #[prost(message, repeated, tag = "7")]
1192    pub direct_args: ::prost::alloc::vec::Vec<Constant>,
1193    /// optional. only used when the kind is USER_DEFINED.
1194    #[prost(message, optional, tag = "8")]
1195    pub udf: ::core::option::Option<UserDefinedFunctionMetadata>,
1196    /// optional. only used when the kind is WRAP_SCALAR.
1197    #[prost(message, optional, tag = "9")]
1198    pub scalar: ::core::option::Option<ExprNode>,
1199}
1200/// Nested message and enum types in `AggCall`.
1201pub mod agg_call {
1202    #[derive(prost_helpers::AnyPB)]
1203    #[derive(
1204        Clone,
1205        Copy,
1206        Debug,
1207        PartialEq,
1208        Eq,
1209        Hash,
1210        PartialOrd,
1211        Ord,
1212        ::prost::Enumeration
1213    )]
1214    #[repr(i32)]
1215    pub enum Kind {
1216        Unspecified = 0,
1217        Sum = 1,
1218        Min = 2,
1219        Max = 3,
1220        Count = 4,
1221        Avg = 5,
1222        StringAgg = 6,
1223        ApproxCountDistinct = 7,
1224        ArrayAgg = 8,
1225        FirstValue = 9,
1226        Sum0 = 10,
1227        VarPop = 11,
1228        VarSamp = 12,
1229        StddevPop = 13,
1230        StddevSamp = 14,
1231        BitAnd = 15,
1232        BitOr = 16,
1233        BitXor = 17,
1234        BoolAnd = 18,
1235        BoolOr = 19,
1236        JsonbAgg = 20,
1237        JsonbObjectAgg = 21,
1238        PercentileCont = 22,
1239        PercentileDisc = 23,
1240        Mode = 24,
1241        LastValue = 25,
1242        Grouping = 26,
1243        InternalLastSeenValue = 27,
1244        ApproxPercentile = 28,
1245        ArgMin = 29,
1246        ArgMax = 30,
1247        /// user defined aggregate function
1248        UserDefined = 100,
1249        /// wraps a scalar function that takes a list as input as an aggregate function.
1250        WrapScalar = 101,
1251    }
1252    impl Kind {
1253        /// String value of the enum field names used in the ProtoBuf definition.
1254        ///
1255        /// The values are not transformed in any way and thus are considered stable
1256        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1257        pub fn as_str_name(&self) -> &'static str {
1258            match self {
1259                Self::Unspecified => "UNSPECIFIED",
1260                Self::Sum => "SUM",
1261                Self::Min => "MIN",
1262                Self::Max => "MAX",
1263                Self::Count => "COUNT",
1264                Self::Avg => "AVG",
1265                Self::StringAgg => "STRING_AGG",
1266                Self::ApproxCountDistinct => "APPROX_COUNT_DISTINCT",
1267                Self::ArrayAgg => "ARRAY_AGG",
1268                Self::FirstValue => "FIRST_VALUE",
1269                Self::Sum0 => "SUM0",
1270                Self::VarPop => "VAR_POP",
1271                Self::VarSamp => "VAR_SAMP",
1272                Self::StddevPop => "STDDEV_POP",
1273                Self::StddevSamp => "STDDEV_SAMP",
1274                Self::BitAnd => "BIT_AND",
1275                Self::BitOr => "BIT_OR",
1276                Self::BitXor => "BIT_XOR",
1277                Self::BoolAnd => "BOOL_AND",
1278                Self::BoolOr => "BOOL_OR",
1279                Self::JsonbAgg => "JSONB_AGG",
1280                Self::JsonbObjectAgg => "JSONB_OBJECT_AGG",
1281                Self::PercentileCont => "PERCENTILE_CONT",
1282                Self::PercentileDisc => "PERCENTILE_DISC",
1283                Self::Mode => "MODE",
1284                Self::LastValue => "LAST_VALUE",
1285                Self::Grouping => "GROUPING",
1286                Self::InternalLastSeenValue => "INTERNAL_LAST_SEEN_VALUE",
1287                Self::ApproxPercentile => "APPROX_PERCENTILE",
1288                Self::ArgMin => "ARG_MIN",
1289                Self::ArgMax => "ARG_MAX",
1290                Self::UserDefined => "USER_DEFINED",
1291                Self::WrapScalar => "WRAP_SCALAR",
1292            }
1293        }
1294        /// Creates an enum from field names used in the ProtoBuf definition.
1295        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1296            match value {
1297                "UNSPECIFIED" => Some(Self::Unspecified),
1298                "SUM" => Some(Self::Sum),
1299                "MIN" => Some(Self::Min),
1300                "MAX" => Some(Self::Max),
1301                "COUNT" => Some(Self::Count),
1302                "AVG" => Some(Self::Avg),
1303                "STRING_AGG" => Some(Self::StringAgg),
1304                "APPROX_COUNT_DISTINCT" => Some(Self::ApproxCountDistinct),
1305                "ARRAY_AGG" => Some(Self::ArrayAgg),
1306                "FIRST_VALUE" => Some(Self::FirstValue),
1307                "SUM0" => Some(Self::Sum0),
1308                "VAR_POP" => Some(Self::VarPop),
1309                "VAR_SAMP" => Some(Self::VarSamp),
1310                "STDDEV_POP" => Some(Self::StddevPop),
1311                "STDDEV_SAMP" => Some(Self::StddevSamp),
1312                "BIT_AND" => Some(Self::BitAnd),
1313                "BIT_OR" => Some(Self::BitOr),
1314                "BIT_XOR" => Some(Self::BitXor),
1315                "BOOL_AND" => Some(Self::BoolAnd),
1316                "BOOL_OR" => Some(Self::BoolOr),
1317                "JSONB_AGG" => Some(Self::JsonbAgg),
1318                "JSONB_OBJECT_AGG" => Some(Self::JsonbObjectAgg),
1319                "PERCENTILE_CONT" => Some(Self::PercentileCont),
1320                "PERCENTILE_DISC" => Some(Self::PercentileDisc),
1321                "MODE" => Some(Self::Mode),
1322                "LAST_VALUE" => Some(Self::LastValue),
1323                "GROUPING" => Some(Self::Grouping),
1324                "INTERNAL_LAST_SEEN_VALUE" => Some(Self::InternalLastSeenValue),
1325                "APPROX_PERCENTILE" => Some(Self::ApproxPercentile),
1326                "ARG_MIN" => Some(Self::ArgMin),
1327                "ARG_MAX" => Some(Self::ArgMax),
1328                "USER_DEFINED" => Some(Self::UserDefined),
1329                "WRAP_SCALAR" => Some(Self::WrapScalar),
1330                _ => None,
1331            }
1332        }
1333    }
1334}
1335/// The aggregation type.
1336///
1337/// Ideally this should be used to encode the Rust `AggCall::agg_type` field, but historically we
1338/// flattened it into multiple fields in proto `AggCall` - `kind` + `udf` + `scalar`. So this
1339/// `AggType` proto type is only used by `WindowFunction` currently.
1340#[derive(prost_helpers::AnyPB)]
1341#[derive(Clone, PartialEq, ::prost::Message)]
1342pub struct AggType {
1343    #[prost(enumeration = "agg_call::Kind", tag = "1")]
1344    pub kind: i32,
1345    /// UDF metadata. Only present when the kind is `USER_DEFINED`.
1346    #[prost(message, optional, tag = "8")]
1347    pub udf_meta: ::core::option::Option<UserDefinedFunctionMetadata>,
1348    /// Wrapped scalar expression. Only present when the kind is `WRAP_SCALAR`.
1349    #[prost(message, optional, tag = "9")]
1350    pub scalar_expr: ::core::option::Option<ExprNode>,
1351}
1352#[derive(prost_helpers::AnyPB)]
1353#[derive(Clone, PartialEq, ::prost::Message)]
1354pub struct WindowFrame {
1355    #[prost(enumeration = "window_frame::Type", tag = "1")]
1356    pub r#type: i32,
1357    /// Deprecated since we introduced `RANGE` frame.
1358    #[deprecated]
1359    #[prost(message, optional, tag = "2")]
1360    pub start: ::core::option::Option<window_frame::Bound>,
1361    /// Deprecated since we introduced `RANGE` frame.
1362    #[deprecated]
1363    #[prost(message, optional, tag = "3")]
1364    pub end: ::core::option::Option<window_frame::Bound>,
1365    #[prost(enumeration = "window_frame::Exclusion", tag = "4")]
1366    pub exclusion: i32,
1367    #[prost(oneof = "window_frame::Bounds", tags = "10, 15, 20")]
1368    pub bounds: ::core::option::Option<window_frame::Bounds>,
1369}
1370/// Nested message and enum types in `WindowFrame`.
1371pub mod window_frame {
1372    /// Deprecated since we introduced `RANGE` frame.
1373    #[derive(prost_helpers::AnyPB)]
1374    #[derive(Clone, PartialEq, ::prost::Message)]
1375    pub struct Bound {
1376        #[prost(enumeration = "BoundType", tag = "1")]
1377        pub r#type: i32,
1378        #[prost(oneof = "bound::Offset", tags = "2, 3")]
1379        pub offset: ::core::option::Option<bound::Offset>,
1380    }
1381    /// Nested message and enum types in `Bound`.
1382    pub mod bound {
1383        #[derive(prost_helpers::AnyPB)]
1384        #[derive(Clone, PartialEq, ::prost::Oneof)]
1385        pub enum Offset {
1386            #[prost(uint64, tag = "2")]
1387            Integer(u64),
1388            #[prost(message, tag = "3")]
1389            Datum(super::super::super::data::Datum),
1390        }
1391    }
1392    #[derive(prost_helpers::AnyPB)]
1393    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
1394    pub struct RowsFrameBounds {
1395        #[prost(message, optional, tag = "1")]
1396        pub start: ::core::option::Option<RowsFrameBound>,
1397        #[prost(message, optional, tag = "2")]
1398        pub end: ::core::option::Option<RowsFrameBound>,
1399    }
1400    #[derive(prost_helpers::AnyPB)]
1401    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
1402    pub struct RowsFrameBound {
1403        #[prost(enumeration = "BoundType", tag = "1")]
1404        pub r#type: i32,
1405        #[prost(uint64, optional, tag = "3")]
1406        pub offset: ::core::option::Option<u64>,
1407    }
1408    #[derive(prost_helpers::AnyPB)]
1409    #[derive(Clone, PartialEq, ::prost::Message)]
1410    pub struct RangeFrameBounds {
1411        #[prost(message, optional, tag = "1")]
1412        pub start: ::core::option::Option<RangeFrameBound>,
1413        #[prost(message, optional, tag = "2")]
1414        pub end: ::core::option::Option<RangeFrameBound>,
1415        #[prost(message, optional, tag = "10")]
1416        pub order_data_type: ::core::option::Option<super::super::data::DataType>,
1417        #[prost(message, optional, tag = "15")]
1418        pub order_type: ::core::option::Option<super::super::common::OrderType>,
1419        #[prost(message, optional, tag = "20")]
1420        pub offset_data_type: ::core::option::Option<super::super::data::DataType>,
1421    }
1422    #[derive(prost_helpers::AnyPB)]
1423    #[derive(Clone, PartialEq, ::prost::Message)]
1424    pub struct RangeFrameBound {
1425        #[prost(enumeration = "BoundType", tag = "1")]
1426        pub r#type: i32,
1427        #[prost(message, optional, tag = "3")]
1428        pub offset: ::core::option::Option<super::super::data::Datum>,
1429    }
1430    #[derive(prost_helpers::AnyPB)]
1431    #[derive(Clone, PartialEq, ::prost::Message)]
1432    pub struct SessionFrameBounds {
1433        #[prost(message, optional, tag = "1")]
1434        pub gap: ::core::option::Option<super::super::data::Datum>,
1435        #[prost(message, optional, tag = "10")]
1436        pub order_data_type: ::core::option::Option<super::super::data::DataType>,
1437        #[prost(message, optional, tag = "15")]
1438        pub order_type: ::core::option::Option<super::super::common::OrderType>,
1439        #[prost(message, optional, tag = "20")]
1440        pub gap_data_type: ::core::option::Option<super::super::data::DataType>,
1441    }
1442    #[derive(prost_helpers::AnyPB)]
1443    #[derive(
1444        Clone,
1445        Copy,
1446        Debug,
1447        PartialEq,
1448        Eq,
1449        Hash,
1450        PartialOrd,
1451        Ord,
1452        ::prost::Enumeration
1453    )]
1454    #[repr(i32)]
1455    pub enum Type {
1456        Unspecified = 0,
1457        /// Deprecated since we introduced `RANGE` frame.
1458        RowsLegacy = 2,
1459        Rows = 5,
1460        Range = 10,
1461        Session = 15,
1462    }
1463    impl Type {
1464        /// String value of the enum field names used in the ProtoBuf definition.
1465        ///
1466        /// The values are not transformed in any way and thus are considered stable
1467        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1468        pub fn as_str_name(&self) -> &'static str {
1469            match self {
1470                Self::Unspecified => "TYPE_UNSPECIFIED",
1471                Self::RowsLegacy => "TYPE_ROWS_LEGACY",
1472                Self::Rows => "TYPE_ROWS",
1473                Self::Range => "TYPE_RANGE",
1474                Self::Session => "TYPE_SESSION",
1475            }
1476        }
1477        /// Creates an enum from field names used in the ProtoBuf definition.
1478        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1479            match value {
1480                "TYPE_UNSPECIFIED" => Some(Self::Unspecified),
1481                "TYPE_ROWS_LEGACY" => Some(Self::RowsLegacy),
1482                "TYPE_ROWS" => Some(Self::Rows),
1483                "TYPE_RANGE" => Some(Self::Range),
1484                "TYPE_SESSION" => Some(Self::Session),
1485                _ => None,
1486            }
1487        }
1488    }
1489    #[derive(prost_helpers::AnyPB)]
1490    #[derive(
1491        Clone,
1492        Copy,
1493        Debug,
1494        PartialEq,
1495        Eq,
1496        Hash,
1497        PartialOrd,
1498        Ord,
1499        ::prost::Enumeration
1500    )]
1501    #[repr(i32)]
1502    pub enum BoundType {
1503        Unspecified = 0,
1504        UnboundedPreceding = 1,
1505        Preceding = 2,
1506        CurrentRow = 3,
1507        Following = 4,
1508        UnboundedFollowing = 5,
1509    }
1510    impl BoundType {
1511        /// String value of the enum field names used in the ProtoBuf definition.
1512        ///
1513        /// The values are not transformed in any way and thus are considered stable
1514        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1515        pub fn as_str_name(&self) -> &'static str {
1516            match self {
1517                Self::Unspecified => "BOUND_TYPE_UNSPECIFIED",
1518                Self::UnboundedPreceding => "BOUND_TYPE_UNBOUNDED_PRECEDING",
1519                Self::Preceding => "BOUND_TYPE_PRECEDING",
1520                Self::CurrentRow => "BOUND_TYPE_CURRENT_ROW",
1521                Self::Following => "BOUND_TYPE_FOLLOWING",
1522                Self::UnboundedFollowing => "BOUND_TYPE_UNBOUNDED_FOLLOWING",
1523            }
1524        }
1525        /// Creates an enum from field names used in the ProtoBuf definition.
1526        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1527            match value {
1528                "BOUND_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
1529                "BOUND_TYPE_UNBOUNDED_PRECEDING" => Some(Self::UnboundedPreceding),
1530                "BOUND_TYPE_PRECEDING" => Some(Self::Preceding),
1531                "BOUND_TYPE_CURRENT_ROW" => Some(Self::CurrentRow),
1532                "BOUND_TYPE_FOLLOWING" => Some(Self::Following),
1533                "BOUND_TYPE_UNBOUNDED_FOLLOWING" => Some(Self::UnboundedFollowing),
1534                _ => None,
1535            }
1536        }
1537    }
1538    #[derive(prost_helpers::AnyPB)]
1539    #[derive(
1540        Clone,
1541        Copy,
1542        Debug,
1543        PartialEq,
1544        Eq,
1545        Hash,
1546        PartialOrd,
1547        Ord,
1548        ::prost::Enumeration
1549    )]
1550    #[repr(i32)]
1551    pub enum Exclusion {
1552        Unspecified = 0,
1553        CurrentRow = 1,
1554        /// EXCLUSION_GROUP = 2;
1555        /// EXCLUSION_TIES = 3;
1556        NoOthers = 4,
1557    }
1558    impl Exclusion {
1559        /// String value of the enum field names used in the ProtoBuf definition.
1560        ///
1561        /// The values are not transformed in any way and thus are considered stable
1562        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1563        pub fn as_str_name(&self) -> &'static str {
1564            match self {
1565                Self::Unspecified => "EXCLUSION_UNSPECIFIED",
1566                Self::CurrentRow => "EXCLUSION_CURRENT_ROW",
1567                Self::NoOthers => "EXCLUSION_NO_OTHERS",
1568            }
1569        }
1570        /// Creates an enum from field names used in the ProtoBuf definition.
1571        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1572            match value {
1573                "EXCLUSION_UNSPECIFIED" => Some(Self::Unspecified),
1574                "EXCLUSION_CURRENT_ROW" => Some(Self::CurrentRow),
1575                "EXCLUSION_NO_OTHERS" => Some(Self::NoOthers),
1576                _ => None,
1577            }
1578        }
1579    }
1580    #[derive(prost_helpers::AnyPB)]
1581    #[derive(Clone, PartialEq, ::prost::Oneof)]
1582    pub enum Bounds {
1583        #[prost(message, tag = "10")]
1584        Rows(RowsFrameBounds),
1585        #[prost(message, tag = "15")]
1586        Range(RangeFrameBounds),
1587        #[prost(message, tag = "20")]
1588        Session(SessionFrameBounds),
1589    }
1590}
1591#[derive(prost_helpers::AnyPB)]
1592#[derive(Clone, PartialEq, ::prost::Message)]
1593pub struct WindowFunction {
1594    #[prost(message, repeated, tag = "3")]
1595    pub args: ::prost::alloc::vec::Vec<InputRef>,
1596    #[prost(message, optional, tag = "4")]
1597    pub return_type: ::core::option::Option<super::data::DataType>,
1598    #[prost(message, optional, tag = "5")]
1599    pub frame: ::core::option::Option<WindowFrame>,
1600    #[prost(bool, tag = "6")]
1601    pub ignore_nulls: bool,
1602    #[prost(oneof = "window_function::Type", tags = "1, 2, 103")]
1603    pub r#type: ::core::option::Option<window_function::Type>,
1604}
1605/// Nested message and enum types in `WindowFunction`.
1606pub mod window_function {
1607    #[derive(prost_helpers::AnyPB)]
1608    #[derive(
1609        Clone,
1610        Copy,
1611        Debug,
1612        PartialEq,
1613        Eq,
1614        Hash,
1615        PartialOrd,
1616        Ord,
1617        ::prost::Enumeration
1618    )]
1619    #[repr(i32)]
1620    pub enum GeneralType {
1621        Unspecified = 0,
1622        RowNumber = 1,
1623        Rank = 2,
1624        DenseRank = 3,
1625        /// PERCENT_RANK = 4;
1626        /// CUME_DIST = 5;
1627        /// NTILE = 6;
1628        Lag = 7,
1629        Lead = 8,
1630    }
1631    impl GeneralType {
1632        /// String value of the enum field names used in the ProtoBuf definition.
1633        ///
1634        /// The values are not transformed in any way and thus are considered stable
1635        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1636        pub fn as_str_name(&self) -> &'static str {
1637            match self {
1638                Self::Unspecified => "UNSPECIFIED",
1639                Self::RowNumber => "ROW_NUMBER",
1640                Self::Rank => "RANK",
1641                Self::DenseRank => "DENSE_RANK",
1642                Self::Lag => "LAG",
1643                Self::Lead => "LEAD",
1644            }
1645        }
1646        /// Creates an enum from field names used in the ProtoBuf definition.
1647        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1648            match value {
1649                "UNSPECIFIED" => Some(Self::Unspecified),
1650                "ROW_NUMBER" => Some(Self::RowNumber),
1651                "RANK" => Some(Self::Rank),
1652                "DENSE_RANK" => Some(Self::DenseRank),
1653                "LAG" => Some(Self::Lag),
1654                "LEAD" => Some(Self::Lead),
1655                _ => None,
1656            }
1657        }
1658    }
1659    #[derive(prost_helpers::AnyPB)]
1660    #[derive(Clone, PartialEq, ::prost::Oneof)]
1661    pub enum Type {
1662        #[prost(enumeration = "GeneralType", tag = "1")]
1663        General(i32),
1664        /// Deprecated since we have a new `aggregate2` variant.
1665        #[prost(enumeration = "super::agg_call::Kind", tag = "2")]
1666        Aggregate(i32),
1667        #[prost(message, tag = "103")]
1668        Aggregate2(super::AggType),
1669    }
1670}
1671#[derive(prost_helpers::AnyPB)]
1672#[derive(Eq, Hash)]
1673#[derive(Clone, PartialEq, ::prost::Message)]
1674pub struct UserDefinedFunction {
1675    #[prost(message, repeated, tag = "1")]
1676    pub children: ::prost::alloc::vec::Vec<ExprNode>,
1677    #[prost(string, tag = "2")]
1678    pub name: ::prost::alloc::string::String,
1679    #[prost(string, repeated, tag = "8")]
1680    pub arg_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1681    #[prost(message, repeated, tag = "3")]
1682    pub arg_types: ::prost::alloc::vec::Vec<super::data::DataType>,
1683    #[prost(string, tag = "4")]
1684    pub language: ::prost::alloc::string::String,
1685    /// The link to the external function service.
1686    #[prost(string, optional, tag = "5")]
1687    pub link: ::core::option::Option<::prost::alloc::string::String>,
1688    /// This is re-interpreted as `name_in_runtime`.
1689    #[prost(string, optional, tag = "6")]
1690    pub identifier: ::core::option::Option<::prost::alloc::string::String>,
1691    /// - If `language` is `javascript` or `python`, the source code of the function.
1692    #[prost(string, optional, tag = "7")]
1693    pub body: ::core::option::Option<::prost::alloc::string::String>,
1694    /// - If `language` is `rust` or `wasm`, the zstd-compressed wasm binary.
1695    #[prost(bytes = "vec", optional, tag = "10")]
1696    pub compressed_binary: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
1697    #[prost(bool, tag = "9")]
1698    pub always_retry_on_network_error: bool,
1699    /// The runtime selected when multiple runtimes are available for the language. Now is not used.
1700    #[prost(string, optional, tag = "11")]
1701    pub runtime: ::core::option::Option<::prost::alloc::string::String>,
1702    /// additional options for javascript functions
1703    #[prost(bool, optional, tag = "13")]
1704    pub is_async: ::core::option::Option<bool>,
1705    #[prost(bool, optional, tag = "14")]
1706    pub is_batched: ::core::option::Option<bool>,
1707    #[prost(enumeration = "UdfExprVersion", tag = "1000")]
1708    pub version: i32,
1709}
1710/// Additional information for user defined table/aggregate functions.
1711#[derive(prost_helpers::AnyPB)]
1712#[derive(Eq, Hash)]
1713#[derive(Clone, PartialEq, ::prost::Message)]
1714pub struct UserDefinedFunctionMetadata {
1715    #[prost(string, repeated, tag = "8")]
1716    pub arg_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1717    #[prost(message, repeated, tag = "3")]
1718    pub arg_types: ::prost::alloc::vec::Vec<super::data::DataType>,
1719    #[prost(message, optional, tag = "13")]
1720    pub return_type: ::core::option::Option<super::data::DataType>,
1721    #[prost(string, tag = "4")]
1722    pub language: ::prost::alloc::string::String,
1723    #[prost(string, optional, tag = "5")]
1724    pub link: ::core::option::Option<::prost::alloc::string::String>,
1725    /// This is re-interpreted as `name_in_runtime`.
1726    #[prost(string, optional, tag = "6")]
1727    pub identifier: ::core::option::Option<::prost::alloc::string::String>,
1728    #[prost(string, optional, tag = "7")]
1729    pub body: ::core::option::Option<::prost::alloc::string::String>,
1730    #[prost(bytes = "vec", optional, tag = "10")]
1731    pub compressed_binary: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
1732    #[prost(string, optional, tag = "11")]
1733    pub runtime: ::core::option::Option<::prost::alloc::string::String>,
1734    #[prost(enumeration = "UdfExprVersion", tag = "1000")]
1735    pub version: i32,
1736}
1737#[derive(prost_helpers::AnyPB)]
1738#[derive(prost_helpers::Version)]
1739#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1740#[repr(i32)]
1741pub enum UdfExprVersion {
1742    /// Versions before introducing this enum.
1743    Unspecified = 0,
1744    /// Begin from this version, we re-interpret `identifier` as `name_in_runtime`.
1745    NameInRuntime = 1,
1746}
1747impl UdfExprVersion {
1748    /// String value of the enum field names used in the ProtoBuf definition.
1749    ///
1750    /// The values are not transformed in any way and thus are considered stable
1751    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1752    pub fn as_str_name(&self) -> &'static str {
1753        match self {
1754            Self::Unspecified => "UDF_EXPR_VERSION_UNSPECIFIED",
1755            Self::NameInRuntime => "UDF_EXPR_VERSION_NAME_IN_RUNTIME",
1756        }
1757    }
1758    /// Creates an enum from field names used in the ProtoBuf definition.
1759    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1760        match value {
1761            "UDF_EXPR_VERSION_UNSPECIFIED" => Some(Self::Unspecified),
1762            "UDF_EXPR_VERSION_NAME_IN_RUNTIME" => Some(Self::NameInRuntime),
1763            _ => None,
1764        }
1765    }
1766}