1use crate::tokens::Span;
34use serde::{Deserialize, Serialize};
35use std::fmt;
36#[cfg(feature = "bindings")]
37use ts_rs::TS;
38
39fn default_true() -> bool {
41 true
42}
43
44fn is_true(v: &bool) -> bool {
45 *v
46}
47
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[cfg_attr(feature = "bindings", derive(TS))]
78#[serde(rename_all = "snake_case")]
79#[cfg_attr(feature = "bindings", ts(export))]
80pub enum Expression {
81 Literal(Box<Literal>),
83 Boolean(BooleanLiteral),
84 Null(Null),
85
86 Identifier(Identifier),
88 Column(Box<Column>),
89 Table(Box<TableRef>),
90 Star(Star),
91 BracedWildcard(Box<Expression>),
93
94 Select(Box<Select>),
96 Union(Box<Union>),
97 Intersect(Box<Intersect>),
98 Except(Box<Except>),
99 Subquery(Box<Subquery>),
100 PipeOperator(Box<PipeOperator>),
101 Pivot(Box<Pivot>),
102 PivotAlias(Box<PivotAlias>),
103 Unpivot(Box<Unpivot>),
104 Values(Box<Values>),
105 PreWhere(Box<PreWhere>),
106 Stream(Box<Stream>),
107 UsingData(Box<UsingData>),
108 XmlNamespace(Box<XmlNamespace>),
109
110 Insert(Box<Insert>),
112 Update(Box<Update>),
113 Delete(Box<Delete>),
114 Copy(Box<CopyStmt>),
115 Put(Box<PutStmt>),
116 StageReference(Box<StageReference>),
117
118 Alias(Box<Alias>),
120 Cast(Box<Cast>),
121 Collation(Box<CollationExpr>),
122 Case(Box<Case>),
123
124 And(Box<BinaryOp>),
126 Or(Box<BinaryOp>),
127 Add(Box<BinaryOp>),
128 Sub(Box<BinaryOp>),
129 Mul(Box<BinaryOp>),
130 Div(Box<BinaryOp>),
131 Mod(Box<BinaryOp>),
132 Eq(Box<BinaryOp>),
133 Neq(Box<BinaryOp>),
134 Lt(Box<BinaryOp>),
135 Lte(Box<BinaryOp>),
136 Gt(Box<BinaryOp>),
137 Gte(Box<BinaryOp>),
138 Like(Box<LikeOp>),
139 ILike(Box<LikeOp>),
140 Match(Box<BinaryOp>),
142 BitwiseAnd(Box<BinaryOp>),
143 BitwiseOr(Box<BinaryOp>),
144 BitwiseXor(Box<BinaryOp>),
145 Concat(Box<BinaryOp>),
146 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
162 Neg(Box<UnaryOp>),
163 BitwiseNot(Box<UnaryOp>),
164
165 In(Box<In>),
167 Between(Box<Between>),
168 IsNull(Box<IsNull>),
169 IsTrue(Box<IsTrueFalse>),
170 IsFalse(Box<IsTrueFalse>),
171 IsJson(Box<IsJson>),
172 Is(Box<BinaryOp>), Exists(Box<Exists>),
174 MemberOf(Box<BinaryOp>),
176
177 Function(Box<Function>),
179 AggregateFunction(Box<AggregateFunction>),
180 WindowFunction(Box<WindowFunction>),
181
182 From(Box<From>),
184 Join(Box<Join>),
185 JoinedTable(Box<JoinedTable>),
186 Where(Box<Where>),
187 GroupBy(Box<GroupBy>),
188 Having(Box<Having>),
189 OrderBy(Box<OrderBy>),
190 Limit(Box<Limit>),
191 Offset(Box<Offset>),
192 Qualify(Box<Qualify>),
193 With(Box<With>),
194 Cte(Box<Cte>),
195 DistributeBy(Box<DistributeBy>),
196 ClusterBy(Box<ClusterBy>),
197 SortBy(Box<SortBy>),
198 LateralView(Box<LateralView>),
199 Hint(Box<Hint>),
200 Pseudocolumn(Pseudocolumn),
201
202 Connect(Box<Connect>),
204 Prior(Box<Prior>),
205 ConnectByRoot(Box<ConnectByRoot>),
206
207 MatchRecognize(Box<MatchRecognize>),
209
210 Ordered(Box<Ordered>),
212
213 Window(Box<WindowSpec>),
215 Over(Box<Over>),
216 WithinGroup(Box<WithinGroup>),
217
218 DataType(DataType),
220
221 Array(Box<Array>),
223 Struct(Box<Struct>),
224 Tuple(Box<Tuple>),
225
226 Interval(Box<Interval>),
228
229 ConcatWs(Box<ConcatWs>),
231 Substring(Box<SubstringFunc>),
232 Upper(Box<UnaryFunc>),
233 Lower(Box<UnaryFunc>),
234 Length(Box<UnaryFunc>),
235 Trim(Box<TrimFunc>),
236 LTrim(Box<UnaryFunc>),
237 RTrim(Box<UnaryFunc>),
238 Replace(Box<ReplaceFunc>),
239 Reverse(Box<UnaryFunc>),
240 Left(Box<LeftRightFunc>),
241 Right(Box<LeftRightFunc>),
242 Repeat(Box<RepeatFunc>),
243 Lpad(Box<PadFunc>),
244 Rpad(Box<PadFunc>),
245 Split(Box<SplitFunc>),
246 RegexpLike(Box<RegexpFunc>),
247 RegexpReplace(Box<RegexpReplaceFunc>),
248 RegexpExtract(Box<RegexpExtractFunc>),
249 Overlay(Box<OverlayFunc>),
250
251 Abs(Box<UnaryFunc>),
253 Round(Box<RoundFunc>),
254 Floor(Box<FloorFunc>),
255 Ceil(Box<CeilFunc>),
256 Power(Box<BinaryFunc>),
257 Sqrt(Box<UnaryFunc>),
258 Cbrt(Box<UnaryFunc>),
259 Ln(Box<UnaryFunc>),
260 Log(Box<LogFunc>),
261 Exp(Box<UnaryFunc>),
262 Sign(Box<UnaryFunc>),
263 Greatest(Box<VarArgFunc>),
264 Least(Box<VarArgFunc>),
265
266 CurrentDate(CurrentDate),
268 CurrentTime(CurrentTime),
269 CurrentTimestamp(CurrentTimestamp),
270 CurrentTimestampLTZ(CurrentTimestampLTZ),
271 AtTimeZone(Box<AtTimeZone>),
272 DateAdd(Box<DateAddFunc>),
273 DateSub(Box<DateAddFunc>),
274 DateDiff(Box<DateDiffFunc>),
275 DateTrunc(Box<DateTruncFunc>),
276 Extract(Box<ExtractFunc>),
277 ToDate(Box<ToDateFunc>),
278 ToTimestamp(Box<ToTimestampFunc>),
279 Date(Box<UnaryFunc>),
280 Time(Box<UnaryFunc>),
281 DateFromUnixDate(Box<UnaryFunc>),
282 UnixDate(Box<UnaryFunc>),
283 UnixSeconds(Box<UnaryFunc>),
284 UnixMillis(Box<UnaryFunc>),
285 UnixMicros(Box<UnaryFunc>),
286 UnixToTimeStr(Box<BinaryFunc>),
287 TimeStrToDate(Box<UnaryFunc>),
288 DateToDi(Box<UnaryFunc>),
289 DiToDate(Box<UnaryFunc>),
290 TsOrDiToDi(Box<UnaryFunc>),
291 TsOrDsToDatetime(Box<UnaryFunc>),
292 TsOrDsToTimestamp(Box<UnaryFunc>),
293 YearOfWeek(Box<UnaryFunc>),
294 YearOfWeekIso(Box<UnaryFunc>),
295
296 Coalesce(Box<VarArgFunc>),
298 NullIf(Box<BinaryFunc>),
299 IfFunc(Box<IfFunc>),
300 IfNull(Box<BinaryFunc>),
301 Nvl(Box<BinaryFunc>),
302 Nvl2(Box<Nvl2Func>),
303
304 TryCast(Box<Cast>),
306 SafeCast(Box<Cast>),
307
308 Count(Box<CountFunc>),
310 Sum(Box<AggFunc>),
311 Avg(Box<AggFunc>),
312 Min(Box<AggFunc>),
313 Max(Box<AggFunc>),
314 GroupConcat(Box<GroupConcatFunc>),
315 StringAgg(Box<StringAggFunc>),
316 ListAgg(Box<ListAggFunc>),
317 ArrayAgg(Box<AggFunc>),
318 CountIf(Box<AggFunc>),
319 SumIf(Box<SumIfFunc>),
320 Stddev(Box<AggFunc>),
321 StddevPop(Box<AggFunc>),
322 StddevSamp(Box<AggFunc>),
323 Variance(Box<AggFunc>),
324 VarPop(Box<AggFunc>),
325 VarSamp(Box<AggFunc>),
326 Median(Box<AggFunc>),
327 Mode(Box<AggFunc>),
328 First(Box<AggFunc>),
329 Last(Box<AggFunc>),
330 AnyValue(Box<AggFunc>),
331 ApproxDistinct(Box<AggFunc>),
332 ApproxCountDistinct(Box<AggFunc>),
333 ApproxPercentile(Box<ApproxPercentileFunc>),
334 Percentile(Box<PercentileFunc>),
335 LogicalAnd(Box<AggFunc>),
336 LogicalOr(Box<AggFunc>),
337 Skewness(Box<AggFunc>),
338 BitwiseCount(Box<UnaryFunc>),
339 ArrayConcatAgg(Box<AggFunc>),
340 ArrayUniqueAgg(Box<AggFunc>),
341 BoolXorAgg(Box<AggFunc>),
342
343 RowNumber(RowNumber),
345 Rank(Rank),
346 DenseRank(DenseRank),
347 NTile(Box<NTileFunc>),
348 Lead(Box<LeadLagFunc>),
349 Lag(Box<LeadLagFunc>),
350 FirstValue(Box<ValueFunc>),
351 LastValue(Box<ValueFunc>),
352 NthValue(Box<NthValueFunc>),
353 PercentRank(PercentRank),
354 CumeDist(CumeDist),
355 PercentileCont(Box<PercentileFunc>),
356 PercentileDisc(Box<PercentileFunc>),
357
358 Contains(Box<BinaryFunc>),
360 StartsWith(Box<BinaryFunc>),
361 EndsWith(Box<BinaryFunc>),
362 Position(Box<PositionFunc>),
363 Initcap(Box<UnaryFunc>),
364 Ascii(Box<UnaryFunc>),
365 Chr(Box<UnaryFunc>),
366 CharFunc(Box<CharFunc>),
368 Soundex(Box<UnaryFunc>),
369 Levenshtein(Box<BinaryFunc>),
370 ByteLength(Box<UnaryFunc>),
371 Hex(Box<UnaryFunc>),
372 LowerHex(Box<UnaryFunc>),
373 Unicode(Box<UnaryFunc>),
374
375 ModFunc(Box<BinaryFunc>),
377 Random(Random),
378 Rand(Box<Rand>),
379 TruncFunc(Box<TruncateFunc>),
380 Pi(Pi),
381 Radians(Box<UnaryFunc>),
382 Degrees(Box<UnaryFunc>),
383 Sin(Box<UnaryFunc>),
384 Cos(Box<UnaryFunc>),
385 Tan(Box<UnaryFunc>),
386 Asin(Box<UnaryFunc>),
387 Acos(Box<UnaryFunc>),
388 Atan(Box<UnaryFunc>),
389 Atan2(Box<BinaryFunc>),
390 IsNan(Box<UnaryFunc>),
391 IsInf(Box<UnaryFunc>),
392 IntDiv(Box<BinaryFunc>),
393
394 Decode(Box<DecodeFunc>),
396
397 DateFormat(Box<DateFormatFunc>),
399 FormatDate(Box<DateFormatFunc>),
400 Year(Box<UnaryFunc>),
401 Month(Box<UnaryFunc>),
402 Day(Box<UnaryFunc>),
403 Hour(Box<UnaryFunc>),
404 Minute(Box<UnaryFunc>),
405 Second(Box<UnaryFunc>),
406 DayOfWeek(Box<UnaryFunc>),
407 DayOfWeekIso(Box<UnaryFunc>),
408 DayOfMonth(Box<UnaryFunc>),
409 DayOfYear(Box<UnaryFunc>),
410 WeekOfYear(Box<UnaryFunc>),
411 Quarter(Box<UnaryFunc>),
412 AddMonths(Box<BinaryFunc>),
413 MonthsBetween(Box<BinaryFunc>),
414 LastDay(Box<LastDayFunc>),
415 NextDay(Box<BinaryFunc>),
416 Epoch(Box<UnaryFunc>),
417 EpochMs(Box<UnaryFunc>),
418 FromUnixtime(Box<FromUnixtimeFunc>),
419 UnixTimestamp(Box<UnixTimestampFunc>),
420 MakeDate(Box<MakeDateFunc>),
421 MakeTimestamp(Box<MakeTimestampFunc>),
422 TimestampTrunc(Box<DateTruncFunc>),
423 TimeStrToUnix(Box<UnaryFunc>),
424
425 SessionUser(SessionUser),
427
428 SHA(Box<UnaryFunc>),
430 SHA1Digest(Box<UnaryFunc>),
431
432 TimeToUnix(Box<UnaryFunc>),
434
435 ArrayFunc(Box<ArrayConstructor>),
437 ArrayLength(Box<UnaryFunc>),
438 ArraySize(Box<UnaryFunc>),
439 Cardinality(Box<UnaryFunc>),
440 ArrayContains(Box<BinaryFunc>),
441 ArrayPosition(Box<BinaryFunc>),
442 ArrayAppend(Box<BinaryFunc>),
443 ArrayPrepend(Box<BinaryFunc>),
444 ArrayConcat(Box<VarArgFunc>),
445 ArraySort(Box<ArraySortFunc>),
446 ArrayReverse(Box<UnaryFunc>),
447 ArrayDistinct(Box<UnaryFunc>),
448 ArrayJoin(Box<ArrayJoinFunc>),
449 ArrayToString(Box<ArrayJoinFunc>),
450 Unnest(Box<UnnestFunc>),
451 Explode(Box<UnaryFunc>),
452 ExplodeOuter(Box<UnaryFunc>),
453 ArrayFilter(Box<ArrayFilterFunc>),
454 ArrayTransform(Box<ArrayTransformFunc>),
455 ArrayFlatten(Box<UnaryFunc>),
456 ArrayCompact(Box<UnaryFunc>),
457 ArrayIntersect(Box<VarArgFunc>),
458 ArrayUnion(Box<BinaryFunc>),
459 ArrayExcept(Box<BinaryFunc>),
460 ArrayRemove(Box<BinaryFunc>),
461 ArrayZip(Box<VarArgFunc>),
462 Sequence(Box<SequenceFunc>),
463 Generate(Box<SequenceFunc>),
464 ExplodingGenerateSeries(Box<SequenceFunc>),
465 ToArray(Box<UnaryFunc>),
466 StarMap(Box<BinaryFunc>),
467
468 StructFunc(Box<StructConstructor>),
470 StructExtract(Box<StructExtractFunc>),
471 NamedStruct(Box<NamedStructFunc>),
472
473 MapFunc(Box<MapConstructor>),
475 MapFromEntries(Box<UnaryFunc>),
476 MapFromArrays(Box<BinaryFunc>),
477 MapKeys(Box<UnaryFunc>),
478 MapValues(Box<UnaryFunc>),
479 MapContainsKey(Box<BinaryFunc>),
480 MapConcat(Box<VarArgFunc>),
481 ElementAt(Box<BinaryFunc>),
482 TransformKeys(Box<TransformFunc>),
483 TransformValues(Box<TransformFunc>),
484
485 FunctionEmits(Box<FunctionEmits>),
487
488 JsonExtract(Box<JsonExtractFunc>),
490 JsonExtractScalar(Box<JsonExtractFunc>),
491 JsonExtractPath(Box<JsonPathFunc>),
492 JsonArray(Box<VarArgFunc>),
493 JsonObject(Box<JsonObjectFunc>),
494 JsonQuery(Box<JsonExtractFunc>),
495 JsonValue(Box<JsonExtractFunc>),
496 JsonArrayLength(Box<UnaryFunc>),
497 JsonKeys(Box<UnaryFunc>),
498 JsonType(Box<UnaryFunc>),
499 ParseJson(Box<UnaryFunc>),
500 ToJson(Box<UnaryFunc>),
501 JsonSet(Box<JsonModifyFunc>),
502 JsonInsert(Box<JsonModifyFunc>),
503 JsonRemove(Box<JsonPathFunc>),
504 JsonMergePatch(Box<BinaryFunc>),
505 JsonArrayAgg(Box<JsonArrayAggFunc>),
506 JsonObjectAgg(Box<JsonObjectAggFunc>),
507
508 Convert(Box<ConvertFunc>),
510 Typeof(Box<UnaryFunc>),
511
512 Lambda(Box<LambdaExpr>),
514 Parameter(Box<Parameter>),
515 Placeholder(Placeholder),
516 NamedArgument(Box<NamedArgument>),
517 TableArgument(Box<TableArgument>),
520 SqlComment(Box<SqlComment>),
521
522 NullSafeEq(Box<BinaryOp>),
524 NullSafeNeq(Box<BinaryOp>),
525 Glob(Box<BinaryOp>),
526 SimilarTo(Box<SimilarToExpr>),
527 Any(Box<QuantifiedExpr>),
528 All(Box<QuantifiedExpr>),
529 Overlaps(Box<OverlapsExpr>),
530
531 BitwiseLeftShift(Box<BinaryOp>),
533 BitwiseRightShift(Box<BinaryOp>),
534 BitwiseAndAgg(Box<AggFunc>),
535 BitwiseOrAgg(Box<AggFunc>),
536 BitwiseXorAgg(Box<AggFunc>),
537
538 Subscript(Box<Subscript>),
540 Dot(Box<DotAccess>),
541 MethodCall(Box<MethodCall>),
542 ArraySlice(Box<ArraySlice>),
543
544 CreateTable(Box<CreateTable>),
546 DropTable(Box<DropTable>),
547 AlterTable(Box<AlterTable>),
548 CreateIndex(Box<CreateIndex>),
549 DropIndex(Box<DropIndex>),
550 CreateView(Box<CreateView>),
551 DropView(Box<DropView>),
552 AlterView(Box<AlterView>),
553 AlterIndex(Box<AlterIndex>),
554 Truncate(Box<Truncate>),
555 Use(Box<Use>),
556 Cache(Box<Cache>),
557 Uncache(Box<Uncache>),
558 LoadData(Box<LoadData>),
559 Pragma(Box<Pragma>),
560 Grant(Box<Grant>),
561 Revoke(Box<Revoke>),
562 Comment(Box<Comment>),
563 SetStatement(Box<SetStatement>),
564 CreateSchema(Box<CreateSchema>),
566 DropSchema(Box<DropSchema>),
567 DropNamespace(Box<DropNamespace>),
568 CreateDatabase(Box<CreateDatabase>),
569 DropDatabase(Box<DropDatabase>),
570 CreateFunction(Box<CreateFunction>),
571 DropFunction(Box<DropFunction>),
572 CreateProcedure(Box<CreateProcedure>),
573 DropProcedure(Box<DropProcedure>),
574 CreateSequence(Box<CreateSequence>),
575 CreateSynonym(Box<CreateSynonym>),
576 DropSequence(Box<DropSequence>),
577 AlterSequence(Box<AlterSequence>),
578 CreateTrigger(Box<CreateTrigger>),
579 DropTrigger(Box<DropTrigger>),
580 CreateType(Box<CreateType>),
581 DropType(Box<DropType>),
582 Describe(Box<Describe>),
583 Show(Box<Show>),
584
585 Command(Box<Command>),
587 Kill(Box<Kill>),
588 Execute(Box<ExecuteStatement>),
590
591 CreateTask(Box<CreateTask>),
593
594 Raw(Raw),
596
597 Paren(Box<Paren>),
599
600 Annotated(Box<Annotated>),
602
603 Refresh(Box<Refresh>),
606 LockingStatement(Box<LockingStatement>),
607 SequenceProperties(Box<SequenceProperties>),
608 TruncateTable(Box<TruncateTable>),
609 Clone(Box<Clone>),
610 Attach(Box<Attach>),
611 Detach(Box<Detach>),
612 Install(Box<Install>),
613 Summarize(Box<Summarize>),
614 Declare(Box<Declare>),
615 DeclareItem(Box<DeclareItem>),
616 Set(Box<Set>),
617 Heredoc(Box<Heredoc>),
618 SetItem(Box<SetItem>),
619 QueryBand(Box<QueryBand>),
620 UserDefinedFunction(Box<UserDefinedFunction>),
621 RecursiveWithSearch(Box<RecursiveWithSearch>),
622 ProjectionDef(Box<ProjectionDef>),
623 TableAlias(Box<TableAlias>),
624 ByteString(Box<ByteString>),
625 HexStringExpr(Box<HexStringExpr>),
626 UnicodeString(Box<UnicodeString>),
627 ColumnPosition(Box<ColumnPosition>),
628 ColumnDef(Box<ColumnDef>),
629 AlterColumn(Box<AlterColumn>),
630 AlterSortKey(Box<AlterSortKey>),
631 AlterSet(Box<AlterSet>),
632 RenameColumn(Box<RenameColumn>),
633 Comprehension(Box<Comprehension>),
634 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
635 MergeTreeTTL(Box<MergeTreeTTL>),
636 IndexConstraintOption(Box<IndexConstraintOption>),
637 ColumnConstraint(Box<ColumnConstraint>),
638 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
639 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
640 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
641 CheckColumnConstraint(Box<CheckColumnConstraint>),
642 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
643 CompressColumnConstraint(Box<CompressColumnConstraint>),
644 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
645 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
646 WithOperator(Box<WithOperator>),
647 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
648 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
649 CommentColumnConstraint(CommentColumnConstraint),
650 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
651 IndexColumnConstraint(Box<IndexColumnConstraint>),
652 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
653 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
654 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
655 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
656 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
657 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
658 InOutColumnConstraint(Box<InOutColumnConstraint>),
659 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
660 PathColumnConstraint(Box<PathColumnConstraint>),
661 Constraint(Box<Constraint>),
662 Export(Box<Export>),
663 Filter(Box<Filter>),
664 Changes(Box<Changes>),
665 CopyParameter(Box<CopyParameter>),
666 Credentials(Box<Credentials>),
667 Directory(Box<Directory>),
668 ForeignKey(Box<ForeignKey>),
669 ColumnPrefix(Box<ColumnPrefix>),
670 PrimaryKey(Box<PrimaryKey>),
671 IntoClause(Box<IntoClause>),
672 JoinHint(Box<JoinHint>),
673 Opclass(Box<Opclass>),
674 Index(Box<Index>),
675 IndexParameters(Box<IndexParameters>),
676 ConditionalInsert(Box<ConditionalInsert>),
677 MultitableInserts(Box<MultitableInserts>),
678 OnConflict(Box<OnConflict>),
679 OnCondition(Box<OnCondition>),
680 Returning(Box<Returning>),
681 Introducer(Box<Introducer>),
682 PartitionRange(Box<PartitionRange>),
683 Fetch(Box<Fetch>),
684 Group(Box<Group>),
685 Cube(Box<Cube>),
686 Rollup(Box<Rollup>),
687 GroupingSets(Box<GroupingSets>),
688 LimitOptions(Box<LimitOptions>),
689 Lateral(Box<Lateral>),
690 TableFromRows(Box<TableFromRows>),
691 RowsFrom(Box<RowsFrom>),
692 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
693 WithFill(Box<WithFill>),
694 Property(Box<Property>),
695 GrantPrivilege(Box<GrantPrivilege>),
696 GrantPrincipal(Box<GrantPrincipal>),
697 AllowedValuesProperty(Box<AllowedValuesProperty>),
698 AlgorithmProperty(Box<AlgorithmProperty>),
699 AutoIncrementProperty(Box<AutoIncrementProperty>),
700 AutoRefreshProperty(Box<AutoRefreshProperty>),
701 BackupProperty(Box<BackupProperty>),
702 BuildProperty(Box<BuildProperty>),
703 BlockCompressionProperty(Box<BlockCompressionProperty>),
704 CharacterSetProperty(Box<CharacterSetProperty>),
705 ChecksumProperty(Box<ChecksumProperty>),
706 CollateProperty(Box<CollateProperty>),
707 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
708 DataDeletionProperty(Box<DataDeletionProperty>),
709 DefinerProperty(Box<DefinerProperty>),
710 DistKeyProperty(Box<DistKeyProperty>),
711 DistributedByProperty(Box<DistributedByProperty>),
712 DistStyleProperty(Box<DistStyleProperty>),
713 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
714 EngineProperty(Box<EngineProperty>),
715 ToTableProperty(Box<ToTableProperty>),
716 ExecuteAsProperty(Box<ExecuteAsProperty>),
717 ExternalProperty(Box<ExternalProperty>),
718 FallbackProperty(Box<FallbackProperty>),
719 FileFormatProperty(Box<FileFormatProperty>),
720 CredentialsProperty(Box<CredentialsProperty>),
721 FreespaceProperty(Box<FreespaceProperty>),
722 InheritsProperty(Box<InheritsProperty>),
723 InputModelProperty(Box<InputModelProperty>),
724 OutputModelProperty(Box<OutputModelProperty>),
725 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
726 JournalProperty(Box<JournalProperty>),
727 LanguageProperty(Box<LanguageProperty>),
728 EnviromentProperty(Box<EnviromentProperty>),
729 ClusteredByProperty(Box<ClusteredByProperty>),
730 DictProperty(Box<DictProperty>),
731 DictRange(Box<DictRange>),
732 OnCluster(Box<OnCluster>),
733 LikeProperty(Box<LikeProperty>),
734 LocationProperty(Box<LocationProperty>),
735 LockProperty(Box<LockProperty>),
736 LockingProperty(Box<LockingProperty>),
737 LogProperty(Box<LogProperty>),
738 MaterializedProperty(Box<MaterializedProperty>),
739 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
740 OnProperty(Box<OnProperty>),
741 OnCommitProperty(Box<OnCommitProperty>),
742 PartitionedByProperty(Box<PartitionedByProperty>),
743 PartitionByProperty(Box<PartitionByProperty>),
744 PartitionedByBucket(Box<PartitionedByBucket>),
745 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
746 PartitionByTruncate(Box<PartitionByTruncate>),
747 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
748 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
749 PartitionByListProperty(Box<PartitionByListProperty>),
750 PartitionList(Box<PartitionList>),
751 Partition(Box<Partition>),
752 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
753 UniqueKeyProperty(Box<UniqueKeyProperty>),
754 RollupProperty(Box<RollupProperty>),
755 PartitionBoundSpec(Box<PartitionBoundSpec>),
756 PartitionedOfProperty(Box<PartitionedOfProperty>),
757 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
758 ReturnsProperty(Box<ReturnsProperty>),
759 RowFormatProperty(Box<RowFormatProperty>),
760 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
761 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
762 QueryTransform(Box<QueryTransform>),
763 SampleProperty(Box<SampleProperty>),
764 SecurityProperty(Box<SecurityProperty>),
765 SchemaCommentProperty(Box<SchemaCommentProperty>),
766 SemanticView(Box<SemanticView>),
767 SerdeProperties(Box<SerdeProperties>),
768 SetProperty(Box<SetProperty>),
769 SharingProperty(Box<SharingProperty>),
770 SetConfigProperty(Box<SetConfigProperty>),
771 SettingsProperty(Box<SettingsProperty>),
772 SortKeyProperty(Box<SortKeyProperty>),
773 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
774 SqlSecurityProperty(Box<SqlSecurityProperty>),
775 StabilityProperty(Box<StabilityProperty>),
776 StorageHandlerProperty(Box<StorageHandlerProperty>),
777 TemporaryProperty(Box<TemporaryProperty>),
778 Tags(Box<Tags>),
779 TransformModelProperty(Box<TransformModelProperty>),
780 TransientProperty(Box<TransientProperty>),
781 UsingTemplateProperty(Box<UsingTemplateProperty>),
782 ViewAttributeProperty(Box<ViewAttributeProperty>),
783 VolatileProperty(Box<VolatileProperty>),
784 WithDataProperty(Box<WithDataProperty>),
785 WithJournalTableProperty(Box<WithJournalTableProperty>),
786 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
787 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
788 WithProcedureOptions(Box<WithProcedureOptions>),
789 EncodeProperty(Box<EncodeProperty>),
790 IncludeProperty(Box<IncludeProperty>),
791 Properties(Box<Properties>),
792 OptionsProperty(Box<OptionsProperty>),
793 InputOutputFormat(Box<InputOutputFormat>),
794 Reference(Box<Reference>),
795 QueryOption(Box<QueryOption>),
796 WithTableHint(Box<WithTableHint>),
797 IndexTableHint(Box<IndexTableHint>),
798 HistoricalData(Box<HistoricalData>),
799 Get(Box<Get>),
800 SetOperation(Box<SetOperation>),
801 Var(Box<Var>),
802 Variadic(Box<Variadic>),
803 Version(Box<Version>),
804 Schema(Box<Schema>),
805 Lock(Box<Lock>),
806 TableSample(Box<TableSample>),
807 Tag(Box<Tag>),
808 UnpivotColumns(Box<UnpivotColumns>),
809 WindowSpec(Box<WindowSpec>),
810 SessionParameter(Box<SessionParameter>),
811 PseudoType(Box<PseudoType>),
812 ObjectIdentifier(Box<ObjectIdentifier>),
813 Transaction(Box<Transaction>),
814 Commit(Box<Commit>),
815 Rollback(Box<Rollback>),
816 AlterSession(Box<AlterSession>),
817 Analyze(Box<Analyze>),
818 AnalyzeStatistics(Box<AnalyzeStatistics>),
819 AnalyzeHistogram(Box<AnalyzeHistogram>),
820 AnalyzeSample(Box<AnalyzeSample>),
821 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
822 AnalyzeDelete(Box<AnalyzeDelete>),
823 AnalyzeWith(Box<AnalyzeWith>),
824 AnalyzeValidate(Box<AnalyzeValidate>),
825 AddPartition(Box<AddPartition>),
826 AttachOption(Box<AttachOption>),
827 DropPartition(Box<DropPartition>),
828 ReplacePartition(Box<ReplacePartition>),
829 DPipe(Box<DPipe>),
830 Operator(Box<Operator>),
831 PivotAny(Box<PivotAny>),
832 Aliases(Box<Aliases>),
833 AtIndex(Box<AtIndex>),
834 FromTimeZone(Box<FromTimeZone>),
835 FormatPhrase(Box<FormatPhrase>),
836 ForIn(Box<ForIn>),
837 TimeUnit(Box<TimeUnit>),
838 IntervalOp(Box<IntervalOp>),
839 IntervalSpan(Box<IntervalSpan>),
840 HavingMax(Box<HavingMax>),
841 CosineDistance(Box<CosineDistance>),
842 DotProduct(Box<DotProduct>),
843 EuclideanDistance(Box<EuclideanDistance>),
844 ManhattanDistance(Box<ManhattanDistance>),
845 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
846 Booland(Box<Booland>),
847 Boolor(Box<Boolor>),
848 ParameterizedAgg(Box<ParameterizedAgg>),
849 ArgMax(Box<ArgMax>),
850 ArgMin(Box<ArgMin>),
851 ApproxTopK(Box<ApproxTopK>),
852 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
853 ApproxTopKCombine(Box<ApproxTopKCombine>),
854 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
855 ApproxTopSum(Box<ApproxTopSum>),
856 ApproxQuantiles(Box<ApproxQuantiles>),
857 Minhash(Box<Minhash>),
858 FarmFingerprint(Box<FarmFingerprint>),
859 Float64(Box<Float64>),
860 Transform(Box<Transform>),
861 Translate(Box<Translate>),
862 Grouping(Box<Grouping>),
863 GroupingId(Box<GroupingId>),
864 Anonymous(Box<Anonymous>),
865 AnonymousAggFunc(Box<AnonymousAggFunc>),
866 CombinedAggFunc(Box<CombinedAggFunc>),
867 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
868 HashAgg(Box<HashAgg>),
869 Hll(Box<Hll>),
870 Apply(Box<Apply>),
871 ToBoolean(Box<ToBoolean>),
872 List(Box<List>),
873 ToMap(Box<ToMap>),
874 Pad(Box<Pad>),
875 ToChar(Box<ToChar>),
876 ToNumber(Box<ToNumber>),
877 ToDouble(Box<ToDouble>),
878 Int64(Box<UnaryFunc>),
879 StringFunc(Box<StringFunc>),
880 ToDecfloat(Box<ToDecfloat>),
881 TryToDecfloat(Box<TryToDecfloat>),
882 ToFile(Box<ToFile>),
883 Columns(Box<Columns>),
884 ConvertToCharset(Box<ConvertToCharset>),
885 ConvertTimezone(Box<ConvertTimezone>),
886 GenerateSeries(Box<GenerateSeries>),
887 AIAgg(Box<AIAgg>),
888 AIClassify(Box<AIClassify>),
889 ArrayAll(Box<ArrayAll>),
890 ArrayAny(Box<ArrayAny>),
891 ArrayConstructCompact(Box<ArrayConstructCompact>),
892 StPoint(Box<StPoint>),
893 StDistance(Box<StDistance>),
894 StringToArray(Box<StringToArray>),
895 ArraySum(Box<ArraySum>),
896 ObjectAgg(Box<ObjectAgg>),
897 CastToStrType(Box<CastToStrType>),
898 CheckJson(Box<CheckJson>),
899 CheckXml(Box<CheckXml>),
900 TranslateCharacters(Box<TranslateCharacters>),
901 CurrentSchemas(Box<CurrentSchemas>),
902 CurrentDatetime(Box<CurrentDatetime>),
903 Localtime(Box<Localtime>),
904 Localtimestamp(Box<Localtimestamp>),
905 Systimestamp(Box<Systimestamp>),
906 CurrentSchema(Box<CurrentSchema>),
907 CurrentUser(Box<CurrentUser>),
908 UtcTime(Box<UtcTime>),
909 UtcTimestamp(Box<UtcTimestamp>),
910 Timestamp(Box<TimestampFunc>),
911 DateBin(Box<DateBin>),
912 Datetime(Box<Datetime>),
913 DatetimeAdd(Box<DatetimeAdd>),
914 DatetimeSub(Box<DatetimeSub>),
915 DatetimeDiff(Box<DatetimeDiff>),
916 DatetimeTrunc(Box<DatetimeTrunc>),
917 Dayname(Box<Dayname>),
918 MakeInterval(Box<MakeInterval>),
919 PreviousDay(Box<PreviousDay>),
920 Elt(Box<Elt>),
921 TimestampAdd(Box<TimestampAdd>),
922 TimestampSub(Box<TimestampSub>),
923 TimestampDiff(Box<TimestampDiff>),
924 TimeSlice(Box<TimeSlice>),
925 TimeAdd(Box<TimeAdd>),
926 TimeSub(Box<TimeSub>),
927 TimeDiff(Box<TimeDiff>),
928 TimeTrunc(Box<TimeTrunc>),
929 DateFromParts(Box<DateFromParts>),
930 TimeFromParts(Box<TimeFromParts>),
931 DecodeCase(Box<DecodeCase>),
932 Decrypt(Box<Decrypt>),
933 DecryptRaw(Box<DecryptRaw>),
934 Encode(Box<Encode>),
935 Encrypt(Box<Encrypt>),
936 EncryptRaw(Box<EncryptRaw>),
937 EqualNull(Box<EqualNull>),
938 ToBinary(Box<ToBinary>),
939 Base64DecodeBinary(Box<Base64DecodeBinary>),
940 Base64DecodeString(Box<Base64DecodeString>),
941 Base64Encode(Box<Base64Encode>),
942 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
943 TryBase64DecodeString(Box<TryBase64DecodeString>),
944 GapFill(Box<GapFill>),
945 GenerateDateArray(Box<GenerateDateArray>),
946 GenerateTimestampArray(Box<GenerateTimestampArray>),
947 GetExtract(Box<GetExtract>),
948 Getbit(Box<Getbit>),
949 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
950 HexEncode(Box<HexEncode>),
951 Compress(Box<Compress>),
952 DecompressBinary(Box<DecompressBinary>),
953 DecompressString(Box<DecompressString>),
954 Xor(Box<Xor>),
955 Nullif(Box<Nullif>),
956 JSON(Box<JSON>),
957 JSONPath(Box<JSONPath>),
958 JSONPathFilter(Box<JSONPathFilter>),
959 JSONPathKey(Box<JSONPathKey>),
960 JSONPathRecursive(Box<JSONPathRecursive>),
961 JSONPathScript(Box<JSONPathScript>),
962 JSONPathSlice(Box<JSONPathSlice>),
963 JSONPathSelector(Box<JSONPathSelector>),
964 JSONPathSubscript(Box<JSONPathSubscript>),
965 JSONPathUnion(Box<JSONPathUnion>),
966 Format(Box<Format>),
967 JSONKeys(Box<JSONKeys>),
968 JSONKeyValue(Box<JSONKeyValue>),
969 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
970 JSONObject(Box<JSONObject>),
971 JSONObjectAgg(Box<JSONObjectAgg>),
972 JSONBObjectAgg(Box<JSONBObjectAgg>),
973 JSONArray(Box<JSONArray>),
974 JSONArrayAgg(Box<JSONArrayAgg>),
975 JSONExists(Box<JSONExists>),
976 JSONColumnDef(Box<JSONColumnDef>),
977 JSONSchema(Box<JSONSchema>),
978 JSONSet(Box<JSONSet>),
979 JSONStripNulls(Box<JSONStripNulls>),
980 JSONValue(Box<JSONValue>),
981 JSONValueArray(Box<JSONValueArray>),
982 JSONRemove(Box<JSONRemove>),
983 JSONTable(Box<JSONTable>),
984 JSONType(Box<JSONType>),
985 ObjectInsert(Box<ObjectInsert>),
986 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
987 OpenJSON(Box<OpenJSON>),
988 JSONBExists(Box<JSONBExists>),
989 JSONBContains(Box<BinaryFunc>),
990 JSONBExtract(Box<BinaryFunc>),
991 JSONCast(Box<JSONCast>),
992 JSONExtract(Box<JSONExtract>),
993 JSONExtractQuote(Box<JSONExtractQuote>),
994 JSONExtractArray(Box<JSONExtractArray>),
995 JSONExtractScalar(Box<JSONExtractScalar>),
996 JSONBExtractScalar(Box<JSONBExtractScalar>),
997 JSONFormat(Box<JSONFormat>),
998 JSONBool(Box<UnaryFunc>),
999 JSONPathRoot(JSONPathRoot),
1000 JSONArrayAppend(Box<JSONArrayAppend>),
1001 JSONArrayContains(Box<JSONArrayContains>),
1002 JSONArrayInsert(Box<JSONArrayInsert>),
1003 ParseJSON(Box<ParseJSON>),
1004 ParseUrl(Box<ParseUrl>),
1005 ParseIp(Box<ParseIp>),
1006 ParseTime(Box<ParseTime>),
1007 ParseDatetime(Box<ParseDatetime>),
1008 Map(Box<Map>),
1009 MapCat(Box<MapCat>),
1010 MapDelete(Box<MapDelete>),
1011 MapInsert(Box<MapInsert>),
1012 MapPick(Box<MapPick>),
1013 ScopeResolution(Box<ScopeResolution>),
1014 Slice(Box<Slice>),
1015 VarMap(Box<VarMap>),
1016 MatchAgainst(Box<MatchAgainst>),
1017 MD5Digest(Box<MD5Digest>),
1018 MD5NumberLower64(Box<UnaryFunc>),
1019 MD5NumberUpper64(Box<UnaryFunc>),
1020 Monthname(Box<Monthname>),
1021 Ntile(Box<Ntile>),
1022 Normalize(Box<Normalize>),
1023 Normal(Box<Normal>),
1024 Predict(Box<Predict>),
1025 MLTranslate(Box<MLTranslate>),
1026 FeaturesAtTime(Box<FeaturesAtTime>),
1027 GenerateEmbedding(Box<GenerateEmbedding>),
1028 MLForecast(Box<MLForecast>),
1029 ModelAttribute(Box<ModelAttribute>),
1030 VectorSearch(Box<VectorSearch>),
1031 Quantile(Box<Quantile>),
1032 ApproxQuantile(Box<ApproxQuantile>),
1033 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1034 Randn(Box<Randn>),
1035 Randstr(Box<Randstr>),
1036 RangeN(Box<RangeN>),
1037 RangeBucket(Box<RangeBucket>),
1038 ReadCSV(Box<ReadCSV>),
1039 ReadParquet(Box<ReadParquet>),
1040 Reduce(Box<Reduce>),
1041 RegexpExtractAll(Box<RegexpExtractAll>),
1042 RegexpILike(Box<RegexpILike>),
1043 RegexpFullMatch(Box<RegexpFullMatch>),
1044 RegexpInstr(Box<RegexpInstr>),
1045 RegexpSplit(Box<RegexpSplit>),
1046 RegexpCount(Box<RegexpCount>),
1047 RegrValx(Box<RegrValx>),
1048 RegrValy(Box<RegrValy>),
1049 RegrAvgy(Box<RegrAvgy>),
1050 RegrAvgx(Box<RegrAvgx>),
1051 RegrCount(Box<RegrCount>),
1052 RegrIntercept(Box<RegrIntercept>),
1053 RegrR2(Box<RegrR2>),
1054 RegrSxx(Box<RegrSxx>),
1055 RegrSxy(Box<RegrSxy>),
1056 RegrSyy(Box<RegrSyy>),
1057 RegrSlope(Box<RegrSlope>),
1058 SafeAdd(Box<SafeAdd>),
1059 SafeDivide(Box<SafeDivide>),
1060 SafeMultiply(Box<SafeMultiply>),
1061 SafeSubtract(Box<SafeSubtract>),
1062 SHA2(Box<SHA2>),
1063 SHA2Digest(Box<SHA2Digest>),
1064 SortArray(Box<SortArray>),
1065 SplitPart(Box<SplitPart>),
1066 SubstringIndex(Box<SubstringIndex>),
1067 StandardHash(Box<StandardHash>),
1068 StrPosition(Box<StrPosition>),
1069 Search(Box<Search>),
1070 SearchIp(Box<SearchIp>),
1071 StrToDate(Box<StrToDate>),
1072 DateStrToDate(Box<UnaryFunc>),
1073 DateToDateStr(Box<UnaryFunc>),
1074 StrToTime(Box<StrToTime>),
1075 StrToUnix(Box<StrToUnix>),
1076 StrToMap(Box<StrToMap>),
1077 NumberToStr(Box<NumberToStr>),
1078 FromBase(Box<FromBase>),
1079 Stuff(Box<Stuff>),
1080 TimeToStr(Box<TimeToStr>),
1081 TimeStrToTime(Box<TimeStrToTime>),
1082 TsOrDsAdd(Box<TsOrDsAdd>),
1083 TsOrDsDiff(Box<TsOrDsDiff>),
1084 TsOrDsToDate(Box<TsOrDsToDate>),
1085 TsOrDsToTime(Box<TsOrDsToTime>),
1086 Unhex(Box<Unhex>),
1087 Uniform(Box<Uniform>),
1088 UnixToStr(Box<UnixToStr>),
1089 UnixToTime(Box<UnixToTime>),
1090 Uuid(Box<Uuid>),
1091 TimestampFromParts(Box<TimestampFromParts>),
1092 TimestampTzFromParts(Box<TimestampTzFromParts>),
1093 Corr(Box<Corr>),
1094 WidthBucket(Box<WidthBucket>),
1095 CovarSamp(Box<CovarSamp>),
1096 CovarPop(Box<CovarPop>),
1097 Week(Box<Week>),
1098 XMLElement(Box<XMLElement>),
1099 XMLGet(Box<XMLGet>),
1100 XMLTable(Box<XMLTable>),
1101 XMLKeyValueOption(Box<XMLKeyValueOption>),
1102 Zipf(Box<Zipf>),
1103 Merge(Box<Merge>),
1104 When(Box<When>),
1105 Whens(Box<Whens>),
1106 NextValueFor(Box<NextValueFor>),
1107 ReturnStmt(Box<Expression>),
1109}
1110
1111impl Expression {
1112 #[inline]
1114 pub fn boxed_column(col: Column) -> Self {
1115 Expression::Column(Box::new(col))
1116 }
1117
1118 #[inline]
1120 pub fn boxed_table(t: TableRef) -> Self {
1121 Expression::Table(Box::new(t))
1122 }
1123
1124 pub fn is_statement(&self) -> bool {
1131 match self {
1132 Expression::Select(_)
1134 | Expression::Union(_)
1135 | Expression::Intersect(_)
1136 | Expression::Except(_)
1137 | Expression::Subquery(_)
1138 | Expression::Values(_)
1139 | Expression::PipeOperator(_)
1140
1141 | Expression::Insert(_)
1143 | Expression::Update(_)
1144 | Expression::Delete(_)
1145 | Expression::Copy(_)
1146 | Expression::Put(_)
1147 | Expression::Merge(_)
1148
1149 | Expression::CreateTable(_)
1151 | Expression::DropTable(_)
1152 | Expression::AlterTable(_)
1153 | Expression::CreateIndex(_)
1154 | Expression::DropIndex(_)
1155 | Expression::CreateView(_)
1156 | Expression::DropView(_)
1157 | Expression::AlterView(_)
1158 | Expression::AlterIndex(_)
1159 | Expression::Truncate(_)
1160 | Expression::TruncateTable(_)
1161 | Expression::CreateSchema(_)
1162 | Expression::DropSchema(_)
1163 | Expression::DropNamespace(_)
1164 | Expression::CreateDatabase(_)
1165 | Expression::DropDatabase(_)
1166 | Expression::CreateFunction(_)
1167 | Expression::DropFunction(_)
1168 | Expression::CreateProcedure(_)
1169 | Expression::DropProcedure(_)
1170 | Expression::CreateSequence(_)
1171 | Expression::DropSequence(_)
1172 | Expression::AlterSequence(_)
1173 | Expression::CreateTrigger(_)
1174 | Expression::DropTrigger(_)
1175 | Expression::CreateType(_)
1176 | Expression::DropType(_)
1177 | Expression::Comment(_)
1178
1179 | Expression::Use(_)
1181 | Expression::Set(_)
1182 | Expression::SetStatement(_)
1183 | Expression::Transaction(_)
1184 | Expression::Commit(_)
1185 | Expression::Rollback(_)
1186 | Expression::Grant(_)
1187 | Expression::Revoke(_)
1188 | Expression::Cache(_)
1189 | Expression::Uncache(_)
1190 | Expression::LoadData(_)
1191 | Expression::Pragma(_)
1192 | Expression::Describe(_)
1193 | Expression::Show(_)
1194 | Expression::Kill(_)
1195 | Expression::Execute(_)
1196 | Expression::Declare(_)
1197 | Expression::Refresh(_)
1198 | Expression::AlterSession(_)
1199 | Expression::LockingStatement(_)
1200
1201 | Expression::Analyze(_)
1203 | Expression::AnalyzeStatistics(_)
1204 | Expression::AnalyzeHistogram(_)
1205 | Expression::AnalyzeSample(_)
1206 | Expression::AnalyzeListChainedRows(_)
1207 | Expression::AnalyzeDelete(_)
1208
1209 | Expression::Attach(_)
1211 | Expression::Detach(_)
1212 | Expression::Install(_)
1213 | Expression::Summarize(_)
1214
1215 | Expression::Pivot(_)
1217 | Expression::Unpivot(_)
1218
1219 | Expression::Command(_)
1221 | Expression::Raw(_)
1222 | Expression::CreateTask(_)
1223
1224 | Expression::ReturnStmt(_) => true,
1226
1227 Expression::Annotated(a) => a.this.is_statement(),
1229
1230 Expression::Alias(a) => a.this.is_statement(),
1232
1233 _ => false,
1235 }
1236 }
1237
1238 pub fn number(n: i64) -> Self {
1240 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1241 }
1242
1243 pub fn string(s: impl Into<String>) -> Self {
1245 Expression::Literal(Box::new(Literal::String(s.into())))
1246 }
1247
1248 pub fn float(f: f64) -> Self {
1250 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1251 }
1252
1253 pub fn inferred_type(&self) -> Option<&DataType> {
1259 match self {
1260 Expression::And(op)
1262 | Expression::Or(op)
1263 | Expression::Add(op)
1264 | Expression::Sub(op)
1265 | Expression::Mul(op)
1266 | Expression::Div(op)
1267 | Expression::Mod(op)
1268 | Expression::Eq(op)
1269 | Expression::Neq(op)
1270 | Expression::Lt(op)
1271 | Expression::Lte(op)
1272 | Expression::Gt(op)
1273 | Expression::Gte(op)
1274 | Expression::Concat(op)
1275 | Expression::BitwiseAnd(op)
1276 | Expression::BitwiseOr(op)
1277 | Expression::BitwiseXor(op)
1278 | Expression::Adjacent(op)
1279 | Expression::TsMatch(op)
1280 | Expression::PropertyEQ(op)
1281 | Expression::ArrayContainsAll(op)
1282 | Expression::ArrayContainedBy(op)
1283 | Expression::ArrayOverlaps(op)
1284 | Expression::JSONBContainsAllTopKeys(op)
1285 | Expression::JSONBContainsAnyTopKeys(op)
1286 | Expression::JSONBDeleteAtPath(op)
1287 | Expression::ExtendsLeft(op)
1288 | Expression::ExtendsRight(op)
1289 | Expression::Is(op)
1290 | Expression::MemberOf(op)
1291 | Expression::Match(op)
1292 | Expression::NullSafeEq(op)
1293 | Expression::NullSafeNeq(op)
1294 | Expression::Glob(op)
1295 | Expression::BitwiseLeftShift(op)
1296 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1297
1298 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1299 op.inferred_type.as_ref()
1300 }
1301
1302 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1303
1304 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1305 c.inferred_type.as_ref()
1306 }
1307
1308 Expression::Column(c) => c.inferred_type.as_ref(),
1309 Expression::Function(f) => f.inferred_type.as_ref(),
1310 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1311 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1312 Expression::Case(c) => c.inferred_type.as_ref(),
1313 Expression::Subquery(s) => s.inferred_type.as_ref(),
1314 Expression::Alias(a) => a.inferred_type.as_ref(),
1315 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1316 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1317 Expression::Count(f) => f.inferred_type.as_ref(),
1318 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1319 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1320 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1321 Expression::SumIf(f) => f.inferred_type.as_ref(),
1322
1323 Expression::Upper(f)
1325 | Expression::Lower(f)
1326 | Expression::Length(f)
1327 | Expression::LTrim(f)
1328 | Expression::RTrim(f)
1329 | Expression::Reverse(f)
1330 | Expression::Abs(f)
1331 | Expression::Sqrt(f)
1332 | Expression::Cbrt(f)
1333 | Expression::Ln(f)
1334 | Expression::Exp(f)
1335 | Expression::Sign(f)
1336 | Expression::Date(f)
1337 | Expression::Time(f)
1338 | Expression::Initcap(f)
1339 | Expression::Ascii(f)
1340 | Expression::Chr(f)
1341 | Expression::Soundex(f)
1342 | Expression::ByteLength(f)
1343 | Expression::Hex(f)
1344 | Expression::LowerHex(f)
1345 | Expression::Unicode(f)
1346 | Expression::Typeof(f)
1347 | Expression::Explode(f)
1348 | Expression::ExplodeOuter(f)
1349 | Expression::MapFromEntries(f)
1350 | Expression::MapKeys(f)
1351 | Expression::MapValues(f)
1352 | Expression::ArrayLength(f)
1353 | Expression::ArraySize(f)
1354 | Expression::Cardinality(f)
1355 | Expression::ArrayReverse(f)
1356 | Expression::ArrayDistinct(f)
1357 | Expression::ArrayFlatten(f)
1358 | Expression::ArrayCompact(f)
1359 | Expression::ToArray(f)
1360 | Expression::JsonArrayLength(f)
1361 | Expression::JsonKeys(f)
1362 | Expression::JsonType(f)
1363 | Expression::ParseJson(f)
1364 | Expression::ToJson(f)
1365 | Expression::Radians(f)
1366 | Expression::Degrees(f)
1367 | Expression::Sin(f)
1368 | Expression::Cos(f)
1369 | Expression::Tan(f)
1370 | Expression::Asin(f)
1371 | Expression::Acos(f)
1372 | Expression::Atan(f)
1373 | Expression::IsNan(f)
1374 | Expression::IsInf(f)
1375 | Expression::Year(f)
1376 | Expression::Month(f)
1377 | Expression::Day(f)
1378 | Expression::Hour(f)
1379 | Expression::Minute(f)
1380 | Expression::Second(f)
1381 | Expression::DayOfWeek(f)
1382 | Expression::DayOfWeekIso(f)
1383 | Expression::DayOfMonth(f)
1384 | Expression::DayOfYear(f)
1385 | Expression::WeekOfYear(f)
1386 | Expression::Quarter(f)
1387 | Expression::Epoch(f)
1388 | Expression::EpochMs(f)
1389 | Expression::BitwiseCount(f)
1390 | Expression::DateFromUnixDate(f)
1391 | Expression::UnixDate(f)
1392 | Expression::UnixSeconds(f)
1393 | Expression::UnixMillis(f)
1394 | Expression::UnixMicros(f)
1395 | Expression::TimeStrToDate(f)
1396 | Expression::DateToDi(f)
1397 | Expression::DiToDate(f)
1398 | Expression::TsOrDiToDi(f)
1399 | Expression::TsOrDsToDatetime(f)
1400 | Expression::TsOrDsToTimestamp(f)
1401 | Expression::YearOfWeek(f)
1402 | Expression::YearOfWeekIso(f)
1403 | Expression::SHA(f)
1404 | Expression::SHA1Digest(f)
1405 | Expression::TimeToUnix(f)
1406 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1407
1408 Expression::Power(f)
1410 | Expression::NullIf(f)
1411 | Expression::IfNull(f)
1412 | Expression::Nvl(f)
1413 | Expression::Contains(f)
1414 | Expression::StartsWith(f)
1415 | Expression::EndsWith(f)
1416 | Expression::Levenshtein(f)
1417 | Expression::ModFunc(f)
1418 | Expression::IntDiv(f)
1419 | Expression::Atan2(f)
1420 | Expression::AddMonths(f)
1421 | Expression::MonthsBetween(f)
1422 | Expression::NextDay(f)
1423 | Expression::UnixToTimeStr(f)
1424 | Expression::ArrayContains(f)
1425 | Expression::ArrayPosition(f)
1426 | Expression::ArrayAppend(f)
1427 | Expression::ArrayPrepend(f)
1428 | Expression::ArrayUnion(f)
1429 | Expression::ArrayExcept(f)
1430 | Expression::ArrayRemove(f)
1431 | Expression::StarMap(f)
1432 | Expression::MapFromArrays(f)
1433 | Expression::MapContainsKey(f)
1434 | Expression::ElementAt(f)
1435 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1436
1437 Expression::Coalesce(f)
1439 | Expression::Greatest(f)
1440 | Expression::Least(f)
1441 | Expression::ArrayConcat(f)
1442 | Expression::ArrayIntersect(f)
1443 | Expression::ArrayZip(f)
1444 | Expression::MapConcat(f)
1445 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1446
1447 Expression::Sum(f)
1449 | Expression::Avg(f)
1450 | Expression::Min(f)
1451 | Expression::Max(f)
1452 | Expression::ArrayAgg(f)
1453 | Expression::CountIf(f)
1454 | Expression::Stddev(f)
1455 | Expression::StddevPop(f)
1456 | Expression::StddevSamp(f)
1457 | Expression::Variance(f)
1458 | Expression::VarPop(f)
1459 | Expression::VarSamp(f)
1460 | Expression::Median(f)
1461 | Expression::Mode(f)
1462 | Expression::First(f)
1463 | Expression::Last(f)
1464 | Expression::AnyValue(f)
1465 | Expression::ApproxDistinct(f)
1466 | Expression::ApproxCountDistinct(f)
1467 | Expression::LogicalAnd(f)
1468 | Expression::LogicalOr(f)
1469 | Expression::Skewness(f)
1470 | Expression::ArrayConcatAgg(f)
1471 | Expression::ArrayUniqueAgg(f)
1472 | Expression::BoolXorAgg(f)
1473 | Expression::BitwiseAndAgg(f)
1474 | Expression::BitwiseOrAgg(f)
1475 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1476
1477 _ => None,
1479 }
1480 }
1481
1482 pub fn set_inferred_type(&mut self, dt: DataType) {
1487 match self {
1488 Expression::And(op)
1489 | Expression::Or(op)
1490 | Expression::Add(op)
1491 | Expression::Sub(op)
1492 | Expression::Mul(op)
1493 | Expression::Div(op)
1494 | Expression::Mod(op)
1495 | Expression::Eq(op)
1496 | Expression::Neq(op)
1497 | Expression::Lt(op)
1498 | Expression::Lte(op)
1499 | Expression::Gt(op)
1500 | Expression::Gte(op)
1501 | Expression::Concat(op)
1502 | Expression::BitwiseAnd(op)
1503 | Expression::BitwiseOr(op)
1504 | Expression::BitwiseXor(op)
1505 | Expression::Adjacent(op)
1506 | Expression::TsMatch(op)
1507 | Expression::PropertyEQ(op)
1508 | Expression::ArrayContainsAll(op)
1509 | Expression::ArrayContainedBy(op)
1510 | Expression::ArrayOverlaps(op)
1511 | Expression::JSONBContainsAllTopKeys(op)
1512 | Expression::JSONBContainsAnyTopKeys(op)
1513 | Expression::JSONBDeleteAtPath(op)
1514 | Expression::ExtendsLeft(op)
1515 | Expression::ExtendsRight(op)
1516 | Expression::Is(op)
1517 | Expression::MemberOf(op)
1518 | Expression::Match(op)
1519 | Expression::NullSafeEq(op)
1520 | Expression::NullSafeNeq(op)
1521 | Expression::Glob(op)
1522 | Expression::BitwiseLeftShift(op)
1523 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1524
1525 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1526 op.inferred_type = Some(dt)
1527 }
1528
1529 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1530
1531 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1532 c.inferred_type = Some(dt)
1533 }
1534
1535 Expression::Column(c) => c.inferred_type = Some(dt),
1536 Expression::Function(f) => f.inferred_type = Some(dt),
1537 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1538 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1539 Expression::Case(c) => c.inferred_type = Some(dt),
1540 Expression::Subquery(s) => s.inferred_type = Some(dt),
1541 Expression::Alias(a) => a.inferred_type = Some(dt),
1542 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1543 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1544 Expression::Count(f) => f.inferred_type = Some(dt),
1545 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1546 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1547 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1548 Expression::SumIf(f) => f.inferred_type = Some(dt),
1549
1550 Expression::Upper(f)
1552 | Expression::Lower(f)
1553 | Expression::Length(f)
1554 | Expression::LTrim(f)
1555 | Expression::RTrim(f)
1556 | Expression::Reverse(f)
1557 | Expression::Abs(f)
1558 | Expression::Sqrt(f)
1559 | Expression::Cbrt(f)
1560 | Expression::Ln(f)
1561 | Expression::Exp(f)
1562 | Expression::Sign(f)
1563 | Expression::Date(f)
1564 | Expression::Time(f)
1565 | Expression::Initcap(f)
1566 | Expression::Ascii(f)
1567 | Expression::Chr(f)
1568 | Expression::Soundex(f)
1569 | Expression::ByteLength(f)
1570 | Expression::Hex(f)
1571 | Expression::LowerHex(f)
1572 | Expression::Unicode(f)
1573 | Expression::Typeof(f)
1574 | Expression::Explode(f)
1575 | Expression::ExplodeOuter(f)
1576 | Expression::MapFromEntries(f)
1577 | Expression::MapKeys(f)
1578 | Expression::MapValues(f)
1579 | Expression::ArrayLength(f)
1580 | Expression::ArraySize(f)
1581 | Expression::Cardinality(f)
1582 | Expression::ArrayReverse(f)
1583 | Expression::ArrayDistinct(f)
1584 | Expression::ArrayFlatten(f)
1585 | Expression::ArrayCompact(f)
1586 | Expression::ToArray(f)
1587 | Expression::JsonArrayLength(f)
1588 | Expression::JsonKeys(f)
1589 | Expression::JsonType(f)
1590 | Expression::ParseJson(f)
1591 | Expression::ToJson(f)
1592 | Expression::Radians(f)
1593 | Expression::Degrees(f)
1594 | Expression::Sin(f)
1595 | Expression::Cos(f)
1596 | Expression::Tan(f)
1597 | Expression::Asin(f)
1598 | Expression::Acos(f)
1599 | Expression::Atan(f)
1600 | Expression::IsNan(f)
1601 | Expression::IsInf(f)
1602 | Expression::Year(f)
1603 | Expression::Month(f)
1604 | Expression::Day(f)
1605 | Expression::Hour(f)
1606 | Expression::Minute(f)
1607 | Expression::Second(f)
1608 | Expression::DayOfWeek(f)
1609 | Expression::DayOfWeekIso(f)
1610 | Expression::DayOfMonth(f)
1611 | Expression::DayOfYear(f)
1612 | Expression::WeekOfYear(f)
1613 | Expression::Quarter(f)
1614 | Expression::Epoch(f)
1615 | Expression::EpochMs(f)
1616 | Expression::BitwiseCount(f)
1617 | Expression::DateFromUnixDate(f)
1618 | Expression::UnixDate(f)
1619 | Expression::UnixSeconds(f)
1620 | Expression::UnixMillis(f)
1621 | Expression::UnixMicros(f)
1622 | Expression::TimeStrToDate(f)
1623 | Expression::DateToDi(f)
1624 | Expression::DiToDate(f)
1625 | Expression::TsOrDiToDi(f)
1626 | Expression::TsOrDsToDatetime(f)
1627 | Expression::TsOrDsToTimestamp(f)
1628 | Expression::YearOfWeek(f)
1629 | Expression::YearOfWeekIso(f)
1630 | Expression::SHA(f)
1631 | Expression::SHA1Digest(f)
1632 | Expression::TimeToUnix(f)
1633 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1634
1635 Expression::Power(f)
1637 | Expression::NullIf(f)
1638 | Expression::IfNull(f)
1639 | Expression::Nvl(f)
1640 | Expression::Contains(f)
1641 | Expression::StartsWith(f)
1642 | Expression::EndsWith(f)
1643 | Expression::Levenshtein(f)
1644 | Expression::ModFunc(f)
1645 | Expression::IntDiv(f)
1646 | Expression::Atan2(f)
1647 | Expression::AddMonths(f)
1648 | Expression::MonthsBetween(f)
1649 | Expression::NextDay(f)
1650 | Expression::UnixToTimeStr(f)
1651 | Expression::ArrayContains(f)
1652 | Expression::ArrayPosition(f)
1653 | Expression::ArrayAppend(f)
1654 | Expression::ArrayPrepend(f)
1655 | Expression::ArrayUnion(f)
1656 | Expression::ArrayExcept(f)
1657 | Expression::ArrayRemove(f)
1658 | Expression::StarMap(f)
1659 | Expression::MapFromArrays(f)
1660 | Expression::MapContainsKey(f)
1661 | Expression::ElementAt(f)
1662 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1663
1664 Expression::Coalesce(f)
1666 | Expression::Greatest(f)
1667 | Expression::Least(f)
1668 | Expression::ArrayConcat(f)
1669 | Expression::ArrayIntersect(f)
1670 | Expression::ArrayZip(f)
1671 | Expression::MapConcat(f)
1672 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1673
1674 Expression::Sum(f)
1676 | Expression::Avg(f)
1677 | Expression::Min(f)
1678 | Expression::Max(f)
1679 | Expression::ArrayAgg(f)
1680 | Expression::CountIf(f)
1681 | Expression::Stddev(f)
1682 | Expression::StddevPop(f)
1683 | Expression::StddevSamp(f)
1684 | Expression::Variance(f)
1685 | Expression::VarPop(f)
1686 | Expression::VarSamp(f)
1687 | Expression::Median(f)
1688 | Expression::Mode(f)
1689 | Expression::First(f)
1690 | Expression::Last(f)
1691 | Expression::AnyValue(f)
1692 | Expression::ApproxDistinct(f)
1693 | Expression::ApproxCountDistinct(f)
1694 | Expression::LogicalAnd(f)
1695 | Expression::LogicalOr(f)
1696 | Expression::Skewness(f)
1697 | Expression::ArrayConcatAgg(f)
1698 | Expression::ArrayUniqueAgg(f)
1699 | Expression::BoolXorAgg(f)
1700 | Expression::BitwiseAndAgg(f)
1701 | Expression::BitwiseOrAgg(f)
1702 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1703
1704 _ => {}
1706 }
1707 }
1708
1709 pub fn column(name: impl Into<String>) -> Self {
1711 Expression::Column(Box::new(Column {
1712 name: Identifier::new(name),
1713 table: None,
1714 join_mark: false,
1715 trailing_comments: Vec::new(),
1716 span: None,
1717 inferred_type: None,
1718 }))
1719 }
1720
1721 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1723 Expression::Column(Box::new(Column {
1724 name: Identifier::new(column),
1725 table: Some(Identifier::new(table)),
1726 join_mark: false,
1727 trailing_comments: Vec::new(),
1728 span: None,
1729 inferred_type: None,
1730 }))
1731 }
1732
1733 pub fn identifier(name: impl Into<String>) -> Self {
1735 Expression::Identifier(Identifier::new(name))
1736 }
1737
1738 pub fn null() -> Self {
1740 Expression::Null(Null)
1741 }
1742
1743 pub fn true_() -> Self {
1745 Expression::Boolean(BooleanLiteral { value: true })
1746 }
1747
1748 pub fn false_() -> Self {
1750 Expression::Boolean(BooleanLiteral { value: false })
1751 }
1752
1753 pub fn star() -> Self {
1755 Expression::Star(Star {
1756 table: None,
1757 except: None,
1758 replace: None,
1759 rename: None,
1760 trailing_comments: Vec::new(),
1761 span: None,
1762 })
1763 }
1764
1765 pub fn alias(self, name: impl Into<String>) -> Self {
1767 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1768 }
1769
1770 pub fn is_select(&self) -> bool {
1772 matches!(self, Expression::Select(_))
1773 }
1774
1775 pub fn as_select(&self) -> Option<&Select> {
1777 match self {
1778 Expression::Select(s) => Some(s),
1779 _ => None,
1780 }
1781 }
1782
1783 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1785 match self {
1786 Expression::Select(s) => Some(s),
1787 _ => None,
1788 }
1789 }
1790
1791 pub fn sql(&self) -> String {
1796 crate::generator::Generator::sql(self).unwrap_or_default()
1797 }
1798
1799 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1805 crate::generate(self, dialect).unwrap_or_default()
1806 }
1807}
1808
1809impl Expression {
1812 pub fn variant_name(&self) -> &'static str {
1815 match self {
1816 Expression::Literal(_) => "literal",
1817 Expression::Boolean(_) => "boolean",
1818 Expression::Null(_) => "null",
1819 Expression::Identifier(_) => "identifier",
1820 Expression::Column(_) => "column",
1821 Expression::Table(_) => "table",
1822 Expression::Star(_) => "star",
1823 Expression::BracedWildcard(_) => "braced_wildcard",
1824 Expression::Select(_) => "select",
1825 Expression::Union(_) => "union",
1826 Expression::Intersect(_) => "intersect",
1827 Expression::Except(_) => "except",
1828 Expression::Subquery(_) => "subquery",
1829 Expression::PipeOperator(_) => "pipe_operator",
1830 Expression::Pivot(_) => "pivot",
1831 Expression::PivotAlias(_) => "pivot_alias",
1832 Expression::Unpivot(_) => "unpivot",
1833 Expression::Values(_) => "values",
1834 Expression::PreWhere(_) => "pre_where",
1835 Expression::Stream(_) => "stream",
1836 Expression::UsingData(_) => "using_data",
1837 Expression::XmlNamespace(_) => "xml_namespace",
1838 Expression::Insert(_) => "insert",
1839 Expression::Update(_) => "update",
1840 Expression::Delete(_) => "delete",
1841 Expression::Copy(_) => "copy",
1842 Expression::Put(_) => "put",
1843 Expression::StageReference(_) => "stage_reference",
1844 Expression::Alias(_) => "alias",
1845 Expression::Cast(_) => "cast",
1846 Expression::Collation(_) => "collation",
1847 Expression::Case(_) => "case",
1848 Expression::And(_) => "and",
1849 Expression::Or(_) => "or",
1850 Expression::Add(_) => "add",
1851 Expression::Sub(_) => "sub",
1852 Expression::Mul(_) => "mul",
1853 Expression::Div(_) => "div",
1854 Expression::Mod(_) => "mod",
1855 Expression::Eq(_) => "eq",
1856 Expression::Neq(_) => "neq",
1857 Expression::Lt(_) => "lt",
1858 Expression::Lte(_) => "lte",
1859 Expression::Gt(_) => "gt",
1860 Expression::Gte(_) => "gte",
1861 Expression::Like(_) => "like",
1862 Expression::ILike(_) => "i_like",
1863 Expression::Match(_) => "match",
1864 Expression::BitwiseAnd(_) => "bitwise_and",
1865 Expression::BitwiseOr(_) => "bitwise_or",
1866 Expression::BitwiseXor(_) => "bitwise_xor",
1867 Expression::Concat(_) => "concat",
1868 Expression::Adjacent(_) => "adjacent",
1869 Expression::TsMatch(_) => "ts_match",
1870 Expression::PropertyEQ(_) => "property_e_q",
1871 Expression::ArrayContainsAll(_) => "array_contains_all",
1872 Expression::ArrayContainedBy(_) => "array_contained_by",
1873 Expression::ArrayOverlaps(_) => "array_overlaps",
1874 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1875 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1876 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1877 Expression::ExtendsLeft(_) => "extends_left",
1878 Expression::ExtendsRight(_) => "extends_right",
1879 Expression::Not(_) => "not",
1880 Expression::Neg(_) => "neg",
1881 Expression::BitwiseNot(_) => "bitwise_not",
1882 Expression::In(_) => "in",
1883 Expression::Between(_) => "between",
1884 Expression::IsNull(_) => "is_null",
1885 Expression::IsTrue(_) => "is_true",
1886 Expression::IsFalse(_) => "is_false",
1887 Expression::IsJson(_) => "is_json",
1888 Expression::Is(_) => "is",
1889 Expression::Exists(_) => "exists",
1890 Expression::MemberOf(_) => "member_of",
1891 Expression::Function(_) => "function",
1892 Expression::AggregateFunction(_) => "aggregate_function",
1893 Expression::WindowFunction(_) => "window_function",
1894 Expression::From(_) => "from",
1895 Expression::Join(_) => "join",
1896 Expression::JoinedTable(_) => "joined_table",
1897 Expression::Where(_) => "where",
1898 Expression::GroupBy(_) => "group_by",
1899 Expression::Having(_) => "having",
1900 Expression::OrderBy(_) => "order_by",
1901 Expression::Limit(_) => "limit",
1902 Expression::Offset(_) => "offset",
1903 Expression::Qualify(_) => "qualify",
1904 Expression::With(_) => "with",
1905 Expression::Cte(_) => "cte",
1906 Expression::DistributeBy(_) => "distribute_by",
1907 Expression::ClusterBy(_) => "cluster_by",
1908 Expression::SortBy(_) => "sort_by",
1909 Expression::LateralView(_) => "lateral_view",
1910 Expression::Hint(_) => "hint",
1911 Expression::Pseudocolumn(_) => "pseudocolumn",
1912 Expression::Connect(_) => "connect",
1913 Expression::Prior(_) => "prior",
1914 Expression::ConnectByRoot(_) => "connect_by_root",
1915 Expression::MatchRecognize(_) => "match_recognize",
1916 Expression::Ordered(_) => "ordered",
1917 Expression::Window(_) => "window",
1918 Expression::Over(_) => "over",
1919 Expression::WithinGroup(_) => "within_group",
1920 Expression::DataType(_) => "data_type",
1921 Expression::Array(_) => "array",
1922 Expression::Struct(_) => "struct",
1923 Expression::Tuple(_) => "tuple",
1924 Expression::Interval(_) => "interval",
1925 Expression::ConcatWs(_) => "concat_ws",
1926 Expression::Substring(_) => "substring",
1927 Expression::Upper(_) => "upper",
1928 Expression::Lower(_) => "lower",
1929 Expression::Length(_) => "length",
1930 Expression::Trim(_) => "trim",
1931 Expression::LTrim(_) => "l_trim",
1932 Expression::RTrim(_) => "r_trim",
1933 Expression::Replace(_) => "replace",
1934 Expression::Reverse(_) => "reverse",
1935 Expression::Left(_) => "left",
1936 Expression::Right(_) => "right",
1937 Expression::Repeat(_) => "repeat",
1938 Expression::Lpad(_) => "lpad",
1939 Expression::Rpad(_) => "rpad",
1940 Expression::Split(_) => "split",
1941 Expression::RegexpLike(_) => "regexp_like",
1942 Expression::RegexpReplace(_) => "regexp_replace",
1943 Expression::RegexpExtract(_) => "regexp_extract",
1944 Expression::Overlay(_) => "overlay",
1945 Expression::Abs(_) => "abs",
1946 Expression::Round(_) => "round",
1947 Expression::Floor(_) => "floor",
1948 Expression::Ceil(_) => "ceil",
1949 Expression::Power(_) => "power",
1950 Expression::Sqrt(_) => "sqrt",
1951 Expression::Cbrt(_) => "cbrt",
1952 Expression::Ln(_) => "ln",
1953 Expression::Log(_) => "log",
1954 Expression::Exp(_) => "exp",
1955 Expression::Sign(_) => "sign",
1956 Expression::Greatest(_) => "greatest",
1957 Expression::Least(_) => "least",
1958 Expression::CurrentDate(_) => "current_date",
1959 Expression::CurrentTime(_) => "current_time",
1960 Expression::CurrentTimestamp(_) => "current_timestamp",
1961 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1962 Expression::AtTimeZone(_) => "at_time_zone",
1963 Expression::DateAdd(_) => "date_add",
1964 Expression::DateSub(_) => "date_sub",
1965 Expression::DateDiff(_) => "date_diff",
1966 Expression::DateTrunc(_) => "date_trunc",
1967 Expression::Extract(_) => "extract",
1968 Expression::ToDate(_) => "to_date",
1969 Expression::ToTimestamp(_) => "to_timestamp",
1970 Expression::Date(_) => "date",
1971 Expression::Time(_) => "time",
1972 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1973 Expression::UnixDate(_) => "unix_date",
1974 Expression::UnixSeconds(_) => "unix_seconds",
1975 Expression::UnixMillis(_) => "unix_millis",
1976 Expression::UnixMicros(_) => "unix_micros",
1977 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1978 Expression::TimeStrToDate(_) => "time_str_to_date",
1979 Expression::DateToDi(_) => "date_to_di",
1980 Expression::DiToDate(_) => "di_to_date",
1981 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1982 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1983 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1984 Expression::YearOfWeek(_) => "year_of_week",
1985 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1986 Expression::Coalesce(_) => "coalesce",
1987 Expression::NullIf(_) => "null_if",
1988 Expression::IfFunc(_) => "if_func",
1989 Expression::IfNull(_) => "if_null",
1990 Expression::Nvl(_) => "nvl",
1991 Expression::Nvl2(_) => "nvl2",
1992 Expression::TryCast(_) => "try_cast",
1993 Expression::SafeCast(_) => "safe_cast",
1994 Expression::Count(_) => "count",
1995 Expression::Sum(_) => "sum",
1996 Expression::Avg(_) => "avg",
1997 Expression::Min(_) => "min",
1998 Expression::Max(_) => "max",
1999 Expression::GroupConcat(_) => "group_concat",
2000 Expression::StringAgg(_) => "string_agg",
2001 Expression::ListAgg(_) => "list_agg",
2002 Expression::ArrayAgg(_) => "array_agg",
2003 Expression::CountIf(_) => "count_if",
2004 Expression::SumIf(_) => "sum_if",
2005 Expression::Stddev(_) => "stddev",
2006 Expression::StddevPop(_) => "stddev_pop",
2007 Expression::StddevSamp(_) => "stddev_samp",
2008 Expression::Variance(_) => "variance",
2009 Expression::VarPop(_) => "var_pop",
2010 Expression::VarSamp(_) => "var_samp",
2011 Expression::Median(_) => "median",
2012 Expression::Mode(_) => "mode",
2013 Expression::First(_) => "first",
2014 Expression::Last(_) => "last",
2015 Expression::AnyValue(_) => "any_value",
2016 Expression::ApproxDistinct(_) => "approx_distinct",
2017 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2018 Expression::ApproxPercentile(_) => "approx_percentile",
2019 Expression::Percentile(_) => "percentile",
2020 Expression::LogicalAnd(_) => "logical_and",
2021 Expression::LogicalOr(_) => "logical_or",
2022 Expression::Skewness(_) => "skewness",
2023 Expression::BitwiseCount(_) => "bitwise_count",
2024 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2025 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2026 Expression::BoolXorAgg(_) => "bool_xor_agg",
2027 Expression::RowNumber(_) => "row_number",
2028 Expression::Rank(_) => "rank",
2029 Expression::DenseRank(_) => "dense_rank",
2030 Expression::NTile(_) => "n_tile",
2031 Expression::Lead(_) => "lead",
2032 Expression::Lag(_) => "lag",
2033 Expression::FirstValue(_) => "first_value",
2034 Expression::LastValue(_) => "last_value",
2035 Expression::NthValue(_) => "nth_value",
2036 Expression::PercentRank(_) => "percent_rank",
2037 Expression::CumeDist(_) => "cume_dist",
2038 Expression::PercentileCont(_) => "percentile_cont",
2039 Expression::PercentileDisc(_) => "percentile_disc",
2040 Expression::Contains(_) => "contains",
2041 Expression::StartsWith(_) => "starts_with",
2042 Expression::EndsWith(_) => "ends_with",
2043 Expression::Position(_) => "position",
2044 Expression::Initcap(_) => "initcap",
2045 Expression::Ascii(_) => "ascii",
2046 Expression::Chr(_) => "chr",
2047 Expression::CharFunc(_) => "char_func",
2048 Expression::Soundex(_) => "soundex",
2049 Expression::Levenshtein(_) => "levenshtein",
2050 Expression::ByteLength(_) => "byte_length",
2051 Expression::Hex(_) => "hex",
2052 Expression::LowerHex(_) => "lower_hex",
2053 Expression::Unicode(_) => "unicode",
2054 Expression::ModFunc(_) => "mod_func",
2055 Expression::Random(_) => "random",
2056 Expression::Rand(_) => "rand",
2057 Expression::TruncFunc(_) => "trunc_func",
2058 Expression::Pi(_) => "pi",
2059 Expression::Radians(_) => "radians",
2060 Expression::Degrees(_) => "degrees",
2061 Expression::Sin(_) => "sin",
2062 Expression::Cos(_) => "cos",
2063 Expression::Tan(_) => "tan",
2064 Expression::Asin(_) => "asin",
2065 Expression::Acos(_) => "acos",
2066 Expression::Atan(_) => "atan",
2067 Expression::Atan2(_) => "atan2",
2068 Expression::IsNan(_) => "is_nan",
2069 Expression::IsInf(_) => "is_inf",
2070 Expression::IntDiv(_) => "int_div",
2071 Expression::Decode(_) => "decode",
2072 Expression::DateFormat(_) => "date_format",
2073 Expression::FormatDate(_) => "format_date",
2074 Expression::Year(_) => "year",
2075 Expression::Month(_) => "month",
2076 Expression::Day(_) => "day",
2077 Expression::Hour(_) => "hour",
2078 Expression::Minute(_) => "minute",
2079 Expression::Second(_) => "second",
2080 Expression::DayOfWeek(_) => "day_of_week",
2081 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2082 Expression::DayOfMonth(_) => "day_of_month",
2083 Expression::DayOfYear(_) => "day_of_year",
2084 Expression::WeekOfYear(_) => "week_of_year",
2085 Expression::Quarter(_) => "quarter",
2086 Expression::AddMonths(_) => "add_months",
2087 Expression::MonthsBetween(_) => "months_between",
2088 Expression::LastDay(_) => "last_day",
2089 Expression::NextDay(_) => "next_day",
2090 Expression::Epoch(_) => "epoch",
2091 Expression::EpochMs(_) => "epoch_ms",
2092 Expression::FromUnixtime(_) => "from_unixtime",
2093 Expression::UnixTimestamp(_) => "unix_timestamp",
2094 Expression::MakeDate(_) => "make_date",
2095 Expression::MakeTimestamp(_) => "make_timestamp",
2096 Expression::TimestampTrunc(_) => "timestamp_trunc",
2097 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2098 Expression::SessionUser(_) => "session_user",
2099 Expression::SHA(_) => "s_h_a",
2100 Expression::SHA1Digest(_) => "s_h_a1_digest",
2101 Expression::TimeToUnix(_) => "time_to_unix",
2102 Expression::ArrayFunc(_) => "array_func",
2103 Expression::ArrayLength(_) => "array_length",
2104 Expression::ArraySize(_) => "array_size",
2105 Expression::Cardinality(_) => "cardinality",
2106 Expression::ArrayContains(_) => "array_contains",
2107 Expression::ArrayPosition(_) => "array_position",
2108 Expression::ArrayAppend(_) => "array_append",
2109 Expression::ArrayPrepend(_) => "array_prepend",
2110 Expression::ArrayConcat(_) => "array_concat",
2111 Expression::ArraySort(_) => "array_sort",
2112 Expression::ArrayReverse(_) => "array_reverse",
2113 Expression::ArrayDistinct(_) => "array_distinct",
2114 Expression::ArrayJoin(_) => "array_join",
2115 Expression::ArrayToString(_) => "array_to_string",
2116 Expression::Unnest(_) => "unnest",
2117 Expression::Explode(_) => "explode",
2118 Expression::ExplodeOuter(_) => "explode_outer",
2119 Expression::ArrayFilter(_) => "array_filter",
2120 Expression::ArrayTransform(_) => "array_transform",
2121 Expression::ArrayFlatten(_) => "array_flatten",
2122 Expression::ArrayCompact(_) => "array_compact",
2123 Expression::ArrayIntersect(_) => "array_intersect",
2124 Expression::ArrayUnion(_) => "array_union",
2125 Expression::ArrayExcept(_) => "array_except",
2126 Expression::ArrayRemove(_) => "array_remove",
2127 Expression::ArrayZip(_) => "array_zip",
2128 Expression::Sequence(_) => "sequence",
2129 Expression::Generate(_) => "generate",
2130 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2131 Expression::ToArray(_) => "to_array",
2132 Expression::StarMap(_) => "star_map",
2133 Expression::StructFunc(_) => "struct_func",
2134 Expression::StructExtract(_) => "struct_extract",
2135 Expression::NamedStruct(_) => "named_struct",
2136 Expression::MapFunc(_) => "map_func",
2137 Expression::MapFromEntries(_) => "map_from_entries",
2138 Expression::MapFromArrays(_) => "map_from_arrays",
2139 Expression::MapKeys(_) => "map_keys",
2140 Expression::MapValues(_) => "map_values",
2141 Expression::MapContainsKey(_) => "map_contains_key",
2142 Expression::MapConcat(_) => "map_concat",
2143 Expression::ElementAt(_) => "element_at",
2144 Expression::TransformKeys(_) => "transform_keys",
2145 Expression::TransformValues(_) => "transform_values",
2146 Expression::FunctionEmits(_) => "function_emits",
2147 Expression::JsonExtract(_) => "json_extract",
2148 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2149 Expression::JsonExtractPath(_) => "json_extract_path",
2150 Expression::JsonArray(_) => "json_array",
2151 Expression::JsonObject(_) => "json_object",
2152 Expression::JsonQuery(_) => "json_query",
2153 Expression::JsonValue(_) => "json_value",
2154 Expression::JsonArrayLength(_) => "json_array_length",
2155 Expression::JsonKeys(_) => "json_keys",
2156 Expression::JsonType(_) => "json_type",
2157 Expression::ParseJson(_) => "parse_json",
2158 Expression::ToJson(_) => "to_json",
2159 Expression::JsonSet(_) => "json_set",
2160 Expression::JsonInsert(_) => "json_insert",
2161 Expression::JsonRemove(_) => "json_remove",
2162 Expression::JsonMergePatch(_) => "json_merge_patch",
2163 Expression::JsonArrayAgg(_) => "json_array_agg",
2164 Expression::JsonObjectAgg(_) => "json_object_agg",
2165 Expression::Convert(_) => "convert",
2166 Expression::Typeof(_) => "typeof",
2167 Expression::Lambda(_) => "lambda",
2168 Expression::Parameter(_) => "parameter",
2169 Expression::Placeholder(_) => "placeholder",
2170 Expression::NamedArgument(_) => "named_argument",
2171 Expression::TableArgument(_) => "table_argument",
2172 Expression::SqlComment(_) => "sql_comment",
2173 Expression::NullSafeEq(_) => "null_safe_eq",
2174 Expression::NullSafeNeq(_) => "null_safe_neq",
2175 Expression::Glob(_) => "glob",
2176 Expression::SimilarTo(_) => "similar_to",
2177 Expression::Any(_) => "any",
2178 Expression::All(_) => "all",
2179 Expression::Overlaps(_) => "overlaps",
2180 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2181 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2182 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2183 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2184 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2185 Expression::Subscript(_) => "subscript",
2186 Expression::Dot(_) => "dot",
2187 Expression::MethodCall(_) => "method_call",
2188 Expression::ArraySlice(_) => "array_slice",
2189 Expression::CreateTable(_) => "create_table",
2190 Expression::DropTable(_) => "drop_table",
2191 Expression::AlterTable(_) => "alter_table",
2192 Expression::CreateIndex(_) => "create_index",
2193 Expression::DropIndex(_) => "drop_index",
2194 Expression::CreateView(_) => "create_view",
2195 Expression::DropView(_) => "drop_view",
2196 Expression::AlterView(_) => "alter_view",
2197 Expression::AlterIndex(_) => "alter_index",
2198 Expression::Truncate(_) => "truncate",
2199 Expression::Use(_) => "use",
2200 Expression::Cache(_) => "cache",
2201 Expression::Uncache(_) => "uncache",
2202 Expression::LoadData(_) => "load_data",
2203 Expression::Pragma(_) => "pragma",
2204 Expression::Grant(_) => "grant",
2205 Expression::Revoke(_) => "revoke",
2206 Expression::Comment(_) => "comment",
2207 Expression::SetStatement(_) => "set_statement",
2208 Expression::CreateSchema(_) => "create_schema",
2209 Expression::DropSchema(_) => "drop_schema",
2210 Expression::DropNamespace(_) => "drop_namespace",
2211 Expression::CreateDatabase(_) => "create_database",
2212 Expression::DropDatabase(_) => "drop_database",
2213 Expression::CreateFunction(_) => "create_function",
2214 Expression::DropFunction(_) => "drop_function",
2215 Expression::CreateProcedure(_) => "create_procedure",
2216 Expression::DropProcedure(_) => "drop_procedure",
2217 Expression::CreateSequence(_) => "create_sequence",
2218 Expression::CreateSynonym(_) => "create_synonym",
2219 Expression::DropSequence(_) => "drop_sequence",
2220 Expression::AlterSequence(_) => "alter_sequence",
2221 Expression::CreateTrigger(_) => "create_trigger",
2222 Expression::DropTrigger(_) => "drop_trigger",
2223 Expression::CreateType(_) => "create_type",
2224 Expression::DropType(_) => "drop_type",
2225 Expression::Describe(_) => "describe",
2226 Expression::Show(_) => "show",
2227 Expression::Command(_) => "command",
2228 Expression::Kill(_) => "kill",
2229 Expression::Execute(_) => "execute",
2230 Expression::Raw(_) => "raw",
2231 Expression::CreateTask(_) => "create_task",
2232 Expression::Paren(_) => "paren",
2233 Expression::Annotated(_) => "annotated",
2234 Expression::Refresh(_) => "refresh",
2235 Expression::LockingStatement(_) => "locking_statement",
2236 Expression::SequenceProperties(_) => "sequence_properties",
2237 Expression::TruncateTable(_) => "truncate_table",
2238 Expression::Clone(_) => "clone",
2239 Expression::Attach(_) => "attach",
2240 Expression::Detach(_) => "detach",
2241 Expression::Install(_) => "install",
2242 Expression::Summarize(_) => "summarize",
2243 Expression::Declare(_) => "declare",
2244 Expression::DeclareItem(_) => "declare_item",
2245 Expression::Set(_) => "set",
2246 Expression::Heredoc(_) => "heredoc",
2247 Expression::SetItem(_) => "set_item",
2248 Expression::QueryBand(_) => "query_band",
2249 Expression::UserDefinedFunction(_) => "user_defined_function",
2250 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2251 Expression::ProjectionDef(_) => "projection_def",
2252 Expression::TableAlias(_) => "table_alias",
2253 Expression::ByteString(_) => "byte_string",
2254 Expression::HexStringExpr(_) => "hex_string_expr",
2255 Expression::UnicodeString(_) => "unicode_string",
2256 Expression::ColumnPosition(_) => "column_position",
2257 Expression::ColumnDef(_) => "column_def",
2258 Expression::AlterColumn(_) => "alter_column",
2259 Expression::AlterSortKey(_) => "alter_sort_key",
2260 Expression::AlterSet(_) => "alter_set",
2261 Expression::RenameColumn(_) => "rename_column",
2262 Expression::Comprehension(_) => "comprehension",
2263 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2264 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2265 Expression::IndexConstraintOption(_) => "index_constraint_option",
2266 Expression::ColumnConstraint(_) => "column_constraint",
2267 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2268 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2269 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2270 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2271 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2272 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2273 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2274 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2275 Expression::WithOperator(_) => "with_operator",
2276 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2277 "generated_as_identity_column_constraint"
2278 }
2279 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2280 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2281 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2282 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2283 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2284 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2285 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2286 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2287 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2288 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2289 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2290 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2291 Expression::PathColumnConstraint(_) => "path_column_constraint",
2292 Expression::Constraint(_) => "constraint",
2293 Expression::Export(_) => "export",
2294 Expression::Filter(_) => "filter",
2295 Expression::Changes(_) => "changes",
2296 Expression::CopyParameter(_) => "copy_parameter",
2297 Expression::Credentials(_) => "credentials",
2298 Expression::Directory(_) => "directory",
2299 Expression::ForeignKey(_) => "foreign_key",
2300 Expression::ColumnPrefix(_) => "column_prefix",
2301 Expression::PrimaryKey(_) => "primary_key",
2302 Expression::IntoClause(_) => "into_clause",
2303 Expression::JoinHint(_) => "join_hint",
2304 Expression::Opclass(_) => "opclass",
2305 Expression::Index(_) => "index",
2306 Expression::IndexParameters(_) => "index_parameters",
2307 Expression::ConditionalInsert(_) => "conditional_insert",
2308 Expression::MultitableInserts(_) => "multitable_inserts",
2309 Expression::OnConflict(_) => "on_conflict",
2310 Expression::OnCondition(_) => "on_condition",
2311 Expression::Returning(_) => "returning",
2312 Expression::Introducer(_) => "introducer",
2313 Expression::PartitionRange(_) => "partition_range",
2314 Expression::Fetch(_) => "fetch",
2315 Expression::Group(_) => "group",
2316 Expression::Cube(_) => "cube",
2317 Expression::Rollup(_) => "rollup",
2318 Expression::GroupingSets(_) => "grouping_sets",
2319 Expression::LimitOptions(_) => "limit_options",
2320 Expression::Lateral(_) => "lateral",
2321 Expression::TableFromRows(_) => "table_from_rows",
2322 Expression::RowsFrom(_) => "rows_from",
2323 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2324 Expression::WithFill(_) => "with_fill",
2325 Expression::Property(_) => "property",
2326 Expression::GrantPrivilege(_) => "grant_privilege",
2327 Expression::GrantPrincipal(_) => "grant_principal",
2328 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2329 Expression::AlgorithmProperty(_) => "algorithm_property",
2330 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2331 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2332 Expression::BackupProperty(_) => "backup_property",
2333 Expression::BuildProperty(_) => "build_property",
2334 Expression::BlockCompressionProperty(_) => "block_compression_property",
2335 Expression::CharacterSetProperty(_) => "character_set_property",
2336 Expression::ChecksumProperty(_) => "checksum_property",
2337 Expression::CollateProperty(_) => "collate_property",
2338 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2339 Expression::DataDeletionProperty(_) => "data_deletion_property",
2340 Expression::DefinerProperty(_) => "definer_property",
2341 Expression::DistKeyProperty(_) => "dist_key_property",
2342 Expression::DistributedByProperty(_) => "distributed_by_property",
2343 Expression::DistStyleProperty(_) => "dist_style_property",
2344 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2345 Expression::EngineProperty(_) => "engine_property",
2346 Expression::ToTableProperty(_) => "to_table_property",
2347 Expression::ExecuteAsProperty(_) => "execute_as_property",
2348 Expression::ExternalProperty(_) => "external_property",
2349 Expression::FallbackProperty(_) => "fallback_property",
2350 Expression::FileFormatProperty(_) => "file_format_property",
2351 Expression::CredentialsProperty(_) => "credentials_property",
2352 Expression::FreespaceProperty(_) => "freespace_property",
2353 Expression::InheritsProperty(_) => "inherits_property",
2354 Expression::InputModelProperty(_) => "input_model_property",
2355 Expression::OutputModelProperty(_) => "output_model_property",
2356 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2357 Expression::JournalProperty(_) => "journal_property",
2358 Expression::LanguageProperty(_) => "language_property",
2359 Expression::EnviromentProperty(_) => "enviroment_property",
2360 Expression::ClusteredByProperty(_) => "clustered_by_property",
2361 Expression::DictProperty(_) => "dict_property",
2362 Expression::DictRange(_) => "dict_range",
2363 Expression::OnCluster(_) => "on_cluster",
2364 Expression::LikeProperty(_) => "like_property",
2365 Expression::LocationProperty(_) => "location_property",
2366 Expression::LockProperty(_) => "lock_property",
2367 Expression::LockingProperty(_) => "locking_property",
2368 Expression::LogProperty(_) => "log_property",
2369 Expression::MaterializedProperty(_) => "materialized_property",
2370 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2371 Expression::OnProperty(_) => "on_property",
2372 Expression::OnCommitProperty(_) => "on_commit_property",
2373 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2374 Expression::PartitionByProperty(_) => "partition_by_property",
2375 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2376 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2377 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2378 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2379 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2380 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2381 Expression::PartitionList(_) => "partition_list",
2382 Expression::Partition(_) => "partition",
2383 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2384 Expression::UniqueKeyProperty(_) => "unique_key_property",
2385 Expression::RollupProperty(_) => "rollup_property",
2386 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2387 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2388 Expression::RemoteWithConnectionModelProperty(_) => {
2389 "remote_with_connection_model_property"
2390 }
2391 Expression::ReturnsProperty(_) => "returns_property",
2392 Expression::RowFormatProperty(_) => "row_format_property",
2393 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2394 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2395 Expression::QueryTransform(_) => "query_transform",
2396 Expression::SampleProperty(_) => "sample_property",
2397 Expression::SecurityProperty(_) => "security_property",
2398 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2399 Expression::SemanticView(_) => "semantic_view",
2400 Expression::SerdeProperties(_) => "serde_properties",
2401 Expression::SetProperty(_) => "set_property",
2402 Expression::SharingProperty(_) => "sharing_property",
2403 Expression::SetConfigProperty(_) => "set_config_property",
2404 Expression::SettingsProperty(_) => "settings_property",
2405 Expression::SortKeyProperty(_) => "sort_key_property",
2406 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2407 Expression::SqlSecurityProperty(_) => "sql_security_property",
2408 Expression::StabilityProperty(_) => "stability_property",
2409 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2410 Expression::TemporaryProperty(_) => "temporary_property",
2411 Expression::Tags(_) => "tags",
2412 Expression::TransformModelProperty(_) => "transform_model_property",
2413 Expression::TransientProperty(_) => "transient_property",
2414 Expression::UsingTemplateProperty(_) => "using_template_property",
2415 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2416 Expression::VolatileProperty(_) => "volatile_property",
2417 Expression::WithDataProperty(_) => "with_data_property",
2418 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2419 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2420 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2421 Expression::WithProcedureOptions(_) => "with_procedure_options",
2422 Expression::EncodeProperty(_) => "encode_property",
2423 Expression::IncludeProperty(_) => "include_property",
2424 Expression::Properties(_) => "properties",
2425 Expression::OptionsProperty(_) => "options_property",
2426 Expression::InputOutputFormat(_) => "input_output_format",
2427 Expression::Reference(_) => "reference",
2428 Expression::QueryOption(_) => "query_option",
2429 Expression::WithTableHint(_) => "with_table_hint",
2430 Expression::IndexTableHint(_) => "index_table_hint",
2431 Expression::HistoricalData(_) => "historical_data",
2432 Expression::Get(_) => "get",
2433 Expression::SetOperation(_) => "set_operation",
2434 Expression::Var(_) => "var",
2435 Expression::Variadic(_) => "variadic",
2436 Expression::Version(_) => "version",
2437 Expression::Schema(_) => "schema",
2438 Expression::Lock(_) => "lock",
2439 Expression::TableSample(_) => "table_sample",
2440 Expression::Tag(_) => "tag",
2441 Expression::UnpivotColumns(_) => "unpivot_columns",
2442 Expression::WindowSpec(_) => "window_spec",
2443 Expression::SessionParameter(_) => "session_parameter",
2444 Expression::PseudoType(_) => "pseudo_type",
2445 Expression::ObjectIdentifier(_) => "object_identifier",
2446 Expression::Transaction(_) => "transaction",
2447 Expression::Commit(_) => "commit",
2448 Expression::Rollback(_) => "rollback",
2449 Expression::AlterSession(_) => "alter_session",
2450 Expression::Analyze(_) => "analyze",
2451 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2452 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2453 Expression::AnalyzeSample(_) => "analyze_sample",
2454 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2455 Expression::AnalyzeDelete(_) => "analyze_delete",
2456 Expression::AnalyzeWith(_) => "analyze_with",
2457 Expression::AnalyzeValidate(_) => "analyze_validate",
2458 Expression::AddPartition(_) => "add_partition",
2459 Expression::AttachOption(_) => "attach_option",
2460 Expression::DropPartition(_) => "drop_partition",
2461 Expression::ReplacePartition(_) => "replace_partition",
2462 Expression::DPipe(_) => "d_pipe",
2463 Expression::Operator(_) => "operator",
2464 Expression::PivotAny(_) => "pivot_any",
2465 Expression::Aliases(_) => "aliases",
2466 Expression::AtIndex(_) => "at_index",
2467 Expression::FromTimeZone(_) => "from_time_zone",
2468 Expression::FormatPhrase(_) => "format_phrase",
2469 Expression::ForIn(_) => "for_in",
2470 Expression::TimeUnit(_) => "time_unit",
2471 Expression::IntervalOp(_) => "interval_op",
2472 Expression::IntervalSpan(_) => "interval_span",
2473 Expression::HavingMax(_) => "having_max",
2474 Expression::CosineDistance(_) => "cosine_distance",
2475 Expression::DotProduct(_) => "dot_product",
2476 Expression::EuclideanDistance(_) => "euclidean_distance",
2477 Expression::ManhattanDistance(_) => "manhattan_distance",
2478 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2479 Expression::Booland(_) => "booland",
2480 Expression::Boolor(_) => "boolor",
2481 Expression::ParameterizedAgg(_) => "parameterized_agg",
2482 Expression::ArgMax(_) => "arg_max",
2483 Expression::ArgMin(_) => "arg_min",
2484 Expression::ApproxTopK(_) => "approx_top_k",
2485 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2486 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2487 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2488 Expression::ApproxTopSum(_) => "approx_top_sum",
2489 Expression::ApproxQuantiles(_) => "approx_quantiles",
2490 Expression::Minhash(_) => "minhash",
2491 Expression::FarmFingerprint(_) => "farm_fingerprint",
2492 Expression::Float64(_) => "float64",
2493 Expression::Transform(_) => "transform",
2494 Expression::Translate(_) => "translate",
2495 Expression::Grouping(_) => "grouping",
2496 Expression::GroupingId(_) => "grouping_id",
2497 Expression::Anonymous(_) => "anonymous",
2498 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2499 Expression::CombinedAggFunc(_) => "combined_agg_func",
2500 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2501 Expression::HashAgg(_) => "hash_agg",
2502 Expression::Hll(_) => "hll",
2503 Expression::Apply(_) => "apply",
2504 Expression::ToBoolean(_) => "to_boolean",
2505 Expression::List(_) => "list",
2506 Expression::ToMap(_) => "to_map",
2507 Expression::Pad(_) => "pad",
2508 Expression::ToChar(_) => "to_char",
2509 Expression::ToNumber(_) => "to_number",
2510 Expression::ToDouble(_) => "to_double",
2511 Expression::Int64(_) => "int64",
2512 Expression::StringFunc(_) => "string_func",
2513 Expression::ToDecfloat(_) => "to_decfloat",
2514 Expression::TryToDecfloat(_) => "try_to_decfloat",
2515 Expression::ToFile(_) => "to_file",
2516 Expression::Columns(_) => "columns",
2517 Expression::ConvertToCharset(_) => "convert_to_charset",
2518 Expression::ConvertTimezone(_) => "convert_timezone",
2519 Expression::GenerateSeries(_) => "generate_series",
2520 Expression::AIAgg(_) => "a_i_agg",
2521 Expression::AIClassify(_) => "a_i_classify",
2522 Expression::ArrayAll(_) => "array_all",
2523 Expression::ArrayAny(_) => "array_any",
2524 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2525 Expression::StPoint(_) => "st_point",
2526 Expression::StDistance(_) => "st_distance",
2527 Expression::StringToArray(_) => "string_to_array",
2528 Expression::ArraySum(_) => "array_sum",
2529 Expression::ObjectAgg(_) => "object_agg",
2530 Expression::CastToStrType(_) => "cast_to_str_type",
2531 Expression::CheckJson(_) => "check_json",
2532 Expression::CheckXml(_) => "check_xml",
2533 Expression::TranslateCharacters(_) => "translate_characters",
2534 Expression::CurrentSchemas(_) => "current_schemas",
2535 Expression::CurrentDatetime(_) => "current_datetime",
2536 Expression::Localtime(_) => "localtime",
2537 Expression::Localtimestamp(_) => "localtimestamp",
2538 Expression::Systimestamp(_) => "systimestamp",
2539 Expression::CurrentSchema(_) => "current_schema",
2540 Expression::CurrentUser(_) => "current_user",
2541 Expression::UtcTime(_) => "utc_time",
2542 Expression::UtcTimestamp(_) => "utc_timestamp",
2543 Expression::Timestamp(_) => "timestamp",
2544 Expression::DateBin(_) => "date_bin",
2545 Expression::Datetime(_) => "datetime",
2546 Expression::DatetimeAdd(_) => "datetime_add",
2547 Expression::DatetimeSub(_) => "datetime_sub",
2548 Expression::DatetimeDiff(_) => "datetime_diff",
2549 Expression::DatetimeTrunc(_) => "datetime_trunc",
2550 Expression::Dayname(_) => "dayname",
2551 Expression::MakeInterval(_) => "make_interval",
2552 Expression::PreviousDay(_) => "previous_day",
2553 Expression::Elt(_) => "elt",
2554 Expression::TimestampAdd(_) => "timestamp_add",
2555 Expression::TimestampSub(_) => "timestamp_sub",
2556 Expression::TimestampDiff(_) => "timestamp_diff",
2557 Expression::TimeSlice(_) => "time_slice",
2558 Expression::TimeAdd(_) => "time_add",
2559 Expression::TimeSub(_) => "time_sub",
2560 Expression::TimeDiff(_) => "time_diff",
2561 Expression::TimeTrunc(_) => "time_trunc",
2562 Expression::DateFromParts(_) => "date_from_parts",
2563 Expression::TimeFromParts(_) => "time_from_parts",
2564 Expression::DecodeCase(_) => "decode_case",
2565 Expression::Decrypt(_) => "decrypt",
2566 Expression::DecryptRaw(_) => "decrypt_raw",
2567 Expression::Encode(_) => "encode",
2568 Expression::Encrypt(_) => "encrypt",
2569 Expression::EncryptRaw(_) => "encrypt_raw",
2570 Expression::EqualNull(_) => "equal_null",
2571 Expression::ToBinary(_) => "to_binary",
2572 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2573 Expression::Base64DecodeString(_) => "base64_decode_string",
2574 Expression::Base64Encode(_) => "base64_encode",
2575 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2576 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2577 Expression::GapFill(_) => "gap_fill",
2578 Expression::GenerateDateArray(_) => "generate_date_array",
2579 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2580 Expression::GetExtract(_) => "get_extract",
2581 Expression::Getbit(_) => "getbit",
2582 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2583 Expression::HexEncode(_) => "hex_encode",
2584 Expression::Compress(_) => "compress",
2585 Expression::DecompressBinary(_) => "decompress_binary",
2586 Expression::DecompressString(_) => "decompress_string",
2587 Expression::Xor(_) => "xor",
2588 Expression::Nullif(_) => "nullif",
2589 Expression::JSON(_) => "j_s_o_n",
2590 Expression::JSONPath(_) => "j_s_o_n_path",
2591 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2592 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2593 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2594 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2595 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2596 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2597 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2598 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2599 Expression::Format(_) => "format",
2600 Expression::JSONKeys(_) => "j_s_o_n_keys",
2601 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2602 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2603 Expression::JSONObject(_) => "j_s_o_n_object",
2604 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2605 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2606 Expression::JSONArray(_) => "j_s_o_n_array",
2607 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2608 Expression::JSONExists(_) => "j_s_o_n_exists",
2609 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2610 Expression::JSONSchema(_) => "j_s_o_n_schema",
2611 Expression::JSONSet(_) => "j_s_o_n_set",
2612 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2613 Expression::JSONValue(_) => "j_s_o_n_value",
2614 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2615 Expression::JSONRemove(_) => "j_s_o_n_remove",
2616 Expression::JSONTable(_) => "j_s_o_n_table",
2617 Expression::JSONType(_) => "j_s_o_n_type",
2618 Expression::ObjectInsert(_) => "object_insert",
2619 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2620 Expression::OpenJSON(_) => "open_j_s_o_n",
2621 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2622 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2623 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2624 Expression::JSONCast(_) => "j_s_o_n_cast",
2625 Expression::JSONExtract(_) => "j_s_o_n_extract",
2626 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2627 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2628 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2629 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2630 Expression::JSONFormat(_) => "j_s_o_n_format",
2631 Expression::JSONBool(_) => "j_s_o_n_bool",
2632 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2633 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2634 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2635 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2636 Expression::ParseJSON(_) => "parse_j_s_o_n",
2637 Expression::ParseUrl(_) => "parse_url",
2638 Expression::ParseIp(_) => "parse_ip",
2639 Expression::ParseTime(_) => "parse_time",
2640 Expression::ParseDatetime(_) => "parse_datetime",
2641 Expression::Map(_) => "map",
2642 Expression::MapCat(_) => "map_cat",
2643 Expression::MapDelete(_) => "map_delete",
2644 Expression::MapInsert(_) => "map_insert",
2645 Expression::MapPick(_) => "map_pick",
2646 Expression::ScopeResolution(_) => "scope_resolution",
2647 Expression::Slice(_) => "slice",
2648 Expression::VarMap(_) => "var_map",
2649 Expression::MatchAgainst(_) => "match_against",
2650 Expression::MD5Digest(_) => "m_d5_digest",
2651 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2652 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2653 Expression::Monthname(_) => "monthname",
2654 Expression::Ntile(_) => "ntile",
2655 Expression::Normalize(_) => "normalize",
2656 Expression::Normal(_) => "normal",
2657 Expression::Predict(_) => "predict",
2658 Expression::MLTranslate(_) => "m_l_translate",
2659 Expression::FeaturesAtTime(_) => "features_at_time",
2660 Expression::GenerateEmbedding(_) => "generate_embedding",
2661 Expression::MLForecast(_) => "m_l_forecast",
2662 Expression::ModelAttribute(_) => "model_attribute",
2663 Expression::VectorSearch(_) => "vector_search",
2664 Expression::Quantile(_) => "quantile",
2665 Expression::ApproxQuantile(_) => "approx_quantile",
2666 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2667 Expression::Randn(_) => "randn",
2668 Expression::Randstr(_) => "randstr",
2669 Expression::RangeN(_) => "range_n",
2670 Expression::RangeBucket(_) => "range_bucket",
2671 Expression::ReadCSV(_) => "read_c_s_v",
2672 Expression::ReadParquet(_) => "read_parquet",
2673 Expression::Reduce(_) => "reduce",
2674 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2675 Expression::RegexpILike(_) => "regexp_i_like",
2676 Expression::RegexpFullMatch(_) => "regexp_full_match",
2677 Expression::RegexpInstr(_) => "regexp_instr",
2678 Expression::RegexpSplit(_) => "regexp_split",
2679 Expression::RegexpCount(_) => "regexp_count",
2680 Expression::RegrValx(_) => "regr_valx",
2681 Expression::RegrValy(_) => "regr_valy",
2682 Expression::RegrAvgy(_) => "regr_avgy",
2683 Expression::RegrAvgx(_) => "regr_avgx",
2684 Expression::RegrCount(_) => "regr_count",
2685 Expression::RegrIntercept(_) => "regr_intercept",
2686 Expression::RegrR2(_) => "regr_r2",
2687 Expression::RegrSxx(_) => "regr_sxx",
2688 Expression::RegrSxy(_) => "regr_sxy",
2689 Expression::RegrSyy(_) => "regr_syy",
2690 Expression::RegrSlope(_) => "regr_slope",
2691 Expression::SafeAdd(_) => "safe_add",
2692 Expression::SafeDivide(_) => "safe_divide",
2693 Expression::SafeMultiply(_) => "safe_multiply",
2694 Expression::SafeSubtract(_) => "safe_subtract",
2695 Expression::SHA2(_) => "s_h_a2",
2696 Expression::SHA2Digest(_) => "s_h_a2_digest",
2697 Expression::SortArray(_) => "sort_array",
2698 Expression::SplitPart(_) => "split_part",
2699 Expression::SubstringIndex(_) => "substring_index",
2700 Expression::StandardHash(_) => "standard_hash",
2701 Expression::StrPosition(_) => "str_position",
2702 Expression::Search(_) => "search",
2703 Expression::SearchIp(_) => "search_ip",
2704 Expression::StrToDate(_) => "str_to_date",
2705 Expression::DateStrToDate(_) => "date_str_to_date",
2706 Expression::DateToDateStr(_) => "date_to_date_str",
2707 Expression::StrToTime(_) => "str_to_time",
2708 Expression::StrToUnix(_) => "str_to_unix",
2709 Expression::StrToMap(_) => "str_to_map",
2710 Expression::NumberToStr(_) => "number_to_str",
2711 Expression::FromBase(_) => "from_base",
2712 Expression::Stuff(_) => "stuff",
2713 Expression::TimeToStr(_) => "time_to_str",
2714 Expression::TimeStrToTime(_) => "time_str_to_time",
2715 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2716 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2717 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2718 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2719 Expression::Unhex(_) => "unhex",
2720 Expression::Uniform(_) => "uniform",
2721 Expression::UnixToStr(_) => "unix_to_str",
2722 Expression::UnixToTime(_) => "unix_to_time",
2723 Expression::Uuid(_) => "uuid",
2724 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2725 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2726 Expression::Corr(_) => "corr",
2727 Expression::WidthBucket(_) => "width_bucket",
2728 Expression::CovarSamp(_) => "covar_samp",
2729 Expression::CovarPop(_) => "covar_pop",
2730 Expression::Week(_) => "week",
2731 Expression::XMLElement(_) => "x_m_l_element",
2732 Expression::XMLGet(_) => "x_m_l_get",
2733 Expression::XMLTable(_) => "x_m_l_table",
2734 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2735 Expression::Zipf(_) => "zipf",
2736 Expression::Merge(_) => "merge",
2737 Expression::When(_) => "when",
2738 Expression::Whens(_) => "whens",
2739 Expression::NextValueFor(_) => "next_value_for",
2740 Expression::ReturnStmt(_) => "return_stmt",
2741 }
2742 }
2743
2744 pub fn get_this(&self) -> Option<&Expression> {
2746 match self {
2747 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2749 Expression::Upper(f)
2751 | Expression::Lower(f)
2752 | Expression::Length(f)
2753 | Expression::LTrim(f)
2754 | Expression::RTrim(f)
2755 | Expression::Reverse(f)
2756 | Expression::Abs(f)
2757 | Expression::Sqrt(f)
2758 | Expression::Cbrt(f)
2759 | Expression::Ln(f)
2760 | Expression::Exp(f)
2761 | Expression::Sign(f)
2762 | Expression::Date(f)
2763 | Expression::Time(f)
2764 | Expression::Initcap(f)
2765 | Expression::Ascii(f)
2766 | Expression::Chr(f)
2767 | Expression::Soundex(f)
2768 | Expression::ByteLength(f)
2769 | Expression::Hex(f)
2770 | Expression::LowerHex(f)
2771 | Expression::Unicode(f)
2772 | Expression::Typeof(f)
2773 | Expression::Explode(f)
2774 | Expression::ExplodeOuter(f)
2775 | Expression::MapFromEntries(f)
2776 | Expression::MapKeys(f)
2777 | Expression::MapValues(f)
2778 | Expression::ArrayLength(f)
2779 | Expression::ArraySize(f)
2780 | Expression::Cardinality(f)
2781 | Expression::ArrayReverse(f)
2782 | Expression::ArrayDistinct(f)
2783 | Expression::ArrayFlatten(f)
2784 | Expression::ArrayCompact(f)
2785 | Expression::ToArray(f)
2786 | Expression::JsonArrayLength(f)
2787 | Expression::JsonKeys(f)
2788 | Expression::JsonType(f)
2789 | Expression::ParseJson(f)
2790 | Expression::ToJson(f)
2791 | Expression::Radians(f)
2792 | Expression::Degrees(f)
2793 | Expression::Sin(f)
2794 | Expression::Cos(f)
2795 | Expression::Tan(f)
2796 | Expression::Asin(f)
2797 | Expression::Acos(f)
2798 | Expression::Atan(f)
2799 | Expression::IsNan(f)
2800 | Expression::IsInf(f)
2801 | Expression::Year(f)
2802 | Expression::Month(f)
2803 | Expression::Day(f)
2804 | Expression::Hour(f)
2805 | Expression::Minute(f)
2806 | Expression::Second(f)
2807 | Expression::DayOfWeek(f)
2808 | Expression::DayOfWeekIso(f)
2809 | Expression::DayOfMonth(f)
2810 | Expression::DayOfYear(f)
2811 | Expression::WeekOfYear(f)
2812 | Expression::Quarter(f)
2813 | Expression::Epoch(f)
2814 | Expression::EpochMs(f)
2815 | Expression::BitwiseCount(f)
2816 | Expression::DateFromUnixDate(f)
2817 | Expression::UnixDate(f)
2818 | Expression::UnixSeconds(f)
2819 | Expression::UnixMillis(f)
2820 | Expression::UnixMicros(f)
2821 | Expression::TimeStrToDate(f)
2822 | Expression::DateToDi(f)
2823 | Expression::DiToDate(f)
2824 | Expression::TsOrDiToDi(f)
2825 | Expression::TsOrDsToDatetime(f)
2826 | Expression::TsOrDsToTimestamp(f)
2827 | Expression::YearOfWeek(f)
2828 | Expression::YearOfWeekIso(f)
2829 | Expression::SHA(f)
2830 | Expression::SHA1Digest(f)
2831 | Expression::TimeToUnix(f)
2832 | Expression::TimeStrToUnix(f)
2833 | Expression::Int64(f)
2834 | Expression::JSONBool(f)
2835 | Expression::MD5NumberLower64(f)
2836 | Expression::MD5NumberUpper64(f)
2837 | Expression::DateStrToDate(f)
2838 | Expression::DateToDateStr(f) => Some(&f.this),
2839 Expression::Power(f)
2841 | Expression::NullIf(f)
2842 | Expression::IfNull(f)
2843 | Expression::Nvl(f)
2844 | Expression::Contains(f)
2845 | Expression::StartsWith(f)
2846 | Expression::EndsWith(f)
2847 | Expression::Levenshtein(f)
2848 | Expression::ModFunc(f)
2849 | Expression::IntDiv(f)
2850 | Expression::Atan2(f)
2851 | Expression::AddMonths(f)
2852 | Expression::MonthsBetween(f)
2853 | Expression::NextDay(f)
2854 | Expression::UnixToTimeStr(f)
2855 | Expression::ArrayContains(f)
2856 | Expression::ArrayPosition(f)
2857 | Expression::ArrayAppend(f)
2858 | Expression::ArrayPrepend(f)
2859 | Expression::ArrayUnion(f)
2860 | Expression::ArrayExcept(f)
2861 | Expression::ArrayRemove(f)
2862 | Expression::StarMap(f)
2863 | Expression::MapFromArrays(f)
2864 | Expression::MapContainsKey(f)
2865 | Expression::ElementAt(f)
2866 | Expression::JsonMergePatch(f)
2867 | Expression::JSONBContains(f)
2868 | Expression::JSONBExtract(f) => Some(&f.this),
2869 Expression::Sum(af)
2871 | Expression::Avg(af)
2872 | Expression::Min(af)
2873 | Expression::Max(af)
2874 | Expression::ArrayAgg(af)
2875 | Expression::CountIf(af)
2876 | Expression::Stddev(af)
2877 | Expression::StddevPop(af)
2878 | Expression::StddevSamp(af)
2879 | Expression::Variance(af)
2880 | Expression::VarPop(af)
2881 | Expression::VarSamp(af)
2882 | Expression::Median(af)
2883 | Expression::Mode(af)
2884 | Expression::First(af)
2885 | Expression::Last(af)
2886 | Expression::AnyValue(af)
2887 | Expression::ApproxDistinct(af)
2888 | Expression::ApproxCountDistinct(af)
2889 | Expression::LogicalAnd(af)
2890 | Expression::LogicalOr(af)
2891 | Expression::Skewness(af)
2892 | Expression::ArrayConcatAgg(af)
2893 | Expression::ArrayUniqueAgg(af)
2894 | Expression::BoolXorAgg(af)
2895 | Expression::BitwiseAndAgg(af)
2896 | Expression::BitwiseOrAgg(af)
2897 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2898 Expression::And(op)
2900 | Expression::Or(op)
2901 | Expression::Add(op)
2902 | Expression::Sub(op)
2903 | Expression::Mul(op)
2904 | Expression::Div(op)
2905 | Expression::Mod(op)
2906 | Expression::Eq(op)
2907 | Expression::Neq(op)
2908 | Expression::Lt(op)
2909 | Expression::Lte(op)
2910 | Expression::Gt(op)
2911 | Expression::Gte(op)
2912 | Expression::BitwiseAnd(op)
2913 | Expression::BitwiseOr(op)
2914 | Expression::BitwiseXor(op)
2915 | Expression::Concat(op)
2916 | Expression::Adjacent(op)
2917 | Expression::TsMatch(op)
2918 | Expression::PropertyEQ(op)
2919 | Expression::ArrayContainsAll(op)
2920 | Expression::ArrayContainedBy(op)
2921 | Expression::ArrayOverlaps(op)
2922 | Expression::JSONBContainsAllTopKeys(op)
2923 | Expression::JSONBContainsAnyTopKeys(op)
2924 | Expression::JSONBDeleteAtPath(op)
2925 | Expression::ExtendsLeft(op)
2926 | Expression::ExtendsRight(op)
2927 | Expression::Is(op)
2928 | Expression::MemberOf(op)
2929 | Expression::Match(op)
2930 | Expression::NullSafeEq(op)
2931 | Expression::NullSafeNeq(op)
2932 | Expression::Glob(op)
2933 | Expression::BitwiseLeftShift(op)
2934 | Expression::BitwiseRightShift(op) => Some(&op.left),
2935 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2937 Expression::Alias(a) => Some(&a.this),
2939 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2940 Expression::Paren(p) => Some(&p.this),
2941 Expression::Annotated(a) => Some(&a.this),
2942 Expression::Subquery(s) => Some(&s.this),
2943 Expression::Where(w) => Some(&w.this),
2944 Expression::Having(h) => Some(&h.this),
2945 Expression::Qualify(q) => Some(&q.this),
2946 Expression::IsNull(i) => Some(&i.this),
2947 Expression::Exists(e) => Some(&e.this),
2948 Expression::Ordered(o) => Some(&o.this),
2949 Expression::WindowFunction(wf) => Some(&wf.this),
2950 Expression::Cte(cte) => Some(&cte.this),
2951 Expression::Between(b) => Some(&b.this),
2952 Expression::In(i) => Some(&i.this),
2953 Expression::ReturnStmt(e) => Some(e),
2954 _ => None,
2955 }
2956 }
2957
2958 pub fn get_expression(&self) -> Option<&Expression> {
2960 match self {
2961 Expression::And(op)
2963 | Expression::Or(op)
2964 | Expression::Add(op)
2965 | Expression::Sub(op)
2966 | Expression::Mul(op)
2967 | Expression::Div(op)
2968 | Expression::Mod(op)
2969 | Expression::Eq(op)
2970 | Expression::Neq(op)
2971 | Expression::Lt(op)
2972 | Expression::Lte(op)
2973 | Expression::Gt(op)
2974 | Expression::Gte(op)
2975 | Expression::BitwiseAnd(op)
2976 | Expression::BitwiseOr(op)
2977 | Expression::BitwiseXor(op)
2978 | Expression::Concat(op)
2979 | Expression::Adjacent(op)
2980 | Expression::TsMatch(op)
2981 | Expression::PropertyEQ(op)
2982 | Expression::ArrayContainsAll(op)
2983 | Expression::ArrayContainedBy(op)
2984 | Expression::ArrayOverlaps(op)
2985 | Expression::JSONBContainsAllTopKeys(op)
2986 | Expression::JSONBContainsAnyTopKeys(op)
2987 | Expression::JSONBDeleteAtPath(op)
2988 | Expression::ExtendsLeft(op)
2989 | Expression::ExtendsRight(op)
2990 | Expression::Is(op)
2991 | Expression::MemberOf(op)
2992 | Expression::Match(op)
2993 | Expression::NullSafeEq(op)
2994 | Expression::NullSafeNeq(op)
2995 | Expression::Glob(op)
2996 | Expression::BitwiseLeftShift(op)
2997 | Expression::BitwiseRightShift(op) => Some(&op.right),
2998 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3000 Expression::Power(f)
3002 | Expression::NullIf(f)
3003 | Expression::IfNull(f)
3004 | Expression::Nvl(f)
3005 | Expression::Contains(f)
3006 | Expression::StartsWith(f)
3007 | Expression::EndsWith(f)
3008 | Expression::Levenshtein(f)
3009 | Expression::ModFunc(f)
3010 | Expression::IntDiv(f)
3011 | Expression::Atan2(f)
3012 | Expression::AddMonths(f)
3013 | Expression::MonthsBetween(f)
3014 | Expression::NextDay(f)
3015 | Expression::UnixToTimeStr(f)
3016 | Expression::ArrayContains(f)
3017 | Expression::ArrayPosition(f)
3018 | Expression::ArrayAppend(f)
3019 | Expression::ArrayPrepend(f)
3020 | Expression::ArrayUnion(f)
3021 | Expression::ArrayExcept(f)
3022 | Expression::ArrayRemove(f)
3023 | Expression::StarMap(f)
3024 | Expression::MapFromArrays(f)
3025 | Expression::MapContainsKey(f)
3026 | Expression::ElementAt(f)
3027 | Expression::JsonMergePatch(f)
3028 | Expression::JSONBContains(f)
3029 | Expression::JSONBExtract(f) => Some(&f.expression),
3030 _ => None,
3031 }
3032 }
3033
3034 pub fn get_expressions(&self) -> &[Expression] {
3036 match self {
3037 Expression::Select(s) => &s.expressions,
3038 Expression::Function(f) => &f.args,
3039 Expression::AggregateFunction(f) => &f.args,
3040 Expression::From(f) => &f.expressions,
3041 Expression::GroupBy(g) => &g.expressions,
3042 Expression::In(i) => &i.expressions,
3043 Expression::Array(a) => &a.expressions,
3044 Expression::Tuple(t) => &t.expressions,
3045 Expression::Coalesce(f)
3046 | Expression::Greatest(f)
3047 | Expression::Least(f)
3048 | Expression::ArrayConcat(f)
3049 | Expression::ArrayIntersect(f)
3050 | Expression::ArrayZip(f)
3051 | Expression::MapConcat(f)
3052 | Expression::JsonArray(f) => &f.expressions,
3053 _ => &[],
3054 }
3055 }
3056
3057 pub fn get_name(&self) -> &str {
3059 match self {
3060 Expression::Identifier(id) => &id.name,
3061 Expression::Column(col) => &col.name.name,
3062 Expression::Table(t) => &t.name.name,
3063 Expression::Literal(lit) => lit.value_str(),
3064 Expression::Star(_) => "*",
3065 Expression::Function(f) => &f.name,
3066 Expression::AggregateFunction(f) => &f.name,
3067 Expression::Alias(a) => a.this.get_name(),
3068 Expression::Boolean(b) => {
3069 if b.value {
3070 "TRUE"
3071 } else {
3072 "FALSE"
3073 }
3074 }
3075 Expression::Null(_) => "NULL",
3076 _ => "",
3077 }
3078 }
3079
3080 pub fn get_alias(&self) -> &str {
3082 match self {
3083 Expression::Alias(a) => &a.alias.name,
3084 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3085 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3086 _ => "",
3087 }
3088 }
3089
3090 pub fn get_output_name(&self) -> &str {
3092 match self {
3093 Expression::Alias(a) => &a.alias.name,
3094 Expression::Column(c) => &c.name.name,
3095 Expression::Identifier(id) => &id.name,
3096 Expression::Literal(lit) => lit.value_str(),
3097 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3098 Expression::Star(_) => "*",
3099 _ => "",
3100 }
3101 }
3102
3103 pub fn get_comments(&self) -> Vec<&str> {
3105 match self {
3106 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3107 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3108 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3109 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3110 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3111 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3112 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3113 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3114 }
3115 Expression::And(op)
3116 | Expression::Or(op)
3117 | Expression::Add(op)
3118 | Expression::Sub(op)
3119 | Expression::Mul(op)
3120 | Expression::Div(op)
3121 | Expression::Mod(op)
3122 | Expression::Eq(op)
3123 | Expression::Neq(op)
3124 | Expression::Lt(op)
3125 | Expression::Lte(op)
3126 | Expression::Gt(op)
3127 | Expression::Gte(op)
3128 | Expression::Concat(op)
3129 | Expression::BitwiseAnd(op)
3130 | Expression::BitwiseOr(op)
3131 | Expression::BitwiseXor(op) => {
3132 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3133 }
3134 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3135 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3136 _ => Vec::new(),
3137 }
3138 }
3139}
3140
3141impl fmt::Display for Expression {
3142 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3143 match self {
3145 Expression::Literal(lit) => write!(f, "{}", lit),
3146 Expression::Identifier(id) => write!(f, "{}", id),
3147 Expression::Column(col) => write!(f, "{}", col),
3148 Expression::Star(_) => write!(f, "*"),
3149 Expression::Null(_) => write!(f, "NULL"),
3150 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3151 Expression::Select(_) => write!(f, "SELECT ..."),
3152 _ => write!(f, "{:?}", self),
3153 }
3154 }
3155}
3156
3157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3167#[cfg_attr(feature = "bindings", derive(TS))]
3168#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3169pub enum Literal {
3170 String(String),
3172 Number(String),
3174 HexString(String),
3176 HexNumber(String),
3178 BitString(String),
3179 ByteString(String),
3181 NationalString(String),
3183 Date(String),
3185 Time(String),
3187 Timestamp(String),
3189 Datetime(String),
3191 TripleQuotedString(String, char),
3194 EscapeString(String),
3196 DollarString(String),
3198 RawString(String),
3202}
3203
3204impl Literal {
3205 pub fn value_str(&self) -> &str {
3207 match self {
3208 Literal::String(s)
3209 | Literal::Number(s)
3210 | Literal::HexString(s)
3211 | Literal::HexNumber(s)
3212 | Literal::BitString(s)
3213 | Literal::ByteString(s)
3214 | Literal::NationalString(s)
3215 | Literal::Date(s)
3216 | Literal::Time(s)
3217 | Literal::Timestamp(s)
3218 | Literal::Datetime(s)
3219 | Literal::EscapeString(s)
3220 | Literal::DollarString(s)
3221 | Literal::RawString(s) => s.as_str(),
3222 Literal::TripleQuotedString(s, _) => s.as_str(),
3223 }
3224 }
3225
3226 pub fn is_string(&self) -> bool {
3228 matches!(
3229 self,
3230 Literal::String(_)
3231 | Literal::NationalString(_)
3232 | Literal::EscapeString(_)
3233 | Literal::DollarString(_)
3234 | Literal::RawString(_)
3235 | Literal::TripleQuotedString(_, _)
3236 )
3237 }
3238
3239 pub fn is_number(&self) -> bool {
3241 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3242 }
3243}
3244
3245impl fmt::Display for Literal {
3246 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3247 match self {
3248 Literal::String(s) => write!(f, "'{}'", s),
3249 Literal::Number(n) => write!(f, "{}", n),
3250 Literal::HexString(h) => write!(f, "X'{}'", h),
3251 Literal::HexNumber(h) => write!(f, "0x{}", h),
3252 Literal::BitString(b) => write!(f, "B'{}'", b),
3253 Literal::ByteString(b) => write!(f, "b'{}'", b),
3254 Literal::NationalString(s) => write!(f, "N'{}'", s),
3255 Literal::Date(d) => write!(f, "DATE '{}'", d),
3256 Literal::Time(t) => write!(f, "TIME '{}'", t),
3257 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3258 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3259 Literal::TripleQuotedString(s, q) => {
3260 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3261 }
3262 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3263 Literal::DollarString(s) => write!(f, "$${}$$", s),
3264 Literal::RawString(s) => write!(f, "r'{}'", s),
3265 }
3266 }
3267}
3268
3269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3271#[cfg_attr(feature = "bindings", derive(TS))]
3272pub struct BooleanLiteral {
3273 pub value: bool,
3274}
3275
3276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3278#[cfg_attr(feature = "bindings", derive(TS))]
3279pub struct Null;
3280
3281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3288#[cfg_attr(feature = "bindings", derive(TS))]
3289pub struct Identifier {
3290 pub name: String,
3292 pub quoted: bool,
3294 #[serde(default)]
3295 pub trailing_comments: Vec<String>,
3296 #[serde(default, skip_serializing_if = "Option::is_none")]
3298 pub span: Option<Span>,
3299}
3300
3301impl Identifier {
3302 pub fn new(name: impl Into<String>) -> Self {
3303 Self {
3304 name: name.into(),
3305 quoted: false,
3306 trailing_comments: Vec::new(),
3307 span: None,
3308 }
3309 }
3310
3311 pub fn quoted(name: impl Into<String>) -> Self {
3312 Self {
3313 name: name.into(),
3314 quoted: true,
3315 trailing_comments: Vec::new(),
3316 span: None,
3317 }
3318 }
3319
3320 pub fn empty() -> Self {
3321 Self {
3322 name: String::new(),
3323 quoted: false,
3324 trailing_comments: Vec::new(),
3325 span: None,
3326 }
3327 }
3328
3329 pub fn is_empty(&self) -> bool {
3330 self.name.is_empty()
3331 }
3332
3333 pub fn with_span(mut self, span: Span) -> Self {
3335 self.span = Some(span);
3336 self
3337 }
3338}
3339
3340impl fmt::Display for Identifier {
3341 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3342 if self.quoted {
3343 write!(f, "\"{}\"", self.name)
3344 } else {
3345 write!(f, "{}", self.name)
3346 }
3347 }
3348}
3349
3350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3356#[cfg_attr(feature = "bindings", derive(TS))]
3357pub struct Column {
3358 pub name: Identifier,
3360 pub table: Option<Identifier>,
3362 #[serde(default)]
3364 pub join_mark: bool,
3365 #[serde(default)]
3367 pub trailing_comments: Vec<String>,
3368 #[serde(default, skip_serializing_if = "Option::is_none")]
3370 pub span: Option<Span>,
3371 #[serde(default, skip_serializing_if = "Option::is_none")]
3373 pub inferred_type: Option<DataType>,
3374}
3375
3376impl fmt::Display for Column {
3377 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3378 if let Some(table) = &self.table {
3379 write!(f, "{}.{}", table, self.name)
3380 } else {
3381 write!(f, "{}", self.name)
3382 }
3383 }
3384}
3385
3386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3393#[cfg_attr(feature = "bindings", derive(TS))]
3394pub struct TableRef {
3395 pub name: Identifier,
3397 pub schema: Option<Identifier>,
3399 pub catalog: Option<Identifier>,
3401 pub alias: Option<Identifier>,
3403 #[serde(default)]
3405 pub alias_explicit_as: bool,
3406 #[serde(default)]
3408 pub column_aliases: Vec<Identifier>,
3409 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3411 pub leading_comments: Vec<String>,
3412 #[serde(default)]
3414 pub trailing_comments: Vec<String>,
3415 #[serde(default)]
3417 pub when: Option<Box<HistoricalData>>,
3418 #[serde(default)]
3420 pub only: bool,
3421 #[serde(default)]
3423 pub final_: bool,
3424 #[serde(default, skip_serializing_if = "Option::is_none")]
3426 pub table_sample: Option<Box<Sample>>,
3427 #[serde(default)]
3429 pub hints: Vec<Expression>,
3430 #[serde(default, skip_serializing_if = "Option::is_none")]
3433 pub system_time: Option<String>,
3434 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3436 pub partitions: Vec<Identifier>,
3437 #[serde(default, skip_serializing_if = "Option::is_none")]
3440 pub identifier_func: Option<Box<Expression>>,
3441 #[serde(default, skip_serializing_if = "Option::is_none")]
3443 pub changes: Option<Box<Changes>>,
3444 #[serde(default, skip_serializing_if = "Option::is_none")]
3446 pub version: Option<Box<Version>>,
3447 #[serde(default, skip_serializing_if = "Option::is_none")]
3449 pub span: Option<Span>,
3450}
3451
3452impl TableRef {
3453 pub fn new(name: impl Into<String>) -> Self {
3454 Self {
3455 name: Identifier::new(name),
3456 schema: None,
3457 catalog: None,
3458 alias: None,
3459 alias_explicit_as: false,
3460 column_aliases: Vec::new(),
3461 leading_comments: Vec::new(),
3462 trailing_comments: Vec::new(),
3463 when: None,
3464 only: false,
3465 final_: false,
3466 table_sample: None,
3467 hints: Vec::new(),
3468 system_time: None,
3469 partitions: Vec::new(),
3470 identifier_func: None,
3471 changes: None,
3472 version: None,
3473 span: None,
3474 }
3475 }
3476
3477 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3479 let mut t = Self::new(name);
3480 t.schema = Some(Identifier::new(schema));
3481 t
3482 }
3483
3484 pub fn new_with_catalog(
3486 name: impl Into<String>,
3487 schema: impl Into<String>,
3488 catalog: impl Into<String>,
3489 ) -> Self {
3490 let mut t = Self::new(name);
3491 t.schema = Some(Identifier::new(schema));
3492 t.catalog = Some(Identifier::new(catalog));
3493 t
3494 }
3495
3496 pub fn from_identifier(name: Identifier) -> Self {
3498 Self {
3499 name,
3500 schema: None,
3501 catalog: None,
3502 alias: None,
3503 alias_explicit_as: false,
3504 column_aliases: Vec::new(),
3505 leading_comments: Vec::new(),
3506 trailing_comments: Vec::new(),
3507 when: None,
3508 only: false,
3509 final_: false,
3510 table_sample: None,
3511 hints: Vec::new(),
3512 system_time: None,
3513 partitions: Vec::new(),
3514 identifier_func: None,
3515 changes: None,
3516 version: None,
3517 span: None,
3518 }
3519 }
3520
3521 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3522 self.alias = Some(Identifier::new(alias));
3523 self
3524 }
3525
3526 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3527 self.schema = Some(Identifier::new(schema));
3528 self
3529 }
3530}
3531
3532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3537#[cfg_attr(feature = "bindings", derive(TS))]
3538pub struct Star {
3539 pub table: Option<Identifier>,
3541 pub except: Option<Vec<Identifier>>,
3543 pub replace: Option<Vec<Alias>>,
3545 pub rename: Option<Vec<(Identifier, Identifier)>>,
3547 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3549 pub trailing_comments: Vec<String>,
3550 #[serde(default, skip_serializing_if = "Option::is_none")]
3552 pub span: Option<Span>,
3553}
3554
3555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3579#[cfg_attr(feature = "bindings", derive(TS))]
3580pub struct Select {
3581 pub expressions: Vec<Expression>,
3583 pub from: Option<From>,
3585 pub joins: Vec<Join>,
3587 pub lateral_views: Vec<LateralView>,
3588 #[serde(default, skip_serializing_if = "Option::is_none")]
3590 pub prewhere: Option<Expression>,
3591 pub where_clause: Option<Where>,
3592 pub group_by: Option<GroupBy>,
3593 pub having: Option<Having>,
3594 pub qualify: Option<Qualify>,
3595 pub order_by: Option<OrderBy>,
3596 pub distribute_by: Option<DistributeBy>,
3597 pub cluster_by: Option<ClusterBy>,
3598 pub sort_by: Option<SortBy>,
3599 pub limit: Option<Limit>,
3600 pub offset: Option<Offset>,
3601 #[serde(default, skip_serializing_if = "Option::is_none")]
3603 pub limit_by: Option<Vec<Expression>>,
3604 pub fetch: Option<Fetch>,
3605 pub distinct: bool,
3606 pub distinct_on: Option<Vec<Expression>>,
3607 pub top: Option<Top>,
3608 pub with: Option<With>,
3609 pub sample: Option<Sample>,
3610 #[serde(default, skip_serializing_if = "Option::is_none")]
3612 pub settings: Option<Vec<Expression>>,
3613 #[serde(default, skip_serializing_if = "Option::is_none")]
3615 pub format: Option<Expression>,
3616 pub windows: Option<Vec<NamedWindow>>,
3617 pub hint: Option<Hint>,
3618 pub connect: Option<Connect>,
3620 pub into: Option<SelectInto>,
3622 #[serde(default)]
3624 pub locks: Vec<Lock>,
3625 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3627 pub for_xml: Vec<Expression>,
3628 #[serde(default)]
3630 pub leading_comments: Vec<String>,
3631 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub post_select_comments: Vec<String>,
3635 #[serde(default, skip_serializing_if = "Option::is_none")]
3637 pub kind: Option<String>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3640 pub operation_modifiers: Vec<String>,
3641 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3643 pub qualify_after_window: bool,
3644 #[serde(default, skip_serializing_if = "Option::is_none")]
3646 pub option: Option<String>,
3647 #[serde(default, skip_serializing_if = "Option::is_none")]
3650 pub exclude: Option<Vec<Expression>>,
3651}
3652
3653impl Select {
3654 pub fn new() -> Self {
3655 Self {
3656 expressions: Vec::new(),
3657 from: None,
3658 joins: Vec::new(),
3659 lateral_views: Vec::new(),
3660 prewhere: None,
3661 where_clause: None,
3662 group_by: None,
3663 having: None,
3664 qualify: None,
3665 order_by: None,
3666 distribute_by: None,
3667 cluster_by: None,
3668 sort_by: None,
3669 limit: None,
3670 offset: None,
3671 limit_by: None,
3672 fetch: None,
3673 distinct: false,
3674 distinct_on: None,
3675 top: None,
3676 with: None,
3677 sample: None,
3678 settings: None,
3679 format: None,
3680 windows: None,
3681 hint: None,
3682 connect: None,
3683 into: None,
3684 locks: Vec::new(),
3685 for_xml: Vec::new(),
3686 leading_comments: Vec::new(),
3687 post_select_comments: Vec::new(),
3688 kind: None,
3689 operation_modifiers: Vec::new(),
3690 qualify_after_window: false,
3691 option: None,
3692 exclude: None,
3693 }
3694 }
3695
3696 pub fn column(mut self, expr: Expression) -> Self {
3698 self.expressions.push(expr);
3699 self
3700 }
3701
3702 pub fn from(mut self, table: Expression) -> Self {
3704 self.from = Some(From {
3705 expressions: vec![table],
3706 });
3707 self
3708 }
3709
3710 pub fn where_(mut self, condition: Expression) -> Self {
3712 self.where_clause = Some(Where { this: condition });
3713 self
3714 }
3715
3716 pub fn distinct(mut self) -> Self {
3718 self.distinct = true;
3719 self
3720 }
3721
3722 pub fn join(mut self, join: Join) -> Self {
3724 self.joins.push(join);
3725 self
3726 }
3727
3728 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3730 self.order_by = Some(OrderBy {
3731 expressions,
3732 siblings: false,
3733 comments: Vec::new(),
3734 });
3735 self
3736 }
3737
3738 pub fn limit(mut self, n: Expression) -> Self {
3740 self.limit = Some(Limit {
3741 this: n,
3742 percent: false,
3743 comments: Vec::new(),
3744 });
3745 self
3746 }
3747
3748 pub fn offset(mut self, n: Expression) -> Self {
3750 self.offset = Some(Offset {
3751 this: n,
3752 rows: None,
3753 });
3754 self
3755 }
3756}
3757
3758impl Default for Select {
3759 fn default() -> Self {
3760 Self::new()
3761 }
3762}
3763
3764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3770#[cfg_attr(feature = "bindings", derive(TS))]
3771pub struct Union {
3772 pub left: Expression,
3774 pub right: Expression,
3776 pub all: bool,
3778 #[serde(default)]
3780 pub distinct: bool,
3781 pub with: Option<With>,
3783 pub order_by: Option<OrderBy>,
3785 pub limit: Option<Box<Expression>>,
3787 pub offset: Option<Box<Expression>>,
3789 #[serde(default, skip_serializing_if = "Option::is_none")]
3791 pub distribute_by: Option<DistributeBy>,
3792 #[serde(default, skip_serializing_if = "Option::is_none")]
3794 pub sort_by: Option<SortBy>,
3795 #[serde(default, skip_serializing_if = "Option::is_none")]
3797 pub cluster_by: Option<ClusterBy>,
3798 #[serde(default)]
3800 pub by_name: bool,
3801 #[serde(default, skip_serializing_if = "Option::is_none")]
3803 pub side: Option<String>,
3804 #[serde(default, skip_serializing_if = "Option::is_none")]
3806 pub kind: Option<String>,
3807 #[serde(default)]
3809 pub corresponding: bool,
3810 #[serde(default)]
3812 pub strict: bool,
3813 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3815 pub on_columns: Vec<Expression>,
3816}
3817
3818impl Drop for Union {
3821 fn drop(&mut self) {
3822 loop {
3823 if let Expression::Union(ref mut inner) = self.left {
3824 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3825 let old_left = std::mem::replace(&mut self.left, next_left);
3826 drop(old_left);
3827 } else {
3828 break;
3829 }
3830 }
3831 }
3832}
3833
3834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3839#[cfg_attr(feature = "bindings", derive(TS))]
3840pub struct Intersect {
3841 pub left: Expression,
3843 pub right: Expression,
3845 pub all: bool,
3847 #[serde(default)]
3849 pub distinct: bool,
3850 pub with: Option<With>,
3852 pub order_by: Option<OrderBy>,
3854 pub limit: Option<Box<Expression>>,
3856 pub offset: Option<Box<Expression>>,
3858 #[serde(default, skip_serializing_if = "Option::is_none")]
3860 pub distribute_by: Option<DistributeBy>,
3861 #[serde(default, skip_serializing_if = "Option::is_none")]
3863 pub sort_by: Option<SortBy>,
3864 #[serde(default, skip_serializing_if = "Option::is_none")]
3866 pub cluster_by: Option<ClusterBy>,
3867 #[serde(default)]
3869 pub by_name: bool,
3870 #[serde(default, skip_serializing_if = "Option::is_none")]
3872 pub side: Option<String>,
3873 #[serde(default, skip_serializing_if = "Option::is_none")]
3875 pub kind: Option<String>,
3876 #[serde(default)]
3878 pub corresponding: bool,
3879 #[serde(default)]
3881 pub strict: bool,
3882 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3884 pub on_columns: Vec<Expression>,
3885}
3886
3887impl Drop for Intersect {
3888 fn drop(&mut self) {
3889 loop {
3890 if let Expression::Intersect(ref mut inner) = self.left {
3891 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3892 let old_left = std::mem::replace(&mut self.left, next_left);
3893 drop(old_left);
3894 } else {
3895 break;
3896 }
3897 }
3898 }
3899}
3900
3901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3906#[cfg_attr(feature = "bindings", derive(TS))]
3907pub struct Except {
3908 pub left: Expression,
3910 pub right: Expression,
3912 pub all: bool,
3914 #[serde(default)]
3916 pub distinct: bool,
3917 pub with: Option<With>,
3919 pub order_by: Option<OrderBy>,
3921 pub limit: Option<Box<Expression>>,
3923 pub offset: Option<Box<Expression>>,
3925 #[serde(default, skip_serializing_if = "Option::is_none")]
3927 pub distribute_by: Option<DistributeBy>,
3928 #[serde(default, skip_serializing_if = "Option::is_none")]
3930 pub sort_by: Option<SortBy>,
3931 #[serde(default, skip_serializing_if = "Option::is_none")]
3933 pub cluster_by: Option<ClusterBy>,
3934 #[serde(default)]
3936 pub by_name: bool,
3937 #[serde(default, skip_serializing_if = "Option::is_none")]
3939 pub side: Option<String>,
3940 #[serde(default, skip_serializing_if = "Option::is_none")]
3942 pub kind: Option<String>,
3943 #[serde(default)]
3945 pub corresponding: bool,
3946 #[serde(default)]
3948 pub strict: bool,
3949 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3951 pub on_columns: Vec<Expression>,
3952}
3953
3954impl Drop for Except {
3955 fn drop(&mut self) {
3956 loop {
3957 if let Expression::Except(ref mut inner) = self.left {
3958 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3959 let old_left = std::mem::replace(&mut self.left, next_left);
3960 drop(old_left);
3961 } else {
3962 break;
3963 }
3964 }
3965 }
3966}
3967
3968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3970#[cfg_attr(feature = "bindings", derive(TS))]
3971pub struct SelectInto {
3972 pub this: Expression,
3974 #[serde(default)]
3976 pub temporary: bool,
3977 #[serde(default)]
3979 pub unlogged: bool,
3980 #[serde(default)]
3982 pub bulk_collect: bool,
3983 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3985 pub expressions: Vec<Expression>,
3986}
3987
3988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3998#[cfg_attr(feature = "bindings", derive(TS))]
3999pub struct Subquery {
4000 pub this: Expression,
4002 pub alias: Option<Identifier>,
4004 pub column_aliases: Vec<Identifier>,
4006 pub order_by: Option<OrderBy>,
4008 pub limit: Option<Limit>,
4010 pub offset: Option<Offset>,
4012 #[serde(default, skip_serializing_if = "Option::is_none")]
4014 pub distribute_by: Option<DistributeBy>,
4015 #[serde(default, skip_serializing_if = "Option::is_none")]
4017 pub sort_by: Option<SortBy>,
4018 #[serde(default, skip_serializing_if = "Option::is_none")]
4020 pub cluster_by: Option<ClusterBy>,
4021 #[serde(default)]
4023 pub lateral: bool,
4024 #[serde(default)]
4028 pub modifiers_inside: bool,
4029 #[serde(default)]
4031 pub trailing_comments: Vec<String>,
4032 #[serde(default, skip_serializing_if = "Option::is_none")]
4034 pub inferred_type: Option<DataType>,
4035}
4036
4037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4042#[cfg_attr(feature = "bindings", derive(TS))]
4043pub struct PipeOperator {
4044 pub this: Expression,
4046 pub expression: Expression,
4048}
4049
4050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4052#[cfg_attr(feature = "bindings", derive(TS))]
4053pub struct Values {
4054 pub expressions: Vec<Tuple>,
4056 pub alias: Option<Identifier>,
4058 pub column_aliases: Vec<Identifier>,
4060}
4061
4062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4072#[cfg_attr(feature = "bindings", derive(TS))]
4073pub struct Pivot {
4074 pub this: Expression,
4076 #[serde(default)]
4079 pub expressions: Vec<Expression>,
4080 #[serde(default)]
4082 pub fields: Vec<Expression>,
4083 #[serde(default)]
4085 pub using: Vec<Expression>,
4086 #[serde(default)]
4088 pub group: Option<Box<Expression>>,
4089 #[serde(default)]
4091 pub unpivot: bool,
4092 #[serde(default)]
4094 pub into: Option<Box<Expression>>,
4095 #[serde(default)]
4097 pub alias: Option<Identifier>,
4098 #[serde(default)]
4100 pub include_nulls: Option<bool>,
4101 #[serde(default)]
4103 pub default_on_null: Option<Box<Expression>>,
4104 #[serde(default, skip_serializing_if = "Option::is_none")]
4106 pub with: Option<With>,
4107}
4108
4109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4111#[cfg_attr(feature = "bindings", derive(TS))]
4112pub struct Unpivot {
4113 pub this: Expression,
4114 pub value_column: Identifier,
4115 pub name_column: Identifier,
4116 pub columns: Vec<Expression>,
4117 pub alias: Option<Identifier>,
4118 #[serde(default)]
4120 pub value_column_parenthesized: bool,
4121 #[serde(default)]
4123 pub include_nulls: Option<bool>,
4124 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4126 pub extra_value_columns: Vec<Identifier>,
4127}
4128
4129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4132#[cfg_attr(feature = "bindings", derive(TS))]
4133pub struct PivotAlias {
4134 pub this: Expression,
4135 pub alias: Expression,
4136}
4137
4138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4140#[cfg_attr(feature = "bindings", derive(TS))]
4141pub struct PreWhere {
4142 pub this: Expression,
4143}
4144
4145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4147#[cfg_attr(feature = "bindings", derive(TS))]
4148pub struct Stream {
4149 pub this: Expression,
4150 #[serde(skip_serializing_if = "Option::is_none")]
4151 pub on: Option<Expression>,
4152 #[serde(skip_serializing_if = "Option::is_none")]
4153 pub show_initial_rows: Option<bool>,
4154}
4155
4156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4158#[cfg_attr(feature = "bindings", derive(TS))]
4159pub struct UsingData {
4160 pub this: Expression,
4161}
4162
4163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4165#[cfg_attr(feature = "bindings", derive(TS))]
4166pub struct XmlNamespace {
4167 pub this: Expression,
4168 #[serde(skip_serializing_if = "Option::is_none")]
4169 pub alias: Option<Identifier>,
4170}
4171
4172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4174#[cfg_attr(feature = "bindings", derive(TS))]
4175pub struct RowFormat {
4176 pub delimited: bool,
4177 pub fields_terminated_by: Option<String>,
4178 pub collection_items_terminated_by: Option<String>,
4179 pub map_keys_terminated_by: Option<String>,
4180 pub lines_terminated_by: Option<String>,
4181 pub null_defined_as: Option<String>,
4182}
4183
4184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4186#[cfg_attr(feature = "bindings", derive(TS))]
4187pub struct DirectoryInsert {
4188 pub local: bool,
4189 pub path: String,
4190 pub row_format: Option<RowFormat>,
4191 #[serde(default)]
4193 pub stored_as: Option<String>,
4194}
4195
4196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4198#[cfg_attr(feature = "bindings", derive(TS))]
4199pub struct Insert {
4200 pub table: TableRef,
4201 pub columns: Vec<Identifier>,
4202 pub values: Vec<Vec<Expression>>,
4203 pub query: Option<Expression>,
4204 pub overwrite: bool,
4206 pub partition: Vec<(Identifier, Option<Expression>)>,
4208 #[serde(default)]
4210 pub directory: Option<DirectoryInsert>,
4211 #[serde(default)]
4213 pub returning: Vec<Expression>,
4214 #[serde(default)]
4216 pub output: Option<OutputClause>,
4217 #[serde(default)]
4219 pub on_conflict: Option<Box<Expression>>,
4220 #[serde(default)]
4222 pub leading_comments: Vec<String>,
4223 #[serde(default)]
4225 pub if_exists: bool,
4226 #[serde(default)]
4228 pub with: Option<With>,
4229 #[serde(default)]
4231 pub ignore: bool,
4232 #[serde(default)]
4234 pub source_alias: Option<Identifier>,
4235 #[serde(default)]
4237 pub alias: Option<Identifier>,
4238 #[serde(default)]
4240 pub alias_explicit_as: bool,
4241 #[serde(default)]
4243 pub default_values: bool,
4244 #[serde(default)]
4246 pub by_name: bool,
4247 #[serde(default, skip_serializing_if = "Option::is_none")]
4249 pub conflict_action: Option<String>,
4250 #[serde(default)]
4252 pub is_replace: bool,
4253 #[serde(default, skip_serializing_if = "Option::is_none")]
4255 pub hint: Option<Hint>,
4256 #[serde(default)]
4258 pub replace_where: Option<Box<Expression>>,
4259 #[serde(default)]
4261 pub source: Option<Box<Expression>>,
4262 #[serde(default, skip_serializing_if = "Option::is_none")]
4264 pub function_target: Option<Box<Expression>>,
4265 #[serde(default, skip_serializing_if = "Option::is_none")]
4267 pub partition_by: Option<Box<Expression>>,
4268 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4270 pub settings: Vec<Expression>,
4271}
4272
4273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4275#[cfg_attr(feature = "bindings", derive(TS))]
4276pub struct OutputClause {
4277 pub columns: Vec<Expression>,
4279 #[serde(default)]
4281 pub into_table: Option<Expression>,
4282}
4283
4284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4286#[cfg_attr(feature = "bindings", derive(TS))]
4287pub struct Update {
4288 pub table: TableRef,
4289 #[serde(default)]
4291 pub extra_tables: Vec<TableRef>,
4292 #[serde(default)]
4294 pub table_joins: Vec<Join>,
4295 pub set: Vec<(Identifier, Expression)>,
4296 pub from_clause: Option<From>,
4297 #[serde(default)]
4299 pub from_joins: Vec<Join>,
4300 pub where_clause: Option<Where>,
4301 #[serde(default)]
4303 pub returning: Vec<Expression>,
4304 #[serde(default)]
4306 pub output: Option<OutputClause>,
4307 #[serde(default)]
4309 pub with: Option<With>,
4310 #[serde(default)]
4312 pub leading_comments: Vec<String>,
4313 #[serde(default)]
4315 pub limit: Option<Expression>,
4316 #[serde(default)]
4318 pub order_by: Option<OrderBy>,
4319 #[serde(default)]
4321 pub from_before_set: bool,
4322}
4323
4324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4326#[cfg_attr(feature = "bindings", derive(TS))]
4327pub struct Delete {
4328 pub table: TableRef,
4329 #[serde(default, skip_serializing_if = "Option::is_none")]
4331 pub on_cluster: Option<OnCluster>,
4332 pub alias: Option<Identifier>,
4334 #[serde(default)]
4336 pub alias_explicit_as: bool,
4337 pub using: Vec<TableRef>,
4339 pub where_clause: Option<Where>,
4340 #[serde(default)]
4342 pub output: Option<OutputClause>,
4343 #[serde(default)]
4345 pub leading_comments: Vec<String>,
4346 #[serde(default)]
4348 pub with: Option<With>,
4349 #[serde(default)]
4351 pub limit: Option<Expression>,
4352 #[serde(default)]
4354 pub order_by: Option<OrderBy>,
4355 #[serde(default)]
4357 pub returning: Vec<Expression>,
4358 #[serde(default)]
4361 pub tables: Vec<TableRef>,
4362 #[serde(default)]
4365 pub tables_from_using: bool,
4366 #[serde(default)]
4368 pub joins: Vec<Join>,
4369 #[serde(default)]
4371 pub force_index: Option<String>,
4372 #[serde(default)]
4374 pub no_from: bool,
4375}
4376
4377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4379#[cfg_attr(feature = "bindings", derive(TS))]
4380pub struct CopyStmt {
4381 pub this: Expression,
4383 pub kind: bool,
4385 pub files: Vec<Expression>,
4387 #[serde(default)]
4389 pub params: Vec<CopyParameter>,
4390 #[serde(default)]
4392 pub credentials: Option<Box<Credentials>>,
4393 #[serde(default)]
4395 pub is_into: bool,
4396 #[serde(default)]
4398 pub with_wrapped: bool,
4399}
4400
4401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4403#[cfg_attr(feature = "bindings", derive(TS))]
4404pub struct CopyParameter {
4405 pub name: String,
4406 pub value: Option<Expression>,
4407 pub values: Vec<Expression>,
4408 #[serde(default)]
4410 pub eq: bool,
4411}
4412
4413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4415#[cfg_attr(feature = "bindings", derive(TS))]
4416pub struct Credentials {
4417 pub credentials: Vec<(String, String)>,
4418 pub encryption: Option<String>,
4419 pub storage: Option<String>,
4420}
4421
4422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4424#[cfg_attr(feature = "bindings", derive(TS))]
4425pub struct PutStmt {
4426 pub source: String,
4428 #[serde(default)]
4430 pub source_quoted: bool,
4431 pub target: Expression,
4433 #[serde(default)]
4435 pub params: Vec<CopyParameter>,
4436}
4437
4438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4440#[cfg_attr(feature = "bindings", derive(TS))]
4441pub struct StageReference {
4442 pub name: String,
4444 #[serde(default)]
4446 pub path: Option<String>,
4447 #[serde(default)]
4449 pub file_format: Option<Expression>,
4450 #[serde(default)]
4452 pub pattern: Option<String>,
4453 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4455 pub quoted: bool,
4456}
4457
4458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4460#[cfg_attr(feature = "bindings", derive(TS))]
4461pub struct HistoricalData {
4462 pub this: Box<Expression>,
4464 pub kind: String,
4466 pub expression: Box<Expression>,
4468}
4469
4470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4475#[cfg_attr(feature = "bindings", derive(TS))]
4476pub struct Alias {
4477 pub this: Expression,
4479 pub alias: Identifier,
4481 #[serde(default)]
4483 pub column_aliases: Vec<Identifier>,
4484 #[serde(default)]
4486 pub pre_alias_comments: Vec<String>,
4487 #[serde(default)]
4489 pub trailing_comments: Vec<String>,
4490 #[serde(default, skip_serializing_if = "Option::is_none")]
4492 pub inferred_type: Option<DataType>,
4493}
4494
4495impl Alias {
4496 pub fn new(this: Expression, alias: Identifier) -> Self {
4498 Self {
4499 this,
4500 alias,
4501 column_aliases: Vec::new(),
4502 pre_alias_comments: Vec::new(),
4503 trailing_comments: Vec::new(),
4504 inferred_type: None,
4505 }
4506 }
4507
4508 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4510 Self {
4511 this,
4512 alias: Identifier::empty(),
4513 column_aliases,
4514 pre_alias_comments: Vec::new(),
4515 trailing_comments: Vec::new(),
4516 inferred_type: None,
4517 }
4518 }
4519}
4520
4521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4528#[cfg_attr(feature = "bindings", derive(TS))]
4529pub struct Cast {
4530 pub this: Expression,
4532 pub to: DataType,
4534 #[serde(default)]
4535 pub trailing_comments: Vec<String>,
4536 #[serde(default)]
4538 pub double_colon_syntax: bool,
4539 #[serde(skip_serializing_if = "Option::is_none", default)]
4541 pub format: Option<Box<Expression>>,
4542 #[serde(skip_serializing_if = "Option::is_none", default)]
4544 pub default: Option<Box<Expression>>,
4545 #[serde(default, skip_serializing_if = "Option::is_none")]
4547 pub inferred_type: Option<DataType>,
4548}
4549
4550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4552#[cfg_attr(feature = "bindings", derive(TS))]
4553pub struct CollationExpr {
4554 pub this: Expression,
4555 pub collation: String,
4556 #[serde(default)]
4558 pub quoted: bool,
4559 #[serde(default)]
4561 pub double_quoted: bool,
4562}
4563
4564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4570#[cfg_attr(feature = "bindings", derive(TS))]
4571pub struct Case {
4572 pub operand: Option<Expression>,
4574 pub whens: Vec<(Expression, Expression)>,
4576 pub else_: Option<Expression>,
4578 #[serde(default)]
4580 #[serde(skip_serializing_if = "Vec::is_empty")]
4581 pub comments: Vec<String>,
4582 #[serde(default, skip_serializing_if = "Option::is_none")]
4584 pub inferred_type: Option<DataType>,
4585}
4586
4587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4595#[cfg_attr(feature = "bindings", derive(TS))]
4596pub struct BinaryOp {
4597 pub left: Expression,
4598 pub right: Expression,
4599 #[serde(default)]
4601 pub left_comments: Vec<String>,
4602 #[serde(default)]
4604 pub operator_comments: Vec<String>,
4605 #[serde(default)]
4607 pub trailing_comments: Vec<String>,
4608 #[serde(default, skip_serializing_if = "Option::is_none")]
4610 pub inferred_type: Option<DataType>,
4611}
4612
4613impl BinaryOp {
4614 pub fn new(left: Expression, right: Expression) -> Self {
4615 Self {
4616 left,
4617 right,
4618 left_comments: Vec::new(),
4619 operator_comments: Vec::new(),
4620 trailing_comments: Vec::new(),
4621 inferred_type: None,
4622 }
4623 }
4624}
4625
4626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4628#[cfg_attr(feature = "bindings", derive(TS))]
4629pub struct LikeOp {
4630 pub left: Expression,
4631 pub right: Expression,
4632 #[serde(default)]
4634 pub escape: Option<Expression>,
4635 #[serde(default)]
4637 pub quantifier: Option<String>,
4638 #[serde(default, skip_serializing_if = "Option::is_none")]
4640 pub inferred_type: Option<DataType>,
4641}
4642
4643impl LikeOp {
4644 pub fn new(left: Expression, right: Expression) -> Self {
4645 Self {
4646 left,
4647 right,
4648 escape: None,
4649 quantifier: None,
4650 inferred_type: None,
4651 }
4652 }
4653
4654 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4655 Self {
4656 left,
4657 right,
4658 escape: Some(escape),
4659 quantifier: None,
4660 inferred_type: None,
4661 }
4662 }
4663}
4664
4665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4669#[cfg_attr(feature = "bindings", derive(TS))]
4670pub struct UnaryOp {
4671 pub this: Expression,
4673 #[serde(default, skip_serializing_if = "Option::is_none")]
4675 pub inferred_type: Option<DataType>,
4676}
4677
4678impl UnaryOp {
4679 pub fn new(this: Expression) -> Self {
4680 Self {
4681 this,
4682 inferred_type: None,
4683 }
4684 }
4685}
4686
4687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4692#[cfg_attr(feature = "bindings", derive(TS))]
4693pub struct In {
4694 pub this: Expression,
4696 pub expressions: Vec<Expression>,
4698 pub query: Option<Expression>,
4700 pub not: bool,
4702 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4703 pub global: bool,
4704 #[serde(default, skip_serializing_if = "Option::is_none")]
4706 pub unnest: Option<Box<Expression>>,
4707 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4711 pub is_field: bool,
4712}
4713
4714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4716#[cfg_attr(feature = "bindings", derive(TS))]
4717pub struct Between {
4718 pub this: Expression,
4720 pub low: Expression,
4722 pub high: Expression,
4724 pub not: bool,
4726 #[serde(default)]
4728 pub symmetric: Option<bool>,
4729}
4730
4731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4733#[cfg_attr(feature = "bindings", derive(TS))]
4734pub struct IsNull {
4735 pub this: Expression,
4736 pub not: bool,
4737 #[serde(default)]
4739 pub postfix_form: bool,
4740}
4741
4742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4744#[cfg_attr(feature = "bindings", derive(TS))]
4745pub struct IsTrueFalse {
4746 pub this: Expression,
4747 pub not: bool,
4748}
4749
4750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4753#[cfg_attr(feature = "bindings", derive(TS))]
4754pub struct IsJson {
4755 pub this: Expression,
4756 pub json_type: Option<String>,
4758 pub unique_keys: Option<JsonUniqueKeys>,
4760 pub negated: bool,
4762}
4763
4764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4766#[cfg_attr(feature = "bindings", derive(TS))]
4767pub enum JsonUniqueKeys {
4768 With,
4770 Without,
4772 Shorthand,
4774}
4775
4776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4778#[cfg_attr(feature = "bindings", derive(TS))]
4779pub struct Exists {
4780 pub this: Expression,
4782 pub not: bool,
4784}
4785
4786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4793#[cfg_attr(feature = "bindings", derive(TS))]
4794pub struct Function {
4795 pub name: String,
4797 pub args: Vec<Expression>,
4799 pub distinct: bool,
4801 #[serde(default)]
4802 pub trailing_comments: Vec<String>,
4803 #[serde(default)]
4805 pub use_bracket_syntax: bool,
4806 #[serde(default)]
4808 pub no_parens: bool,
4809 #[serde(default)]
4811 pub quoted: bool,
4812 #[serde(default, skip_serializing_if = "Option::is_none")]
4814 pub span: Option<Span>,
4815 #[serde(default, skip_serializing_if = "Option::is_none")]
4817 pub inferred_type: Option<DataType>,
4818}
4819
4820impl Default for Function {
4821 fn default() -> Self {
4822 Self {
4823 name: String::new(),
4824 args: Vec::new(),
4825 distinct: false,
4826 trailing_comments: Vec::new(),
4827 use_bracket_syntax: false,
4828 no_parens: false,
4829 quoted: false,
4830 span: None,
4831 inferred_type: None,
4832 }
4833 }
4834}
4835
4836impl Function {
4837 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4838 Self {
4839 name: name.into(),
4840 args,
4841 distinct: false,
4842 trailing_comments: Vec::new(),
4843 use_bracket_syntax: false,
4844 no_parens: false,
4845 quoted: false,
4846 span: None,
4847 inferred_type: None,
4848 }
4849 }
4850}
4851
4852#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4859#[cfg_attr(feature = "bindings", derive(TS))]
4860pub struct AggregateFunction {
4861 pub name: String,
4863 pub args: Vec<Expression>,
4865 pub distinct: bool,
4867 pub filter: Option<Expression>,
4869 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4871 pub order_by: Vec<Ordered>,
4872 #[serde(default, skip_serializing_if = "Option::is_none")]
4874 pub limit: Option<Box<Expression>>,
4875 #[serde(default, skip_serializing_if = "Option::is_none")]
4877 pub ignore_nulls: Option<bool>,
4878 #[serde(default, skip_serializing_if = "Option::is_none")]
4880 pub inferred_type: Option<DataType>,
4881}
4882
4883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4890#[cfg_attr(feature = "bindings", derive(TS))]
4891pub struct WindowFunction {
4892 pub this: Expression,
4894 pub over: Over,
4896 #[serde(default, skip_serializing_if = "Option::is_none")]
4898 pub keep: Option<Keep>,
4899 #[serde(default, skip_serializing_if = "Option::is_none")]
4901 pub inferred_type: Option<DataType>,
4902}
4903
4904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4907#[cfg_attr(feature = "bindings", derive(TS))]
4908pub struct Keep {
4909 pub first: bool,
4911 pub order_by: Vec<Ordered>,
4913}
4914
4915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4917#[cfg_attr(feature = "bindings", derive(TS))]
4918pub struct WithinGroup {
4919 pub this: Expression,
4921 pub order_by: Vec<Ordered>,
4923}
4924
4925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4930#[cfg_attr(feature = "bindings", derive(TS))]
4931pub struct From {
4932 pub expressions: Vec<Expression>,
4934}
4935
4936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4942#[cfg_attr(feature = "bindings", derive(TS))]
4943pub struct Join {
4944 pub this: Expression,
4946 pub on: Option<Expression>,
4948 pub using: Vec<Identifier>,
4950 pub kind: JoinKind,
4952 pub use_inner_keyword: bool,
4954 pub use_outer_keyword: bool,
4956 pub deferred_condition: bool,
4958 #[serde(default, skip_serializing_if = "Option::is_none")]
4960 pub join_hint: Option<String>,
4961 #[serde(default, skip_serializing_if = "Option::is_none")]
4963 pub match_condition: Option<Expression>,
4964 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4966 pub pivots: Vec<Expression>,
4967 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4969 pub comments: Vec<String>,
4970 #[serde(default)]
4974 pub nesting_group: usize,
4975 #[serde(default)]
4977 pub directed: bool,
4978}
4979
4980#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4987#[cfg_attr(feature = "bindings", derive(TS))]
4988pub enum JoinKind {
4989 Inner,
4990 Left,
4991 Right,
4992 Full,
4993 Outer, Cross,
4995 Natural,
4996 NaturalLeft,
4997 NaturalRight,
4998 NaturalFull,
4999 Semi,
5000 Anti,
5001 LeftSemi,
5003 LeftAnti,
5004 RightSemi,
5005 RightAnti,
5006 CrossApply,
5008 OuterApply,
5009 AsOf,
5011 AsOfLeft,
5012 AsOfRight,
5013 Lateral,
5015 LeftLateral,
5016 Straight,
5018 Implicit,
5020 Array,
5022 LeftArray,
5023 Paste,
5025 Positional,
5027}
5028
5029impl Default for JoinKind {
5030 fn default() -> Self {
5031 JoinKind::Inner
5032 }
5033}
5034
5035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5038#[cfg_attr(feature = "bindings", derive(TS))]
5039pub struct JoinedTable {
5040 pub left: Expression,
5042 pub joins: Vec<Join>,
5044 pub lateral_views: Vec<LateralView>,
5046 pub alias: Option<Identifier>,
5048}
5049
5050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5052#[cfg_attr(feature = "bindings", derive(TS))]
5053pub struct Where {
5054 pub this: Expression,
5056}
5057
5058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5063#[cfg_attr(feature = "bindings", derive(TS))]
5064pub struct GroupBy {
5065 pub expressions: Vec<Expression>,
5067 #[serde(default)]
5069 pub all: Option<bool>,
5070 #[serde(default)]
5072 pub totals: bool,
5073 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5075 pub comments: Vec<String>,
5076}
5077
5078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5080#[cfg_attr(feature = "bindings", derive(TS))]
5081pub struct Having {
5082 pub this: Expression,
5084 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5086 pub comments: Vec<String>,
5087}
5088
5089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5091#[cfg_attr(feature = "bindings", derive(TS))]
5092pub struct OrderBy {
5093 pub expressions: Vec<Ordered>,
5095 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5097 pub siblings: bool,
5098 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5100 pub comments: Vec<String>,
5101}
5102
5103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5110#[cfg_attr(feature = "bindings", derive(TS))]
5111pub struct Ordered {
5112 pub this: Expression,
5114 pub desc: bool,
5116 pub nulls_first: Option<bool>,
5118 #[serde(default)]
5120 pub explicit_asc: bool,
5121 #[serde(default, skip_serializing_if = "Option::is_none")]
5123 pub with_fill: Option<Box<WithFill>>,
5124}
5125
5126impl Ordered {
5127 pub fn asc(expr: Expression) -> Self {
5128 Self {
5129 this: expr,
5130 desc: false,
5131 nulls_first: None,
5132 explicit_asc: false,
5133 with_fill: None,
5134 }
5135 }
5136
5137 pub fn desc(expr: Expression) -> Self {
5138 Self {
5139 this: expr,
5140 desc: true,
5141 nulls_first: None,
5142 explicit_asc: false,
5143 with_fill: None,
5144 }
5145 }
5146}
5147
5148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5151#[cfg_attr(feature = "bindings", derive(TS))]
5152#[cfg_attr(feature = "bindings", ts(export))]
5153pub struct DistributeBy {
5154 pub expressions: Vec<Expression>,
5155}
5156
5157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5160#[cfg_attr(feature = "bindings", derive(TS))]
5161#[cfg_attr(feature = "bindings", ts(export))]
5162pub struct ClusterBy {
5163 pub expressions: Vec<Ordered>,
5164}
5165
5166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5169#[cfg_attr(feature = "bindings", derive(TS))]
5170#[cfg_attr(feature = "bindings", ts(export))]
5171pub struct SortBy {
5172 pub expressions: Vec<Ordered>,
5173}
5174
5175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5178#[cfg_attr(feature = "bindings", derive(TS))]
5179#[cfg_attr(feature = "bindings", ts(export))]
5180pub struct LateralView {
5181 pub this: Expression,
5183 pub table_alias: Option<Identifier>,
5185 pub column_aliases: Vec<Identifier>,
5187 pub outer: bool,
5189}
5190
5191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5193#[cfg_attr(feature = "bindings", derive(TS))]
5194#[cfg_attr(feature = "bindings", ts(export))]
5195pub struct Hint {
5196 pub expressions: Vec<HintExpression>,
5197}
5198
5199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5201#[cfg_attr(feature = "bindings", derive(TS))]
5202#[cfg_attr(feature = "bindings", ts(export))]
5203pub enum HintExpression {
5204 Function { name: String, args: Vec<Expression> },
5206 Identifier(String),
5208 Raw(String),
5210}
5211
5212#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5214#[cfg_attr(feature = "bindings", derive(TS))]
5215#[cfg_attr(feature = "bindings", ts(export))]
5216pub enum PseudocolumnType {
5217 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5224
5225impl PseudocolumnType {
5226 pub fn as_str(&self) -> &'static str {
5227 match self {
5228 PseudocolumnType::Rownum => "ROWNUM",
5229 PseudocolumnType::Rowid => "ROWID",
5230 PseudocolumnType::Level => "LEVEL",
5231 PseudocolumnType::Sysdate => "SYSDATE",
5232 PseudocolumnType::ObjectId => "OBJECT_ID",
5233 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5234 }
5235 }
5236
5237 pub fn from_str(s: &str) -> Option<Self> {
5238 match s.to_uppercase().as_str() {
5239 "ROWNUM" => Some(PseudocolumnType::Rownum),
5240 "ROWID" => Some(PseudocolumnType::Rowid),
5241 "LEVEL" => Some(PseudocolumnType::Level),
5242 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5243 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5244 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5245 _ => None,
5246 }
5247 }
5248}
5249
5250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5253#[cfg_attr(feature = "bindings", derive(TS))]
5254#[cfg_attr(feature = "bindings", ts(export))]
5255pub struct Pseudocolumn {
5256 pub kind: PseudocolumnType,
5257}
5258
5259impl Pseudocolumn {
5260 pub fn rownum() -> Self {
5261 Self {
5262 kind: PseudocolumnType::Rownum,
5263 }
5264 }
5265
5266 pub fn rowid() -> Self {
5267 Self {
5268 kind: PseudocolumnType::Rowid,
5269 }
5270 }
5271
5272 pub fn level() -> Self {
5273 Self {
5274 kind: PseudocolumnType::Level,
5275 }
5276 }
5277}
5278
5279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5281#[cfg_attr(feature = "bindings", derive(TS))]
5282#[cfg_attr(feature = "bindings", ts(export))]
5283pub struct Connect {
5284 pub start: Option<Expression>,
5286 pub connect: Expression,
5288 pub nocycle: bool,
5290}
5291
5292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5294#[cfg_attr(feature = "bindings", derive(TS))]
5295#[cfg_attr(feature = "bindings", ts(export))]
5296pub struct Prior {
5297 pub this: Expression,
5298}
5299
5300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5302#[cfg_attr(feature = "bindings", derive(TS))]
5303#[cfg_attr(feature = "bindings", ts(export))]
5304pub struct ConnectByRoot {
5305 pub this: Expression,
5306}
5307
5308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5310#[cfg_attr(feature = "bindings", derive(TS))]
5311#[cfg_attr(feature = "bindings", ts(export))]
5312pub struct MatchRecognize {
5313 pub this: Option<Box<Expression>>,
5315 pub partition_by: Option<Vec<Expression>>,
5317 pub order_by: Option<Vec<Ordered>>,
5319 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5321 pub rows: Option<MatchRecognizeRows>,
5323 pub after: Option<MatchRecognizeAfter>,
5325 pub pattern: Option<String>,
5327 pub define: Option<Vec<(Identifier, Expression)>>,
5329 pub alias: Option<Identifier>,
5331 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5333 pub alias_explicit_as: bool,
5334}
5335
5336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5338#[cfg_attr(feature = "bindings", derive(TS))]
5339#[cfg_attr(feature = "bindings", ts(export))]
5340pub struct MatchRecognizeMeasure {
5341 pub this: Expression,
5343 pub window_frame: Option<MatchRecognizeSemantics>,
5345}
5346
5347#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5349#[cfg_attr(feature = "bindings", derive(TS))]
5350#[cfg_attr(feature = "bindings", ts(export))]
5351pub enum MatchRecognizeSemantics {
5352 Running,
5353 Final,
5354}
5355
5356#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5358#[cfg_attr(feature = "bindings", derive(TS))]
5359#[cfg_attr(feature = "bindings", ts(export))]
5360pub enum MatchRecognizeRows {
5361 OneRowPerMatch,
5362 AllRowsPerMatch,
5363 AllRowsPerMatchShowEmptyMatches,
5364 AllRowsPerMatchOmitEmptyMatches,
5365 AllRowsPerMatchWithUnmatchedRows,
5366}
5367
5368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5370#[cfg_attr(feature = "bindings", derive(TS))]
5371#[cfg_attr(feature = "bindings", ts(export))]
5372pub enum MatchRecognizeAfter {
5373 PastLastRow,
5374 ToNextRow,
5375 ToFirst(Identifier),
5376 ToLast(Identifier),
5377}
5378
5379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5381#[cfg_attr(feature = "bindings", derive(TS))]
5382pub struct Limit {
5383 pub this: Expression,
5385 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5387 pub percent: bool,
5388 #[serde(default)]
5390 #[serde(skip_serializing_if = "Vec::is_empty")]
5391 pub comments: Vec<String>,
5392}
5393
5394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5396#[cfg_attr(feature = "bindings", derive(TS))]
5397pub struct Offset {
5398 pub this: Expression,
5399 #[serde(skip_serializing_if = "Option::is_none", default)]
5401 pub rows: Option<bool>,
5402}
5403
5404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5406#[cfg_attr(feature = "bindings", derive(TS))]
5407pub struct Top {
5408 pub this: Expression,
5409 pub percent: bool,
5410 pub with_ties: bool,
5411 #[serde(default)]
5413 pub parenthesized: bool,
5414}
5415
5416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5418#[cfg_attr(feature = "bindings", derive(TS))]
5419pub struct Fetch {
5420 pub direction: String,
5422 pub count: Option<Expression>,
5424 pub percent: bool,
5426 pub rows: bool,
5428 pub with_ties: bool,
5430}
5431
5432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5438#[cfg_attr(feature = "bindings", derive(TS))]
5439pub struct Qualify {
5440 pub this: Expression,
5442}
5443
5444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5446#[cfg_attr(feature = "bindings", derive(TS))]
5447pub struct Sample {
5448 pub method: SampleMethod,
5449 pub size: Expression,
5450 pub seed: Option<Expression>,
5451 #[serde(default)]
5453 pub offset: Option<Expression>,
5454 pub unit_after_size: bool,
5456 #[serde(default)]
5458 pub use_sample_keyword: bool,
5459 #[serde(default)]
5461 pub explicit_method: bool,
5462 #[serde(default)]
5464 pub method_before_size: bool,
5465 #[serde(default)]
5467 pub use_seed_keyword: bool,
5468 pub bucket_numerator: Option<Box<Expression>>,
5470 pub bucket_denominator: Option<Box<Expression>>,
5472 pub bucket_field: Option<Box<Expression>>,
5474 #[serde(default)]
5476 pub is_using_sample: bool,
5477 #[serde(default)]
5479 pub is_percent: bool,
5480 #[serde(default)]
5482 pub suppress_method_output: bool,
5483}
5484
5485#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5487#[cfg_attr(feature = "bindings", derive(TS))]
5488pub enum SampleMethod {
5489 Bernoulli,
5490 System,
5491 Block,
5492 Row,
5493 Percent,
5494 Bucket,
5496 Reservoir,
5498}
5499
5500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5502#[cfg_attr(feature = "bindings", derive(TS))]
5503pub struct NamedWindow {
5504 pub name: Identifier,
5505 pub spec: Over,
5506}
5507
5508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5514#[cfg_attr(feature = "bindings", derive(TS))]
5515pub struct With {
5516 pub ctes: Vec<Cte>,
5518 pub recursive: bool,
5520 #[serde(default)]
5522 pub leading_comments: Vec<String>,
5523 #[serde(default, skip_serializing_if = "Option::is_none")]
5525 pub search: Option<Box<Expression>>,
5526}
5527
5528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5535#[cfg_attr(feature = "bindings", derive(TS))]
5536pub struct Cte {
5537 pub alias: Identifier,
5539 pub this: Expression,
5541 pub columns: Vec<Identifier>,
5543 pub materialized: Option<bool>,
5545 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5547 pub key_expressions: Vec<Identifier>,
5548 #[serde(default)]
5550 pub alias_first: bool,
5551 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5553 pub comments: Vec<String>,
5554}
5555
5556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5558#[cfg_attr(feature = "bindings", derive(TS))]
5559pub struct WindowSpec {
5560 pub partition_by: Vec<Expression>,
5561 pub order_by: Vec<Ordered>,
5562 pub frame: Option<WindowFrame>,
5563}
5564
5565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5567#[cfg_attr(feature = "bindings", derive(TS))]
5568pub struct Over {
5569 pub window_name: Option<Identifier>,
5571 pub partition_by: Vec<Expression>,
5572 pub order_by: Vec<Ordered>,
5573 pub frame: Option<WindowFrame>,
5574 pub alias: Option<Identifier>,
5575}
5576
5577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5579#[cfg_attr(feature = "bindings", derive(TS))]
5580pub struct WindowFrame {
5581 pub kind: WindowFrameKind,
5582 pub start: WindowFrameBound,
5583 pub end: Option<WindowFrameBound>,
5584 pub exclude: Option<WindowFrameExclude>,
5585 #[serde(default, skip_serializing_if = "Option::is_none")]
5587 pub kind_text: Option<String>,
5588 #[serde(default, skip_serializing_if = "Option::is_none")]
5590 pub start_side_text: Option<String>,
5591 #[serde(default, skip_serializing_if = "Option::is_none")]
5593 pub end_side_text: Option<String>,
5594}
5595
5596#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5597#[cfg_attr(feature = "bindings", derive(TS))]
5598pub enum WindowFrameKind {
5599 Rows,
5600 Range,
5601 Groups,
5602}
5603
5604#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5606#[cfg_attr(feature = "bindings", derive(TS))]
5607pub enum WindowFrameExclude {
5608 CurrentRow,
5609 Group,
5610 Ties,
5611 NoOthers,
5612}
5613
5614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5615#[cfg_attr(feature = "bindings", derive(TS))]
5616pub enum WindowFrameBound {
5617 CurrentRow,
5618 UnboundedPreceding,
5619 UnboundedFollowing,
5620 Preceding(Box<Expression>),
5621 Following(Box<Expression>),
5622 BarePreceding,
5624 BareFollowing,
5626 Value(Box<Expression>),
5628}
5629
5630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5632#[cfg_attr(feature = "bindings", derive(TS))]
5633pub struct StructField {
5634 pub name: String,
5635 pub data_type: DataType,
5636 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5637 pub options: Vec<Expression>,
5638 #[serde(default, skip_serializing_if = "Option::is_none")]
5639 pub comment: Option<String>,
5640}
5641
5642impl StructField {
5643 pub fn new(name: String, data_type: DataType) -> Self {
5645 Self {
5646 name,
5647 data_type,
5648 options: Vec::new(),
5649 comment: None,
5650 }
5651 }
5652
5653 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5655 Self {
5656 name,
5657 data_type,
5658 options,
5659 comment: None,
5660 }
5661 }
5662
5663 pub fn with_options_and_comment(
5665 name: String,
5666 data_type: DataType,
5667 options: Vec<Expression>,
5668 comment: Option<String>,
5669 ) -> Self {
5670 Self {
5671 name,
5672 data_type,
5673 options,
5674 comment,
5675 }
5676 }
5677}
5678
5679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5691#[cfg_attr(feature = "bindings", derive(TS))]
5692#[serde(tag = "data_type", rename_all = "snake_case")]
5693pub enum DataType {
5694 Boolean,
5696 TinyInt {
5697 length: Option<u32>,
5698 },
5699 SmallInt {
5700 length: Option<u32>,
5701 },
5702 Int {
5706 length: Option<u32>,
5707 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5708 integer_spelling: bool,
5709 },
5710 BigInt {
5711 length: Option<u32>,
5712 },
5713 Float {
5717 precision: Option<u32>,
5718 scale: Option<u32>,
5719 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5720 real_spelling: bool,
5721 },
5722 Double {
5723 precision: Option<u32>,
5724 scale: Option<u32>,
5725 },
5726 Decimal {
5727 precision: Option<u32>,
5728 scale: Option<u32>,
5729 },
5730
5731 Char {
5733 length: Option<u32>,
5734 },
5735 VarChar {
5738 length: Option<u32>,
5739 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5740 parenthesized_length: bool,
5741 },
5742 String {
5744 length: Option<u32>,
5745 },
5746 Text,
5747 TextWithLength {
5749 length: u32,
5750 },
5751
5752 Binary {
5754 length: Option<u32>,
5755 },
5756 VarBinary {
5757 length: Option<u32>,
5758 },
5759 Blob,
5760
5761 Bit {
5763 length: Option<u32>,
5764 },
5765 VarBit {
5766 length: Option<u32>,
5767 },
5768
5769 Date,
5771 Time {
5772 precision: Option<u32>,
5773 #[serde(default)]
5774 timezone: bool,
5775 },
5776 Timestamp {
5777 precision: Option<u32>,
5778 timezone: bool,
5779 },
5780 Interval {
5781 unit: Option<String>,
5782 #[serde(default, skip_serializing_if = "Option::is_none")]
5784 to: Option<String>,
5785 },
5786
5787 Json,
5789 JsonB,
5790
5791 Uuid,
5793
5794 Array {
5796 element_type: Box<DataType>,
5797 #[serde(default, skip_serializing_if = "Option::is_none")]
5799 dimension: Option<u32>,
5800 },
5801
5802 List {
5805 element_type: Box<DataType>,
5806 },
5807
5808 Struct {
5812 fields: Vec<StructField>,
5813 nested: bool,
5814 },
5815 Map {
5816 key_type: Box<DataType>,
5817 value_type: Box<DataType>,
5818 },
5819
5820 Enum {
5822 values: Vec<String>,
5823 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5824 assignments: Vec<Option<String>>,
5825 },
5826
5827 Set {
5829 values: Vec<String>,
5830 },
5831
5832 Union {
5834 fields: Vec<(String, DataType)>,
5835 },
5836
5837 Vector {
5839 #[serde(default)]
5840 element_type: Option<Box<DataType>>,
5841 dimension: Option<u32>,
5842 },
5843
5844 Object {
5847 fields: Vec<(String, DataType, bool)>,
5848 modifier: Option<String>,
5849 },
5850
5851 Nullable {
5853 inner: Box<DataType>,
5854 },
5855
5856 Custom {
5858 name: String,
5859 },
5860
5861 Geometry {
5863 subtype: Option<String>,
5864 srid: Option<u32>,
5865 },
5866 Geography {
5867 subtype: Option<String>,
5868 srid: Option<u32>,
5869 },
5870
5871 CharacterSet {
5874 name: String,
5875 },
5876
5877 Unknown,
5879}
5880
5881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5883#[cfg_attr(feature = "bindings", derive(TS))]
5884#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5885pub struct Array {
5886 pub expressions: Vec<Expression>,
5887}
5888
5889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5891#[cfg_attr(feature = "bindings", derive(TS))]
5892pub struct Struct {
5893 pub fields: Vec<(Option<String>, Expression)>,
5894}
5895
5896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5898#[cfg_attr(feature = "bindings", derive(TS))]
5899pub struct Tuple {
5900 pub expressions: Vec<Expression>,
5901}
5902
5903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5905#[cfg_attr(feature = "bindings", derive(TS))]
5906pub struct Interval {
5907 pub this: Option<Expression>,
5909 pub unit: Option<IntervalUnitSpec>,
5911}
5912
5913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5915#[cfg_attr(feature = "bindings", derive(TS))]
5916#[serde(tag = "type", rename_all = "snake_case")]
5917pub enum IntervalUnitSpec {
5918 Simple {
5920 unit: IntervalUnit,
5921 use_plural: bool,
5923 },
5924 Span(IntervalSpan),
5926 ExprSpan(IntervalSpanExpr),
5929 Expr(Box<Expression>),
5931}
5932
5933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5935#[cfg_attr(feature = "bindings", derive(TS))]
5936pub struct IntervalSpan {
5937 pub this: IntervalUnit,
5939 pub expression: IntervalUnit,
5941}
5942
5943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5946#[cfg_attr(feature = "bindings", derive(TS))]
5947pub struct IntervalSpanExpr {
5948 pub this: Box<Expression>,
5950 pub expression: Box<Expression>,
5952}
5953
5954#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5955#[cfg_attr(feature = "bindings", derive(TS))]
5956pub enum IntervalUnit {
5957 Year,
5958 Quarter,
5959 Month,
5960 Week,
5961 Day,
5962 Hour,
5963 Minute,
5964 Second,
5965 Millisecond,
5966 Microsecond,
5967 Nanosecond,
5968}
5969
5970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5972#[cfg_attr(feature = "bindings", derive(TS))]
5973pub struct Command {
5974 pub this: String,
5976}
5977
5978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5981#[cfg_attr(feature = "bindings", derive(TS))]
5982pub struct ExecuteStatement {
5983 pub this: Expression,
5985 #[serde(default)]
5987 pub parameters: Vec<ExecuteParameter>,
5988 #[serde(default, skip_serializing_if = "Option::is_none")]
5990 pub suffix: Option<String>,
5991}
5992
5993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5995#[cfg_attr(feature = "bindings", derive(TS))]
5996pub struct ExecuteParameter {
5997 pub name: String,
5999 pub value: Expression,
6001 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6003 pub positional: bool,
6004 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6006 pub output: bool,
6007}
6008
6009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6012#[cfg_attr(feature = "bindings", derive(TS))]
6013pub struct Kill {
6014 pub this: Expression,
6016 pub kind: Option<String>,
6018}
6019
6020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6022#[cfg_attr(feature = "bindings", derive(TS))]
6023pub struct CreateTask {
6024 pub or_replace: bool,
6025 pub if_not_exists: bool,
6026 pub name: String,
6028 pub properties: String,
6030 pub body: Expression,
6032}
6033
6034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6036#[cfg_attr(feature = "bindings", derive(TS))]
6037pub struct Raw {
6038 pub sql: String,
6039}
6040
6041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6047#[cfg_attr(feature = "bindings", derive(TS))]
6048pub struct UnaryFunc {
6049 pub this: Expression,
6050 #[serde(skip_serializing_if = "Option::is_none", default)]
6052 pub original_name: Option<String>,
6053 #[serde(default, skip_serializing_if = "Option::is_none")]
6055 pub inferred_type: Option<DataType>,
6056}
6057
6058impl UnaryFunc {
6059 pub fn new(this: Expression) -> Self {
6061 Self {
6062 this,
6063 original_name: None,
6064 inferred_type: None,
6065 }
6066 }
6067
6068 pub fn with_name(this: Expression, name: String) -> Self {
6070 Self {
6071 this,
6072 original_name: Some(name),
6073 inferred_type: None,
6074 }
6075 }
6076}
6077
6078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6082#[cfg_attr(feature = "bindings", derive(TS))]
6083pub struct CharFunc {
6084 pub args: Vec<Expression>,
6085 #[serde(skip_serializing_if = "Option::is_none", default)]
6086 pub charset: Option<String>,
6087 #[serde(skip_serializing_if = "Option::is_none", default)]
6089 pub name: Option<String>,
6090}
6091
6092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6094#[cfg_attr(feature = "bindings", derive(TS))]
6095pub struct BinaryFunc {
6096 pub this: Expression,
6097 pub expression: Expression,
6098 #[serde(skip_serializing_if = "Option::is_none", default)]
6100 pub original_name: Option<String>,
6101 #[serde(default, skip_serializing_if = "Option::is_none")]
6103 pub inferred_type: Option<DataType>,
6104}
6105
6106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6108#[cfg_attr(feature = "bindings", derive(TS))]
6109pub struct VarArgFunc {
6110 pub expressions: Vec<Expression>,
6111 #[serde(skip_serializing_if = "Option::is_none", default)]
6113 pub original_name: Option<String>,
6114 #[serde(default, skip_serializing_if = "Option::is_none")]
6116 pub inferred_type: Option<DataType>,
6117}
6118
6119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6121#[cfg_attr(feature = "bindings", derive(TS))]
6122pub struct ConcatWs {
6123 pub separator: Expression,
6124 pub expressions: Vec<Expression>,
6125}
6126
6127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6129#[cfg_attr(feature = "bindings", derive(TS))]
6130pub struct SubstringFunc {
6131 pub this: Expression,
6132 pub start: Expression,
6133 pub length: Option<Expression>,
6134 #[serde(default)]
6136 pub from_for_syntax: bool,
6137}
6138
6139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6141#[cfg_attr(feature = "bindings", derive(TS))]
6142pub struct OverlayFunc {
6143 pub this: Expression,
6144 pub replacement: Expression,
6145 pub from: Expression,
6146 pub length: Option<Expression>,
6147}
6148
6149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6151#[cfg_attr(feature = "bindings", derive(TS))]
6152pub struct TrimFunc {
6153 pub this: Expression,
6154 pub characters: Option<Expression>,
6155 pub position: TrimPosition,
6156 #[serde(default)]
6158 pub sql_standard_syntax: bool,
6159 #[serde(default)]
6161 pub position_explicit: bool,
6162}
6163
6164#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6165#[cfg_attr(feature = "bindings", derive(TS))]
6166pub enum TrimPosition {
6167 Both,
6168 Leading,
6169 Trailing,
6170}
6171
6172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6174#[cfg_attr(feature = "bindings", derive(TS))]
6175pub struct ReplaceFunc {
6176 pub this: Expression,
6177 pub old: Expression,
6178 pub new: Expression,
6179}
6180
6181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6183#[cfg_attr(feature = "bindings", derive(TS))]
6184pub struct LeftRightFunc {
6185 pub this: Expression,
6186 pub length: Expression,
6187}
6188
6189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6191#[cfg_attr(feature = "bindings", derive(TS))]
6192pub struct RepeatFunc {
6193 pub this: Expression,
6194 pub times: Expression,
6195}
6196
6197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6199#[cfg_attr(feature = "bindings", derive(TS))]
6200pub struct PadFunc {
6201 pub this: Expression,
6202 pub length: Expression,
6203 pub fill: Option<Expression>,
6204}
6205
6206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6208#[cfg_attr(feature = "bindings", derive(TS))]
6209pub struct SplitFunc {
6210 pub this: Expression,
6211 pub delimiter: Expression,
6212}
6213
6214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6216#[cfg_attr(feature = "bindings", derive(TS))]
6217pub struct RegexpFunc {
6218 pub this: Expression,
6219 pub pattern: Expression,
6220 pub flags: Option<Expression>,
6221}
6222
6223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6225#[cfg_attr(feature = "bindings", derive(TS))]
6226pub struct RegexpReplaceFunc {
6227 pub this: Expression,
6228 pub pattern: Expression,
6229 pub replacement: Expression,
6230 pub flags: Option<Expression>,
6231}
6232
6233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6235#[cfg_attr(feature = "bindings", derive(TS))]
6236pub struct RegexpExtractFunc {
6237 pub this: Expression,
6238 pub pattern: Expression,
6239 pub group: Option<Expression>,
6240}
6241
6242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6244#[cfg_attr(feature = "bindings", derive(TS))]
6245pub struct RoundFunc {
6246 pub this: Expression,
6247 pub decimals: Option<Expression>,
6248}
6249
6250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6252#[cfg_attr(feature = "bindings", derive(TS))]
6253pub struct FloorFunc {
6254 pub this: Expression,
6255 pub scale: Option<Expression>,
6256 #[serde(skip_serializing_if = "Option::is_none", default)]
6258 pub to: Option<Expression>,
6259}
6260
6261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6263#[cfg_attr(feature = "bindings", derive(TS))]
6264pub struct CeilFunc {
6265 pub this: Expression,
6266 #[serde(skip_serializing_if = "Option::is_none", default)]
6267 pub decimals: Option<Expression>,
6268 #[serde(skip_serializing_if = "Option::is_none", default)]
6270 pub to: Option<Expression>,
6271}
6272
6273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6275#[cfg_attr(feature = "bindings", derive(TS))]
6276pub struct LogFunc {
6277 pub this: Expression,
6278 pub base: Option<Expression>,
6279}
6280
6281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6283#[cfg_attr(feature = "bindings", derive(TS))]
6284pub struct CurrentDate;
6285
6286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6288#[cfg_attr(feature = "bindings", derive(TS))]
6289pub struct CurrentTime {
6290 pub precision: Option<u32>,
6291}
6292
6293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6295#[cfg_attr(feature = "bindings", derive(TS))]
6296pub struct CurrentTimestamp {
6297 pub precision: Option<u32>,
6298 #[serde(default)]
6300 pub sysdate: bool,
6301}
6302
6303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6305#[cfg_attr(feature = "bindings", derive(TS))]
6306pub struct CurrentTimestampLTZ {
6307 pub precision: Option<u32>,
6308}
6309
6310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6312#[cfg_attr(feature = "bindings", derive(TS))]
6313pub struct AtTimeZone {
6314 pub this: Expression,
6316 pub zone: Expression,
6318}
6319
6320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6322#[cfg_attr(feature = "bindings", derive(TS))]
6323pub struct DateAddFunc {
6324 pub this: Expression,
6325 pub interval: Expression,
6326 pub unit: IntervalUnit,
6327}
6328
6329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6331#[cfg_attr(feature = "bindings", derive(TS))]
6332pub struct DateDiffFunc {
6333 pub this: Expression,
6334 pub expression: Expression,
6335 pub unit: Option<IntervalUnit>,
6336}
6337
6338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6340#[cfg_attr(feature = "bindings", derive(TS))]
6341pub struct DateTruncFunc {
6342 pub this: Expression,
6343 pub unit: DateTimeField,
6344}
6345
6346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6348#[cfg_attr(feature = "bindings", derive(TS))]
6349pub struct ExtractFunc {
6350 pub this: Expression,
6351 pub field: DateTimeField,
6352}
6353
6354#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6355#[cfg_attr(feature = "bindings", derive(TS))]
6356pub enum DateTimeField {
6357 Year,
6358 Month,
6359 Day,
6360 Hour,
6361 Minute,
6362 Second,
6363 Millisecond,
6364 Microsecond,
6365 DayOfWeek,
6366 DayOfYear,
6367 Week,
6368 WeekWithModifier(String),
6370 Quarter,
6371 Epoch,
6372 Timezone,
6373 TimezoneHour,
6374 TimezoneMinute,
6375 Date,
6376 Time,
6377 Custom(String),
6379}
6380
6381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6383#[cfg_attr(feature = "bindings", derive(TS))]
6384pub struct ToDateFunc {
6385 pub this: Expression,
6386 pub format: Option<Expression>,
6387}
6388
6389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6391#[cfg_attr(feature = "bindings", derive(TS))]
6392pub struct ToTimestampFunc {
6393 pub this: Expression,
6394 pub format: Option<Expression>,
6395}
6396
6397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6399#[cfg_attr(feature = "bindings", derive(TS))]
6400pub struct IfFunc {
6401 pub condition: Expression,
6402 pub true_value: Expression,
6403 pub false_value: Option<Expression>,
6404 #[serde(skip_serializing_if = "Option::is_none", default)]
6406 pub original_name: Option<String>,
6407 #[serde(default, skip_serializing_if = "Option::is_none")]
6409 pub inferred_type: Option<DataType>,
6410}
6411
6412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6414#[cfg_attr(feature = "bindings", derive(TS))]
6415pub struct Nvl2Func {
6416 pub this: Expression,
6417 pub true_value: Expression,
6418 pub false_value: Expression,
6419 #[serde(default, skip_serializing_if = "Option::is_none")]
6421 pub inferred_type: Option<DataType>,
6422}
6423
6424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6430#[cfg_attr(feature = "bindings", derive(TS))]
6431pub struct AggFunc {
6432 pub this: Expression,
6433 pub distinct: bool,
6434 pub filter: Option<Expression>,
6435 pub order_by: Vec<Ordered>,
6436 #[serde(skip_serializing_if = "Option::is_none", default)]
6438 pub name: Option<String>,
6439 #[serde(skip_serializing_if = "Option::is_none", default)]
6441 pub ignore_nulls: Option<bool>,
6442 #[serde(skip_serializing_if = "Option::is_none", default)]
6445 pub having_max: Option<(Box<Expression>, bool)>,
6446 #[serde(skip_serializing_if = "Option::is_none", default)]
6448 pub limit: Option<Box<Expression>>,
6449 #[serde(default, skip_serializing_if = "Option::is_none")]
6451 pub inferred_type: Option<DataType>,
6452}
6453
6454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6456#[cfg_attr(feature = "bindings", derive(TS))]
6457pub struct CountFunc {
6458 pub this: Option<Expression>,
6459 pub star: bool,
6460 pub distinct: bool,
6461 pub filter: Option<Expression>,
6462 #[serde(default, skip_serializing_if = "Option::is_none")]
6464 pub ignore_nulls: Option<bool>,
6465 #[serde(default, skip_serializing_if = "Option::is_none")]
6467 pub original_name: Option<String>,
6468 #[serde(default, skip_serializing_if = "Option::is_none")]
6470 pub inferred_type: Option<DataType>,
6471}
6472
6473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6475#[cfg_attr(feature = "bindings", derive(TS))]
6476pub struct GroupConcatFunc {
6477 pub this: Expression,
6478 pub separator: Option<Expression>,
6479 pub order_by: Option<Vec<Ordered>>,
6480 pub distinct: bool,
6481 pub filter: Option<Expression>,
6482 #[serde(default, skip_serializing_if = "Option::is_none")]
6484 pub inferred_type: Option<DataType>,
6485}
6486
6487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6489#[cfg_attr(feature = "bindings", derive(TS))]
6490pub struct StringAggFunc {
6491 pub this: Expression,
6492 #[serde(default)]
6493 pub separator: Option<Expression>,
6494 #[serde(default)]
6495 pub order_by: Option<Vec<Ordered>>,
6496 #[serde(default)]
6497 pub distinct: bool,
6498 #[serde(default)]
6499 pub filter: Option<Expression>,
6500 #[serde(default, skip_serializing_if = "Option::is_none")]
6502 pub limit: Option<Box<Expression>>,
6503 #[serde(default, skip_serializing_if = "Option::is_none")]
6505 pub inferred_type: Option<DataType>,
6506}
6507
6508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6510#[cfg_attr(feature = "bindings", derive(TS))]
6511pub struct ListAggFunc {
6512 pub this: Expression,
6513 pub separator: Option<Expression>,
6514 pub on_overflow: Option<ListAggOverflow>,
6515 pub order_by: Option<Vec<Ordered>>,
6516 pub distinct: bool,
6517 pub filter: Option<Expression>,
6518 #[serde(default, skip_serializing_if = "Option::is_none")]
6520 pub inferred_type: Option<DataType>,
6521}
6522
6523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6525#[cfg_attr(feature = "bindings", derive(TS))]
6526pub enum ListAggOverflow {
6527 Error,
6528 Truncate {
6529 filler: Option<Expression>,
6530 with_count: bool,
6531 },
6532}
6533
6534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6536#[cfg_attr(feature = "bindings", derive(TS))]
6537pub struct SumIfFunc {
6538 pub this: Expression,
6539 pub condition: Expression,
6540 pub filter: Option<Expression>,
6541 #[serde(default, skip_serializing_if = "Option::is_none")]
6543 pub inferred_type: Option<DataType>,
6544}
6545
6546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6548#[cfg_attr(feature = "bindings", derive(TS))]
6549pub struct ApproxPercentileFunc {
6550 pub this: Expression,
6551 pub percentile: Expression,
6552 pub accuracy: Option<Expression>,
6553 pub filter: Option<Expression>,
6554}
6555
6556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6558#[cfg_attr(feature = "bindings", derive(TS))]
6559pub struct PercentileFunc {
6560 pub this: Expression,
6561 pub percentile: Expression,
6562 pub order_by: Option<Vec<Ordered>>,
6563 pub filter: Option<Expression>,
6564}
6565
6566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6572#[cfg_attr(feature = "bindings", derive(TS))]
6573pub struct RowNumber;
6574
6575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6577#[cfg_attr(feature = "bindings", derive(TS))]
6578pub struct Rank {
6579 #[serde(default, skip_serializing_if = "Option::is_none")]
6581 pub order_by: Option<Vec<Ordered>>,
6582 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6584 pub args: Vec<Expression>,
6585}
6586
6587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6589#[cfg_attr(feature = "bindings", derive(TS))]
6590pub struct DenseRank {
6591 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6593 pub args: Vec<Expression>,
6594}
6595
6596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6598#[cfg_attr(feature = "bindings", derive(TS))]
6599pub struct NTileFunc {
6600 #[serde(default, skip_serializing_if = "Option::is_none")]
6602 pub num_buckets: Option<Expression>,
6603 #[serde(default, skip_serializing_if = "Option::is_none")]
6605 pub order_by: Option<Vec<Ordered>>,
6606}
6607
6608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6610#[cfg_attr(feature = "bindings", derive(TS))]
6611pub struct LeadLagFunc {
6612 pub this: Expression,
6613 pub offset: Option<Expression>,
6614 pub default: Option<Expression>,
6615 #[serde(default, skip_serializing_if = "Option::is_none")]
6617 pub ignore_nulls: Option<bool>,
6618}
6619
6620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6622#[cfg_attr(feature = "bindings", derive(TS))]
6623pub struct ValueFunc {
6624 pub this: Expression,
6625 #[serde(default, skip_serializing_if = "Option::is_none")]
6627 pub ignore_nulls: Option<bool>,
6628 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6630 pub order_by: Vec<Ordered>,
6631}
6632
6633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6635#[cfg_attr(feature = "bindings", derive(TS))]
6636pub struct NthValueFunc {
6637 pub this: Expression,
6638 pub offset: Expression,
6639 #[serde(default, skip_serializing_if = "Option::is_none")]
6641 pub ignore_nulls: Option<bool>,
6642 #[serde(default, skip_serializing_if = "Option::is_none")]
6645 pub from_first: Option<bool>,
6646}
6647
6648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6650#[cfg_attr(feature = "bindings", derive(TS))]
6651pub struct PercentRank {
6652 #[serde(default, skip_serializing_if = "Option::is_none")]
6654 pub order_by: Option<Vec<Ordered>>,
6655 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6657 pub args: Vec<Expression>,
6658}
6659
6660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6662#[cfg_attr(feature = "bindings", derive(TS))]
6663pub struct CumeDist {
6664 #[serde(default, skip_serializing_if = "Option::is_none")]
6666 pub order_by: Option<Vec<Ordered>>,
6667 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6669 pub args: Vec<Expression>,
6670}
6671
6672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6678#[cfg_attr(feature = "bindings", derive(TS))]
6679pub struct PositionFunc {
6680 pub substring: Expression,
6681 pub string: Expression,
6682 pub start: Option<Expression>,
6683}
6684
6685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6691#[cfg_attr(feature = "bindings", derive(TS))]
6692pub struct Random;
6693
6694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6696#[cfg_attr(feature = "bindings", derive(TS))]
6697pub struct Rand {
6698 pub seed: Option<Box<Expression>>,
6699 #[serde(default)]
6701 pub lower: Option<Box<Expression>>,
6702 #[serde(default)]
6704 pub upper: Option<Box<Expression>>,
6705}
6706
6707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6709#[cfg_attr(feature = "bindings", derive(TS))]
6710pub struct TruncateFunc {
6711 pub this: Expression,
6712 pub decimals: Option<Expression>,
6713}
6714
6715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6717#[cfg_attr(feature = "bindings", derive(TS))]
6718pub struct Pi;
6719
6720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6726#[cfg_attr(feature = "bindings", derive(TS))]
6727pub struct DecodeFunc {
6728 pub this: Expression,
6729 pub search_results: Vec<(Expression, Expression)>,
6730 pub default: Option<Expression>,
6731}
6732
6733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6739#[cfg_attr(feature = "bindings", derive(TS))]
6740pub struct DateFormatFunc {
6741 pub this: Expression,
6742 pub format: Expression,
6743}
6744
6745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6747#[cfg_attr(feature = "bindings", derive(TS))]
6748pub struct FromUnixtimeFunc {
6749 pub this: Expression,
6750 pub format: Option<Expression>,
6751}
6752
6753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6755#[cfg_attr(feature = "bindings", derive(TS))]
6756pub struct UnixTimestampFunc {
6757 pub this: Option<Expression>,
6758 pub format: Option<Expression>,
6759}
6760
6761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6763#[cfg_attr(feature = "bindings", derive(TS))]
6764pub struct MakeDateFunc {
6765 pub year: Expression,
6766 pub month: Expression,
6767 pub day: Expression,
6768}
6769
6770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6772#[cfg_attr(feature = "bindings", derive(TS))]
6773pub struct MakeTimestampFunc {
6774 pub year: Expression,
6775 pub month: Expression,
6776 pub day: Expression,
6777 pub hour: Expression,
6778 pub minute: Expression,
6779 pub second: Expression,
6780 pub timezone: Option<Expression>,
6781}
6782
6783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6785#[cfg_attr(feature = "bindings", derive(TS))]
6786pub struct LastDayFunc {
6787 pub this: Expression,
6788 #[serde(skip_serializing_if = "Option::is_none", default)]
6790 pub unit: Option<DateTimeField>,
6791}
6792
6793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6799#[cfg_attr(feature = "bindings", derive(TS))]
6800pub struct ArrayConstructor {
6801 pub expressions: Vec<Expression>,
6802 pub bracket_notation: bool,
6803 pub use_list_keyword: bool,
6805}
6806
6807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6809#[cfg_attr(feature = "bindings", derive(TS))]
6810pub struct ArraySortFunc {
6811 pub this: Expression,
6812 pub comparator: Option<Expression>,
6813 pub desc: bool,
6814 pub nulls_first: Option<bool>,
6815}
6816
6817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6819#[cfg_attr(feature = "bindings", derive(TS))]
6820pub struct ArrayJoinFunc {
6821 pub this: Expression,
6822 pub separator: Expression,
6823 pub null_replacement: Option<Expression>,
6824}
6825
6826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6828#[cfg_attr(feature = "bindings", derive(TS))]
6829pub struct UnnestFunc {
6830 pub this: Expression,
6831 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6833 pub expressions: Vec<Expression>,
6834 pub with_ordinality: bool,
6835 pub alias: Option<Identifier>,
6836 #[serde(default, skip_serializing_if = "Option::is_none")]
6838 pub offset_alias: Option<Identifier>,
6839}
6840
6841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6843#[cfg_attr(feature = "bindings", derive(TS))]
6844pub struct ArrayFilterFunc {
6845 pub this: Expression,
6846 pub filter: Expression,
6847}
6848
6849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6851#[cfg_attr(feature = "bindings", derive(TS))]
6852pub struct ArrayTransformFunc {
6853 pub this: Expression,
6854 pub transform: Expression,
6855}
6856
6857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6859#[cfg_attr(feature = "bindings", derive(TS))]
6860pub struct SequenceFunc {
6861 pub start: Expression,
6862 pub stop: Expression,
6863 pub step: Option<Expression>,
6864}
6865
6866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6872#[cfg_attr(feature = "bindings", derive(TS))]
6873pub struct StructConstructor {
6874 pub fields: Vec<(Option<Identifier>, Expression)>,
6875}
6876
6877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6879#[cfg_attr(feature = "bindings", derive(TS))]
6880pub struct StructExtractFunc {
6881 pub this: Expression,
6882 pub field: Identifier,
6883}
6884
6885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6887#[cfg_attr(feature = "bindings", derive(TS))]
6888pub struct NamedStructFunc {
6889 pub pairs: Vec<(Expression, Expression)>,
6890}
6891
6892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6898#[cfg_attr(feature = "bindings", derive(TS))]
6899pub struct MapConstructor {
6900 pub keys: Vec<Expression>,
6901 pub values: Vec<Expression>,
6902 #[serde(default)]
6904 pub curly_brace_syntax: bool,
6905 #[serde(default)]
6907 pub with_map_keyword: bool,
6908}
6909
6910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6912#[cfg_attr(feature = "bindings", derive(TS))]
6913pub struct TransformFunc {
6914 pub this: Expression,
6915 pub transform: Expression,
6916}
6917
6918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6921#[cfg_attr(feature = "bindings", derive(TS))]
6922pub struct FunctionEmits {
6923 pub this: Expression,
6925 pub emits: Expression,
6927}
6928
6929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6935#[cfg_attr(feature = "bindings", derive(TS))]
6936pub struct JsonExtractFunc {
6937 pub this: Expression,
6938 pub path: Expression,
6939 pub returning: Option<DataType>,
6940 #[serde(default)]
6942 pub arrow_syntax: bool,
6943 #[serde(default)]
6945 pub hash_arrow_syntax: bool,
6946 #[serde(default)]
6948 pub wrapper_option: Option<String>,
6949 #[serde(default)]
6951 pub quotes_option: Option<String>,
6952 #[serde(default)]
6954 pub on_scalar_string: bool,
6955 #[serde(default)]
6957 pub on_error: Option<String>,
6958}
6959
6960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6962#[cfg_attr(feature = "bindings", derive(TS))]
6963pub struct JsonPathFunc {
6964 pub this: Expression,
6965 pub paths: Vec<Expression>,
6966}
6967
6968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6970#[cfg_attr(feature = "bindings", derive(TS))]
6971pub struct JsonObjectFunc {
6972 pub pairs: Vec<(Expression, Expression)>,
6973 pub null_handling: Option<JsonNullHandling>,
6974 #[serde(default)]
6975 pub with_unique_keys: bool,
6976 #[serde(default)]
6977 pub returning_type: Option<DataType>,
6978 #[serde(default)]
6979 pub format_json: bool,
6980 #[serde(default)]
6981 pub encoding: Option<String>,
6982 #[serde(default)]
6984 pub star: bool,
6985}
6986
6987#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6989#[cfg_attr(feature = "bindings", derive(TS))]
6990pub enum JsonNullHandling {
6991 NullOnNull,
6992 AbsentOnNull,
6993}
6994
6995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6997#[cfg_attr(feature = "bindings", derive(TS))]
6998pub struct JsonModifyFunc {
6999 pub this: Expression,
7000 pub path_values: Vec<(Expression, Expression)>,
7001}
7002
7003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7005#[cfg_attr(feature = "bindings", derive(TS))]
7006pub struct JsonArrayAggFunc {
7007 pub this: Expression,
7008 pub order_by: Option<Vec<Ordered>>,
7009 pub null_handling: Option<JsonNullHandling>,
7010 pub filter: Option<Expression>,
7011}
7012
7013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7015#[cfg_attr(feature = "bindings", derive(TS))]
7016pub struct JsonObjectAggFunc {
7017 pub key: Expression,
7018 pub value: Expression,
7019 pub null_handling: Option<JsonNullHandling>,
7020 pub filter: Option<Expression>,
7021}
7022
7023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7029#[cfg_attr(feature = "bindings", derive(TS))]
7030pub struct ConvertFunc {
7031 pub this: Expression,
7032 pub to: DataType,
7033 pub style: Option<Expression>,
7034}
7035
7036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7042#[cfg_attr(feature = "bindings", derive(TS))]
7043pub struct LambdaExpr {
7044 pub parameters: Vec<Identifier>,
7045 pub body: Expression,
7046 #[serde(default)]
7048 pub colon: bool,
7049 #[serde(default)]
7052 pub parameter_types: Vec<Option<DataType>>,
7053}
7054
7055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7057#[cfg_attr(feature = "bindings", derive(TS))]
7058pub struct Parameter {
7059 pub name: Option<String>,
7060 pub index: Option<u32>,
7061 pub style: ParameterStyle,
7062 #[serde(default)]
7064 pub quoted: bool,
7065 #[serde(default)]
7067 pub string_quoted: bool,
7068 #[serde(default)]
7070 pub expression: Option<String>,
7071}
7072
7073#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7075#[cfg_attr(feature = "bindings", derive(TS))]
7076pub enum ParameterStyle {
7077 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7087
7088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7090#[cfg_attr(feature = "bindings", derive(TS))]
7091pub struct Placeholder {
7092 pub index: Option<u32>,
7093}
7094
7095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7097#[cfg_attr(feature = "bindings", derive(TS))]
7098pub struct NamedArgument {
7099 pub name: Identifier,
7100 pub value: Expression,
7101 pub separator: NamedArgSeparator,
7103}
7104
7105#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7107#[cfg_attr(feature = "bindings", derive(TS))]
7108pub enum NamedArgSeparator {
7109 DArrow,
7111 ColonEq,
7113 Eq,
7115}
7116
7117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7120#[cfg_attr(feature = "bindings", derive(TS))]
7121pub struct TableArgument {
7122 pub prefix: String,
7124 pub this: Expression,
7126}
7127
7128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7130#[cfg_attr(feature = "bindings", derive(TS))]
7131pub struct SqlComment {
7132 pub text: String,
7133 pub is_block: bool,
7134}
7135
7136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7142#[cfg_attr(feature = "bindings", derive(TS))]
7143pub struct SimilarToExpr {
7144 pub this: Expression,
7145 pub pattern: Expression,
7146 pub escape: Option<Expression>,
7147 pub not: bool,
7148}
7149
7150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7152#[cfg_attr(feature = "bindings", derive(TS))]
7153pub struct QuantifiedExpr {
7154 pub this: Expression,
7155 pub subquery: Expression,
7156 pub op: Option<QuantifiedOp>,
7157}
7158
7159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7161#[cfg_attr(feature = "bindings", derive(TS))]
7162pub enum QuantifiedOp {
7163 Eq,
7164 Neq,
7165 Lt,
7166 Lte,
7167 Gt,
7168 Gte,
7169}
7170
7171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7176#[cfg_attr(feature = "bindings", derive(TS))]
7177pub struct OverlapsExpr {
7178 #[serde(skip_serializing_if = "Option::is_none")]
7180 pub this: Option<Expression>,
7181 #[serde(skip_serializing_if = "Option::is_none")]
7183 pub expression: Option<Expression>,
7184 #[serde(skip_serializing_if = "Option::is_none")]
7186 pub left_start: Option<Expression>,
7187 #[serde(skip_serializing_if = "Option::is_none")]
7189 pub left_end: Option<Expression>,
7190 #[serde(skip_serializing_if = "Option::is_none")]
7192 pub right_start: Option<Expression>,
7193 #[serde(skip_serializing_if = "Option::is_none")]
7195 pub right_end: Option<Expression>,
7196}
7197
7198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7204#[cfg_attr(feature = "bindings", derive(TS))]
7205pub struct Subscript {
7206 pub this: Expression,
7207 pub index: Expression,
7208}
7209
7210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7212#[cfg_attr(feature = "bindings", derive(TS))]
7213pub struct DotAccess {
7214 pub this: Expression,
7215 pub field: Identifier,
7216}
7217
7218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7220#[cfg_attr(feature = "bindings", derive(TS))]
7221pub struct MethodCall {
7222 pub this: Expression,
7223 pub method: Identifier,
7224 pub args: Vec<Expression>,
7225}
7226
7227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7229#[cfg_attr(feature = "bindings", derive(TS))]
7230pub struct ArraySlice {
7231 pub this: Expression,
7232 pub start: Option<Expression>,
7233 pub end: Option<Expression>,
7234}
7235
7236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7242#[cfg_attr(feature = "bindings", derive(TS))]
7243pub enum OnCommit {
7244 PreserveRows,
7246 DeleteRows,
7248}
7249
7250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7252#[cfg_attr(feature = "bindings", derive(TS))]
7253pub struct CreateTable {
7254 pub name: TableRef,
7255 #[serde(default, skip_serializing_if = "Option::is_none")]
7257 pub on_cluster: Option<OnCluster>,
7258 pub columns: Vec<ColumnDef>,
7259 pub constraints: Vec<TableConstraint>,
7260 pub if_not_exists: bool,
7261 pub temporary: bool,
7262 pub or_replace: bool,
7263 #[serde(default, skip_serializing_if = "Option::is_none")]
7265 pub table_modifier: Option<String>,
7266 pub as_select: Option<Expression>,
7267 #[serde(default)]
7269 pub as_select_parenthesized: bool,
7270 #[serde(default)]
7272 pub on_commit: Option<OnCommit>,
7273 #[serde(default)]
7275 pub clone_source: Option<TableRef>,
7276 #[serde(default, skip_serializing_if = "Option::is_none")]
7278 pub clone_at_clause: Option<Expression>,
7279 #[serde(default)]
7281 pub is_copy: bool,
7282 #[serde(default)]
7284 pub shallow_clone: bool,
7285 #[serde(default)]
7287 pub leading_comments: Vec<String>,
7288 #[serde(default)]
7290 pub with_properties: Vec<(String, String)>,
7291 #[serde(default)]
7293 pub teradata_post_name_options: Vec<String>,
7294 #[serde(default)]
7296 pub with_data: Option<bool>,
7297 #[serde(default)]
7299 pub with_statistics: Option<bool>,
7300 #[serde(default)]
7302 pub teradata_indexes: Vec<TeradataIndex>,
7303 #[serde(default)]
7305 pub with_cte: Option<With>,
7306 #[serde(default)]
7308 pub properties: Vec<Expression>,
7309 #[serde(default, skip_serializing_if = "Option::is_none")]
7311 pub partition_of: Option<Expression>,
7312 #[serde(default)]
7314 pub post_table_properties: Vec<Expression>,
7315 #[serde(default)]
7317 pub mysql_table_options: Vec<(String, String)>,
7318 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7320 pub inherits: Vec<TableRef>,
7321 #[serde(default, skip_serializing_if = "Option::is_none")]
7323 pub on_property: Option<OnProperty>,
7324 #[serde(default)]
7326 pub copy_grants: bool,
7327 #[serde(default, skip_serializing_if = "Option::is_none")]
7329 pub using_template: Option<Box<Expression>>,
7330 #[serde(default, skip_serializing_if = "Option::is_none")]
7332 pub rollup: Option<RollupProperty>,
7333 #[serde(default, skip_serializing_if = "Option::is_none")]
7335 pub uuid: Option<String>,
7336}
7337
7338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7340#[cfg_attr(feature = "bindings", derive(TS))]
7341pub struct TeradataIndex {
7342 pub kind: TeradataIndexKind,
7344 pub name: Option<String>,
7346 pub columns: Vec<String>,
7348}
7349
7350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7352#[cfg_attr(feature = "bindings", derive(TS))]
7353pub enum TeradataIndexKind {
7354 NoPrimary,
7356 Primary,
7358 PrimaryAmp,
7360 Unique,
7362 UniquePrimary,
7364 Secondary,
7366}
7367
7368impl CreateTable {
7369 pub fn new(name: impl Into<String>) -> Self {
7370 Self {
7371 name: TableRef::new(name),
7372 on_cluster: None,
7373 columns: Vec::new(),
7374 constraints: Vec::new(),
7375 if_not_exists: false,
7376 temporary: false,
7377 or_replace: false,
7378 table_modifier: None,
7379 as_select: None,
7380 as_select_parenthesized: false,
7381 on_commit: None,
7382 clone_source: None,
7383 clone_at_clause: None,
7384 shallow_clone: false,
7385 is_copy: false,
7386 leading_comments: Vec::new(),
7387 with_properties: Vec::new(),
7388 teradata_post_name_options: Vec::new(),
7389 with_data: None,
7390 with_statistics: None,
7391 teradata_indexes: Vec::new(),
7392 with_cte: None,
7393 properties: Vec::new(),
7394 partition_of: None,
7395 post_table_properties: Vec::new(),
7396 mysql_table_options: Vec::new(),
7397 inherits: Vec::new(),
7398 on_property: None,
7399 copy_grants: false,
7400 using_template: None,
7401 rollup: None,
7402 uuid: None,
7403 }
7404 }
7405}
7406
7407#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7409#[cfg_attr(feature = "bindings", derive(TS))]
7410pub enum SortOrder {
7411 Asc,
7412 Desc,
7413}
7414
7415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7417#[cfg_attr(feature = "bindings", derive(TS))]
7418pub enum ConstraintType {
7419 NotNull,
7420 Null,
7421 PrimaryKey,
7422 Unique,
7423 Default,
7424 AutoIncrement,
7425 Collate,
7426 Comment,
7427 References,
7428 Check,
7429 GeneratedAsIdentity,
7430 Tags,
7432 ComputedColumn,
7434 GeneratedAsRow,
7436 OnUpdate,
7438 Path,
7440 Encode,
7442}
7443
7444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7446#[cfg_attr(feature = "bindings", derive(TS))]
7447pub struct ColumnDef {
7448 pub name: Identifier,
7449 pub data_type: DataType,
7450 pub nullable: Option<bool>,
7451 pub default: Option<Expression>,
7452 pub primary_key: bool,
7453 #[serde(default)]
7455 pub primary_key_order: Option<SortOrder>,
7456 pub unique: bool,
7457 #[serde(default)]
7459 pub unique_nulls_not_distinct: bool,
7460 pub auto_increment: bool,
7461 pub comment: Option<String>,
7462 pub constraints: Vec<ColumnConstraint>,
7463 #[serde(default)]
7465 pub constraint_order: Vec<ConstraintType>,
7466 #[serde(default)]
7468 pub format: Option<String>,
7469 #[serde(default)]
7471 pub title: Option<String>,
7472 #[serde(default)]
7474 pub inline_length: Option<u64>,
7475 #[serde(default)]
7477 pub compress: Option<Vec<Expression>>,
7478 #[serde(default)]
7480 pub character_set: Option<String>,
7481 #[serde(default)]
7483 pub uppercase: bool,
7484 #[serde(default)]
7486 pub casespecific: Option<bool>,
7487 #[serde(default)]
7489 pub auto_increment_start: Option<Box<Expression>>,
7490 #[serde(default)]
7492 pub auto_increment_increment: Option<Box<Expression>>,
7493 #[serde(default)]
7495 pub auto_increment_order: Option<bool>,
7496 #[serde(default)]
7498 pub unsigned: bool,
7499 #[serde(default)]
7501 pub zerofill: bool,
7502 #[serde(default, skip_serializing_if = "Option::is_none")]
7504 pub on_update: Option<Expression>,
7505 #[serde(default, skip_serializing_if = "Option::is_none")]
7507 pub unique_constraint_name: Option<String>,
7508 #[serde(default, skip_serializing_if = "Option::is_none")]
7510 pub not_null_constraint_name: Option<String>,
7511 #[serde(default, skip_serializing_if = "Option::is_none")]
7513 pub primary_key_constraint_name: Option<String>,
7514 #[serde(default, skip_serializing_if = "Option::is_none")]
7516 pub check_constraint_name: Option<String>,
7517 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7519 pub options: Vec<Expression>,
7520 #[serde(default)]
7522 pub no_type: bool,
7523 #[serde(default, skip_serializing_if = "Option::is_none")]
7525 pub encoding: Option<String>,
7526 #[serde(default, skip_serializing_if = "Option::is_none")]
7528 pub codec: Option<String>,
7529 #[serde(default, skip_serializing_if = "Option::is_none")]
7531 pub ephemeral: Option<Option<Box<Expression>>>,
7532 #[serde(default, skip_serializing_if = "Option::is_none")]
7534 pub materialized_expr: Option<Box<Expression>>,
7535 #[serde(default, skip_serializing_if = "Option::is_none")]
7537 pub alias_expr: Option<Box<Expression>>,
7538 #[serde(default, skip_serializing_if = "Option::is_none")]
7540 pub ttl_expr: Option<Box<Expression>>,
7541 #[serde(default)]
7543 pub not_for_replication: bool,
7544}
7545
7546impl ColumnDef {
7547 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7548 Self {
7549 name: Identifier::new(name),
7550 data_type,
7551 nullable: None,
7552 default: None,
7553 primary_key: false,
7554 primary_key_order: None,
7555 unique: false,
7556 unique_nulls_not_distinct: false,
7557 auto_increment: false,
7558 comment: None,
7559 constraints: Vec::new(),
7560 constraint_order: Vec::new(),
7561 format: None,
7562 title: None,
7563 inline_length: None,
7564 compress: None,
7565 character_set: None,
7566 uppercase: false,
7567 casespecific: None,
7568 auto_increment_start: None,
7569 auto_increment_increment: None,
7570 auto_increment_order: None,
7571 unsigned: false,
7572 zerofill: false,
7573 on_update: None,
7574 unique_constraint_name: None,
7575 not_null_constraint_name: None,
7576 primary_key_constraint_name: None,
7577 check_constraint_name: None,
7578 options: Vec::new(),
7579 no_type: false,
7580 encoding: None,
7581 codec: None,
7582 ephemeral: None,
7583 materialized_expr: None,
7584 alias_expr: None,
7585 ttl_expr: None,
7586 not_for_replication: false,
7587 }
7588 }
7589}
7590
7591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7593#[cfg_attr(feature = "bindings", derive(TS))]
7594pub enum ColumnConstraint {
7595 NotNull,
7596 Null,
7597 Unique,
7598 PrimaryKey,
7599 Default(Expression),
7600 Check(Expression),
7601 References(ForeignKeyRef),
7602 GeneratedAsIdentity(GeneratedAsIdentity),
7603 Collate(Identifier),
7604 Comment(String),
7605 Tags(Tags),
7607 ComputedColumn(ComputedColumn),
7610 GeneratedAsRow(GeneratedAsRow),
7612 Path(Expression),
7614}
7615
7616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7618#[cfg_attr(feature = "bindings", derive(TS))]
7619pub struct ComputedColumn {
7620 pub expression: Box<Expression>,
7622 #[serde(default)]
7624 pub persisted: bool,
7625 #[serde(default)]
7627 pub not_null: bool,
7628 #[serde(default)]
7631 pub persistence_kind: Option<String>,
7632 #[serde(default, skip_serializing_if = "Option::is_none")]
7634 pub data_type: Option<DataType>,
7635}
7636
7637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7639#[cfg_attr(feature = "bindings", derive(TS))]
7640pub struct GeneratedAsRow {
7641 pub start: bool,
7643 #[serde(default)]
7645 pub hidden: bool,
7646}
7647
7648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7650#[cfg_attr(feature = "bindings", derive(TS))]
7651pub struct GeneratedAsIdentity {
7652 pub always: bool,
7654 pub on_null: bool,
7656 pub start: Option<Box<Expression>>,
7658 pub increment: Option<Box<Expression>>,
7660 pub minvalue: Option<Box<Expression>>,
7662 pub maxvalue: Option<Box<Expression>>,
7664 pub cycle: Option<bool>,
7666}
7667
7668#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7670#[cfg_attr(feature = "bindings", derive(TS))]
7671pub struct ConstraintModifiers {
7672 pub enforced: Option<bool>,
7674 pub deferrable: Option<bool>,
7676 pub initially_deferred: Option<bool>,
7678 pub norely: bool,
7680 pub rely: bool,
7682 #[serde(default)]
7684 pub using: Option<String>,
7685 #[serde(default)]
7687 pub using_before_columns: bool,
7688 #[serde(default, skip_serializing_if = "Option::is_none")]
7690 pub comment: Option<String>,
7691 #[serde(default, skip_serializing_if = "Option::is_none")]
7693 pub visible: Option<bool>,
7694 #[serde(default, skip_serializing_if = "Option::is_none")]
7696 pub engine_attribute: Option<String>,
7697 #[serde(default, skip_serializing_if = "Option::is_none")]
7699 pub with_parser: Option<String>,
7700 #[serde(default)]
7702 pub not_valid: bool,
7703 #[serde(default, skip_serializing_if = "Option::is_none")]
7705 pub clustered: Option<String>,
7706 #[serde(default, skip_serializing_if = "Option::is_none")]
7708 pub on_conflict: Option<String>,
7709 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7711 pub with_options: Vec<(String, String)>,
7712 #[serde(default, skip_serializing_if = "Option::is_none")]
7714 pub on_filegroup: Option<Identifier>,
7715}
7716
7717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7719#[cfg_attr(feature = "bindings", derive(TS))]
7720pub enum TableConstraint {
7721 PrimaryKey {
7722 name: Option<Identifier>,
7723 columns: Vec<Identifier>,
7724 #[serde(default)]
7726 include_columns: Vec<Identifier>,
7727 #[serde(default)]
7728 modifiers: ConstraintModifiers,
7729 #[serde(default)]
7731 has_constraint_keyword: bool,
7732 },
7733 Unique {
7734 name: Option<Identifier>,
7735 columns: Vec<Identifier>,
7736 #[serde(default)]
7738 columns_parenthesized: bool,
7739 #[serde(default)]
7740 modifiers: ConstraintModifiers,
7741 #[serde(default)]
7743 has_constraint_keyword: bool,
7744 #[serde(default)]
7746 nulls_not_distinct: bool,
7747 },
7748 ForeignKey {
7749 name: Option<Identifier>,
7750 columns: Vec<Identifier>,
7751 #[serde(default)]
7752 references: Option<ForeignKeyRef>,
7753 #[serde(default)]
7755 on_delete: Option<ReferentialAction>,
7756 #[serde(default)]
7758 on_update: Option<ReferentialAction>,
7759 #[serde(default)]
7760 modifiers: ConstraintModifiers,
7761 },
7762 Check {
7763 name: Option<Identifier>,
7764 expression: Expression,
7765 #[serde(default)]
7766 modifiers: ConstraintModifiers,
7767 },
7768 Assume {
7770 name: Option<Identifier>,
7771 expression: Expression,
7772 },
7773 Index {
7775 name: Option<Identifier>,
7776 columns: Vec<Identifier>,
7777 #[serde(default)]
7779 kind: Option<String>,
7780 #[serde(default)]
7781 modifiers: ConstraintModifiers,
7782 #[serde(default)]
7784 use_key_keyword: bool,
7785 #[serde(default, skip_serializing_if = "Option::is_none")]
7787 expression: Option<Box<Expression>>,
7788 #[serde(default, skip_serializing_if = "Option::is_none")]
7790 index_type: Option<Box<Expression>>,
7791 #[serde(default, skip_serializing_if = "Option::is_none")]
7793 granularity: Option<Box<Expression>>,
7794 },
7795 Projection {
7797 name: Identifier,
7798 expression: Expression,
7799 },
7800 Like {
7802 source: TableRef,
7803 options: Vec<(LikeOptionAction, String)>,
7805 },
7806 PeriodForSystemTime {
7808 start_col: Identifier,
7809 end_col: Identifier,
7810 },
7811 Exclude {
7814 name: Option<Identifier>,
7815 #[serde(default)]
7817 using: Option<String>,
7818 elements: Vec<ExcludeElement>,
7820 #[serde(default)]
7822 include_columns: Vec<Identifier>,
7823 #[serde(default)]
7825 where_clause: Option<Box<Expression>>,
7826 #[serde(default)]
7828 with_params: Vec<(String, String)>,
7829 #[serde(default)]
7831 using_index_tablespace: Option<String>,
7832 #[serde(default)]
7833 modifiers: ConstraintModifiers,
7834 },
7835 Tags(Tags),
7837 InitiallyDeferred {
7841 deferred: bool,
7843 },
7844}
7845
7846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7848#[cfg_attr(feature = "bindings", derive(TS))]
7849pub struct ExcludeElement {
7850 pub expression: String,
7852 pub operator: String,
7854}
7855
7856#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7858#[cfg_attr(feature = "bindings", derive(TS))]
7859pub enum LikeOptionAction {
7860 Including,
7861 Excluding,
7862}
7863
7864#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7866#[cfg_attr(feature = "bindings", derive(TS))]
7867pub enum MatchType {
7868 Full,
7869 Partial,
7870 Simple,
7871}
7872
7873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7875#[cfg_attr(feature = "bindings", derive(TS))]
7876pub struct ForeignKeyRef {
7877 pub table: TableRef,
7878 pub columns: Vec<Identifier>,
7879 pub on_delete: Option<ReferentialAction>,
7880 pub on_update: Option<ReferentialAction>,
7881 #[serde(default)]
7883 pub on_update_first: bool,
7884 #[serde(default)]
7886 pub match_type: Option<MatchType>,
7887 #[serde(default)]
7889 pub match_after_actions: bool,
7890 #[serde(default)]
7892 pub constraint_name: Option<String>,
7893 #[serde(default)]
7895 pub deferrable: Option<bool>,
7896 #[serde(default)]
7898 pub has_foreign_key_keywords: bool,
7899}
7900
7901#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7903#[cfg_attr(feature = "bindings", derive(TS))]
7904pub enum ReferentialAction {
7905 Cascade,
7906 SetNull,
7907 SetDefault,
7908 Restrict,
7909 NoAction,
7910}
7911
7912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7914#[cfg_attr(feature = "bindings", derive(TS))]
7915pub struct DropTable {
7916 pub names: Vec<TableRef>,
7917 pub if_exists: bool,
7918 pub cascade: bool,
7919 #[serde(default)]
7921 pub cascade_constraints: bool,
7922 #[serde(default)]
7924 pub purge: bool,
7925 #[serde(default)]
7927 pub leading_comments: Vec<String>,
7928 #[serde(default, skip_serializing_if = "Option::is_none")]
7931 pub object_id_args: Option<String>,
7932 #[serde(default)]
7934 pub sync: bool,
7935 #[serde(default)]
7937 pub iceberg: bool,
7938 #[serde(default)]
7940 pub restrict: bool,
7941}
7942
7943impl DropTable {
7944 pub fn new(name: impl Into<String>) -> Self {
7945 Self {
7946 names: vec![TableRef::new(name)],
7947 if_exists: false,
7948 cascade: false,
7949 cascade_constraints: false,
7950 purge: false,
7951 leading_comments: Vec::new(),
7952 object_id_args: None,
7953 sync: false,
7954 iceberg: false,
7955 restrict: false,
7956 }
7957 }
7958}
7959
7960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7962#[cfg_attr(feature = "bindings", derive(TS))]
7963pub struct AlterTable {
7964 pub name: TableRef,
7965 pub actions: Vec<AlterTableAction>,
7966 #[serde(default)]
7968 pub if_exists: bool,
7969 #[serde(default, skip_serializing_if = "Option::is_none")]
7971 pub algorithm: Option<String>,
7972 #[serde(default, skip_serializing_if = "Option::is_none")]
7974 pub lock: Option<String>,
7975 #[serde(default, skip_serializing_if = "Option::is_none")]
7977 pub with_check: Option<String>,
7978 #[serde(default, skip_serializing_if = "Option::is_none")]
7980 pub partition: Option<Vec<(Identifier, Expression)>>,
7981 #[serde(default, skip_serializing_if = "Option::is_none")]
7983 pub on_cluster: Option<OnCluster>,
7984 #[serde(default, skip_serializing_if = "Option::is_none")]
7986 pub table_modifier: Option<String>,
7987}
7988
7989impl AlterTable {
7990 pub fn new(name: impl Into<String>) -> Self {
7991 Self {
7992 name: TableRef::new(name),
7993 actions: Vec::new(),
7994 if_exists: false,
7995 algorithm: None,
7996 lock: None,
7997 with_check: None,
7998 partition: None,
7999 on_cluster: None,
8000 table_modifier: None,
8001 }
8002 }
8003}
8004
8005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8007#[cfg_attr(feature = "bindings", derive(TS))]
8008pub enum ColumnPosition {
8009 First,
8010 After(Identifier),
8011}
8012
8013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8015#[cfg_attr(feature = "bindings", derive(TS))]
8016pub enum AlterTableAction {
8017 AddColumn {
8018 column: ColumnDef,
8019 if_not_exists: bool,
8020 position: Option<ColumnPosition>,
8021 },
8022 DropColumn {
8023 name: Identifier,
8024 if_exists: bool,
8025 cascade: bool,
8026 },
8027 RenameColumn {
8028 old_name: Identifier,
8029 new_name: Identifier,
8030 if_exists: bool,
8031 },
8032 AlterColumn {
8033 name: Identifier,
8034 action: AlterColumnAction,
8035 #[serde(default)]
8037 use_modify_keyword: bool,
8038 },
8039 RenameTable(TableRef),
8040 AddConstraint(TableConstraint),
8041 DropConstraint {
8042 name: Identifier,
8043 if_exists: bool,
8044 },
8045 DropForeignKey {
8047 name: Identifier,
8048 },
8049 DropPartition {
8051 partitions: Vec<Vec<(Identifier, Expression)>>,
8053 if_exists: bool,
8054 },
8055 AddPartition {
8057 partition: Expression,
8059 if_not_exists: bool,
8060 location: Option<Expression>,
8061 },
8062 Delete {
8064 where_clause: Expression,
8065 },
8066 SwapWith(TableRef),
8068 SetProperty {
8070 properties: Vec<(String, Expression)>,
8071 },
8072 UnsetProperty {
8074 properties: Vec<String>,
8075 },
8076 ClusterBy {
8078 expressions: Vec<Expression>,
8079 },
8080 SetTag {
8082 expressions: Vec<(String, Expression)>,
8083 },
8084 UnsetTag {
8086 names: Vec<String>,
8087 },
8088 SetOptions {
8090 expressions: Vec<Expression>,
8091 },
8092 AlterIndex {
8094 name: Identifier,
8095 visible: bool,
8096 },
8097 SetAttribute {
8099 attribute: String,
8100 },
8101 SetStageFileFormat {
8103 options: Option<Expression>,
8104 },
8105 SetStageCopyOptions {
8107 options: Option<Expression>,
8108 },
8109 AddColumns {
8111 columns: Vec<ColumnDef>,
8112 cascade: bool,
8113 },
8114 DropColumns {
8116 names: Vec<Identifier>,
8117 },
8118 ChangeColumn {
8121 old_name: Identifier,
8122 new_name: Identifier,
8123 #[serde(default, skip_serializing_if = "Option::is_none")]
8124 data_type: Option<DataType>,
8125 comment: Option<String>,
8126 #[serde(default)]
8127 cascade: bool,
8128 },
8129 AlterSortKey {
8132 this: Option<String>,
8134 expressions: Vec<Expression>,
8136 compound: bool,
8138 },
8139 AlterDistStyle {
8143 style: String,
8145 distkey: Option<Identifier>,
8147 },
8148 SetTableProperties {
8150 properties: Vec<(Expression, Expression)>,
8151 },
8152 SetLocation {
8154 location: String,
8155 },
8156 SetFileFormat {
8158 format: String,
8159 },
8160 ReplacePartition {
8162 partition: Expression,
8163 source: Option<Box<Expression>>,
8164 },
8165 Raw {
8167 sql: String,
8168 },
8169}
8170
8171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8173#[cfg_attr(feature = "bindings", derive(TS))]
8174pub enum AlterColumnAction {
8175 SetDataType {
8176 data_type: DataType,
8177 using: Option<Expression>,
8179 #[serde(default, skip_serializing_if = "Option::is_none")]
8181 collate: Option<String>,
8182 },
8183 SetDefault(Expression),
8184 DropDefault,
8185 SetNotNull,
8186 DropNotNull,
8187 Comment(String),
8189 SetVisible,
8191 SetInvisible,
8193}
8194
8195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8197#[cfg_attr(feature = "bindings", derive(TS))]
8198pub struct CreateIndex {
8199 pub name: Identifier,
8200 pub table: TableRef,
8201 pub columns: Vec<IndexColumn>,
8202 pub unique: bool,
8203 pub if_not_exists: bool,
8204 pub using: Option<String>,
8205 #[serde(default)]
8207 pub clustered: Option<String>,
8208 #[serde(default)]
8210 pub concurrently: bool,
8211 #[serde(default)]
8213 pub where_clause: Option<Box<Expression>>,
8214 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8216 pub include_columns: Vec<Identifier>,
8217 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8219 pub with_options: Vec<(String, String)>,
8220 #[serde(default)]
8222 pub on_filegroup: Option<String>,
8223}
8224
8225impl CreateIndex {
8226 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8227 Self {
8228 name: Identifier::new(name),
8229 table: TableRef::new(table),
8230 columns: Vec::new(),
8231 unique: false,
8232 if_not_exists: false,
8233 using: None,
8234 clustered: None,
8235 concurrently: false,
8236 where_clause: None,
8237 include_columns: Vec::new(),
8238 with_options: Vec::new(),
8239 on_filegroup: None,
8240 }
8241 }
8242}
8243
8244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8246#[cfg_attr(feature = "bindings", derive(TS))]
8247pub struct IndexColumn {
8248 pub column: Identifier,
8249 pub desc: bool,
8250 #[serde(default)]
8252 pub asc: bool,
8253 pub nulls_first: Option<bool>,
8254 #[serde(default, skip_serializing_if = "Option::is_none")]
8256 pub opclass: Option<String>,
8257}
8258
8259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8261#[cfg_attr(feature = "bindings", derive(TS))]
8262pub struct DropIndex {
8263 pub name: Identifier,
8264 pub table: Option<TableRef>,
8265 pub if_exists: bool,
8266 #[serde(default)]
8268 pub concurrently: bool,
8269}
8270
8271impl DropIndex {
8272 pub fn new(name: impl Into<String>) -> Self {
8273 Self {
8274 name: Identifier::new(name),
8275 table: None,
8276 if_exists: false,
8277 concurrently: false,
8278 }
8279 }
8280}
8281
8282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8284#[cfg_attr(feature = "bindings", derive(TS))]
8285pub struct ViewColumn {
8286 pub name: Identifier,
8287 pub comment: Option<String>,
8288 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8290 pub options: Vec<Expression>,
8291}
8292
8293impl ViewColumn {
8294 pub fn new(name: impl Into<String>) -> Self {
8295 Self {
8296 name: Identifier::new(name),
8297 comment: None,
8298 options: Vec::new(),
8299 }
8300 }
8301
8302 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8303 Self {
8304 name: Identifier::new(name),
8305 comment: Some(comment.into()),
8306 options: Vec::new(),
8307 }
8308 }
8309}
8310
8311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8313#[cfg_attr(feature = "bindings", derive(TS))]
8314pub struct CreateView {
8315 pub name: TableRef,
8316 pub columns: Vec<ViewColumn>,
8317 pub query: Expression,
8318 pub or_replace: bool,
8319 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8321 pub or_alter: bool,
8322 pub if_not_exists: bool,
8323 pub materialized: bool,
8324 pub temporary: bool,
8325 #[serde(default)]
8327 pub secure: bool,
8328 #[serde(skip_serializing_if = "Option::is_none")]
8330 pub algorithm: Option<String>,
8331 #[serde(skip_serializing_if = "Option::is_none")]
8333 pub definer: Option<String>,
8334 #[serde(skip_serializing_if = "Option::is_none")]
8336 pub security: Option<FunctionSecurity>,
8337 #[serde(default = "default_true")]
8339 pub security_sql_style: bool,
8340 #[serde(default)]
8342 pub security_after_name: bool,
8343 #[serde(default)]
8345 pub query_parenthesized: bool,
8346 #[serde(skip_serializing_if = "Option::is_none")]
8348 pub locking_mode: Option<String>,
8349 #[serde(skip_serializing_if = "Option::is_none")]
8351 pub locking_access: Option<String>,
8352 #[serde(default)]
8354 pub copy_grants: bool,
8355 #[serde(skip_serializing_if = "Option::is_none", default)]
8357 pub comment: Option<String>,
8358 #[serde(default)]
8360 pub tags: Vec<(String, String)>,
8361 #[serde(default)]
8363 pub options: Vec<Expression>,
8364 #[serde(skip_serializing_if = "Option::is_none", default)]
8366 pub build: Option<String>,
8367 #[serde(skip_serializing_if = "Option::is_none", default)]
8369 pub refresh: Option<Box<RefreshTriggerProperty>>,
8370 #[serde(skip_serializing_if = "Option::is_none", default)]
8373 pub schema: Option<Box<Schema>>,
8374 #[serde(skip_serializing_if = "Option::is_none", default)]
8376 pub unique_key: Option<Box<UniqueKeyProperty>>,
8377 #[serde(default)]
8379 pub no_schema_binding: bool,
8380 #[serde(skip_serializing_if = "Option::is_none", default)]
8382 pub auto_refresh: Option<bool>,
8383 #[serde(default, skip_serializing_if = "Option::is_none")]
8385 pub on_cluster: Option<OnCluster>,
8386 #[serde(default, skip_serializing_if = "Option::is_none")]
8388 pub to_table: Option<TableRef>,
8389 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8391 pub table_properties: Vec<Expression>,
8392}
8393
8394impl CreateView {
8395 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8396 Self {
8397 name: TableRef::new(name),
8398 columns: Vec::new(),
8399 query,
8400 or_replace: false,
8401 or_alter: false,
8402 if_not_exists: false,
8403 materialized: false,
8404 temporary: false,
8405 secure: false,
8406 algorithm: None,
8407 definer: None,
8408 security: None,
8409 security_sql_style: true,
8410 security_after_name: false,
8411 query_parenthesized: false,
8412 locking_mode: None,
8413 locking_access: None,
8414 copy_grants: false,
8415 comment: None,
8416 tags: Vec::new(),
8417 options: Vec::new(),
8418 build: None,
8419 refresh: None,
8420 schema: None,
8421 unique_key: None,
8422 no_schema_binding: false,
8423 auto_refresh: None,
8424 on_cluster: None,
8425 to_table: None,
8426 table_properties: Vec::new(),
8427 }
8428 }
8429}
8430
8431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8433#[cfg_attr(feature = "bindings", derive(TS))]
8434pub struct DropView {
8435 pub name: TableRef,
8436 pub if_exists: bool,
8437 pub materialized: bool,
8438}
8439
8440impl DropView {
8441 pub fn new(name: impl Into<String>) -> Self {
8442 Self {
8443 name: TableRef::new(name),
8444 if_exists: false,
8445 materialized: false,
8446 }
8447 }
8448}
8449
8450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8452#[cfg_attr(feature = "bindings", derive(TS))]
8453pub struct Truncate {
8454 #[serde(default)]
8456 pub target: TruncateTarget,
8457 #[serde(default)]
8459 pub if_exists: bool,
8460 pub table: TableRef,
8461 #[serde(default, skip_serializing_if = "Option::is_none")]
8463 pub on_cluster: Option<OnCluster>,
8464 pub cascade: bool,
8465 #[serde(default)]
8467 pub extra_tables: Vec<TruncateTableEntry>,
8468 #[serde(default)]
8470 pub identity: Option<TruncateIdentity>,
8471 #[serde(default)]
8473 pub restrict: bool,
8474 #[serde(default, skip_serializing_if = "Option::is_none")]
8476 pub partition: Option<Box<Expression>>,
8477}
8478
8479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8481#[cfg_attr(feature = "bindings", derive(TS))]
8482pub struct TruncateTableEntry {
8483 pub table: TableRef,
8484 #[serde(default)]
8486 pub star: bool,
8487}
8488
8489#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8491#[cfg_attr(feature = "bindings", derive(TS))]
8492pub enum TruncateTarget {
8493 Table,
8494 Database,
8495}
8496
8497impl Default for TruncateTarget {
8498 fn default() -> Self {
8499 TruncateTarget::Table
8500 }
8501}
8502
8503#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8505#[cfg_attr(feature = "bindings", derive(TS))]
8506pub enum TruncateIdentity {
8507 Restart,
8508 Continue,
8509}
8510
8511impl Truncate {
8512 pub fn new(table: impl Into<String>) -> Self {
8513 Self {
8514 target: TruncateTarget::Table,
8515 if_exists: false,
8516 table: TableRef::new(table),
8517 on_cluster: None,
8518 cascade: false,
8519 extra_tables: Vec::new(),
8520 identity: None,
8521 restrict: false,
8522 partition: None,
8523 }
8524 }
8525}
8526
8527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8529#[cfg_attr(feature = "bindings", derive(TS))]
8530pub struct Use {
8531 pub kind: Option<UseKind>,
8533 pub this: Identifier,
8535}
8536
8537#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8539#[cfg_attr(feature = "bindings", derive(TS))]
8540pub enum UseKind {
8541 Database,
8542 Schema,
8543 Role,
8544 Warehouse,
8545 Catalog,
8546 SecondaryRoles,
8548}
8549
8550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8552#[cfg_attr(feature = "bindings", derive(TS))]
8553pub struct SetStatement {
8554 pub items: Vec<SetItem>,
8556}
8557
8558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8560#[cfg_attr(feature = "bindings", derive(TS))]
8561pub struct SetItem {
8562 pub name: Expression,
8564 pub value: Expression,
8566 pub kind: Option<String>,
8568 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8570 pub no_equals: bool,
8571}
8572
8573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8575#[cfg_attr(feature = "bindings", derive(TS))]
8576pub struct Cache {
8577 pub table: Identifier,
8579 pub lazy: bool,
8581 pub options: Vec<(Expression, Expression)>,
8583 pub query: Option<Expression>,
8585}
8586
8587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8589#[cfg_attr(feature = "bindings", derive(TS))]
8590pub struct Uncache {
8591 pub table: Identifier,
8593 pub if_exists: bool,
8595}
8596
8597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8599#[cfg_attr(feature = "bindings", derive(TS))]
8600pub struct LoadData {
8601 pub local: bool,
8603 pub inpath: String,
8605 pub overwrite: bool,
8607 pub table: Expression,
8609 pub partition: Vec<(Identifier, Expression)>,
8611 pub input_format: Option<String>,
8613 pub serde: Option<String>,
8615}
8616
8617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8619#[cfg_attr(feature = "bindings", derive(TS))]
8620pub struct Pragma {
8621 pub schema: Option<Identifier>,
8623 pub name: Identifier,
8625 pub value: Option<Expression>,
8627 pub args: Vec<Expression>,
8629}
8630
8631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8634#[cfg_attr(feature = "bindings", derive(TS))]
8635pub struct Privilege {
8636 pub name: String,
8638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8640 pub columns: Vec<String>,
8641}
8642
8643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8645#[cfg_attr(feature = "bindings", derive(TS))]
8646pub struct GrantPrincipal {
8647 pub name: Identifier,
8649 pub is_role: bool,
8651 #[serde(default)]
8653 pub is_group: bool,
8654 #[serde(default)]
8656 pub is_share: bool,
8657}
8658
8659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8661#[cfg_attr(feature = "bindings", derive(TS))]
8662pub struct Grant {
8663 pub privileges: Vec<Privilege>,
8665 pub kind: Option<String>,
8667 pub securable: Identifier,
8669 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8671 pub function_params: Vec<String>,
8672 pub principals: Vec<GrantPrincipal>,
8674 pub grant_option: bool,
8676 #[serde(default, skip_serializing_if = "Option::is_none")]
8678 pub as_principal: Option<Identifier>,
8679}
8680
8681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8683#[cfg_attr(feature = "bindings", derive(TS))]
8684pub struct Revoke {
8685 pub privileges: Vec<Privilege>,
8687 pub kind: Option<String>,
8689 pub securable: Identifier,
8691 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8693 pub function_params: Vec<String>,
8694 pub principals: Vec<GrantPrincipal>,
8696 pub grant_option: bool,
8698 pub cascade: bool,
8700 #[serde(default)]
8702 pub restrict: bool,
8703}
8704
8705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8707#[cfg_attr(feature = "bindings", derive(TS))]
8708pub struct Comment {
8709 pub this: Expression,
8711 pub kind: String,
8713 pub expression: Expression,
8715 pub exists: bool,
8717 pub materialized: bool,
8719}
8720
8721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8727#[cfg_attr(feature = "bindings", derive(TS))]
8728pub struct AlterView {
8729 pub name: TableRef,
8730 pub actions: Vec<AlterViewAction>,
8731 #[serde(default, skip_serializing_if = "Option::is_none")]
8733 pub algorithm: Option<String>,
8734 #[serde(default, skip_serializing_if = "Option::is_none")]
8736 pub definer: Option<String>,
8737 #[serde(default, skip_serializing_if = "Option::is_none")]
8739 pub sql_security: Option<String>,
8740 #[serde(default, skip_serializing_if = "Option::is_none")]
8742 pub with_option: Option<String>,
8743 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8745 pub columns: Vec<ViewColumn>,
8746}
8747
8748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8750#[cfg_attr(feature = "bindings", derive(TS))]
8751pub enum AlterViewAction {
8752 Rename(TableRef),
8754 OwnerTo(Identifier),
8756 SetSchema(Identifier),
8758 SetAuthorization(String),
8760 AlterColumn {
8762 name: Identifier,
8763 action: AlterColumnAction,
8764 },
8765 AsSelect(Box<Expression>),
8767 SetTblproperties(Vec<(String, String)>),
8769 UnsetTblproperties(Vec<String>),
8771}
8772
8773impl AlterView {
8774 pub fn new(name: impl Into<String>) -> Self {
8775 Self {
8776 name: TableRef::new(name),
8777 actions: Vec::new(),
8778 algorithm: None,
8779 definer: None,
8780 sql_security: None,
8781 with_option: None,
8782 columns: Vec::new(),
8783 }
8784 }
8785}
8786
8787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8789#[cfg_attr(feature = "bindings", derive(TS))]
8790pub struct AlterIndex {
8791 pub name: Identifier,
8792 pub table: Option<TableRef>,
8793 pub actions: Vec<AlterIndexAction>,
8794}
8795
8796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8798#[cfg_attr(feature = "bindings", derive(TS))]
8799pub enum AlterIndexAction {
8800 Rename(Identifier),
8802 SetTablespace(Identifier),
8804 Visible(bool),
8806}
8807
8808impl AlterIndex {
8809 pub fn new(name: impl Into<String>) -> Self {
8810 Self {
8811 name: Identifier::new(name),
8812 table: None,
8813 actions: Vec::new(),
8814 }
8815 }
8816}
8817
8818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8820#[cfg_attr(feature = "bindings", derive(TS))]
8821pub struct CreateSchema {
8822 pub name: Vec<Identifier>,
8824 pub if_not_exists: bool,
8825 pub authorization: Option<Identifier>,
8826 #[serde(default)]
8828 pub clone_from: Option<Vec<Identifier>>,
8829 #[serde(default)]
8831 pub at_clause: Option<Expression>,
8832 #[serde(default)]
8834 pub properties: Vec<Expression>,
8835 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8837 pub leading_comments: Vec<String>,
8838}
8839
8840impl CreateSchema {
8841 pub fn new(name: impl Into<String>) -> Self {
8842 Self {
8843 name: vec![Identifier::new(name)],
8844 if_not_exists: false,
8845 authorization: None,
8846 clone_from: None,
8847 at_clause: None,
8848 properties: Vec::new(),
8849 leading_comments: Vec::new(),
8850 }
8851 }
8852}
8853
8854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8856#[cfg_attr(feature = "bindings", derive(TS))]
8857pub struct DropSchema {
8858 pub name: Identifier,
8859 pub if_exists: bool,
8860 pub cascade: bool,
8861}
8862
8863impl DropSchema {
8864 pub fn new(name: impl Into<String>) -> Self {
8865 Self {
8866 name: Identifier::new(name),
8867 if_exists: false,
8868 cascade: false,
8869 }
8870 }
8871}
8872
8873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8875#[cfg_attr(feature = "bindings", derive(TS))]
8876pub struct DropNamespace {
8877 pub name: Identifier,
8878 pub if_exists: bool,
8879 pub cascade: bool,
8880}
8881
8882impl DropNamespace {
8883 pub fn new(name: impl Into<String>) -> Self {
8884 Self {
8885 name: Identifier::new(name),
8886 if_exists: false,
8887 cascade: false,
8888 }
8889 }
8890}
8891
8892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8894#[cfg_attr(feature = "bindings", derive(TS))]
8895pub struct CreateDatabase {
8896 pub name: Identifier,
8897 pub if_not_exists: bool,
8898 pub options: Vec<DatabaseOption>,
8899 #[serde(default)]
8901 pub clone_from: Option<Identifier>,
8902 #[serde(default)]
8904 pub at_clause: Option<Expression>,
8905}
8906
8907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8909#[cfg_attr(feature = "bindings", derive(TS))]
8910pub enum DatabaseOption {
8911 CharacterSet(String),
8912 Collate(String),
8913 Owner(Identifier),
8914 Template(Identifier),
8915 Encoding(String),
8916 Location(String),
8917}
8918
8919impl CreateDatabase {
8920 pub fn new(name: impl Into<String>) -> Self {
8921 Self {
8922 name: Identifier::new(name),
8923 if_not_exists: false,
8924 options: Vec::new(),
8925 clone_from: None,
8926 at_clause: None,
8927 }
8928 }
8929}
8930
8931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8933#[cfg_attr(feature = "bindings", derive(TS))]
8934pub struct DropDatabase {
8935 pub name: Identifier,
8936 pub if_exists: bool,
8937 #[serde(default)]
8939 pub sync: bool,
8940}
8941
8942impl DropDatabase {
8943 pub fn new(name: impl Into<String>) -> Self {
8944 Self {
8945 name: Identifier::new(name),
8946 if_exists: false,
8947 sync: false,
8948 }
8949 }
8950}
8951
8952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8954#[cfg_attr(feature = "bindings", derive(TS))]
8955pub struct CreateFunction {
8956 pub name: TableRef,
8957 pub parameters: Vec<FunctionParameter>,
8958 pub return_type: Option<DataType>,
8959 pub body: Option<FunctionBody>,
8960 pub or_replace: bool,
8961 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8963 pub or_alter: bool,
8964 pub if_not_exists: bool,
8965 pub temporary: bool,
8966 pub language: Option<String>,
8967 pub deterministic: Option<bool>,
8968 pub returns_null_on_null_input: Option<bool>,
8969 pub security: Option<FunctionSecurity>,
8970 #[serde(default = "default_true")]
8972 pub has_parens: bool,
8973 #[serde(default)]
8975 pub sql_data_access: Option<SqlDataAccess>,
8976 #[serde(default, skip_serializing_if = "Option::is_none")]
8978 pub returns_table_body: Option<String>,
8979 #[serde(default)]
8981 pub language_first: bool,
8982 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8984 pub set_options: Vec<FunctionSetOption>,
8985 #[serde(default)]
8987 pub strict: bool,
8988 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8990 pub options: Vec<Expression>,
8991 #[serde(default)]
8993 pub is_table_function: bool,
8994 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8996 pub property_order: Vec<FunctionPropertyKind>,
8997 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8999 pub environment: Vec<Expression>,
9000 #[serde(default, skip_serializing_if = "Option::is_none")]
9002 pub handler: Option<String>,
9003 #[serde(default, skip_serializing_if = "Option::is_none")]
9005 pub parameter_style: Option<String>,
9006}
9007
9008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9010#[cfg_attr(feature = "bindings", derive(TS))]
9011pub struct FunctionSetOption {
9012 pub name: String,
9013 pub value: FunctionSetValue,
9014}
9015
9016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9018#[cfg_attr(feature = "bindings", derive(TS))]
9019pub enum FunctionSetValue {
9020 Value { value: String, use_to: bool },
9022 FromCurrent,
9024}
9025
9026#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9028#[cfg_attr(feature = "bindings", derive(TS))]
9029pub enum SqlDataAccess {
9030 NoSql,
9032 ContainsSql,
9034 ReadsSqlData,
9036 ModifiesSqlData,
9038}
9039
9040#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9042#[cfg_attr(feature = "bindings", derive(TS))]
9043pub enum FunctionPropertyKind {
9044 Set,
9046 As,
9048 Language,
9050 Determinism,
9052 NullInput,
9054 Security,
9056 SqlDataAccess,
9058 Options,
9060 Environment,
9062 Handler,
9064 ParameterStyle,
9066}
9067
9068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9070#[cfg_attr(feature = "bindings", derive(TS))]
9071pub struct FunctionParameter {
9072 pub name: Option<Identifier>,
9073 pub data_type: DataType,
9074 pub mode: Option<ParameterMode>,
9075 pub default: Option<Expression>,
9076 #[serde(default, skip_serializing_if = "Option::is_none")]
9078 pub mode_text: Option<String>,
9079}
9080
9081#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9083#[cfg_attr(feature = "bindings", derive(TS))]
9084pub enum ParameterMode {
9085 In,
9086 Out,
9087 InOut,
9088 Variadic,
9089}
9090
9091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9093#[cfg_attr(feature = "bindings", derive(TS))]
9094pub enum FunctionBody {
9095 Block(String),
9097 StringLiteral(String),
9099 Expression(Expression),
9101 External(String),
9103 Return(Expression),
9105 Statements(Vec<Expression>),
9107 DollarQuoted {
9110 content: String,
9111 tag: Option<String>,
9112 },
9113}
9114
9115#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9117#[cfg_attr(feature = "bindings", derive(TS))]
9118pub enum FunctionSecurity {
9119 Definer,
9120 Invoker,
9121 None,
9123}
9124
9125impl CreateFunction {
9126 pub fn new(name: impl Into<String>) -> Self {
9127 Self {
9128 name: TableRef::new(name),
9129 parameters: Vec::new(),
9130 return_type: None,
9131 body: None,
9132 or_replace: false,
9133 or_alter: false,
9134 if_not_exists: false,
9135 temporary: false,
9136 language: None,
9137 deterministic: None,
9138 returns_null_on_null_input: None,
9139 security: None,
9140 has_parens: true,
9141 sql_data_access: None,
9142 returns_table_body: None,
9143 language_first: false,
9144 set_options: Vec::new(),
9145 strict: false,
9146 options: Vec::new(),
9147 is_table_function: false,
9148 property_order: Vec::new(),
9149 environment: Vec::new(),
9150 handler: None,
9151 parameter_style: None,
9152 }
9153 }
9154}
9155
9156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9158#[cfg_attr(feature = "bindings", derive(TS))]
9159pub struct DropFunction {
9160 pub name: TableRef,
9161 pub parameters: Option<Vec<DataType>>,
9162 pub if_exists: bool,
9163 pub cascade: bool,
9164}
9165
9166impl DropFunction {
9167 pub fn new(name: impl Into<String>) -> Self {
9168 Self {
9169 name: TableRef::new(name),
9170 parameters: None,
9171 if_exists: false,
9172 cascade: false,
9173 }
9174 }
9175}
9176
9177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9179#[cfg_attr(feature = "bindings", derive(TS))]
9180pub struct CreateProcedure {
9181 pub name: TableRef,
9182 pub parameters: Vec<FunctionParameter>,
9183 pub body: Option<FunctionBody>,
9184 pub or_replace: bool,
9185 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9187 pub or_alter: bool,
9188 pub if_not_exists: bool,
9189 pub language: Option<String>,
9190 pub security: Option<FunctionSecurity>,
9191 #[serde(default)]
9193 pub return_type: Option<DataType>,
9194 #[serde(default)]
9196 pub execute_as: Option<String>,
9197 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9199 pub with_options: Vec<String>,
9200 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9202 pub has_parens: bool,
9203 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9205 pub use_proc_keyword: bool,
9206}
9207
9208impl CreateProcedure {
9209 pub fn new(name: impl Into<String>) -> Self {
9210 Self {
9211 name: TableRef::new(name),
9212 parameters: Vec::new(),
9213 body: None,
9214 or_replace: false,
9215 or_alter: false,
9216 if_not_exists: false,
9217 language: None,
9218 security: None,
9219 return_type: None,
9220 execute_as: None,
9221 with_options: Vec::new(),
9222 has_parens: true,
9223 use_proc_keyword: false,
9224 }
9225 }
9226}
9227
9228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9230#[cfg_attr(feature = "bindings", derive(TS))]
9231pub struct DropProcedure {
9232 pub name: TableRef,
9233 pub parameters: Option<Vec<DataType>>,
9234 pub if_exists: bool,
9235 pub cascade: bool,
9236}
9237
9238impl DropProcedure {
9239 pub fn new(name: impl Into<String>) -> Self {
9240 Self {
9241 name: TableRef::new(name),
9242 parameters: None,
9243 if_exists: false,
9244 cascade: false,
9245 }
9246 }
9247}
9248
9249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9251#[cfg_attr(feature = "bindings", derive(TS))]
9252pub enum SeqPropKind {
9253 Start,
9254 Increment,
9255 Minvalue,
9256 Maxvalue,
9257 Cache,
9258 NoCache,
9259 Cycle,
9260 NoCycle,
9261 OwnedBy,
9262 Order,
9263 NoOrder,
9264 Comment,
9265 Sharing,
9267 Keep,
9269 NoKeep,
9271 Scale,
9273 NoScale,
9275 Shard,
9277 NoShard,
9279 Session,
9281 Global,
9283 NoCacheWord,
9285 NoCycleWord,
9287 NoMinvalueWord,
9289 NoMaxvalueWord,
9291}
9292
9293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9295#[cfg_attr(feature = "bindings", derive(TS))]
9296pub struct CreateSynonym {
9297 pub name: TableRef,
9299 pub target: TableRef,
9301}
9302
9303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9305#[cfg_attr(feature = "bindings", derive(TS))]
9306pub struct CreateSequence {
9307 pub name: TableRef,
9308 pub if_not_exists: bool,
9309 pub temporary: bool,
9310 #[serde(default)]
9311 pub or_replace: bool,
9312 #[serde(default, skip_serializing_if = "Option::is_none")]
9314 pub as_type: Option<DataType>,
9315 pub increment: Option<i64>,
9316 pub minvalue: Option<SequenceBound>,
9317 pub maxvalue: Option<SequenceBound>,
9318 pub start: Option<i64>,
9319 pub cache: Option<i64>,
9320 pub cycle: bool,
9321 pub owned_by: Option<TableRef>,
9322 #[serde(default)]
9324 pub owned_by_none: bool,
9325 #[serde(default)]
9327 pub order: Option<bool>,
9328 #[serde(default)]
9330 pub comment: Option<String>,
9331 #[serde(default, skip_serializing_if = "Option::is_none")]
9333 pub sharing: Option<String>,
9334 #[serde(default, skip_serializing_if = "Option::is_none")]
9336 pub scale_modifier: Option<String>,
9337 #[serde(default, skip_serializing_if = "Option::is_none")]
9339 pub shard_modifier: Option<String>,
9340 #[serde(default)]
9342 pub property_order: Vec<SeqPropKind>,
9343}
9344
9345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9347#[cfg_attr(feature = "bindings", derive(TS))]
9348pub enum SequenceBound {
9349 Value(i64),
9350 None,
9351}
9352
9353impl CreateSequence {
9354 pub fn new(name: impl Into<String>) -> Self {
9355 Self {
9356 name: TableRef::new(name),
9357 if_not_exists: false,
9358 temporary: false,
9359 or_replace: false,
9360 as_type: None,
9361 increment: None,
9362 minvalue: None,
9363 maxvalue: None,
9364 start: None,
9365 cache: None,
9366 cycle: false,
9367 owned_by: None,
9368 owned_by_none: false,
9369 order: None,
9370 comment: None,
9371 sharing: None,
9372 scale_modifier: None,
9373 shard_modifier: None,
9374 property_order: Vec::new(),
9375 }
9376 }
9377}
9378
9379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9381#[cfg_attr(feature = "bindings", derive(TS))]
9382pub struct DropSequence {
9383 pub name: TableRef,
9384 pub if_exists: bool,
9385 pub cascade: bool,
9386}
9387
9388impl DropSequence {
9389 pub fn new(name: impl Into<String>) -> Self {
9390 Self {
9391 name: TableRef::new(name),
9392 if_exists: false,
9393 cascade: false,
9394 }
9395 }
9396}
9397
9398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9400#[cfg_attr(feature = "bindings", derive(TS))]
9401pub struct AlterSequence {
9402 pub name: TableRef,
9403 pub if_exists: bool,
9404 pub increment: Option<i64>,
9405 pub minvalue: Option<SequenceBound>,
9406 pub maxvalue: Option<SequenceBound>,
9407 pub start: Option<i64>,
9408 pub restart: Option<Option<i64>>,
9409 pub cache: Option<i64>,
9410 pub cycle: Option<bool>,
9411 pub owned_by: Option<Option<TableRef>>,
9412}
9413
9414impl AlterSequence {
9415 pub fn new(name: impl Into<String>) -> Self {
9416 Self {
9417 name: TableRef::new(name),
9418 if_exists: false,
9419 increment: None,
9420 minvalue: None,
9421 maxvalue: None,
9422 start: None,
9423 restart: None,
9424 cache: None,
9425 cycle: None,
9426 owned_by: None,
9427 }
9428 }
9429}
9430
9431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9433#[cfg_attr(feature = "bindings", derive(TS))]
9434pub struct CreateTrigger {
9435 pub name: Identifier,
9436 pub table: TableRef,
9437 pub timing: TriggerTiming,
9438 pub events: Vec<TriggerEvent>,
9439 #[serde(default, skip_serializing_if = "Option::is_none")]
9440 pub for_each: Option<TriggerForEach>,
9441 pub when: Option<Expression>,
9442 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9444 pub when_paren: bool,
9445 pub body: TriggerBody,
9446 pub or_replace: bool,
9447 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9449 pub or_alter: bool,
9450 pub constraint: bool,
9451 pub deferrable: Option<bool>,
9452 pub initially_deferred: Option<bool>,
9453 pub referencing: Option<TriggerReferencing>,
9454}
9455
9456#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9458#[cfg_attr(feature = "bindings", derive(TS))]
9459pub enum TriggerTiming {
9460 Before,
9461 After,
9462 InsteadOf,
9463}
9464
9465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9467#[cfg_attr(feature = "bindings", derive(TS))]
9468pub enum TriggerEvent {
9469 Insert,
9470 Update(Option<Vec<Identifier>>),
9471 Delete,
9472 Truncate,
9473}
9474
9475#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9477#[cfg_attr(feature = "bindings", derive(TS))]
9478pub enum TriggerForEach {
9479 Row,
9480 Statement,
9481}
9482
9483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9485#[cfg_attr(feature = "bindings", derive(TS))]
9486pub enum TriggerBody {
9487 Execute {
9489 function: TableRef,
9490 args: Vec<Expression>,
9491 },
9492 Block(String),
9494}
9495
9496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9498#[cfg_attr(feature = "bindings", derive(TS))]
9499pub struct TriggerReferencing {
9500 pub old_table: Option<Identifier>,
9501 pub new_table: Option<Identifier>,
9502 pub old_row: Option<Identifier>,
9503 pub new_row: Option<Identifier>,
9504}
9505
9506impl CreateTrigger {
9507 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9508 Self {
9509 name: Identifier::new(name),
9510 table: TableRef::new(table),
9511 timing: TriggerTiming::Before,
9512 events: Vec::new(),
9513 for_each: Some(TriggerForEach::Row),
9514 when: None,
9515 when_paren: false,
9516 body: TriggerBody::Execute {
9517 function: TableRef::new(""),
9518 args: Vec::new(),
9519 },
9520 or_replace: false,
9521 or_alter: false,
9522 constraint: false,
9523 deferrable: None,
9524 initially_deferred: None,
9525 referencing: None,
9526 }
9527 }
9528}
9529
9530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9532#[cfg_attr(feature = "bindings", derive(TS))]
9533pub struct DropTrigger {
9534 pub name: Identifier,
9535 pub table: Option<TableRef>,
9536 pub if_exists: bool,
9537 pub cascade: bool,
9538}
9539
9540impl DropTrigger {
9541 pub fn new(name: impl Into<String>) -> Self {
9542 Self {
9543 name: Identifier::new(name),
9544 table: None,
9545 if_exists: false,
9546 cascade: false,
9547 }
9548 }
9549}
9550
9551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9553#[cfg_attr(feature = "bindings", derive(TS))]
9554pub struct CreateType {
9555 pub name: TableRef,
9556 pub definition: TypeDefinition,
9557 pub if_not_exists: bool,
9558}
9559
9560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9562#[cfg_attr(feature = "bindings", derive(TS))]
9563pub enum TypeDefinition {
9564 Enum(Vec<String>),
9566 Composite(Vec<TypeAttribute>),
9568 Range {
9570 subtype: DataType,
9571 subtype_diff: Option<String>,
9572 canonical: Option<String>,
9573 },
9574 Base {
9576 input: String,
9577 output: String,
9578 internallength: Option<i32>,
9579 },
9580 Domain {
9582 base_type: DataType,
9583 default: Option<Expression>,
9584 constraints: Vec<DomainConstraint>,
9585 },
9586}
9587
9588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9590#[cfg_attr(feature = "bindings", derive(TS))]
9591pub struct TypeAttribute {
9592 pub name: Identifier,
9593 pub data_type: DataType,
9594 pub collate: Option<Identifier>,
9595}
9596
9597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9599#[cfg_attr(feature = "bindings", derive(TS))]
9600pub struct DomainConstraint {
9601 pub name: Option<Identifier>,
9602 pub check: Expression,
9603}
9604
9605impl CreateType {
9606 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9607 Self {
9608 name: TableRef::new(name),
9609 definition: TypeDefinition::Enum(values),
9610 if_not_exists: false,
9611 }
9612 }
9613
9614 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9615 Self {
9616 name: TableRef::new(name),
9617 definition: TypeDefinition::Composite(attributes),
9618 if_not_exists: false,
9619 }
9620 }
9621}
9622
9623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9625#[cfg_attr(feature = "bindings", derive(TS))]
9626pub struct DropType {
9627 pub name: TableRef,
9628 pub if_exists: bool,
9629 pub cascade: bool,
9630}
9631
9632impl DropType {
9633 pub fn new(name: impl Into<String>) -> Self {
9634 Self {
9635 name: TableRef::new(name),
9636 if_exists: false,
9637 cascade: false,
9638 }
9639 }
9640}
9641
9642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9644#[cfg_attr(feature = "bindings", derive(TS))]
9645pub struct Describe {
9646 pub target: Expression,
9648 pub extended: bool,
9650 pub formatted: bool,
9652 #[serde(default)]
9654 pub kind: Option<String>,
9655 #[serde(default)]
9657 pub properties: Vec<(String, String)>,
9658 #[serde(default, skip_serializing_if = "Option::is_none")]
9660 pub style: Option<String>,
9661 #[serde(default)]
9663 pub partition: Option<Box<Expression>>,
9664 #[serde(default)]
9666 pub leading_comments: Vec<String>,
9667 #[serde(default)]
9669 pub as_json: bool,
9670}
9671
9672impl Describe {
9673 pub fn new(target: Expression) -> Self {
9674 Self {
9675 target,
9676 extended: false,
9677 formatted: false,
9678 kind: None,
9679 properties: Vec::new(),
9680 style: None,
9681 partition: None,
9682 leading_comments: Vec::new(),
9683 as_json: false,
9684 }
9685 }
9686}
9687
9688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9690#[cfg_attr(feature = "bindings", derive(TS))]
9691pub struct Show {
9692 pub this: String,
9694 #[serde(default)]
9696 pub terse: bool,
9697 #[serde(default)]
9699 pub history: bool,
9700 pub like: Option<Expression>,
9702 pub scope_kind: Option<String>,
9704 pub scope: Option<Expression>,
9706 pub starts_with: Option<Expression>,
9708 pub limit: Option<Box<Limit>>,
9710 pub from: Option<Expression>,
9712 #[serde(default, skip_serializing_if = "Option::is_none")]
9714 pub where_clause: Option<Expression>,
9715 #[serde(default, skip_serializing_if = "Option::is_none")]
9717 pub for_target: Option<Expression>,
9718 #[serde(default, skip_serializing_if = "Option::is_none")]
9720 pub db: Option<Expression>,
9721 #[serde(default, skip_serializing_if = "Option::is_none")]
9723 pub target: Option<Expression>,
9724 #[serde(default, skip_serializing_if = "Option::is_none")]
9726 pub mutex: Option<bool>,
9727 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9729 pub privileges: Vec<String>,
9730}
9731
9732impl Show {
9733 pub fn new(this: impl Into<String>) -> Self {
9734 Self {
9735 this: this.into(),
9736 terse: false,
9737 history: false,
9738 like: None,
9739 scope_kind: None,
9740 scope: None,
9741 starts_with: None,
9742 limit: None,
9743 from: None,
9744 where_clause: None,
9745 for_target: None,
9746 db: None,
9747 target: None,
9748 mutex: None,
9749 privileges: Vec::new(),
9750 }
9751 }
9752}
9753
9754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9759#[cfg_attr(feature = "bindings", derive(TS))]
9760pub struct Paren {
9761 pub this: Expression,
9763 #[serde(default)]
9764 pub trailing_comments: Vec<String>,
9765}
9766
9767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9769#[cfg_attr(feature = "bindings", derive(TS))]
9770pub struct Annotated {
9771 pub this: Expression,
9772 pub trailing_comments: Vec<String>,
9773}
9774
9775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9780#[cfg_attr(feature = "bindings", derive(TS))]
9781pub struct Refresh {
9782 pub this: Box<Expression>,
9783 pub kind: String,
9784}
9785
9786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9788#[cfg_attr(feature = "bindings", derive(TS))]
9789pub struct LockingStatement {
9790 pub this: Box<Expression>,
9791 pub expression: Box<Expression>,
9792}
9793
9794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9796#[cfg_attr(feature = "bindings", derive(TS))]
9797pub struct SequenceProperties {
9798 #[serde(default)]
9799 pub increment: Option<Box<Expression>>,
9800 #[serde(default)]
9801 pub minvalue: Option<Box<Expression>>,
9802 #[serde(default)]
9803 pub maxvalue: Option<Box<Expression>>,
9804 #[serde(default)]
9805 pub cache: Option<Box<Expression>>,
9806 #[serde(default)]
9807 pub start: Option<Box<Expression>>,
9808 #[serde(default)]
9809 pub owned: Option<Box<Expression>>,
9810 #[serde(default)]
9811 pub options: Vec<Expression>,
9812}
9813
9814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9816#[cfg_attr(feature = "bindings", derive(TS))]
9817pub struct TruncateTable {
9818 #[serde(default)]
9819 pub expressions: Vec<Expression>,
9820 #[serde(default)]
9821 pub is_database: Option<Box<Expression>>,
9822 #[serde(default)]
9823 pub exists: bool,
9824 #[serde(default)]
9825 pub only: Option<Box<Expression>>,
9826 #[serde(default)]
9827 pub cluster: Option<Box<Expression>>,
9828 #[serde(default)]
9829 pub identity: Option<Box<Expression>>,
9830 #[serde(default)]
9831 pub option: Option<Box<Expression>>,
9832 #[serde(default)]
9833 pub partition: Option<Box<Expression>>,
9834}
9835
9836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9838#[cfg_attr(feature = "bindings", derive(TS))]
9839pub struct Clone {
9840 pub this: Box<Expression>,
9841 #[serde(default)]
9842 pub shallow: Option<Box<Expression>>,
9843 #[serde(default)]
9844 pub copy: Option<Box<Expression>>,
9845}
9846
9847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9849#[cfg_attr(feature = "bindings", derive(TS))]
9850pub struct Attach {
9851 pub this: Box<Expression>,
9852 #[serde(default)]
9853 pub exists: bool,
9854 #[serde(default)]
9855 pub expressions: Vec<Expression>,
9856}
9857
9858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9860#[cfg_attr(feature = "bindings", derive(TS))]
9861pub struct Detach {
9862 pub this: Box<Expression>,
9863 #[serde(default)]
9864 pub exists: bool,
9865}
9866
9867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9869#[cfg_attr(feature = "bindings", derive(TS))]
9870pub struct Install {
9871 pub this: Box<Expression>,
9872 #[serde(default)]
9873 pub from_: Option<Box<Expression>>,
9874 #[serde(default)]
9875 pub force: Option<Box<Expression>>,
9876}
9877
9878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9880#[cfg_attr(feature = "bindings", derive(TS))]
9881pub struct Summarize {
9882 pub this: Box<Expression>,
9883 #[serde(default)]
9884 pub table: Option<Box<Expression>>,
9885}
9886
9887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9889#[cfg_attr(feature = "bindings", derive(TS))]
9890pub struct Declare {
9891 #[serde(default)]
9892 pub expressions: Vec<Expression>,
9893 #[serde(default)]
9894 pub replace: bool,
9895}
9896
9897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9899#[cfg_attr(feature = "bindings", derive(TS))]
9900pub struct DeclareItem {
9901 pub this: Box<Expression>,
9902 #[serde(default)]
9903 pub kind: Option<String>,
9904 #[serde(default)]
9905 pub default: Option<Box<Expression>>,
9906 #[serde(default)]
9907 pub has_as: bool,
9908 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9910 pub additional_names: Vec<Expression>,
9911}
9912
9913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9915#[cfg_attr(feature = "bindings", derive(TS))]
9916pub struct Set {
9917 #[serde(default)]
9918 pub expressions: Vec<Expression>,
9919 #[serde(default)]
9920 pub unset: Option<Box<Expression>>,
9921 #[serde(default)]
9922 pub tag: Option<Box<Expression>>,
9923}
9924
9925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9927#[cfg_attr(feature = "bindings", derive(TS))]
9928pub struct Heredoc {
9929 pub this: Box<Expression>,
9930 #[serde(default)]
9931 pub tag: Option<Box<Expression>>,
9932}
9933
9934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9936#[cfg_attr(feature = "bindings", derive(TS))]
9937pub struct QueryBand {
9938 pub this: Box<Expression>,
9939 #[serde(default)]
9940 pub scope: Option<Box<Expression>>,
9941 #[serde(default)]
9942 pub update: Option<Box<Expression>>,
9943}
9944
9945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9947#[cfg_attr(feature = "bindings", derive(TS))]
9948pub struct UserDefinedFunction {
9949 pub this: Box<Expression>,
9950 #[serde(default)]
9951 pub expressions: Vec<Expression>,
9952 #[serde(default)]
9953 pub wrapped: Option<Box<Expression>>,
9954}
9955
9956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9958#[cfg_attr(feature = "bindings", derive(TS))]
9959pub struct RecursiveWithSearch {
9960 pub kind: String,
9961 pub this: Box<Expression>,
9962 pub expression: Box<Expression>,
9963 #[serde(default)]
9964 pub using: Option<Box<Expression>>,
9965}
9966
9967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9969#[cfg_attr(feature = "bindings", derive(TS))]
9970pub struct ProjectionDef {
9971 pub this: Box<Expression>,
9972 pub expression: Box<Expression>,
9973}
9974
9975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9977#[cfg_attr(feature = "bindings", derive(TS))]
9978pub struct TableAlias {
9979 #[serde(default)]
9980 pub this: Option<Box<Expression>>,
9981 #[serde(default)]
9982 pub columns: Vec<Expression>,
9983}
9984
9985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9987#[cfg_attr(feature = "bindings", derive(TS))]
9988pub struct ByteString {
9989 pub this: Box<Expression>,
9990 #[serde(default)]
9991 pub is_bytes: Option<Box<Expression>>,
9992}
9993
9994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9997#[cfg_attr(feature = "bindings", derive(TS))]
9998pub struct HexStringExpr {
9999 pub this: Box<Expression>,
10000 #[serde(default)]
10001 pub is_integer: Option<bool>,
10002}
10003
10004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10006#[cfg_attr(feature = "bindings", derive(TS))]
10007pub struct UnicodeString {
10008 pub this: Box<Expression>,
10009 #[serde(default)]
10010 pub escape: Option<Box<Expression>>,
10011}
10012
10013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10015#[cfg_attr(feature = "bindings", derive(TS))]
10016pub struct AlterColumn {
10017 pub this: Box<Expression>,
10018 #[serde(default)]
10019 pub dtype: Option<Box<Expression>>,
10020 #[serde(default)]
10021 pub collate: Option<Box<Expression>>,
10022 #[serde(default)]
10023 pub using: Option<Box<Expression>>,
10024 #[serde(default)]
10025 pub default: Option<Box<Expression>>,
10026 #[serde(default)]
10027 pub drop: Option<Box<Expression>>,
10028 #[serde(default)]
10029 pub comment: Option<Box<Expression>>,
10030 #[serde(default)]
10031 pub allow_null: Option<Box<Expression>>,
10032 #[serde(default)]
10033 pub visible: Option<Box<Expression>>,
10034 #[serde(default)]
10035 pub rename_to: Option<Box<Expression>>,
10036}
10037
10038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10040#[cfg_attr(feature = "bindings", derive(TS))]
10041pub struct AlterSortKey {
10042 #[serde(default)]
10043 pub this: Option<Box<Expression>>,
10044 #[serde(default)]
10045 pub expressions: Vec<Expression>,
10046 #[serde(default)]
10047 pub compound: Option<Box<Expression>>,
10048}
10049
10050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10052#[cfg_attr(feature = "bindings", derive(TS))]
10053pub struct AlterSet {
10054 #[serde(default)]
10055 pub expressions: Vec<Expression>,
10056 #[serde(default)]
10057 pub option: Option<Box<Expression>>,
10058 #[serde(default)]
10059 pub tablespace: Option<Box<Expression>>,
10060 #[serde(default)]
10061 pub access_method: Option<Box<Expression>>,
10062 #[serde(default)]
10063 pub file_format: Option<Box<Expression>>,
10064 #[serde(default)]
10065 pub copy_options: Option<Box<Expression>>,
10066 #[serde(default)]
10067 pub tag: Option<Box<Expression>>,
10068 #[serde(default)]
10069 pub location: Option<Box<Expression>>,
10070 #[serde(default)]
10071 pub serde: Option<Box<Expression>>,
10072}
10073
10074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10076#[cfg_attr(feature = "bindings", derive(TS))]
10077pub struct RenameColumn {
10078 pub this: Box<Expression>,
10079 #[serde(default)]
10080 pub to: Option<Box<Expression>>,
10081 #[serde(default)]
10082 pub exists: bool,
10083}
10084
10085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10087#[cfg_attr(feature = "bindings", derive(TS))]
10088pub struct Comprehension {
10089 pub this: Box<Expression>,
10090 pub expression: Box<Expression>,
10091 #[serde(default)]
10092 pub position: Option<Box<Expression>>,
10093 #[serde(default)]
10094 pub iterator: Option<Box<Expression>>,
10095 #[serde(default)]
10096 pub condition: Option<Box<Expression>>,
10097}
10098
10099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10101#[cfg_attr(feature = "bindings", derive(TS))]
10102pub struct MergeTreeTTLAction {
10103 pub this: Box<Expression>,
10104 #[serde(default)]
10105 pub delete: Option<Box<Expression>>,
10106 #[serde(default)]
10107 pub recompress: Option<Box<Expression>>,
10108 #[serde(default)]
10109 pub to_disk: Option<Box<Expression>>,
10110 #[serde(default)]
10111 pub to_volume: Option<Box<Expression>>,
10112}
10113
10114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10116#[cfg_attr(feature = "bindings", derive(TS))]
10117pub struct MergeTreeTTL {
10118 #[serde(default)]
10119 pub expressions: Vec<Expression>,
10120 #[serde(default)]
10121 pub where_: Option<Box<Expression>>,
10122 #[serde(default)]
10123 pub group: Option<Box<Expression>>,
10124 #[serde(default)]
10125 pub aggregates: Option<Box<Expression>>,
10126}
10127
10128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10130#[cfg_attr(feature = "bindings", derive(TS))]
10131pub struct IndexConstraintOption {
10132 #[serde(default)]
10133 pub key_block_size: Option<Box<Expression>>,
10134 #[serde(default)]
10135 pub using: Option<Box<Expression>>,
10136 #[serde(default)]
10137 pub parser: Option<Box<Expression>>,
10138 #[serde(default)]
10139 pub comment: Option<Box<Expression>>,
10140 #[serde(default)]
10141 pub visible: Option<Box<Expression>>,
10142 #[serde(default)]
10143 pub engine_attr: Option<Box<Expression>>,
10144 #[serde(default)]
10145 pub secondary_engine_attr: Option<Box<Expression>>,
10146}
10147
10148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10150#[cfg_attr(feature = "bindings", derive(TS))]
10151pub struct PeriodForSystemTimeConstraint {
10152 pub this: Box<Expression>,
10153 pub expression: Box<Expression>,
10154}
10155
10156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10158#[cfg_attr(feature = "bindings", derive(TS))]
10159pub struct CaseSpecificColumnConstraint {
10160 #[serde(default)]
10161 pub not_: Option<Box<Expression>>,
10162}
10163
10164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10166#[cfg_attr(feature = "bindings", derive(TS))]
10167pub struct CharacterSetColumnConstraint {
10168 pub this: Box<Expression>,
10169}
10170
10171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10173#[cfg_attr(feature = "bindings", derive(TS))]
10174pub struct CheckColumnConstraint {
10175 pub this: Box<Expression>,
10176 #[serde(default)]
10177 pub enforced: Option<Box<Expression>>,
10178}
10179
10180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10182#[cfg_attr(feature = "bindings", derive(TS))]
10183pub struct AssumeColumnConstraint {
10184 pub this: Box<Expression>,
10185}
10186
10187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10189#[cfg_attr(feature = "bindings", derive(TS))]
10190pub struct CompressColumnConstraint {
10191 #[serde(default)]
10192 pub this: Option<Box<Expression>>,
10193}
10194
10195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10197#[cfg_attr(feature = "bindings", derive(TS))]
10198pub struct DateFormatColumnConstraint {
10199 pub this: Box<Expression>,
10200}
10201
10202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10204#[cfg_attr(feature = "bindings", derive(TS))]
10205pub struct EphemeralColumnConstraint {
10206 #[serde(default)]
10207 pub this: Option<Box<Expression>>,
10208}
10209
10210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10212#[cfg_attr(feature = "bindings", derive(TS))]
10213pub struct WithOperator {
10214 pub this: Box<Expression>,
10215 pub op: String,
10216}
10217
10218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10220#[cfg_attr(feature = "bindings", derive(TS))]
10221pub struct GeneratedAsIdentityColumnConstraint {
10222 #[serde(default)]
10223 pub this: Option<Box<Expression>>,
10224 #[serde(default)]
10225 pub expression: Option<Box<Expression>>,
10226 #[serde(default)]
10227 pub on_null: Option<Box<Expression>>,
10228 #[serde(default)]
10229 pub start: Option<Box<Expression>>,
10230 #[serde(default)]
10231 pub increment: Option<Box<Expression>>,
10232 #[serde(default)]
10233 pub minvalue: Option<Box<Expression>>,
10234 #[serde(default)]
10235 pub maxvalue: Option<Box<Expression>>,
10236 #[serde(default)]
10237 pub cycle: Option<Box<Expression>>,
10238 #[serde(default)]
10239 pub order: Option<Box<Expression>>,
10240}
10241
10242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10245#[cfg_attr(feature = "bindings", derive(TS))]
10246pub struct AutoIncrementColumnConstraint;
10247
10248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10250#[cfg_attr(feature = "bindings", derive(TS))]
10251pub struct CommentColumnConstraint;
10252
10253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10255#[cfg_attr(feature = "bindings", derive(TS))]
10256pub struct GeneratedAsRowColumnConstraint {
10257 #[serde(default)]
10258 pub start: Option<Box<Expression>>,
10259 #[serde(default)]
10260 pub hidden: Option<Box<Expression>>,
10261}
10262
10263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10265#[cfg_attr(feature = "bindings", derive(TS))]
10266pub struct IndexColumnConstraint {
10267 #[serde(default)]
10268 pub this: Option<Box<Expression>>,
10269 #[serde(default)]
10270 pub expressions: Vec<Expression>,
10271 #[serde(default)]
10272 pub kind: Option<String>,
10273 #[serde(default)]
10274 pub index_type: Option<Box<Expression>>,
10275 #[serde(default)]
10276 pub options: Vec<Expression>,
10277 #[serde(default)]
10278 pub expression: Option<Box<Expression>>,
10279 #[serde(default)]
10280 pub granularity: Option<Box<Expression>>,
10281}
10282
10283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10285#[cfg_attr(feature = "bindings", derive(TS))]
10286pub struct MaskingPolicyColumnConstraint {
10287 pub this: Box<Expression>,
10288 #[serde(default)]
10289 pub expressions: Vec<Expression>,
10290}
10291
10292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10294#[cfg_attr(feature = "bindings", derive(TS))]
10295pub struct NotNullColumnConstraint {
10296 #[serde(default)]
10297 pub allow_null: Option<Box<Expression>>,
10298}
10299
10300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10302#[cfg_attr(feature = "bindings", derive(TS))]
10303pub struct DefaultColumnConstraint {
10304 pub this: Box<Expression>,
10305 #[serde(default, skip_serializing_if = "Option::is_none")]
10307 pub for_column: Option<Identifier>,
10308}
10309
10310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10312#[cfg_attr(feature = "bindings", derive(TS))]
10313pub struct PrimaryKeyColumnConstraint {
10314 #[serde(default)]
10315 pub desc: Option<Box<Expression>>,
10316 #[serde(default)]
10317 pub options: Vec<Expression>,
10318}
10319
10320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10322#[cfg_attr(feature = "bindings", derive(TS))]
10323pub struct UniqueColumnConstraint {
10324 #[serde(default)]
10325 pub this: Option<Box<Expression>>,
10326 #[serde(default)]
10327 pub index_type: Option<Box<Expression>>,
10328 #[serde(default)]
10329 pub on_conflict: Option<Box<Expression>>,
10330 #[serde(default)]
10331 pub nulls: Option<Box<Expression>>,
10332 #[serde(default)]
10333 pub options: Vec<Expression>,
10334}
10335
10336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10338#[cfg_attr(feature = "bindings", derive(TS))]
10339pub struct WatermarkColumnConstraint {
10340 pub this: Box<Expression>,
10341 pub expression: Box<Expression>,
10342}
10343
10344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10346#[cfg_attr(feature = "bindings", derive(TS))]
10347pub struct ComputedColumnConstraint {
10348 pub this: Box<Expression>,
10349 #[serde(default)]
10350 pub persisted: Option<Box<Expression>>,
10351 #[serde(default)]
10352 pub not_null: Option<Box<Expression>>,
10353 #[serde(default)]
10354 pub data_type: Option<Box<Expression>>,
10355}
10356
10357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10359#[cfg_attr(feature = "bindings", derive(TS))]
10360pub struct InOutColumnConstraint {
10361 #[serde(default)]
10362 pub input_: Option<Box<Expression>>,
10363 #[serde(default)]
10364 pub output: Option<Box<Expression>>,
10365}
10366
10367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10369#[cfg_attr(feature = "bindings", derive(TS))]
10370pub struct PathColumnConstraint {
10371 pub this: Box<Expression>,
10372}
10373
10374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10376#[cfg_attr(feature = "bindings", derive(TS))]
10377pub struct Constraint {
10378 pub this: Box<Expression>,
10379 #[serde(default)]
10380 pub expressions: Vec<Expression>,
10381}
10382
10383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10385#[cfg_attr(feature = "bindings", derive(TS))]
10386pub struct Export {
10387 pub this: Box<Expression>,
10388 #[serde(default)]
10389 pub connection: Option<Box<Expression>>,
10390 #[serde(default)]
10391 pub options: Vec<Expression>,
10392}
10393
10394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10396#[cfg_attr(feature = "bindings", derive(TS))]
10397pub struct Filter {
10398 pub this: Box<Expression>,
10399 pub expression: Box<Expression>,
10400}
10401
10402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10404#[cfg_attr(feature = "bindings", derive(TS))]
10405pub struct Changes {
10406 #[serde(default)]
10407 pub information: Option<Box<Expression>>,
10408 #[serde(default)]
10409 pub at_before: Option<Box<Expression>>,
10410 #[serde(default)]
10411 pub end: Option<Box<Expression>>,
10412}
10413
10414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10416#[cfg_attr(feature = "bindings", derive(TS))]
10417pub struct Directory {
10418 pub this: Box<Expression>,
10419 #[serde(default)]
10420 pub local: Option<Box<Expression>>,
10421 #[serde(default)]
10422 pub row_format: Option<Box<Expression>>,
10423}
10424
10425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10427#[cfg_attr(feature = "bindings", derive(TS))]
10428pub struct ForeignKey {
10429 #[serde(default)]
10430 pub expressions: Vec<Expression>,
10431 #[serde(default)]
10432 pub reference: Option<Box<Expression>>,
10433 #[serde(default)]
10434 pub delete: Option<Box<Expression>>,
10435 #[serde(default)]
10436 pub update: Option<Box<Expression>>,
10437 #[serde(default)]
10438 pub options: Vec<Expression>,
10439}
10440
10441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10443#[cfg_attr(feature = "bindings", derive(TS))]
10444pub struct ColumnPrefix {
10445 pub this: Box<Expression>,
10446 pub expression: Box<Expression>,
10447}
10448
10449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10451#[cfg_attr(feature = "bindings", derive(TS))]
10452pub struct PrimaryKey {
10453 #[serde(default)]
10454 pub this: Option<Box<Expression>>,
10455 #[serde(default)]
10456 pub expressions: Vec<Expression>,
10457 #[serde(default)]
10458 pub options: Vec<Expression>,
10459 #[serde(default)]
10460 pub include: Option<Box<Expression>>,
10461}
10462
10463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10465#[cfg_attr(feature = "bindings", derive(TS))]
10466pub struct IntoClause {
10467 #[serde(default)]
10468 pub this: Option<Box<Expression>>,
10469 #[serde(default)]
10470 pub temporary: bool,
10471 #[serde(default)]
10472 pub unlogged: Option<Box<Expression>>,
10473 #[serde(default)]
10474 pub bulk_collect: Option<Box<Expression>>,
10475 #[serde(default)]
10476 pub expressions: Vec<Expression>,
10477}
10478
10479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10481#[cfg_attr(feature = "bindings", derive(TS))]
10482pub struct JoinHint {
10483 pub this: Box<Expression>,
10484 #[serde(default)]
10485 pub expressions: Vec<Expression>,
10486}
10487
10488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10490#[cfg_attr(feature = "bindings", derive(TS))]
10491pub struct Opclass {
10492 pub this: Box<Expression>,
10493 pub expression: Box<Expression>,
10494}
10495
10496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10498#[cfg_attr(feature = "bindings", derive(TS))]
10499pub struct Index {
10500 #[serde(default)]
10501 pub this: Option<Box<Expression>>,
10502 #[serde(default)]
10503 pub table: Option<Box<Expression>>,
10504 #[serde(default)]
10505 pub unique: bool,
10506 #[serde(default)]
10507 pub primary: Option<Box<Expression>>,
10508 #[serde(default)]
10509 pub amp: Option<Box<Expression>>,
10510 #[serde(default)]
10511 pub params: Vec<Expression>,
10512}
10513
10514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10516#[cfg_attr(feature = "bindings", derive(TS))]
10517pub struct IndexParameters {
10518 #[serde(default)]
10519 pub using: Option<Box<Expression>>,
10520 #[serde(default)]
10521 pub include: Option<Box<Expression>>,
10522 #[serde(default)]
10523 pub columns: Vec<Expression>,
10524 #[serde(default)]
10525 pub with_storage: Option<Box<Expression>>,
10526 #[serde(default)]
10527 pub partition_by: Option<Box<Expression>>,
10528 #[serde(default)]
10529 pub tablespace: Option<Box<Expression>>,
10530 #[serde(default)]
10531 pub where_: Option<Box<Expression>>,
10532 #[serde(default)]
10533 pub on: Option<Box<Expression>>,
10534}
10535
10536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10538#[cfg_attr(feature = "bindings", derive(TS))]
10539pub struct ConditionalInsert {
10540 pub this: Box<Expression>,
10541 #[serde(default)]
10542 pub expression: Option<Box<Expression>>,
10543 #[serde(default)]
10544 pub else_: Option<Box<Expression>>,
10545}
10546
10547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10549#[cfg_attr(feature = "bindings", derive(TS))]
10550pub struct MultitableInserts {
10551 #[serde(default)]
10552 pub expressions: Vec<Expression>,
10553 pub kind: String,
10554 #[serde(default)]
10555 pub source: Option<Box<Expression>>,
10556 #[serde(default)]
10558 pub leading_comments: Vec<String>,
10559}
10560
10561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10563#[cfg_attr(feature = "bindings", derive(TS))]
10564pub struct OnConflict {
10565 #[serde(default)]
10566 pub duplicate: Option<Box<Expression>>,
10567 #[serde(default)]
10568 pub expressions: Vec<Expression>,
10569 #[serde(default)]
10570 pub action: Option<Box<Expression>>,
10571 #[serde(default)]
10572 pub conflict_keys: Option<Box<Expression>>,
10573 #[serde(default)]
10574 pub index_predicate: Option<Box<Expression>>,
10575 #[serde(default)]
10576 pub constraint: Option<Box<Expression>>,
10577 #[serde(default)]
10578 pub where_: Option<Box<Expression>>,
10579}
10580
10581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10583#[cfg_attr(feature = "bindings", derive(TS))]
10584pub struct OnCondition {
10585 #[serde(default)]
10586 pub error: Option<Box<Expression>>,
10587 #[serde(default)]
10588 pub empty: Option<Box<Expression>>,
10589 #[serde(default)]
10590 pub null: Option<Box<Expression>>,
10591}
10592
10593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10595#[cfg_attr(feature = "bindings", derive(TS))]
10596pub struct Returning {
10597 #[serde(default)]
10598 pub expressions: Vec<Expression>,
10599 #[serde(default)]
10600 pub into: Option<Box<Expression>>,
10601}
10602
10603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10605#[cfg_attr(feature = "bindings", derive(TS))]
10606pub struct Introducer {
10607 pub this: Box<Expression>,
10608 pub expression: Box<Expression>,
10609}
10610
10611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10613#[cfg_attr(feature = "bindings", derive(TS))]
10614pub struct PartitionRange {
10615 pub this: Box<Expression>,
10616 #[serde(default)]
10617 pub expression: Option<Box<Expression>>,
10618 #[serde(default)]
10619 pub expressions: Vec<Expression>,
10620}
10621
10622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10624#[cfg_attr(feature = "bindings", derive(TS))]
10625pub struct Group {
10626 #[serde(default)]
10627 pub expressions: Vec<Expression>,
10628 #[serde(default)]
10629 pub grouping_sets: Option<Box<Expression>>,
10630 #[serde(default)]
10631 pub cube: Option<Box<Expression>>,
10632 #[serde(default)]
10633 pub rollup: Option<Box<Expression>>,
10634 #[serde(default)]
10635 pub totals: Option<Box<Expression>>,
10636 #[serde(default)]
10638 pub all: Option<bool>,
10639}
10640
10641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10643#[cfg_attr(feature = "bindings", derive(TS))]
10644pub struct Cube {
10645 #[serde(default)]
10646 pub expressions: Vec<Expression>,
10647}
10648
10649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10651#[cfg_attr(feature = "bindings", derive(TS))]
10652pub struct Rollup {
10653 #[serde(default)]
10654 pub expressions: Vec<Expression>,
10655}
10656
10657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10659#[cfg_attr(feature = "bindings", derive(TS))]
10660pub struct GroupingSets {
10661 #[serde(default)]
10662 pub expressions: Vec<Expression>,
10663}
10664
10665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10667#[cfg_attr(feature = "bindings", derive(TS))]
10668pub struct LimitOptions {
10669 #[serde(default)]
10670 pub percent: Option<Box<Expression>>,
10671 #[serde(default)]
10672 pub rows: Option<Box<Expression>>,
10673 #[serde(default)]
10674 pub with_ties: Option<Box<Expression>>,
10675}
10676
10677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10679#[cfg_attr(feature = "bindings", derive(TS))]
10680pub struct Lateral {
10681 pub this: Box<Expression>,
10682 #[serde(default)]
10683 pub view: Option<Box<Expression>>,
10684 #[serde(default)]
10685 pub outer: Option<Box<Expression>>,
10686 #[serde(default)]
10687 pub alias: Option<String>,
10688 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10690 pub alias_quoted: bool,
10691 #[serde(default)]
10692 pub cross_apply: Option<Box<Expression>>,
10693 #[serde(default)]
10694 pub ordinality: Option<Box<Expression>>,
10695 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10697 pub column_aliases: Vec<String>,
10698}
10699
10700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10702#[cfg_attr(feature = "bindings", derive(TS))]
10703pub struct TableFromRows {
10704 pub this: Box<Expression>,
10705 #[serde(default)]
10706 pub alias: Option<String>,
10707 #[serde(default)]
10708 pub joins: Vec<Expression>,
10709 #[serde(default)]
10710 pub pivots: Option<Box<Expression>>,
10711 #[serde(default)]
10712 pub sample: Option<Box<Expression>>,
10713}
10714
10715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10718#[cfg_attr(feature = "bindings", derive(TS))]
10719pub struct RowsFrom {
10720 pub expressions: Vec<Expression>,
10722 #[serde(default)]
10724 pub ordinality: bool,
10725 #[serde(default)]
10727 pub alias: Option<Box<Expression>>,
10728}
10729
10730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10732#[cfg_attr(feature = "bindings", derive(TS))]
10733pub struct WithFill {
10734 #[serde(default)]
10735 pub from_: Option<Box<Expression>>,
10736 #[serde(default)]
10737 pub to: Option<Box<Expression>>,
10738 #[serde(default)]
10739 pub step: Option<Box<Expression>>,
10740 #[serde(default)]
10741 pub staleness: Option<Box<Expression>>,
10742 #[serde(default)]
10743 pub interpolate: Option<Box<Expression>>,
10744}
10745
10746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10748#[cfg_attr(feature = "bindings", derive(TS))]
10749pub struct Property {
10750 pub this: Box<Expression>,
10751 #[serde(default)]
10752 pub value: Option<Box<Expression>>,
10753}
10754
10755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10757#[cfg_attr(feature = "bindings", derive(TS))]
10758pub struct GrantPrivilege {
10759 pub this: Box<Expression>,
10760 #[serde(default)]
10761 pub expressions: Vec<Expression>,
10762}
10763
10764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10766#[cfg_attr(feature = "bindings", derive(TS))]
10767pub struct AllowedValuesProperty {
10768 #[serde(default)]
10769 pub expressions: Vec<Expression>,
10770}
10771
10772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10774#[cfg_attr(feature = "bindings", derive(TS))]
10775pub struct AlgorithmProperty {
10776 pub this: Box<Expression>,
10777}
10778
10779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10781#[cfg_attr(feature = "bindings", derive(TS))]
10782pub struct AutoIncrementProperty {
10783 pub this: Box<Expression>,
10784}
10785
10786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10788#[cfg_attr(feature = "bindings", derive(TS))]
10789pub struct AutoRefreshProperty {
10790 pub this: Box<Expression>,
10791}
10792
10793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10795#[cfg_attr(feature = "bindings", derive(TS))]
10796pub struct BackupProperty {
10797 pub this: Box<Expression>,
10798}
10799
10800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10802#[cfg_attr(feature = "bindings", derive(TS))]
10803pub struct BuildProperty {
10804 pub this: Box<Expression>,
10805}
10806
10807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10809#[cfg_attr(feature = "bindings", derive(TS))]
10810pub struct BlockCompressionProperty {
10811 #[serde(default)]
10812 pub autotemp: Option<Box<Expression>>,
10813 #[serde(default)]
10814 pub always: Option<Box<Expression>>,
10815 #[serde(default)]
10816 pub default: Option<Box<Expression>>,
10817 #[serde(default)]
10818 pub manual: Option<Box<Expression>>,
10819 #[serde(default)]
10820 pub never: Option<Box<Expression>>,
10821}
10822
10823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10825#[cfg_attr(feature = "bindings", derive(TS))]
10826pub struct CharacterSetProperty {
10827 pub this: Box<Expression>,
10828 #[serde(default)]
10829 pub default: Option<Box<Expression>>,
10830}
10831
10832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10834#[cfg_attr(feature = "bindings", derive(TS))]
10835pub struct ChecksumProperty {
10836 #[serde(default)]
10837 pub on: Option<Box<Expression>>,
10838 #[serde(default)]
10839 pub default: Option<Box<Expression>>,
10840}
10841
10842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10844#[cfg_attr(feature = "bindings", derive(TS))]
10845pub struct CollateProperty {
10846 pub this: Box<Expression>,
10847 #[serde(default)]
10848 pub default: Option<Box<Expression>>,
10849}
10850
10851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10853#[cfg_attr(feature = "bindings", derive(TS))]
10854pub struct DataBlocksizeProperty {
10855 #[serde(default)]
10856 pub size: Option<i64>,
10857 #[serde(default)]
10858 pub units: Option<Box<Expression>>,
10859 #[serde(default)]
10860 pub minimum: Option<Box<Expression>>,
10861 #[serde(default)]
10862 pub maximum: Option<Box<Expression>>,
10863 #[serde(default)]
10864 pub default: Option<Box<Expression>>,
10865}
10866
10867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10869#[cfg_attr(feature = "bindings", derive(TS))]
10870pub struct DataDeletionProperty {
10871 pub on: Box<Expression>,
10872 #[serde(default)]
10873 pub filter_column: Option<Box<Expression>>,
10874 #[serde(default)]
10875 pub retention_period: Option<Box<Expression>>,
10876}
10877
10878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10880#[cfg_attr(feature = "bindings", derive(TS))]
10881pub struct DefinerProperty {
10882 pub this: Box<Expression>,
10883}
10884
10885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10887#[cfg_attr(feature = "bindings", derive(TS))]
10888pub struct DistKeyProperty {
10889 pub this: Box<Expression>,
10890}
10891
10892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10894#[cfg_attr(feature = "bindings", derive(TS))]
10895pub struct DistributedByProperty {
10896 #[serde(default)]
10897 pub expressions: Vec<Expression>,
10898 pub kind: String,
10899 #[serde(default)]
10900 pub buckets: Option<Box<Expression>>,
10901 #[serde(default)]
10902 pub order: Option<Box<Expression>>,
10903}
10904
10905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10907#[cfg_attr(feature = "bindings", derive(TS))]
10908pub struct DistStyleProperty {
10909 pub this: Box<Expression>,
10910}
10911
10912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10914#[cfg_attr(feature = "bindings", derive(TS))]
10915pub struct DuplicateKeyProperty {
10916 #[serde(default)]
10917 pub expressions: Vec<Expression>,
10918}
10919
10920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10922#[cfg_attr(feature = "bindings", derive(TS))]
10923pub struct EngineProperty {
10924 pub this: Box<Expression>,
10925}
10926
10927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10929#[cfg_attr(feature = "bindings", derive(TS))]
10930pub struct ToTableProperty {
10931 pub this: Box<Expression>,
10932}
10933
10934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10936#[cfg_attr(feature = "bindings", derive(TS))]
10937pub struct ExecuteAsProperty {
10938 pub this: Box<Expression>,
10939}
10940
10941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10943#[cfg_attr(feature = "bindings", derive(TS))]
10944pub struct ExternalProperty {
10945 #[serde(default)]
10946 pub this: Option<Box<Expression>>,
10947}
10948
10949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10951#[cfg_attr(feature = "bindings", derive(TS))]
10952pub struct FallbackProperty {
10953 #[serde(default)]
10954 pub no: Option<Box<Expression>>,
10955 #[serde(default)]
10956 pub protection: Option<Box<Expression>>,
10957}
10958
10959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10961#[cfg_attr(feature = "bindings", derive(TS))]
10962pub struct FileFormatProperty {
10963 #[serde(default)]
10964 pub this: Option<Box<Expression>>,
10965 #[serde(default)]
10966 pub expressions: Vec<Expression>,
10967 #[serde(default)]
10968 pub hive_format: Option<Box<Expression>>,
10969}
10970
10971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10973#[cfg_attr(feature = "bindings", derive(TS))]
10974pub struct CredentialsProperty {
10975 #[serde(default)]
10976 pub expressions: Vec<Expression>,
10977}
10978
10979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10981#[cfg_attr(feature = "bindings", derive(TS))]
10982pub struct FreespaceProperty {
10983 pub this: Box<Expression>,
10984 #[serde(default)]
10985 pub percent: Option<Box<Expression>>,
10986}
10987
10988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10990#[cfg_attr(feature = "bindings", derive(TS))]
10991pub struct InheritsProperty {
10992 #[serde(default)]
10993 pub expressions: Vec<Expression>,
10994}
10995
10996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10998#[cfg_attr(feature = "bindings", derive(TS))]
10999pub struct InputModelProperty {
11000 pub this: Box<Expression>,
11001}
11002
11003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11005#[cfg_attr(feature = "bindings", derive(TS))]
11006pub struct OutputModelProperty {
11007 pub this: Box<Expression>,
11008}
11009
11010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11012#[cfg_attr(feature = "bindings", derive(TS))]
11013pub struct IsolatedLoadingProperty {
11014 #[serde(default)]
11015 pub no: Option<Box<Expression>>,
11016 #[serde(default)]
11017 pub concurrent: Option<Box<Expression>>,
11018 #[serde(default)]
11019 pub target: Option<Box<Expression>>,
11020}
11021
11022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11024#[cfg_attr(feature = "bindings", derive(TS))]
11025pub struct JournalProperty {
11026 #[serde(default)]
11027 pub no: Option<Box<Expression>>,
11028 #[serde(default)]
11029 pub dual: Option<Box<Expression>>,
11030 #[serde(default)]
11031 pub before: Option<Box<Expression>>,
11032 #[serde(default)]
11033 pub local: Option<Box<Expression>>,
11034 #[serde(default)]
11035 pub after: Option<Box<Expression>>,
11036}
11037
11038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11040#[cfg_attr(feature = "bindings", derive(TS))]
11041pub struct LanguageProperty {
11042 pub this: Box<Expression>,
11043}
11044
11045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11047#[cfg_attr(feature = "bindings", derive(TS))]
11048pub struct EnviromentProperty {
11049 #[serde(default)]
11050 pub expressions: Vec<Expression>,
11051}
11052
11053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11055#[cfg_attr(feature = "bindings", derive(TS))]
11056pub struct ClusteredByProperty {
11057 #[serde(default)]
11058 pub expressions: Vec<Expression>,
11059 #[serde(default)]
11060 pub sorted_by: Option<Box<Expression>>,
11061 #[serde(default)]
11062 pub buckets: Option<Box<Expression>>,
11063}
11064
11065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11067#[cfg_attr(feature = "bindings", derive(TS))]
11068pub struct DictProperty {
11069 pub this: Box<Expression>,
11070 pub kind: String,
11071 #[serde(default)]
11072 pub settings: Option<Box<Expression>>,
11073}
11074
11075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11077#[cfg_attr(feature = "bindings", derive(TS))]
11078pub struct DictRange {
11079 pub this: Box<Expression>,
11080 #[serde(default)]
11081 pub min: Option<Box<Expression>>,
11082 #[serde(default)]
11083 pub max: Option<Box<Expression>>,
11084}
11085
11086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11088#[cfg_attr(feature = "bindings", derive(TS))]
11089pub struct OnCluster {
11090 pub this: Box<Expression>,
11091}
11092
11093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11095#[cfg_attr(feature = "bindings", derive(TS))]
11096pub struct LikeProperty {
11097 pub this: Box<Expression>,
11098 #[serde(default)]
11099 pub expressions: Vec<Expression>,
11100}
11101
11102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11104#[cfg_attr(feature = "bindings", derive(TS))]
11105pub struct LocationProperty {
11106 pub this: Box<Expression>,
11107}
11108
11109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11111#[cfg_attr(feature = "bindings", derive(TS))]
11112pub struct LockProperty {
11113 pub this: Box<Expression>,
11114}
11115
11116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11118#[cfg_attr(feature = "bindings", derive(TS))]
11119pub struct LockingProperty {
11120 #[serde(default)]
11121 pub this: Option<Box<Expression>>,
11122 pub kind: String,
11123 #[serde(default)]
11124 pub for_or_in: Option<Box<Expression>>,
11125 #[serde(default)]
11126 pub lock_type: Option<Box<Expression>>,
11127 #[serde(default)]
11128 pub override_: Option<Box<Expression>>,
11129}
11130
11131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11133#[cfg_attr(feature = "bindings", derive(TS))]
11134pub struct LogProperty {
11135 #[serde(default)]
11136 pub no: Option<Box<Expression>>,
11137}
11138
11139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11141#[cfg_attr(feature = "bindings", derive(TS))]
11142pub struct MaterializedProperty {
11143 #[serde(default)]
11144 pub this: Option<Box<Expression>>,
11145}
11146
11147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11149#[cfg_attr(feature = "bindings", derive(TS))]
11150pub struct MergeBlockRatioProperty {
11151 #[serde(default)]
11152 pub this: Option<Box<Expression>>,
11153 #[serde(default)]
11154 pub no: Option<Box<Expression>>,
11155 #[serde(default)]
11156 pub default: Option<Box<Expression>>,
11157 #[serde(default)]
11158 pub percent: Option<Box<Expression>>,
11159}
11160
11161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11163#[cfg_attr(feature = "bindings", derive(TS))]
11164pub struct OnProperty {
11165 pub this: Box<Expression>,
11166}
11167
11168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11170#[cfg_attr(feature = "bindings", derive(TS))]
11171pub struct OnCommitProperty {
11172 #[serde(default)]
11173 pub delete: Option<Box<Expression>>,
11174}
11175
11176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11178#[cfg_attr(feature = "bindings", derive(TS))]
11179pub struct PartitionedByProperty {
11180 pub this: Box<Expression>,
11181}
11182
11183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11185#[cfg_attr(feature = "bindings", derive(TS))]
11186pub struct PartitionByProperty {
11187 #[serde(default)]
11188 pub expressions: Vec<Expression>,
11189}
11190
11191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11193#[cfg_attr(feature = "bindings", derive(TS))]
11194pub struct PartitionedByBucket {
11195 pub this: Box<Expression>,
11196 pub expression: Box<Expression>,
11197}
11198
11199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11201#[cfg_attr(feature = "bindings", derive(TS))]
11202pub struct ClusterByColumnsProperty {
11203 #[serde(default)]
11204 pub columns: Vec<Identifier>,
11205}
11206
11207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11209#[cfg_attr(feature = "bindings", derive(TS))]
11210pub struct PartitionByTruncate {
11211 pub this: Box<Expression>,
11212 pub expression: Box<Expression>,
11213}
11214
11215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11217#[cfg_attr(feature = "bindings", derive(TS))]
11218pub struct PartitionByRangeProperty {
11219 #[serde(default)]
11220 pub partition_expressions: Option<Box<Expression>>,
11221 #[serde(default)]
11222 pub create_expressions: Option<Box<Expression>>,
11223}
11224
11225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11227#[cfg_attr(feature = "bindings", derive(TS))]
11228pub struct PartitionByRangePropertyDynamic {
11229 #[serde(default)]
11230 pub this: Option<Box<Expression>>,
11231 #[serde(default)]
11232 pub start: Option<Box<Expression>>,
11233 #[serde(default)]
11235 pub use_start_end: bool,
11236 #[serde(default)]
11237 pub end: Option<Box<Expression>>,
11238 #[serde(default)]
11239 pub every: Option<Box<Expression>>,
11240}
11241
11242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11244#[cfg_attr(feature = "bindings", derive(TS))]
11245pub struct PartitionByListProperty {
11246 #[serde(default)]
11247 pub partition_expressions: Option<Box<Expression>>,
11248 #[serde(default)]
11249 pub create_expressions: Option<Box<Expression>>,
11250}
11251
11252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11254#[cfg_attr(feature = "bindings", derive(TS))]
11255pub struct PartitionList {
11256 pub this: Box<Expression>,
11257 #[serde(default)]
11258 pub expressions: Vec<Expression>,
11259}
11260
11261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11263#[cfg_attr(feature = "bindings", derive(TS))]
11264pub struct Partition {
11265 pub expressions: Vec<Expression>,
11266 #[serde(default)]
11267 pub subpartition: bool,
11268}
11269
11270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11273#[cfg_attr(feature = "bindings", derive(TS))]
11274pub struct RefreshTriggerProperty {
11275 pub method: String,
11277 #[serde(default)]
11279 pub kind: Option<String>,
11280 #[serde(default)]
11282 pub every: Option<Box<Expression>>,
11283 #[serde(default)]
11285 pub unit: Option<String>,
11286 #[serde(default)]
11288 pub starts: Option<Box<Expression>>,
11289}
11290
11291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11293#[cfg_attr(feature = "bindings", derive(TS))]
11294pub struct UniqueKeyProperty {
11295 #[serde(default)]
11296 pub expressions: Vec<Expression>,
11297}
11298
11299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11301#[cfg_attr(feature = "bindings", derive(TS))]
11302pub struct RollupProperty {
11303 pub expressions: Vec<RollupIndex>,
11304}
11305
11306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11308#[cfg_attr(feature = "bindings", derive(TS))]
11309pub struct RollupIndex {
11310 pub name: Identifier,
11311 pub expressions: Vec<Identifier>,
11312}
11313
11314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11316#[cfg_attr(feature = "bindings", derive(TS))]
11317pub struct PartitionBoundSpec {
11318 #[serde(default)]
11319 pub this: Option<Box<Expression>>,
11320 #[serde(default)]
11321 pub expression: Option<Box<Expression>>,
11322 #[serde(default)]
11323 pub from_expressions: Option<Box<Expression>>,
11324 #[serde(default)]
11325 pub to_expressions: Option<Box<Expression>>,
11326}
11327
11328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11330#[cfg_attr(feature = "bindings", derive(TS))]
11331pub struct PartitionedOfProperty {
11332 pub this: Box<Expression>,
11333 pub expression: Box<Expression>,
11334}
11335
11336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11338#[cfg_attr(feature = "bindings", derive(TS))]
11339pub struct RemoteWithConnectionModelProperty {
11340 pub this: Box<Expression>,
11341}
11342
11343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11345#[cfg_attr(feature = "bindings", derive(TS))]
11346pub struct ReturnsProperty {
11347 #[serde(default)]
11348 pub this: Option<Box<Expression>>,
11349 #[serde(default)]
11350 pub is_table: Option<Box<Expression>>,
11351 #[serde(default)]
11352 pub table: Option<Box<Expression>>,
11353 #[serde(default)]
11354 pub null: Option<Box<Expression>>,
11355}
11356
11357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11359#[cfg_attr(feature = "bindings", derive(TS))]
11360pub struct RowFormatProperty {
11361 pub this: Box<Expression>,
11362}
11363
11364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11366#[cfg_attr(feature = "bindings", derive(TS))]
11367pub struct RowFormatDelimitedProperty {
11368 #[serde(default)]
11369 pub fields: Option<Box<Expression>>,
11370 #[serde(default)]
11371 pub escaped: Option<Box<Expression>>,
11372 #[serde(default)]
11373 pub collection_items: Option<Box<Expression>>,
11374 #[serde(default)]
11375 pub map_keys: Option<Box<Expression>>,
11376 #[serde(default)]
11377 pub lines: Option<Box<Expression>>,
11378 #[serde(default)]
11379 pub null: Option<Box<Expression>>,
11380 #[serde(default)]
11381 pub serde: Option<Box<Expression>>,
11382}
11383
11384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11386#[cfg_attr(feature = "bindings", derive(TS))]
11387pub struct RowFormatSerdeProperty {
11388 pub this: Box<Expression>,
11389 #[serde(default)]
11390 pub serde_properties: Option<Box<Expression>>,
11391}
11392
11393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11395#[cfg_attr(feature = "bindings", derive(TS))]
11396pub struct QueryTransform {
11397 #[serde(default)]
11398 pub expressions: Vec<Expression>,
11399 #[serde(default)]
11400 pub command_script: Option<Box<Expression>>,
11401 #[serde(default)]
11402 pub schema: Option<Box<Expression>>,
11403 #[serde(default)]
11404 pub row_format_before: Option<Box<Expression>>,
11405 #[serde(default)]
11406 pub record_writer: Option<Box<Expression>>,
11407 #[serde(default)]
11408 pub row_format_after: Option<Box<Expression>>,
11409 #[serde(default)]
11410 pub record_reader: Option<Box<Expression>>,
11411}
11412
11413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11415#[cfg_attr(feature = "bindings", derive(TS))]
11416pub struct SampleProperty {
11417 pub this: Box<Expression>,
11418}
11419
11420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11422#[cfg_attr(feature = "bindings", derive(TS))]
11423pub struct SecurityProperty {
11424 pub this: Box<Expression>,
11425}
11426
11427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11429#[cfg_attr(feature = "bindings", derive(TS))]
11430pub struct SchemaCommentProperty {
11431 pub this: Box<Expression>,
11432}
11433
11434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11436#[cfg_attr(feature = "bindings", derive(TS))]
11437pub struct SemanticView {
11438 pub this: Box<Expression>,
11439 #[serde(default)]
11440 pub metrics: Option<Box<Expression>>,
11441 #[serde(default)]
11442 pub dimensions: Option<Box<Expression>>,
11443 #[serde(default)]
11444 pub facts: Option<Box<Expression>>,
11445 #[serde(default)]
11446 pub where_: Option<Box<Expression>>,
11447}
11448
11449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11451#[cfg_attr(feature = "bindings", derive(TS))]
11452pub struct SerdeProperties {
11453 #[serde(default)]
11454 pub expressions: Vec<Expression>,
11455 #[serde(default)]
11456 pub with_: Option<Box<Expression>>,
11457}
11458
11459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11461#[cfg_attr(feature = "bindings", derive(TS))]
11462pub struct SetProperty {
11463 #[serde(default)]
11464 pub multi: Option<Box<Expression>>,
11465}
11466
11467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11469#[cfg_attr(feature = "bindings", derive(TS))]
11470pub struct SharingProperty {
11471 #[serde(default)]
11472 pub this: Option<Box<Expression>>,
11473}
11474
11475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11477#[cfg_attr(feature = "bindings", derive(TS))]
11478pub struct SetConfigProperty {
11479 pub this: Box<Expression>,
11480}
11481
11482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11484#[cfg_attr(feature = "bindings", derive(TS))]
11485pub struct SettingsProperty {
11486 #[serde(default)]
11487 pub expressions: Vec<Expression>,
11488}
11489
11490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11492#[cfg_attr(feature = "bindings", derive(TS))]
11493pub struct SortKeyProperty {
11494 pub this: Box<Expression>,
11495 #[serde(default)]
11496 pub compound: Option<Box<Expression>>,
11497}
11498
11499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11501#[cfg_attr(feature = "bindings", derive(TS))]
11502pub struct SqlReadWriteProperty {
11503 pub this: Box<Expression>,
11504}
11505
11506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11508#[cfg_attr(feature = "bindings", derive(TS))]
11509pub struct SqlSecurityProperty {
11510 pub this: Box<Expression>,
11511}
11512
11513#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11515#[cfg_attr(feature = "bindings", derive(TS))]
11516pub struct StabilityProperty {
11517 pub this: Box<Expression>,
11518}
11519
11520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11522#[cfg_attr(feature = "bindings", derive(TS))]
11523pub struct StorageHandlerProperty {
11524 pub this: Box<Expression>,
11525}
11526
11527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11529#[cfg_attr(feature = "bindings", derive(TS))]
11530pub struct TemporaryProperty {
11531 #[serde(default)]
11532 pub this: Option<Box<Expression>>,
11533}
11534
11535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11537#[cfg_attr(feature = "bindings", derive(TS))]
11538pub struct Tags {
11539 #[serde(default)]
11540 pub expressions: Vec<Expression>,
11541}
11542
11543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11545#[cfg_attr(feature = "bindings", derive(TS))]
11546pub struct TransformModelProperty {
11547 #[serde(default)]
11548 pub expressions: Vec<Expression>,
11549}
11550
11551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11553#[cfg_attr(feature = "bindings", derive(TS))]
11554pub struct TransientProperty {
11555 #[serde(default)]
11556 pub this: Option<Box<Expression>>,
11557}
11558
11559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11561#[cfg_attr(feature = "bindings", derive(TS))]
11562pub struct UsingTemplateProperty {
11563 pub this: Box<Expression>,
11564}
11565
11566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11568#[cfg_attr(feature = "bindings", derive(TS))]
11569pub struct ViewAttributeProperty {
11570 pub this: Box<Expression>,
11571}
11572
11573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11575#[cfg_attr(feature = "bindings", derive(TS))]
11576pub struct VolatileProperty {
11577 #[serde(default)]
11578 pub this: Option<Box<Expression>>,
11579}
11580
11581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11583#[cfg_attr(feature = "bindings", derive(TS))]
11584pub struct WithDataProperty {
11585 #[serde(default)]
11586 pub no: Option<Box<Expression>>,
11587 #[serde(default)]
11588 pub statistics: Option<Box<Expression>>,
11589}
11590
11591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11593#[cfg_attr(feature = "bindings", derive(TS))]
11594pub struct WithJournalTableProperty {
11595 pub this: Box<Expression>,
11596}
11597
11598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11600#[cfg_attr(feature = "bindings", derive(TS))]
11601pub struct WithSchemaBindingProperty {
11602 pub this: Box<Expression>,
11603}
11604
11605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11607#[cfg_attr(feature = "bindings", derive(TS))]
11608pub struct WithSystemVersioningProperty {
11609 #[serde(default)]
11610 pub on: Option<Box<Expression>>,
11611 #[serde(default)]
11612 pub this: Option<Box<Expression>>,
11613 #[serde(default)]
11614 pub data_consistency: Option<Box<Expression>>,
11615 #[serde(default)]
11616 pub retention_period: Option<Box<Expression>>,
11617 #[serde(default)]
11618 pub with_: Option<Box<Expression>>,
11619}
11620
11621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11623#[cfg_attr(feature = "bindings", derive(TS))]
11624pub struct WithProcedureOptions {
11625 #[serde(default)]
11626 pub expressions: Vec<Expression>,
11627}
11628
11629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11631#[cfg_attr(feature = "bindings", derive(TS))]
11632pub struct EncodeProperty {
11633 pub this: Box<Expression>,
11634 #[serde(default)]
11635 pub properties: Vec<Expression>,
11636 #[serde(default)]
11637 pub key: Option<Box<Expression>>,
11638}
11639
11640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11642#[cfg_attr(feature = "bindings", derive(TS))]
11643pub struct IncludeProperty {
11644 pub this: Box<Expression>,
11645 #[serde(default)]
11646 pub alias: Option<String>,
11647 #[serde(default)]
11648 pub column_def: Option<Box<Expression>>,
11649}
11650
11651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11653#[cfg_attr(feature = "bindings", derive(TS))]
11654pub struct Properties {
11655 #[serde(default)]
11656 pub expressions: Vec<Expression>,
11657}
11658
11659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11661#[cfg_attr(feature = "bindings", derive(TS))]
11662pub struct OptionEntry {
11663 pub key: Identifier,
11664 pub value: Expression,
11665}
11666
11667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11669#[cfg_attr(feature = "bindings", derive(TS))]
11670pub struct OptionsProperty {
11671 #[serde(default)]
11672 pub entries: Vec<OptionEntry>,
11673}
11674
11675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11677#[cfg_attr(feature = "bindings", derive(TS))]
11678pub struct InputOutputFormat {
11679 #[serde(default)]
11680 pub input_format: Option<Box<Expression>>,
11681 #[serde(default)]
11682 pub output_format: Option<Box<Expression>>,
11683}
11684
11685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11687#[cfg_attr(feature = "bindings", derive(TS))]
11688pub struct Reference {
11689 pub this: Box<Expression>,
11690 #[serde(default)]
11691 pub expressions: Vec<Expression>,
11692 #[serde(default)]
11693 pub options: Vec<Expression>,
11694}
11695
11696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11698#[cfg_attr(feature = "bindings", derive(TS))]
11699pub struct QueryOption {
11700 pub this: Box<Expression>,
11701 #[serde(default)]
11702 pub expression: Option<Box<Expression>>,
11703}
11704
11705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11707#[cfg_attr(feature = "bindings", derive(TS))]
11708pub struct WithTableHint {
11709 #[serde(default)]
11710 pub expressions: Vec<Expression>,
11711}
11712
11713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11715#[cfg_attr(feature = "bindings", derive(TS))]
11716pub struct IndexTableHint {
11717 pub this: Box<Expression>,
11718 #[serde(default)]
11719 pub expressions: Vec<Expression>,
11720 #[serde(default)]
11721 pub target: Option<Box<Expression>>,
11722}
11723
11724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11726#[cfg_attr(feature = "bindings", derive(TS))]
11727pub struct Get {
11728 pub this: Box<Expression>,
11729 #[serde(default)]
11730 pub target: Option<Box<Expression>>,
11731 #[serde(default)]
11732 pub properties: Vec<Expression>,
11733}
11734
11735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11737#[cfg_attr(feature = "bindings", derive(TS))]
11738pub struct SetOperation {
11739 #[serde(default)]
11740 pub with_: Option<Box<Expression>>,
11741 pub this: Box<Expression>,
11742 pub expression: Box<Expression>,
11743 #[serde(default)]
11744 pub distinct: bool,
11745 #[serde(default)]
11746 pub by_name: Option<Box<Expression>>,
11747 #[serde(default)]
11748 pub side: Option<Box<Expression>>,
11749 #[serde(default)]
11750 pub kind: Option<String>,
11751 #[serde(default)]
11752 pub on: Option<Box<Expression>>,
11753}
11754
11755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11757#[cfg_attr(feature = "bindings", derive(TS))]
11758pub struct Var {
11759 pub this: String,
11760}
11761
11762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11764#[cfg_attr(feature = "bindings", derive(TS))]
11765pub struct Variadic {
11766 pub this: Box<Expression>,
11767}
11768
11769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11771#[cfg_attr(feature = "bindings", derive(TS))]
11772pub struct Version {
11773 pub this: Box<Expression>,
11774 pub kind: String,
11775 #[serde(default)]
11776 pub expression: Option<Box<Expression>>,
11777}
11778
11779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11781#[cfg_attr(feature = "bindings", derive(TS))]
11782pub struct Schema {
11783 #[serde(default)]
11784 pub this: Option<Box<Expression>>,
11785 #[serde(default)]
11786 pub expressions: Vec<Expression>,
11787}
11788
11789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11791#[cfg_attr(feature = "bindings", derive(TS))]
11792pub struct Lock {
11793 #[serde(default)]
11794 pub update: Option<Box<Expression>>,
11795 #[serde(default)]
11796 pub expressions: Vec<Expression>,
11797 #[serde(default)]
11798 pub wait: Option<Box<Expression>>,
11799 #[serde(default)]
11800 pub key: Option<Box<Expression>>,
11801}
11802
11803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11806#[cfg_attr(feature = "bindings", derive(TS))]
11807pub struct TableSample {
11808 #[serde(default, skip_serializing_if = "Option::is_none")]
11810 pub this: Option<Box<Expression>>,
11811 #[serde(default, skip_serializing_if = "Option::is_none")]
11813 pub sample: Option<Box<Sample>>,
11814 #[serde(default)]
11815 pub expressions: Vec<Expression>,
11816 #[serde(default)]
11817 pub method: Option<String>,
11818 #[serde(default)]
11819 pub bucket_numerator: Option<Box<Expression>>,
11820 #[serde(default)]
11821 pub bucket_denominator: Option<Box<Expression>>,
11822 #[serde(default)]
11823 pub bucket_field: Option<Box<Expression>>,
11824 #[serde(default)]
11825 pub percent: Option<Box<Expression>>,
11826 #[serde(default)]
11827 pub rows: Option<Box<Expression>>,
11828 #[serde(default)]
11829 pub size: Option<i64>,
11830 #[serde(default)]
11831 pub seed: Option<Box<Expression>>,
11832}
11833
11834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11836#[cfg_attr(feature = "bindings", derive(TS))]
11837pub struct Tag {
11838 #[serde(default)]
11839 pub this: Option<Box<Expression>>,
11840 #[serde(default)]
11841 pub prefix: Option<Box<Expression>>,
11842 #[serde(default)]
11843 pub postfix: Option<Box<Expression>>,
11844}
11845
11846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11848#[cfg_attr(feature = "bindings", derive(TS))]
11849pub struct UnpivotColumns {
11850 pub this: Box<Expression>,
11851 #[serde(default)]
11852 pub expressions: Vec<Expression>,
11853}
11854
11855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11857#[cfg_attr(feature = "bindings", derive(TS))]
11858pub struct SessionParameter {
11859 pub this: Box<Expression>,
11860 #[serde(default)]
11861 pub kind: Option<String>,
11862}
11863
11864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11866#[cfg_attr(feature = "bindings", derive(TS))]
11867pub struct PseudoType {
11868 pub this: Box<Expression>,
11869}
11870
11871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11873#[cfg_attr(feature = "bindings", derive(TS))]
11874pub struct ObjectIdentifier {
11875 pub this: Box<Expression>,
11876}
11877
11878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11880#[cfg_attr(feature = "bindings", derive(TS))]
11881pub struct Transaction {
11882 #[serde(default)]
11883 pub this: Option<Box<Expression>>,
11884 #[serde(default)]
11885 pub modes: Option<Box<Expression>>,
11886 #[serde(default)]
11887 pub mark: Option<Box<Expression>>,
11888}
11889
11890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11892#[cfg_attr(feature = "bindings", derive(TS))]
11893pub struct Commit {
11894 #[serde(default)]
11895 pub chain: Option<Box<Expression>>,
11896 #[serde(default)]
11897 pub this: Option<Box<Expression>>,
11898 #[serde(default)]
11899 pub durability: Option<Box<Expression>>,
11900}
11901
11902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11904#[cfg_attr(feature = "bindings", derive(TS))]
11905pub struct Rollback {
11906 #[serde(default)]
11907 pub savepoint: Option<Box<Expression>>,
11908 #[serde(default)]
11909 pub this: Option<Box<Expression>>,
11910}
11911
11912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11914#[cfg_attr(feature = "bindings", derive(TS))]
11915pub struct AlterSession {
11916 #[serde(default)]
11917 pub expressions: Vec<Expression>,
11918 #[serde(default)]
11919 pub unset: Option<Box<Expression>>,
11920}
11921
11922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11924#[cfg_attr(feature = "bindings", derive(TS))]
11925pub struct Analyze {
11926 #[serde(default)]
11927 pub kind: Option<String>,
11928 #[serde(default)]
11929 pub this: Option<Box<Expression>>,
11930 #[serde(default)]
11931 pub options: Vec<Expression>,
11932 #[serde(default)]
11933 pub mode: Option<Box<Expression>>,
11934 #[serde(default)]
11935 pub partition: Option<Box<Expression>>,
11936 #[serde(default)]
11937 pub expression: Option<Box<Expression>>,
11938 #[serde(default)]
11939 pub properties: Vec<Expression>,
11940 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11942 pub columns: Vec<String>,
11943}
11944
11945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11947#[cfg_attr(feature = "bindings", derive(TS))]
11948pub struct AnalyzeStatistics {
11949 pub kind: String,
11950 #[serde(default)]
11951 pub option: Option<Box<Expression>>,
11952 #[serde(default)]
11953 pub this: Option<Box<Expression>>,
11954 #[serde(default)]
11955 pub expressions: Vec<Expression>,
11956}
11957
11958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11960#[cfg_attr(feature = "bindings", derive(TS))]
11961pub struct AnalyzeHistogram {
11962 pub this: Box<Expression>,
11963 #[serde(default)]
11964 pub expressions: Vec<Expression>,
11965 #[serde(default)]
11966 pub expression: Option<Box<Expression>>,
11967 #[serde(default)]
11968 pub update_options: Option<Box<Expression>>,
11969}
11970
11971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11973#[cfg_attr(feature = "bindings", derive(TS))]
11974pub struct AnalyzeSample {
11975 pub kind: String,
11976 #[serde(default)]
11977 pub sample: Option<Box<Expression>>,
11978}
11979
11980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11982#[cfg_attr(feature = "bindings", derive(TS))]
11983pub struct AnalyzeListChainedRows {
11984 #[serde(default)]
11985 pub expression: Option<Box<Expression>>,
11986}
11987
11988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11990#[cfg_attr(feature = "bindings", derive(TS))]
11991pub struct AnalyzeDelete {
11992 #[serde(default)]
11993 pub kind: Option<String>,
11994}
11995
11996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11998#[cfg_attr(feature = "bindings", derive(TS))]
11999pub struct AnalyzeWith {
12000 #[serde(default)]
12001 pub expressions: Vec<Expression>,
12002}
12003
12004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12006#[cfg_attr(feature = "bindings", derive(TS))]
12007pub struct AnalyzeValidate {
12008 pub kind: String,
12009 #[serde(default)]
12010 pub this: Option<Box<Expression>>,
12011 #[serde(default)]
12012 pub expression: Option<Box<Expression>>,
12013}
12014
12015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12017#[cfg_attr(feature = "bindings", derive(TS))]
12018pub struct AddPartition {
12019 pub this: Box<Expression>,
12020 #[serde(default)]
12021 pub exists: bool,
12022 #[serde(default)]
12023 pub location: Option<Box<Expression>>,
12024}
12025
12026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12028#[cfg_attr(feature = "bindings", derive(TS))]
12029pub struct AttachOption {
12030 pub this: Box<Expression>,
12031 #[serde(default)]
12032 pub expression: Option<Box<Expression>>,
12033}
12034
12035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12037#[cfg_attr(feature = "bindings", derive(TS))]
12038pub struct DropPartition {
12039 #[serde(default)]
12040 pub expressions: Vec<Expression>,
12041 #[serde(default)]
12042 pub exists: bool,
12043}
12044
12045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12047#[cfg_attr(feature = "bindings", derive(TS))]
12048pub struct ReplacePartition {
12049 pub expression: Box<Expression>,
12050 #[serde(default)]
12051 pub source: Option<Box<Expression>>,
12052}
12053
12054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12056#[cfg_attr(feature = "bindings", derive(TS))]
12057pub struct DPipe {
12058 pub this: Box<Expression>,
12059 pub expression: Box<Expression>,
12060 #[serde(default)]
12061 pub safe: Option<Box<Expression>>,
12062}
12063
12064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12066#[cfg_attr(feature = "bindings", derive(TS))]
12067pub struct Operator {
12068 pub this: Box<Expression>,
12069 #[serde(default)]
12070 pub operator: Option<Box<Expression>>,
12071 pub expression: Box<Expression>,
12072 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12074 pub comments: Vec<String>,
12075}
12076
12077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12079#[cfg_attr(feature = "bindings", derive(TS))]
12080pub struct PivotAny {
12081 #[serde(default)]
12082 pub this: Option<Box<Expression>>,
12083}
12084
12085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12087#[cfg_attr(feature = "bindings", derive(TS))]
12088pub struct Aliases {
12089 pub this: Box<Expression>,
12090 #[serde(default)]
12091 pub expressions: Vec<Expression>,
12092}
12093
12094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12096#[cfg_attr(feature = "bindings", derive(TS))]
12097pub struct AtIndex {
12098 pub this: Box<Expression>,
12099 pub expression: Box<Expression>,
12100}
12101
12102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12104#[cfg_attr(feature = "bindings", derive(TS))]
12105pub struct FromTimeZone {
12106 pub this: Box<Expression>,
12107 #[serde(default)]
12108 pub zone: Option<Box<Expression>>,
12109}
12110
12111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12113#[cfg_attr(feature = "bindings", derive(TS))]
12114pub struct FormatPhrase {
12115 pub this: Box<Expression>,
12116 pub format: String,
12117}
12118
12119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12121#[cfg_attr(feature = "bindings", derive(TS))]
12122pub struct ForIn {
12123 pub this: Box<Expression>,
12124 pub expression: Box<Expression>,
12125}
12126
12127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12129#[cfg_attr(feature = "bindings", derive(TS))]
12130pub struct TimeUnit {
12131 #[serde(default)]
12132 pub unit: Option<String>,
12133}
12134
12135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12137#[cfg_attr(feature = "bindings", derive(TS))]
12138pub struct IntervalOp {
12139 #[serde(default)]
12140 pub unit: Option<String>,
12141 pub expression: Box<Expression>,
12142}
12143
12144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12146#[cfg_attr(feature = "bindings", derive(TS))]
12147pub struct HavingMax {
12148 pub this: Box<Expression>,
12149 pub expression: Box<Expression>,
12150 #[serde(default)]
12151 pub max: Option<Box<Expression>>,
12152}
12153
12154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12156#[cfg_attr(feature = "bindings", derive(TS))]
12157pub struct CosineDistance {
12158 pub this: Box<Expression>,
12159 pub expression: Box<Expression>,
12160}
12161
12162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12164#[cfg_attr(feature = "bindings", derive(TS))]
12165pub struct DotProduct {
12166 pub this: Box<Expression>,
12167 pub expression: Box<Expression>,
12168}
12169
12170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12172#[cfg_attr(feature = "bindings", derive(TS))]
12173pub struct EuclideanDistance {
12174 pub this: Box<Expression>,
12175 pub expression: Box<Expression>,
12176}
12177
12178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12180#[cfg_attr(feature = "bindings", derive(TS))]
12181pub struct ManhattanDistance {
12182 pub this: Box<Expression>,
12183 pub expression: Box<Expression>,
12184}
12185
12186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12188#[cfg_attr(feature = "bindings", derive(TS))]
12189pub struct JarowinklerSimilarity {
12190 pub this: Box<Expression>,
12191 pub expression: Box<Expression>,
12192}
12193
12194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12196#[cfg_attr(feature = "bindings", derive(TS))]
12197pub struct Booland {
12198 pub this: Box<Expression>,
12199 pub expression: Box<Expression>,
12200}
12201
12202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12204#[cfg_attr(feature = "bindings", derive(TS))]
12205pub struct Boolor {
12206 pub this: Box<Expression>,
12207 pub expression: Box<Expression>,
12208}
12209
12210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12212#[cfg_attr(feature = "bindings", derive(TS))]
12213pub struct ParameterizedAgg {
12214 pub this: Box<Expression>,
12215 #[serde(default)]
12216 pub expressions: Vec<Expression>,
12217 #[serde(default)]
12218 pub params: Vec<Expression>,
12219}
12220
12221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12223#[cfg_attr(feature = "bindings", derive(TS))]
12224pub struct ArgMax {
12225 pub this: Box<Expression>,
12226 pub expression: Box<Expression>,
12227 #[serde(default)]
12228 pub count: Option<Box<Expression>>,
12229}
12230
12231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12233#[cfg_attr(feature = "bindings", derive(TS))]
12234pub struct ArgMin {
12235 pub this: Box<Expression>,
12236 pub expression: Box<Expression>,
12237 #[serde(default)]
12238 pub count: Option<Box<Expression>>,
12239}
12240
12241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12243#[cfg_attr(feature = "bindings", derive(TS))]
12244pub struct ApproxTopK {
12245 pub this: Box<Expression>,
12246 #[serde(default)]
12247 pub expression: Option<Box<Expression>>,
12248 #[serde(default)]
12249 pub counters: Option<Box<Expression>>,
12250}
12251
12252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12254#[cfg_attr(feature = "bindings", derive(TS))]
12255pub struct ApproxTopKAccumulate {
12256 pub this: Box<Expression>,
12257 #[serde(default)]
12258 pub expression: Option<Box<Expression>>,
12259}
12260
12261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12263#[cfg_attr(feature = "bindings", derive(TS))]
12264pub struct ApproxTopKCombine {
12265 pub this: Box<Expression>,
12266 #[serde(default)]
12267 pub expression: Option<Box<Expression>>,
12268}
12269
12270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12272#[cfg_attr(feature = "bindings", derive(TS))]
12273pub struct ApproxTopKEstimate {
12274 pub this: Box<Expression>,
12275 #[serde(default)]
12276 pub expression: Option<Box<Expression>>,
12277}
12278
12279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12281#[cfg_attr(feature = "bindings", derive(TS))]
12282pub struct ApproxTopSum {
12283 pub this: Box<Expression>,
12284 pub expression: Box<Expression>,
12285 #[serde(default)]
12286 pub count: Option<Box<Expression>>,
12287}
12288
12289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12291#[cfg_attr(feature = "bindings", derive(TS))]
12292pub struct ApproxQuantiles {
12293 pub this: Box<Expression>,
12294 #[serde(default)]
12295 pub expression: Option<Box<Expression>>,
12296}
12297
12298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12300#[cfg_attr(feature = "bindings", derive(TS))]
12301pub struct Minhash {
12302 pub this: Box<Expression>,
12303 #[serde(default)]
12304 pub expressions: Vec<Expression>,
12305}
12306
12307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12309#[cfg_attr(feature = "bindings", derive(TS))]
12310pub struct FarmFingerprint {
12311 #[serde(default)]
12312 pub expressions: Vec<Expression>,
12313}
12314
12315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12317#[cfg_attr(feature = "bindings", derive(TS))]
12318pub struct Float64 {
12319 pub this: Box<Expression>,
12320 #[serde(default)]
12321 pub expression: Option<Box<Expression>>,
12322}
12323
12324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12326#[cfg_attr(feature = "bindings", derive(TS))]
12327pub struct Transform {
12328 pub this: Box<Expression>,
12329 pub expression: Box<Expression>,
12330}
12331
12332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12334#[cfg_attr(feature = "bindings", derive(TS))]
12335pub struct Translate {
12336 pub this: Box<Expression>,
12337 #[serde(default)]
12338 pub from_: Option<Box<Expression>>,
12339 #[serde(default)]
12340 pub to: Option<Box<Expression>>,
12341}
12342
12343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12345#[cfg_attr(feature = "bindings", derive(TS))]
12346pub struct Grouping {
12347 #[serde(default)]
12348 pub expressions: Vec<Expression>,
12349}
12350
12351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12353#[cfg_attr(feature = "bindings", derive(TS))]
12354pub struct GroupingId {
12355 #[serde(default)]
12356 pub expressions: Vec<Expression>,
12357}
12358
12359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12361#[cfg_attr(feature = "bindings", derive(TS))]
12362pub struct Anonymous {
12363 pub this: Box<Expression>,
12364 #[serde(default)]
12365 pub expressions: Vec<Expression>,
12366}
12367
12368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12370#[cfg_attr(feature = "bindings", derive(TS))]
12371pub struct AnonymousAggFunc {
12372 pub this: Box<Expression>,
12373 #[serde(default)]
12374 pub expressions: Vec<Expression>,
12375}
12376
12377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12379#[cfg_attr(feature = "bindings", derive(TS))]
12380pub struct CombinedAggFunc {
12381 pub this: Box<Expression>,
12382 #[serde(default)]
12383 pub expressions: Vec<Expression>,
12384}
12385
12386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12388#[cfg_attr(feature = "bindings", derive(TS))]
12389pub struct CombinedParameterizedAgg {
12390 pub this: Box<Expression>,
12391 #[serde(default)]
12392 pub expressions: Vec<Expression>,
12393 #[serde(default)]
12394 pub params: Vec<Expression>,
12395}
12396
12397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12399#[cfg_attr(feature = "bindings", derive(TS))]
12400pub struct HashAgg {
12401 pub this: Box<Expression>,
12402 #[serde(default)]
12403 pub expressions: Vec<Expression>,
12404}
12405
12406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12408#[cfg_attr(feature = "bindings", derive(TS))]
12409pub struct Hll {
12410 pub this: Box<Expression>,
12411 #[serde(default)]
12412 pub expressions: Vec<Expression>,
12413}
12414
12415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12417#[cfg_attr(feature = "bindings", derive(TS))]
12418pub struct Apply {
12419 pub this: Box<Expression>,
12420 pub expression: Box<Expression>,
12421}
12422
12423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12425#[cfg_attr(feature = "bindings", derive(TS))]
12426pub struct ToBoolean {
12427 pub this: Box<Expression>,
12428 #[serde(default)]
12429 pub safe: Option<Box<Expression>>,
12430}
12431
12432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12434#[cfg_attr(feature = "bindings", derive(TS))]
12435pub struct List {
12436 #[serde(default)]
12437 pub expressions: Vec<Expression>,
12438}
12439
12440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12445#[cfg_attr(feature = "bindings", derive(TS))]
12446pub struct ToMap {
12447 pub this: Box<Expression>,
12449}
12450
12451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12453#[cfg_attr(feature = "bindings", derive(TS))]
12454pub struct Pad {
12455 pub this: Box<Expression>,
12456 pub expression: Box<Expression>,
12457 #[serde(default)]
12458 pub fill_pattern: Option<Box<Expression>>,
12459 #[serde(default)]
12460 pub is_left: Option<Box<Expression>>,
12461}
12462
12463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12465#[cfg_attr(feature = "bindings", derive(TS))]
12466pub struct ToChar {
12467 pub this: Box<Expression>,
12468 #[serde(default)]
12469 pub format: Option<String>,
12470 #[serde(default)]
12471 pub nlsparam: Option<Box<Expression>>,
12472 #[serde(default)]
12473 pub is_numeric: Option<Box<Expression>>,
12474}
12475
12476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12478#[cfg_attr(feature = "bindings", derive(TS))]
12479pub struct StringFunc {
12480 pub this: Box<Expression>,
12481 #[serde(default)]
12482 pub zone: Option<Box<Expression>>,
12483}
12484
12485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12487#[cfg_attr(feature = "bindings", derive(TS))]
12488pub struct ToNumber {
12489 pub this: Box<Expression>,
12490 #[serde(default)]
12491 pub format: Option<Box<Expression>>,
12492 #[serde(default)]
12493 pub nlsparam: Option<Box<Expression>>,
12494 #[serde(default)]
12495 pub precision: Option<Box<Expression>>,
12496 #[serde(default)]
12497 pub scale: Option<Box<Expression>>,
12498 #[serde(default)]
12499 pub safe: Option<Box<Expression>>,
12500 #[serde(default)]
12501 pub safe_name: Option<Box<Expression>>,
12502}
12503
12504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12506#[cfg_attr(feature = "bindings", derive(TS))]
12507pub struct ToDouble {
12508 pub this: Box<Expression>,
12509 #[serde(default)]
12510 pub format: Option<String>,
12511 #[serde(default)]
12512 pub safe: Option<Box<Expression>>,
12513}
12514
12515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12517#[cfg_attr(feature = "bindings", derive(TS))]
12518pub struct ToDecfloat {
12519 pub this: Box<Expression>,
12520 #[serde(default)]
12521 pub format: Option<String>,
12522}
12523
12524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12526#[cfg_attr(feature = "bindings", derive(TS))]
12527pub struct TryToDecfloat {
12528 pub this: Box<Expression>,
12529 #[serde(default)]
12530 pub format: Option<String>,
12531}
12532
12533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12535#[cfg_attr(feature = "bindings", derive(TS))]
12536pub struct ToFile {
12537 pub this: Box<Expression>,
12538 #[serde(default)]
12539 pub path: Option<Box<Expression>>,
12540 #[serde(default)]
12541 pub safe: Option<Box<Expression>>,
12542}
12543
12544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12546#[cfg_attr(feature = "bindings", derive(TS))]
12547pub struct Columns {
12548 pub this: Box<Expression>,
12549 #[serde(default)]
12550 pub unpack: Option<Box<Expression>>,
12551}
12552
12553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12555#[cfg_attr(feature = "bindings", derive(TS))]
12556pub struct ConvertToCharset {
12557 pub this: Box<Expression>,
12558 #[serde(default)]
12559 pub dest: Option<Box<Expression>>,
12560 #[serde(default)]
12561 pub source: Option<Box<Expression>>,
12562}
12563
12564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12566#[cfg_attr(feature = "bindings", derive(TS))]
12567pub struct ConvertTimezone {
12568 #[serde(default)]
12569 pub source_tz: Option<Box<Expression>>,
12570 #[serde(default)]
12571 pub target_tz: Option<Box<Expression>>,
12572 #[serde(default)]
12573 pub timestamp: Option<Box<Expression>>,
12574 #[serde(default)]
12575 pub options: Vec<Expression>,
12576}
12577
12578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12580#[cfg_attr(feature = "bindings", derive(TS))]
12581pub struct GenerateSeries {
12582 #[serde(default)]
12583 pub start: Option<Box<Expression>>,
12584 #[serde(default)]
12585 pub end: Option<Box<Expression>>,
12586 #[serde(default)]
12587 pub step: Option<Box<Expression>>,
12588 #[serde(default)]
12589 pub is_end_exclusive: Option<Box<Expression>>,
12590}
12591
12592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12594#[cfg_attr(feature = "bindings", derive(TS))]
12595pub struct AIAgg {
12596 pub this: Box<Expression>,
12597 pub expression: Box<Expression>,
12598}
12599
12600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12602#[cfg_attr(feature = "bindings", derive(TS))]
12603pub struct AIClassify {
12604 pub this: Box<Expression>,
12605 #[serde(default)]
12606 pub categories: Option<Box<Expression>>,
12607 #[serde(default)]
12608 pub config: Option<Box<Expression>>,
12609}
12610
12611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12613#[cfg_attr(feature = "bindings", derive(TS))]
12614pub struct ArrayAll {
12615 pub this: Box<Expression>,
12616 pub expression: Box<Expression>,
12617}
12618
12619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12621#[cfg_attr(feature = "bindings", derive(TS))]
12622pub struct ArrayAny {
12623 pub this: Box<Expression>,
12624 pub expression: Box<Expression>,
12625}
12626
12627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12629#[cfg_attr(feature = "bindings", derive(TS))]
12630pub struct ArrayConstructCompact {
12631 #[serde(default)]
12632 pub expressions: Vec<Expression>,
12633}
12634
12635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12637#[cfg_attr(feature = "bindings", derive(TS))]
12638pub struct StPoint {
12639 pub this: Box<Expression>,
12640 pub expression: Box<Expression>,
12641 #[serde(default)]
12642 pub null: Option<Box<Expression>>,
12643}
12644
12645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12647#[cfg_attr(feature = "bindings", derive(TS))]
12648pub struct StDistance {
12649 pub this: Box<Expression>,
12650 pub expression: Box<Expression>,
12651 #[serde(default)]
12652 pub use_spheroid: Option<Box<Expression>>,
12653}
12654
12655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12657#[cfg_attr(feature = "bindings", derive(TS))]
12658pub struct StringToArray {
12659 pub this: Box<Expression>,
12660 #[serde(default)]
12661 pub expression: Option<Box<Expression>>,
12662 #[serde(default)]
12663 pub null: Option<Box<Expression>>,
12664}
12665
12666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12668#[cfg_attr(feature = "bindings", derive(TS))]
12669pub struct ArraySum {
12670 pub this: Box<Expression>,
12671 #[serde(default)]
12672 pub expression: Option<Box<Expression>>,
12673}
12674
12675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12677#[cfg_attr(feature = "bindings", derive(TS))]
12678pub struct ObjectAgg {
12679 pub this: Box<Expression>,
12680 pub expression: Box<Expression>,
12681}
12682
12683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12685#[cfg_attr(feature = "bindings", derive(TS))]
12686pub struct CastToStrType {
12687 pub this: Box<Expression>,
12688 #[serde(default)]
12689 pub to: Option<Box<Expression>>,
12690}
12691
12692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12694#[cfg_attr(feature = "bindings", derive(TS))]
12695pub struct CheckJson {
12696 pub this: Box<Expression>,
12697}
12698
12699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12701#[cfg_attr(feature = "bindings", derive(TS))]
12702pub struct CheckXml {
12703 pub this: Box<Expression>,
12704 #[serde(default)]
12705 pub disable_auto_convert: Option<Box<Expression>>,
12706}
12707
12708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12710#[cfg_attr(feature = "bindings", derive(TS))]
12711pub struct TranslateCharacters {
12712 pub this: Box<Expression>,
12713 pub expression: Box<Expression>,
12714 #[serde(default)]
12715 pub with_error: Option<Box<Expression>>,
12716}
12717
12718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12720#[cfg_attr(feature = "bindings", derive(TS))]
12721pub struct CurrentSchemas {
12722 #[serde(default)]
12723 pub this: Option<Box<Expression>>,
12724}
12725
12726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12728#[cfg_attr(feature = "bindings", derive(TS))]
12729pub struct CurrentDatetime {
12730 #[serde(default)]
12731 pub this: Option<Box<Expression>>,
12732}
12733
12734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12736#[cfg_attr(feature = "bindings", derive(TS))]
12737pub struct Localtime {
12738 #[serde(default)]
12739 pub this: Option<Box<Expression>>,
12740}
12741
12742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12744#[cfg_attr(feature = "bindings", derive(TS))]
12745pub struct Localtimestamp {
12746 #[serde(default)]
12747 pub this: Option<Box<Expression>>,
12748}
12749
12750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12752#[cfg_attr(feature = "bindings", derive(TS))]
12753pub struct Systimestamp {
12754 #[serde(default)]
12755 pub this: Option<Box<Expression>>,
12756}
12757
12758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12760#[cfg_attr(feature = "bindings", derive(TS))]
12761pub struct CurrentSchema {
12762 #[serde(default)]
12763 pub this: Option<Box<Expression>>,
12764}
12765
12766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12768#[cfg_attr(feature = "bindings", derive(TS))]
12769pub struct CurrentUser {
12770 #[serde(default)]
12771 pub this: Option<Box<Expression>>,
12772}
12773
12774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12776#[cfg_attr(feature = "bindings", derive(TS))]
12777pub struct SessionUser;
12778
12779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12781#[cfg_attr(feature = "bindings", derive(TS))]
12782pub struct JSONPathRoot;
12783
12784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12786#[cfg_attr(feature = "bindings", derive(TS))]
12787pub struct UtcTime {
12788 #[serde(default)]
12789 pub this: Option<Box<Expression>>,
12790}
12791
12792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12794#[cfg_attr(feature = "bindings", derive(TS))]
12795pub struct UtcTimestamp {
12796 #[serde(default)]
12797 pub this: Option<Box<Expression>>,
12798}
12799
12800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12802#[cfg_attr(feature = "bindings", derive(TS))]
12803pub struct TimestampFunc {
12804 #[serde(default)]
12805 pub this: Option<Box<Expression>>,
12806 #[serde(default)]
12807 pub zone: Option<Box<Expression>>,
12808 #[serde(default)]
12809 pub with_tz: Option<bool>,
12810 #[serde(default)]
12811 pub safe: Option<bool>,
12812}
12813
12814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12816#[cfg_attr(feature = "bindings", derive(TS))]
12817pub struct DateBin {
12818 pub this: Box<Expression>,
12819 pub expression: Box<Expression>,
12820 #[serde(default)]
12821 pub unit: Option<String>,
12822 #[serde(default)]
12823 pub zone: Option<Box<Expression>>,
12824 #[serde(default)]
12825 pub origin: Option<Box<Expression>>,
12826}
12827
12828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12830#[cfg_attr(feature = "bindings", derive(TS))]
12831pub struct Datetime {
12832 pub this: Box<Expression>,
12833 #[serde(default)]
12834 pub expression: Option<Box<Expression>>,
12835}
12836
12837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12839#[cfg_attr(feature = "bindings", derive(TS))]
12840pub struct DatetimeAdd {
12841 pub this: Box<Expression>,
12842 pub expression: Box<Expression>,
12843 #[serde(default)]
12844 pub unit: Option<String>,
12845}
12846
12847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12849#[cfg_attr(feature = "bindings", derive(TS))]
12850pub struct DatetimeSub {
12851 pub this: Box<Expression>,
12852 pub expression: Box<Expression>,
12853 #[serde(default)]
12854 pub unit: Option<String>,
12855}
12856
12857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12859#[cfg_attr(feature = "bindings", derive(TS))]
12860pub struct DatetimeDiff {
12861 pub this: Box<Expression>,
12862 pub expression: Box<Expression>,
12863 #[serde(default)]
12864 pub unit: Option<String>,
12865}
12866
12867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12869#[cfg_attr(feature = "bindings", derive(TS))]
12870pub struct DatetimeTrunc {
12871 pub this: Box<Expression>,
12872 pub unit: String,
12873 #[serde(default)]
12874 pub zone: Option<Box<Expression>>,
12875}
12876
12877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12879#[cfg_attr(feature = "bindings", derive(TS))]
12880pub struct Dayname {
12881 pub this: Box<Expression>,
12882 #[serde(default)]
12883 pub abbreviated: Option<Box<Expression>>,
12884}
12885
12886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12888#[cfg_attr(feature = "bindings", derive(TS))]
12889pub struct MakeInterval {
12890 #[serde(default)]
12891 pub year: Option<Box<Expression>>,
12892 #[serde(default)]
12893 pub month: Option<Box<Expression>>,
12894 #[serde(default)]
12895 pub week: Option<Box<Expression>>,
12896 #[serde(default)]
12897 pub day: Option<Box<Expression>>,
12898 #[serde(default)]
12899 pub hour: Option<Box<Expression>>,
12900 #[serde(default)]
12901 pub minute: Option<Box<Expression>>,
12902 #[serde(default)]
12903 pub second: Option<Box<Expression>>,
12904}
12905
12906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12908#[cfg_attr(feature = "bindings", derive(TS))]
12909pub struct PreviousDay {
12910 pub this: Box<Expression>,
12911 pub expression: Box<Expression>,
12912}
12913
12914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12916#[cfg_attr(feature = "bindings", derive(TS))]
12917pub struct Elt {
12918 pub this: Box<Expression>,
12919 #[serde(default)]
12920 pub expressions: Vec<Expression>,
12921}
12922
12923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12925#[cfg_attr(feature = "bindings", derive(TS))]
12926pub struct TimestampAdd {
12927 pub this: Box<Expression>,
12928 pub expression: Box<Expression>,
12929 #[serde(default)]
12930 pub unit: Option<String>,
12931}
12932
12933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12935#[cfg_attr(feature = "bindings", derive(TS))]
12936pub struct TimestampSub {
12937 pub this: Box<Expression>,
12938 pub expression: Box<Expression>,
12939 #[serde(default)]
12940 pub unit: Option<String>,
12941}
12942
12943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12945#[cfg_attr(feature = "bindings", derive(TS))]
12946pub struct TimestampDiff {
12947 pub this: Box<Expression>,
12948 pub expression: Box<Expression>,
12949 #[serde(default)]
12950 pub unit: Option<String>,
12951}
12952
12953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12955#[cfg_attr(feature = "bindings", derive(TS))]
12956pub struct TimeSlice {
12957 pub this: Box<Expression>,
12958 pub expression: Box<Expression>,
12959 pub unit: String,
12960 #[serde(default)]
12961 pub kind: Option<String>,
12962}
12963
12964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12966#[cfg_attr(feature = "bindings", derive(TS))]
12967pub struct TimeAdd {
12968 pub this: Box<Expression>,
12969 pub expression: Box<Expression>,
12970 #[serde(default)]
12971 pub unit: Option<String>,
12972}
12973
12974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12976#[cfg_attr(feature = "bindings", derive(TS))]
12977pub struct TimeSub {
12978 pub this: Box<Expression>,
12979 pub expression: Box<Expression>,
12980 #[serde(default)]
12981 pub unit: Option<String>,
12982}
12983
12984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12986#[cfg_attr(feature = "bindings", derive(TS))]
12987pub struct TimeDiff {
12988 pub this: Box<Expression>,
12989 pub expression: Box<Expression>,
12990 #[serde(default)]
12991 pub unit: Option<String>,
12992}
12993
12994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12996#[cfg_attr(feature = "bindings", derive(TS))]
12997pub struct TimeTrunc {
12998 pub this: Box<Expression>,
12999 pub unit: String,
13000 #[serde(default)]
13001 pub zone: Option<Box<Expression>>,
13002}
13003
13004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13006#[cfg_attr(feature = "bindings", derive(TS))]
13007pub struct DateFromParts {
13008 #[serde(default)]
13009 pub year: Option<Box<Expression>>,
13010 #[serde(default)]
13011 pub month: Option<Box<Expression>>,
13012 #[serde(default)]
13013 pub day: Option<Box<Expression>>,
13014 #[serde(default)]
13015 pub allow_overflow: Option<Box<Expression>>,
13016}
13017
13018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13020#[cfg_attr(feature = "bindings", derive(TS))]
13021pub struct TimeFromParts {
13022 #[serde(default)]
13023 pub hour: Option<Box<Expression>>,
13024 #[serde(default)]
13025 pub min: Option<Box<Expression>>,
13026 #[serde(default)]
13027 pub sec: Option<Box<Expression>>,
13028 #[serde(default)]
13029 pub nano: Option<Box<Expression>>,
13030 #[serde(default)]
13031 pub fractions: Option<Box<Expression>>,
13032 #[serde(default)]
13033 pub precision: Option<i64>,
13034}
13035
13036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13038#[cfg_attr(feature = "bindings", derive(TS))]
13039pub struct DecodeCase {
13040 #[serde(default)]
13041 pub expressions: Vec<Expression>,
13042}
13043
13044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13046#[cfg_attr(feature = "bindings", derive(TS))]
13047pub struct Decrypt {
13048 pub this: Box<Expression>,
13049 #[serde(default)]
13050 pub passphrase: Option<Box<Expression>>,
13051 #[serde(default)]
13052 pub aad: Option<Box<Expression>>,
13053 #[serde(default)]
13054 pub encryption_method: Option<Box<Expression>>,
13055 #[serde(default)]
13056 pub safe: Option<Box<Expression>>,
13057}
13058
13059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13061#[cfg_attr(feature = "bindings", derive(TS))]
13062pub struct DecryptRaw {
13063 pub this: Box<Expression>,
13064 #[serde(default)]
13065 pub key: Option<Box<Expression>>,
13066 #[serde(default)]
13067 pub iv: Option<Box<Expression>>,
13068 #[serde(default)]
13069 pub aad: Option<Box<Expression>>,
13070 #[serde(default)]
13071 pub encryption_method: Option<Box<Expression>>,
13072 #[serde(default)]
13073 pub aead: Option<Box<Expression>>,
13074 #[serde(default)]
13075 pub safe: Option<Box<Expression>>,
13076}
13077
13078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13080#[cfg_attr(feature = "bindings", derive(TS))]
13081pub struct Encode {
13082 pub this: Box<Expression>,
13083 #[serde(default)]
13084 pub charset: Option<Box<Expression>>,
13085}
13086
13087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13089#[cfg_attr(feature = "bindings", derive(TS))]
13090pub struct Encrypt {
13091 pub this: Box<Expression>,
13092 #[serde(default)]
13093 pub passphrase: Option<Box<Expression>>,
13094 #[serde(default)]
13095 pub aad: Option<Box<Expression>>,
13096 #[serde(default)]
13097 pub encryption_method: Option<Box<Expression>>,
13098}
13099
13100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13102#[cfg_attr(feature = "bindings", derive(TS))]
13103pub struct EncryptRaw {
13104 pub this: Box<Expression>,
13105 #[serde(default)]
13106 pub key: Option<Box<Expression>>,
13107 #[serde(default)]
13108 pub iv: Option<Box<Expression>>,
13109 #[serde(default)]
13110 pub aad: Option<Box<Expression>>,
13111 #[serde(default)]
13112 pub encryption_method: Option<Box<Expression>>,
13113}
13114
13115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13117#[cfg_attr(feature = "bindings", derive(TS))]
13118pub struct EqualNull {
13119 pub this: Box<Expression>,
13120 pub expression: Box<Expression>,
13121}
13122
13123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13125#[cfg_attr(feature = "bindings", derive(TS))]
13126pub struct ToBinary {
13127 pub this: Box<Expression>,
13128 #[serde(default)]
13129 pub format: Option<String>,
13130 #[serde(default)]
13131 pub safe: Option<Box<Expression>>,
13132}
13133
13134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13136#[cfg_attr(feature = "bindings", derive(TS))]
13137pub struct Base64DecodeBinary {
13138 pub this: Box<Expression>,
13139 #[serde(default)]
13140 pub alphabet: Option<Box<Expression>>,
13141}
13142
13143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13145#[cfg_attr(feature = "bindings", derive(TS))]
13146pub struct Base64DecodeString {
13147 pub this: Box<Expression>,
13148 #[serde(default)]
13149 pub alphabet: Option<Box<Expression>>,
13150}
13151
13152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13154#[cfg_attr(feature = "bindings", derive(TS))]
13155pub struct Base64Encode {
13156 pub this: Box<Expression>,
13157 #[serde(default)]
13158 pub max_line_length: Option<Box<Expression>>,
13159 #[serde(default)]
13160 pub alphabet: Option<Box<Expression>>,
13161}
13162
13163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13165#[cfg_attr(feature = "bindings", derive(TS))]
13166pub struct TryBase64DecodeBinary {
13167 pub this: Box<Expression>,
13168 #[serde(default)]
13169 pub alphabet: Option<Box<Expression>>,
13170}
13171
13172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13174#[cfg_attr(feature = "bindings", derive(TS))]
13175pub struct TryBase64DecodeString {
13176 pub this: Box<Expression>,
13177 #[serde(default)]
13178 pub alphabet: Option<Box<Expression>>,
13179}
13180
13181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13183#[cfg_attr(feature = "bindings", derive(TS))]
13184pub struct GapFill {
13185 pub this: Box<Expression>,
13186 #[serde(default)]
13187 pub ts_column: Option<Box<Expression>>,
13188 #[serde(default)]
13189 pub bucket_width: Option<Box<Expression>>,
13190 #[serde(default)]
13191 pub partitioning_columns: Option<Box<Expression>>,
13192 #[serde(default)]
13193 pub value_columns: Option<Box<Expression>>,
13194 #[serde(default)]
13195 pub origin: Option<Box<Expression>>,
13196 #[serde(default)]
13197 pub ignore_nulls: Option<Box<Expression>>,
13198}
13199
13200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13202#[cfg_attr(feature = "bindings", derive(TS))]
13203pub struct GenerateDateArray {
13204 #[serde(default)]
13205 pub start: Option<Box<Expression>>,
13206 #[serde(default)]
13207 pub end: Option<Box<Expression>>,
13208 #[serde(default)]
13209 pub step: Option<Box<Expression>>,
13210}
13211
13212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13214#[cfg_attr(feature = "bindings", derive(TS))]
13215pub struct GenerateTimestampArray {
13216 #[serde(default)]
13217 pub start: Option<Box<Expression>>,
13218 #[serde(default)]
13219 pub end: Option<Box<Expression>>,
13220 #[serde(default)]
13221 pub step: Option<Box<Expression>>,
13222}
13223
13224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13226#[cfg_attr(feature = "bindings", derive(TS))]
13227pub struct GetExtract {
13228 pub this: Box<Expression>,
13229 pub expression: Box<Expression>,
13230}
13231
13232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13234#[cfg_attr(feature = "bindings", derive(TS))]
13235pub struct Getbit {
13236 pub this: Box<Expression>,
13237 pub expression: Box<Expression>,
13238 #[serde(default)]
13239 pub zero_is_msb: Option<Box<Expression>>,
13240}
13241
13242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13244#[cfg_attr(feature = "bindings", derive(TS))]
13245pub struct OverflowTruncateBehavior {
13246 #[serde(default)]
13247 pub this: Option<Box<Expression>>,
13248 #[serde(default)]
13249 pub with_count: Option<Box<Expression>>,
13250}
13251
13252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13254#[cfg_attr(feature = "bindings", derive(TS))]
13255pub struct HexEncode {
13256 pub this: Box<Expression>,
13257 #[serde(default)]
13258 pub case: Option<Box<Expression>>,
13259}
13260
13261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13263#[cfg_attr(feature = "bindings", derive(TS))]
13264pub struct Compress {
13265 pub this: Box<Expression>,
13266 #[serde(default)]
13267 pub method: Option<String>,
13268}
13269
13270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13272#[cfg_attr(feature = "bindings", derive(TS))]
13273pub struct DecompressBinary {
13274 pub this: Box<Expression>,
13275 pub method: String,
13276}
13277
13278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13280#[cfg_attr(feature = "bindings", derive(TS))]
13281pub struct DecompressString {
13282 pub this: Box<Expression>,
13283 pub method: String,
13284}
13285
13286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13288#[cfg_attr(feature = "bindings", derive(TS))]
13289pub struct Xor {
13290 #[serde(default)]
13291 pub this: Option<Box<Expression>>,
13292 #[serde(default)]
13293 pub expression: Option<Box<Expression>>,
13294 #[serde(default)]
13295 pub expressions: Vec<Expression>,
13296}
13297
13298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13300#[cfg_attr(feature = "bindings", derive(TS))]
13301pub struct Nullif {
13302 pub this: Box<Expression>,
13303 pub expression: Box<Expression>,
13304}
13305
13306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13308#[cfg_attr(feature = "bindings", derive(TS))]
13309pub struct JSON {
13310 #[serde(default)]
13311 pub this: Option<Box<Expression>>,
13312 #[serde(default)]
13313 pub with_: Option<Box<Expression>>,
13314 #[serde(default)]
13315 pub unique: bool,
13316}
13317
13318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13320#[cfg_attr(feature = "bindings", derive(TS))]
13321pub struct JSONPath {
13322 #[serde(default)]
13323 pub expressions: Vec<Expression>,
13324 #[serde(default)]
13325 pub escape: Option<Box<Expression>>,
13326}
13327
13328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13330#[cfg_attr(feature = "bindings", derive(TS))]
13331pub struct JSONPathFilter {
13332 pub this: Box<Expression>,
13333}
13334
13335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13337#[cfg_attr(feature = "bindings", derive(TS))]
13338pub struct JSONPathKey {
13339 pub this: Box<Expression>,
13340}
13341
13342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13344#[cfg_attr(feature = "bindings", derive(TS))]
13345pub struct JSONPathRecursive {
13346 #[serde(default)]
13347 pub this: Option<Box<Expression>>,
13348}
13349
13350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13352#[cfg_attr(feature = "bindings", derive(TS))]
13353pub struct JSONPathScript {
13354 pub this: Box<Expression>,
13355}
13356
13357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13359#[cfg_attr(feature = "bindings", derive(TS))]
13360pub struct JSONPathSlice {
13361 #[serde(default)]
13362 pub start: Option<Box<Expression>>,
13363 #[serde(default)]
13364 pub end: Option<Box<Expression>>,
13365 #[serde(default)]
13366 pub step: Option<Box<Expression>>,
13367}
13368
13369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13371#[cfg_attr(feature = "bindings", derive(TS))]
13372pub struct JSONPathSelector {
13373 pub this: Box<Expression>,
13374}
13375
13376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13378#[cfg_attr(feature = "bindings", derive(TS))]
13379pub struct JSONPathSubscript {
13380 pub this: Box<Expression>,
13381}
13382
13383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13385#[cfg_attr(feature = "bindings", derive(TS))]
13386pub struct JSONPathUnion {
13387 #[serde(default)]
13388 pub expressions: Vec<Expression>,
13389}
13390
13391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13393#[cfg_attr(feature = "bindings", derive(TS))]
13394pub struct Format {
13395 pub this: Box<Expression>,
13396 #[serde(default)]
13397 pub expressions: Vec<Expression>,
13398}
13399
13400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13402#[cfg_attr(feature = "bindings", derive(TS))]
13403pub struct JSONKeys {
13404 pub this: Box<Expression>,
13405 #[serde(default)]
13406 pub expression: Option<Box<Expression>>,
13407 #[serde(default)]
13408 pub expressions: Vec<Expression>,
13409}
13410
13411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13413#[cfg_attr(feature = "bindings", derive(TS))]
13414pub struct JSONKeyValue {
13415 pub this: Box<Expression>,
13416 pub expression: Box<Expression>,
13417}
13418
13419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13421#[cfg_attr(feature = "bindings", derive(TS))]
13422pub struct JSONKeysAtDepth {
13423 pub this: Box<Expression>,
13424 #[serde(default)]
13425 pub expression: Option<Box<Expression>>,
13426 #[serde(default)]
13427 pub mode: Option<Box<Expression>>,
13428}
13429
13430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13432#[cfg_attr(feature = "bindings", derive(TS))]
13433pub struct JSONObject {
13434 #[serde(default)]
13435 pub expressions: Vec<Expression>,
13436 #[serde(default)]
13437 pub null_handling: Option<Box<Expression>>,
13438 #[serde(default)]
13439 pub unique_keys: Option<Box<Expression>>,
13440 #[serde(default)]
13441 pub return_type: Option<Box<Expression>>,
13442 #[serde(default)]
13443 pub encoding: Option<Box<Expression>>,
13444}
13445
13446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13448#[cfg_attr(feature = "bindings", derive(TS))]
13449pub struct JSONObjectAgg {
13450 #[serde(default)]
13451 pub expressions: Vec<Expression>,
13452 #[serde(default)]
13453 pub null_handling: Option<Box<Expression>>,
13454 #[serde(default)]
13455 pub unique_keys: Option<Box<Expression>>,
13456 #[serde(default)]
13457 pub return_type: Option<Box<Expression>>,
13458 #[serde(default)]
13459 pub encoding: Option<Box<Expression>>,
13460}
13461
13462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13464#[cfg_attr(feature = "bindings", derive(TS))]
13465pub struct JSONBObjectAgg {
13466 pub this: Box<Expression>,
13467 pub expression: Box<Expression>,
13468}
13469
13470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13472#[cfg_attr(feature = "bindings", derive(TS))]
13473pub struct JSONArray {
13474 #[serde(default)]
13475 pub expressions: Vec<Expression>,
13476 #[serde(default)]
13477 pub null_handling: Option<Box<Expression>>,
13478 #[serde(default)]
13479 pub return_type: Option<Box<Expression>>,
13480 #[serde(default)]
13481 pub strict: Option<Box<Expression>>,
13482}
13483
13484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13486#[cfg_attr(feature = "bindings", derive(TS))]
13487pub struct JSONArrayAgg {
13488 pub this: Box<Expression>,
13489 #[serde(default)]
13490 pub order: Option<Box<Expression>>,
13491 #[serde(default)]
13492 pub null_handling: Option<Box<Expression>>,
13493 #[serde(default)]
13494 pub return_type: Option<Box<Expression>>,
13495 #[serde(default)]
13496 pub strict: Option<Box<Expression>>,
13497}
13498
13499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13501#[cfg_attr(feature = "bindings", derive(TS))]
13502pub struct JSONExists {
13503 pub this: Box<Expression>,
13504 #[serde(default)]
13505 pub path: Option<Box<Expression>>,
13506 #[serde(default)]
13507 pub passing: Option<Box<Expression>>,
13508 #[serde(default)]
13509 pub on_condition: Option<Box<Expression>>,
13510 #[serde(default)]
13511 pub from_dcolonqmark: Option<Box<Expression>>,
13512}
13513
13514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13516#[cfg_attr(feature = "bindings", derive(TS))]
13517pub struct JSONColumnDef {
13518 #[serde(default)]
13519 pub this: Option<Box<Expression>>,
13520 #[serde(default)]
13521 pub kind: Option<String>,
13522 #[serde(default)]
13523 pub path: Option<Box<Expression>>,
13524 #[serde(default)]
13525 pub nested_schema: Option<Box<Expression>>,
13526 #[serde(default)]
13527 pub ordinality: Option<Box<Expression>>,
13528}
13529
13530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13532#[cfg_attr(feature = "bindings", derive(TS))]
13533pub struct JSONSchema {
13534 #[serde(default)]
13535 pub expressions: Vec<Expression>,
13536}
13537
13538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13540#[cfg_attr(feature = "bindings", derive(TS))]
13541pub struct JSONSet {
13542 pub this: Box<Expression>,
13543 #[serde(default)]
13544 pub expressions: Vec<Expression>,
13545}
13546
13547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13549#[cfg_attr(feature = "bindings", derive(TS))]
13550pub struct JSONStripNulls {
13551 pub this: Box<Expression>,
13552 #[serde(default)]
13553 pub expression: Option<Box<Expression>>,
13554 #[serde(default)]
13555 pub include_arrays: Option<Box<Expression>>,
13556 #[serde(default)]
13557 pub remove_empty: Option<Box<Expression>>,
13558}
13559
13560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13562#[cfg_attr(feature = "bindings", derive(TS))]
13563pub struct JSONValue {
13564 pub this: Box<Expression>,
13565 #[serde(default)]
13566 pub path: Option<Box<Expression>>,
13567 #[serde(default)]
13568 pub returning: Option<Box<Expression>>,
13569 #[serde(default)]
13570 pub on_condition: Option<Box<Expression>>,
13571}
13572
13573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13575#[cfg_attr(feature = "bindings", derive(TS))]
13576pub struct JSONValueArray {
13577 pub this: Box<Expression>,
13578 #[serde(default)]
13579 pub expression: Option<Box<Expression>>,
13580}
13581
13582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13584#[cfg_attr(feature = "bindings", derive(TS))]
13585pub struct JSONRemove {
13586 pub this: Box<Expression>,
13587 #[serde(default)]
13588 pub expressions: Vec<Expression>,
13589}
13590
13591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13593#[cfg_attr(feature = "bindings", derive(TS))]
13594pub struct JSONTable {
13595 pub this: Box<Expression>,
13596 #[serde(default)]
13597 pub schema: Option<Box<Expression>>,
13598 #[serde(default)]
13599 pub path: Option<Box<Expression>>,
13600 #[serde(default)]
13601 pub error_handling: Option<Box<Expression>>,
13602 #[serde(default)]
13603 pub empty_handling: Option<Box<Expression>>,
13604}
13605
13606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13608#[cfg_attr(feature = "bindings", derive(TS))]
13609pub struct JSONType {
13610 pub this: Box<Expression>,
13611 #[serde(default)]
13612 pub expression: Option<Box<Expression>>,
13613}
13614
13615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13617#[cfg_attr(feature = "bindings", derive(TS))]
13618pub struct ObjectInsert {
13619 pub this: Box<Expression>,
13620 #[serde(default)]
13621 pub key: Option<Box<Expression>>,
13622 #[serde(default)]
13623 pub value: Option<Box<Expression>>,
13624 #[serde(default)]
13625 pub update_flag: Option<Box<Expression>>,
13626}
13627
13628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13630#[cfg_attr(feature = "bindings", derive(TS))]
13631pub struct OpenJSONColumnDef {
13632 pub this: Box<Expression>,
13633 pub kind: String,
13634 #[serde(default)]
13635 pub path: Option<Box<Expression>>,
13636 #[serde(default)]
13637 pub as_json: Option<Box<Expression>>,
13638 #[serde(default, skip_serializing_if = "Option::is_none")]
13640 pub data_type: Option<DataType>,
13641}
13642
13643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13645#[cfg_attr(feature = "bindings", derive(TS))]
13646pub struct OpenJSON {
13647 pub this: Box<Expression>,
13648 #[serde(default)]
13649 pub path: Option<Box<Expression>>,
13650 #[serde(default)]
13651 pub expressions: Vec<Expression>,
13652}
13653
13654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13656#[cfg_attr(feature = "bindings", derive(TS))]
13657pub struct JSONBExists {
13658 pub this: Box<Expression>,
13659 #[serde(default)]
13660 pub path: Option<Box<Expression>>,
13661}
13662
13663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13665#[cfg_attr(feature = "bindings", derive(TS))]
13666pub struct JSONCast {
13667 pub this: Box<Expression>,
13668 pub to: DataType,
13669}
13670
13671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13673#[cfg_attr(feature = "bindings", derive(TS))]
13674pub struct JSONExtract {
13675 pub this: Box<Expression>,
13676 pub expression: Box<Expression>,
13677 #[serde(default)]
13678 pub only_json_types: Option<Box<Expression>>,
13679 #[serde(default)]
13680 pub expressions: Vec<Expression>,
13681 #[serde(default)]
13682 pub variant_extract: Option<Box<Expression>>,
13683 #[serde(default)]
13684 pub json_query: Option<Box<Expression>>,
13685 #[serde(default)]
13686 pub option: Option<Box<Expression>>,
13687 #[serde(default)]
13688 pub quote: Option<Box<Expression>>,
13689 #[serde(default)]
13690 pub on_condition: Option<Box<Expression>>,
13691 #[serde(default)]
13692 pub requires_json: Option<Box<Expression>>,
13693}
13694
13695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13697#[cfg_attr(feature = "bindings", derive(TS))]
13698pub struct JSONExtractQuote {
13699 #[serde(default)]
13700 pub option: Option<Box<Expression>>,
13701 #[serde(default)]
13702 pub scalar: Option<Box<Expression>>,
13703}
13704
13705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13707#[cfg_attr(feature = "bindings", derive(TS))]
13708pub struct JSONExtractArray {
13709 pub this: Box<Expression>,
13710 #[serde(default)]
13711 pub expression: Option<Box<Expression>>,
13712}
13713
13714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13716#[cfg_attr(feature = "bindings", derive(TS))]
13717pub struct JSONExtractScalar {
13718 pub this: Box<Expression>,
13719 pub expression: Box<Expression>,
13720 #[serde(default)]
13721 pub only_json_types: Option<Box<Expression>>,
13722 #[serde(default)]
13723 pub expressions: Vec<Expression>,
13724 #[serde(default)]
13725 pub json_type: Option<Box<Expression>>,
13726 #[serde(default)]
13727 pub scalar_only: Option<Box<Expression>>,
13728}
13729
13730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13732#[cfg_attr(feature = "bindings", derive(TS))]
13733pub struct JSONBExtractScalar {
13734 pub this: Box<Expression>,
13735 pub expression: Box<Expression>,
13736 #[serde(default)]
13737 pub json_type: Option<Box<Expression>>,
13738}
13739
13740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13742#[cfg_attr(feature = "bindings", derive(TS))]
13743pub struct JSONFormat {
13744 #[serde(default)]
13745 pub this: Option<Box<Expression>>,
13746 #[serde(default)]
13747 pub options: Vec<Expression>,
13748 #[serde(default)]
13749 pub is_json: Option<Box<Expression>>,
13750 #[serde(default)]
13751 pub to_json: Option<Box<Expression>>,
13752}
13753
13754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13756#[cfg_attr(feature = "bindings", derive(TS))]
13757pub struct JSONArrayAppend {
13758 pub this: Box<Expression>,
13759 #[serde(default)]
13760 pub expressions: Vec<Expression>,
13761}
13762
13763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13765#[cfg_attr(feature = "bindings", derive(TS))]
13766pub struct JSONArrayContains {
13767 pub this: Box<Expression>,
13768 pub expression: Box<Expression>,
13769 #[serde(default)]
13770 pub json_type: Option<Box<Expression>>,
13771}
13772
13773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13775#[cfg_attr(feature = "bindings", derive(TS))]
13776pub struct JSONArrayInsert {
13777 pub this: Box<Expression>,
13778 #[serde(default)]
13779 pub expressions: Vec<Expression>,
13780}
13781
13782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13784#[cfg_attr(feature = "bindings", derive(TS))]
13785pub struct ParseJSON {
13786 pub this: Box<Expression>,
13787 #[serde(default)]
13788 pub expression: Option<Box<Expression>>,
13789 #[serde(default)]
13790 pub safe: Option<Box<Expression>>,
13791}
13792
13793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13795#[cfg_attr(feature = "bindings", derive(TS))]
13796pub struct ParseUrl {
13797 pub this: Box<Expression>,
13798 #[serde(default)]
13799 pub part_to_extract: Option<Box<Expression>>,
13800 #[serde(default)]
13801 pub key: Option<Box<Expression>>,
13802 #[serde(default)]
13803 pub permissive: Option<Box<Expression>>,
13804}
13805
13806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13808#[cfg_attr(feature = "bindings", derive(TS))]
13809pub struct ParseIp {
13810 pub this: Box<Expression>,
13811 #[serde(default)]
13812 pub type_: Option<Box<Expression>>,
13813 #[serde(default)]
13814 pub permissive: Option<Box<Expression>>,
13815}
13816
13817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13819#[cfg_attr(feature = "bindings", derive(TS))]
13820pub struct ParseTime {
13821 pub this: Box<Expression>,
13822 pub format: String,
13823}
13824
13825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13827#[cfg_attr(feature = "bindings", derive(TS))]
13828pub struct ParseDatetime {
13829 pub this: Box<Expression>,
13830 #[serde(default)]
13831 pub format: Option<String>,
13832 #[serde(default)]
13833 pub zone: Option<Box<Expression>>,
13834}
13835
13836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13838#[cfg_attr(feature = "bindings", derive(TS))]
13839pub struct Map {
13840 #[serde(default)]
13841 pub keys: Vec<Expression>,
13842 #[serde(default)]
13843 pub values: Vec<Expression>,
13844}
13845
13846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13848#[cfg_attr(feature = "bindings", derive(TS))]
13849pub struct MapCat {
13850 pub this: Box<Expression>,
13851 pub expression: Box<Expression>,
13852}
13853
13854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13856#[cfg_attr(feature = "bindings", derive(TS))]
13857pub struct MapDelete {
13858 pub this: Box<Expression>,
13859 #[serde(default)]
13860 pub expressions: Vec<Expression>,
13861}
13862
13863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13865#[cfg_attr(feature = "bindings", derive(TS))]
13866pub struct MapInsert {
13867 pub this: Box<Expression>,
13868 #[serde(default)]
13869 pub key: Option<Box<Expression>>,
13870 #[serde(default)]
13871 pub value: Option<Box<Expression>>,
13872 #[serde(default)]
13873 pub update_flag: Option<Box<Expression>>,
13874}
13875
13876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13878#[cfg_attr(feature = "bindings", derive(TS))]
13879pub struct MapPick {
13880 pub this: Box<Expression>,
13881 #[serde(default)]
13882 pub expressions: Vec<Expression>,
13883}
13884
13885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13887#[cfg_attr(feature = "bindings", derive(TS))]
13888pub struct ScopeResolution {
13889 #[serde(default)]
13890 pub this: Option<Box<Expression>>,
13891 pub expression: Box<Expression>,
13892}
13893
13894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13896#[cfg_attr(feature = "bindings", derive(TS))]
13897pub struct Slice {
13898 #[serde(default)]
13899 pub this: Option<Box<Expression>>,
13900 #[serde(default)]
13901 pub expression: Option<Box<Expression>>,
13902 #[serde(default)]
13903 pub step: Option<Box<Expression>>,
13904}
13905
13906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13908#[cfg_attr(feature = "bindings", derive(TS))]
13909pub struct VarMap {
13910 #[serde(default)]
13911 pub keys: Vec<Expression>,
13912 #[serde(default)]
13913 pub values: Vec<Expression>,
13914}
13915
13916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13918#[cfg_attr(feature = "bindings", derive(TS))]
13919pub struct MatchAgainst {
13920 pub this: Box<Expression>,
13921 #[serde(default)]
13922 pub expressions: Vec<Expression>,
13923 #[serde(default)]
13924 pub modifier: Option<Box<Expression>>,
13925}
13926
13927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13929#[cfg_attr(feature = "bindings", derive(TS))]
13930pub struct MD5Digest {
13931 pub this: Box<Expression>,
13932 #[serde(default)]
13933 pub expressions: Vec<Expression>,
13934}
13935
13936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13938#[cfg_attr(feature = "bindings", derive(TS))]
13939pub struct Monthname {
13940 pub this: Box<Expression>,
13941 #[serde(default)]
13942 pub abbreviated: Option<Box<Expression>>,
13943}
13944
13945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13947#[cfg_attr(feature = "bindings", derive(TS))]
13948pub struct Ntile {
13949 #[serde(default)]
13950 pub this: Option<Box<Expression>>,
13951}
13952
13953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13955#[cfg_attr(feature = "bindings", derive(TS))]
13956pub struct Normalize {
13957 pub this: Box<Expression>,
13958 #[serde(default)]
13959 pub form: Option<Box<Expression>>,
13960 #[serde(default)]
13961 pub is_casefold: Option<Box<Expression>>,
13962}
13963
13964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13966#[cfg_attr(feature = "bindings", derive(TS))]
13967pub struct Normal {
13968 pub this: Box<Expression>,
13969 #[serde(default)]
13970 pub stddev: Option<Box<Expression>>,
13971 #[serde(default)]
13972 pub gen: Option<Box<Expression>>,
13973}
13974
13975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13977#[cfg_attr(feature = "bindings", derive(TS))]
13978pub struct Predict {
13979 pub this: Box<Expression>,
13980 pub expression: Box<Expression>,
13981 #[serde(default)]
13982 pub params_struct: Option<Box<Expression>>,
13983}
13984
13985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13987#[cfg_attr(feature = "bindings", derive(TS))]
13988pub struct MLTranslate {
13989 pub this: Box<Expression>,
13990 pub expression: Box<Expression>,
13991 #[serde(default)]
13992 pub params_struct: Option<Box<Expression>>,
13993}
13994
13995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13997#[cfg_attr(feature = "bindings", derive(TS))]
13998pub struct FeaturesAtTime {
13999 pub this: Box<Expression>,
14000 #[serde(default)]
14001 pub time: Option<Box<Expression>>,
14002 #[serde(default)]
14003 pub num_rows: Option<Box<Expression>>,
14004 #[serde(default)]
14005 pub ignore_feature_nulls: Option<Box<Expression>>,
14006}
14007
14008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14010#[cfg_attr(feature = "bindings", derive(TS))]
14011pub struct GenerateEmbedding {
14012 pub this: Box<Expression>,
14013 pub expression: Box<Expression>,
14014 #[serde(default)]
14015 pub params_struct: Option<Box<Expression>>,
14016 #[serde(default)]
14017 pub is_text: Option<Box<Expression>>,
14018}
14019
14020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14022#[cfg_attr(feature = "bindings", derive(TS))]
14023pub struct MLForecast {
14024 pub this: Box<Expression>,
14025 #[serde(default)]
14026 pub expression: Option<Box<Expression>>,
14027 #[serde(default)]
14028 pub params_struct: Option<Box<Expression>>,
14029}
14030
14031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14033#[cfg_attr(feature = "bindings", derive(TS))]
14034pub struct ModelAttribute {
14035 pub this: Box<Expression>,
14036 pub expression: Box<Expression>,
14037}
14038
14039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14041#[cfg_attr(feature = "bindings", derive(TS))]
14042pub struct VectorSearch {
14043 pub this: Box<Expression>,
14044 #[serde(default)]
14045 pub column_to_search: Option<Box<Expression>>,
14046 #[serde(default)]
14047 pub query_table: Option<Box<Expression>>,
14048 #[serde(default)]
14049 pub query_column_to_search: Option<Box<Expression>>,
14050 #[serde(default)]
14051 pub top_k: Option<Box<Expression>>,
14052 #[serde(default)]
14053 pub distance_type: Option<Box<Expression>>,
14054 #[serde(default)]
14055 pub options: Vec<Expression>,
14056}
14057
14058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14060#[cfg_attr(feature = "bindings", derive(TS))]
14061pub struct Quantile {
14062 pub this: Box<Expression>,
14063 #[serde(default)]
14064 pub quantile: Option<Box<Expression>>,
14065}
14066
14067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14069#[cfg_attr(feature = "bindings", derive(TS))]
14070pub struct ApproxQuantile {
14071 pub this: Box<Expression>,
14072 #[serde(default)]
14073 pub quantile: Option<Box<Expression>>,
14074 #[serde(default)]
14075 pub accuracy: Option<Box<Expression>>,
14076 #[serde(default)]
14077 pub weight: Option<Box<Expression>>,
14078 #[serde(default)]
14079 pub error_tolerance: Option<Box<Expression>>,
14080}
14081
14082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14084#[cfg_attr(feature = "bindings", derive(TS))]
14085pub struct ApproxPercentileEstimate {
14086 pub this: Box<Expression>,
14087 #[serde(default)]
14088 pub percentile: Option<Box<Expression>>,
14089}
14090
14091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14093#[cfg_attr(feature = "bindings", derive(TS))]
14094pub struct Randn {
14095 #[serde(default)]
14096 pub this: Option<Box<Expression>>,
14097}
14098
14099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14101#[cfg_attr(feature = "bindings", derive(TS))]
14102pub struct Randstr {
14103 pub this: Box<Expression>,
14104 #[serde(default)]
14105 pub generator: Option<Box<Expression>>,
14106}
14107
14108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14110#[cfg_attr(feature = "bindings", derive(TS))]
14111pub struct RangeN {
14112 pub this: Box<Expression>,
14113 #[serde(default)]
14114 pub expressions: Vec<Expression>,
14115 #[serde(default)]
14116 pub each: Option<Box<Expression>>,
14117}
14118
14119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14121#[cfg_attr(feature = "bindings", derive(TS))]
14122pub struct RangeBucket {
14123 pub this: Box<Expression>,
14124 pub expression: Box<Expression>,
14125}
14126
14127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14129#[cfg_attr(feature = "bindings", derive(TS))]
14130pub struct ReadCSV {
14131 pub this: Box<Expression>,
14132 #[serde(default)]
14133 pub expressions: Vec<Expression>,
14134}
14135
14136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14138#[cfg_attr(feature = "bindings", derive(TS))]
14139pub struct ReadParquet {
14140 #[serde(default)]
14141 pub expressions: Vec<Expression>,
14142}
14143
14144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14146#[cfg_attr(feature = "bindings", derive(TS))]
14147pub struct Reduce {
14148 pub this: Box<Expression>,
14149 #[serde(default)]
14150 pub initial: Option<Box<Expression>>,
14151 #[serde(default)]
14152 pub merge: Option<Box<Expression>>,
14153 #[serde(default)]
14154 pub finish: Option<Box<Expression>>,
14155}
14156
14157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14159#[cfg_attr(feature = "bindings", derive(TS))]
14160pub struct RegexpExtractAll {
14161 pub this: Box<Expression>,
14162 pub expression: Box<Expression>,
14163 #[serde(default)]
14164 pub group: Option<Box<Expression>>,
14165 #[serde(default)]
14166 pub parameters: Option<Box<Expression>>,
14167 #[serde(default)]
14168 pub position: Option<Box<Expression>>,
14169 #[serde(default)]
14170 pub occurrence: Option<Box<Expression>>,
14171}
14172
14173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14175#[cfg_attr(feature = "bindings", derive(TS))]
14176pub struct RegexpILike {
14177 pub this: Box<Expression>,
14178 pub expression: Box<Expression>,
14179 #[serde(default)]
14180 pub flag: Option<Box<Expression>>,
14181}
14182
14183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14185#[cfg_attr(feature = "bindings", derive(TS))]
14186pub struct RegexpFullMatch {
14187 pub this: Box<Expression>,
14188 pub expression: Box<Expression>,
14189 #[serde(default)]
14190 pub options: Vec<Expression>,
14191}
14192
14193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14195#[cfg_attr(feature = "bindings", derive(TS))]
14196pub struct RegexpInstr {
14197 pub this: Box<Expression>,
14198 pub expression: Box<Expression>,
14199 #[serde(default)]
14200 pub position: Option<Box<Expression>>,
14201 #[serde(default)]
14202 pub occurrence: Option<Box<Expression>>,
14203 #[serde(default)]
14204 pub option: Option<Box<Expression>>,
14205 #[serde(default)]
14206 pub parameters: Option<Box<Expression>>,
14207 #[serde(default)]
14208 pub group: Option<Box<Expression>>,
14209}
14210
14211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14213#[cfg_attr(feature = "bindings", derive(TS))]
14214pub struct RegexpSplit {
14215 pub this: Box<Expression>,
14216 pub expression: Box<Expression>,
14217 #[serde(default)]
14218 pub limit: Option<Box<Expression>>,
14219}
14220
14221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14223#[cfg_attr(feature = "bindings", derive(TS))]
14224pub struct RegexpCount {
14225 pub this: Box<Expression>,
14226 pub expression: Box<Expression>,
14227 #[serde(default)]
14228 pub position: Option<Box<Expression>>,
14229 #[serde(default)]
14230 pub parameters: Option<Box<Expression>>,
14231}
14232
14233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14235#[cfg_attr(feature = "bindings", derive(TS))]
14236pub struct RegrValx {
14237 pub this: Box<Expression>,
14238 pub expression: Box<Expression>,
14239}
14240
14241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14243#[cfg_attr(feature = "bindings", derive(TS))]
14244pub struct RegrValy {
14245 pub this: Box<Expression>,
14246 pub expression: Box<Expression>,
14247}
14248
14249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14251#[cfg_attr(feature = "bindings", derive(TS))]
14252pub struct RegrAvgy {
14253 pub this: Box<Expression>,
14254 pub expression: Box<Expression>,
14255}
14256
14257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14259#[cfg_attr(feature = "bindings", derive(TS))]
14260pub struct RegrAvgx {
14261 pub this: Box<Expression>,
14262 pub expression: Box<Expression>,
14263}
14264
14265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14267#[cfg_attr(feature = "bindings", derive(TS))]
14268pub struct RegrCount {
14269 pub this: Box<Expression>,
14270 pub expression: Box<Expression>,
14271}
14272
14273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14275#[cfg_attr(feature = "bindings", derive(TS))]
14276pub struct RegrIntercept {
14277 pub this: Box<Expression>,
14278 pub expression: Box<Expression>,
14279}
14280
14281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14283#[cfg_attr(feature = "bindings", derive(TS))]
14284pub struct RegrR2 {
14285 pub this: Box<Expression>,
14286 pub expression: Box<Expression>,
14287}
14288
14289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14291#[cfg_attr(feature = "bindings", derive(TS))]
14292pub struct RegrSxx {
14293 pub this: Box<Expression>,
14294 pub expression: Box<Expression>,
14295}
14296
14297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14299#[cfg_attr(feature = "bindings", derive(TS))]
14300pub struct RegrSxy {
14301 pub this: Box<Expression>,
14302 pub expression: Box<Expression>,
14303}
14304
14305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14307#[cfg_attr(feature = "bindings", derive(TS))]
14308pub struct RegrSyy {
14309 pub this: Box<Expression>,
14310 pub expression: Box<Expression>,
14311}
14312
14313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14315#[cfg_attr(feature = "bindings", derive(TS))]
14316pub struct RegrSlope {
14317 pub this: Box<Expression>,
14318 pub expression: Box<Expression>,
14319}
14320
14321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14323#[cfg_attr(feature = "bindings", derive(TS))]
14324pub struct SafeAdd {
14325 pub this: Box<Expression>,
14326 pub expression: Box<Expression>,
14327}
14328
14329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14331#[cfg_attr(feature = "bindings", derive(TS))]
14332pub struct SafeDivide {
14333 pub this: Box<Expression>,
14334 pub expression: Box<Expression>,
14335}
14336
14337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14339#[cfg_attr(feature = "bindings", derive(TS))]
14340pub struct SafeMultiply {
14341 pub this: Box<Expression>,
14342 pub expression: Box<Expression>,
14343}
14344
14345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14347#[cfg_attr(feature = "bindings", derive(TS))]
14348pub struct SafeSubtract {
14349 pub this: Box<Expression>,
14350 pub expression: Box<Expression>,
14351}
14352
14353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14355#[cfg_attr(feature = "bindings", derive(TS))]
14356pub struct SHA2 {
14357 pub this: Box<Expression>,
14358 #[serde(default)]
14359 pub length: Option<i64>,
14360}
14361
14362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14364#[cfg_attr(feature = "bindings", derive(TS))]
14365pub struct SHA2Digest {
14366 pub this: Box<Expression>,
14367 #[serde(default)]
14368 pub length: Option<i64>,
14369}
14370
14371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14373#[cfg_attr(feature = "bindings", derive(TS))]
14374pub struct SortArray {
14375 pub this: Box<Expression>,
14376 #[serde(default)]
14377 pub asc: Option<Box<Expression>>,
14378 #[serde(default)]
14379 pub nulls_first: Option<Box<Expression>>,
14380}
14381
14382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14384#[cfg_attr(feature = "bindings", derive(TS))]
14385pub struct SplitPart {
14386 pub this: Box<Expression>,
14387 #[serde(default)]
14388 pub delimiter: Option<Box<Expression>>,
14389 #[serde(default)]
14390 pub part_index: Option<Box<Expression>>,
14391}
14392
14393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14395#[cfg_attr(feature = "bindings", derive(TS))]
14396pub struct SubstringIndex {
14397 pub this: Box<Expression>,
14398 #[serde(default)]
14399 pub delimiter: Option<Box<Expression>>,
14400 #[serde(default)]
14401 pub count: Option<Box<Expression>>,
14402}
14403
14404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14406#[cfg_attr(feature = "bindings", derive(TS))]
14407pub struct StandardHash {
14408 pub this: Box<Expression>,
14409 #[serde(default)]
14410 pub expression: Option<Box<Expression>>,
14411}
14412
14413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14415#[cfg_attr(feature = "bindings", derive(TS))]
14416pub struct StrPosition {
14417 pub this: Box<Expression>,
14418 #[serde(default)]
14419 pub substr: Option<Box<Expression>>,
14420 #[serde(default)]
14421 pub position: Option<Box<Expression>>,
14422 #[serde(default)]
14423 pub occurrence: Option<Box<Expression>>,
14424}
14425
14426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14428#[cfg_attr(feature = "bindings", derive(TS))]
14429pub struct Search {
14430 pub this: Box<Expression>,
14431 pub expression: Box<Expression>,
14432 #[serde(default)]
14433 pub json_scope: Option<Box<Expression>>,
14434 #[serde(default)]
14435 pub analyzer: Option<Box<Expression>>,
14436 #[serde(default)]
14437 pub analyzer_options: Option<Box<Expression>>,
14438 #[serde(default)]
14439 pub search_mode: Option<Box<Expression>>,
14440}
14441
14442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14444#[cfg_attr(feature = "bindings", derive(TS))]
14445pub struct SearchIp {
14446 pub this: Box<Expression>,
14447 pub expression: Box<Expression>,
14448}
14449
14450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14452#[cfg_attr(feature = "bindings", derive(TS))]
14453pub struct StrToDate {
14454 pub this: Box<Expression>,
14455 #[serde(default)]
14456 pub format: Option<String>,
14457 #[serde(default)]
14458 pub safe: Option<Box<Expression>>,
14459}
14460
14461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14463#[cfg_attr(feature = "bindings", derive(TS))]
14464pub struct StrToTime {
14465 pub this: Box<Expression>,
14466 pub format: String,
14467 #[serde(default)]
14468 pub zone: Option<Box<Expression>>,
14469 #[serde(default)]
14470 pub safe: Option<Box<Expression>>,
14471 #[serde(default)]
14472 pub target_type: Option<Box<Expression>>,
14473}
14474
14475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14477#[cfg_attr(feature = "bindings", derive(TS))]
14478pub struct StrToUnix {
14479 #[serde(default)]
14480 pub this: Option<Box<Expression>>,
14481 #[serde(default)]
14482 pub format: Option<String>,
14483}
14484
14485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14487#[cfg_attr(feature = "bindings", derive(TS))]
14488pub struct StrToMap {
14489 pub this: Box<Expression>,
14490 #[serde(default)]
14491 pub pair_delim: Option<Box<Expression>>,
14492 #[serde(default)]
14493 pub key_value_delim: Option<Box<Expression>>,
14494 #[serde(default)]
14495 pub duplicate_resolution_callback: Option<Box<Expression>>,
14496}
14497
14498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14500#[cfg_attr(feature = "bindings", derive(TS))]
14501pub struct NumberToStr {
14502 pub this: Box<Expression>,
14503 pub format: String,
14504 #[serde(default)]
14505 pub culture: Option<Box<Expression>>,
14506}
14507
14508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14510#[cfg_attr(feature = "bindings", derive(TS))]
14511pub struct FromBase {
14512 pub this: Box<Expression>,
14513 pub expression: Box<Expression>,
14514}
14515
14516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14518#[cfg_attr(feature = "bindings", derive(TS))]
14519pub struct Stuff {
14520 pub this: Box<Expression>,
14521 #[serde(default)]
14522 pub start: Option<Box<Expression>>,
14523 #[serde(default)]
14524 pub length: Option<i64>,
14525 pub expression: Box<Expression>,
14526}
14527
14528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14530#[cfg_attr(feature = "bindings", derive(TS))]
14531pub struct TimeToStr {
14532 pub this: Box<Expression>,
14533 pub format: String,
14534 #[serde(default)]
14535 pub culture: Option<Box<Expression>>,
14536 #[serde(default)]
14537 pub zone: Option<Box<Expression>>,
14538}
14539
14540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14542#[cfg_attr(feature = "bindings", derive(TS))]
14543pub struct TimeStrToTime {
14544 pub this: Box<Expression>,
14545 #[serde(default)]
14546 pub zone: Option<Box<Expression>>,
14547}
14548
14549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14551#[cfg_attr(feature = "bindings", derive(TS))]
14552pub struct TsOrDsAdd {
14553 pub this: Box<Expression>,
14554 pub expression: Box<Expression>,
14555 #[serde(default)]
14556 pub unit: Option<String>,
14557 #[serde(default)]
14558 pub return_type: Option<Box<Expression>>,
14559}
14560
14561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14563#[cfg_attr(feature = "bindings", derive(TS))]
14564pub struct TsOrDsDiff {
14565 pub this: Box<Expression>,
14566 pub expression: Box<Expression>,
14567 #[serde(default)]
14568 pub unit: Option<String>,
14569}
14570
14571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14573#[cfg_attr(feature = "bindings", derive(TS))]
14574pub struct TsOrDsToDate {
14575 pub this: Box<Expression>,
14576 #[serde(default)]
14577 pub format: Option<String>,
14578 #[serde(default)]
14579 pub safe: Option<Box<Expression>>,
14580}
14581
14582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14584#[cfg_attr(feature = "bindings", derive(TS))]
14585pub struct TsOrDsToTime {
14586 pub this: Box<Expression>,
14587 #[serde(default)]
14588 pub format: Option<String>,
14589 #[serde(default)]
14590 pub safe: Option<Box<Expression>>,
14591}
14592
14593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14595#[cfg_attr(feature = "bindings", derive(TS))]
14596pub struct Unhex {
14597 pub this: Box<Expression>,
14598 #[serde(default)]
14599 pub expression: Option<Box<Expression>>,
14600}
14601
14602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14604#[cfg_attr(feature = "bindings", derive(TS))]
14605pub struct Uniform {
14606 pub this: Box<Expression>,
14607 pub expression: Box<Expression>,
14608 #[serde(default)]
14609 pub gen: Option<Box<Expression>>,
14610 #[serde(default)]
14611 pub seed: Option<Box<Expression>>,
14612}
14613
14614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14616#[cfg_attr(feature = "bindings", derive(TS))]
14617pub struct UnixToStr {
14618 pub this: Box<Expression>,
14619 #[serde(default)]
14620 pub format: Option<String>,
14621}
14622
14623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14625#[cfg_attr(feature = "bindings", derive(TS))]
14626pub struct UnixToTime {
14627 pub this: Box<Expression>,
14628 #[serde(default)]
14629 pub scale: Option<i64>,
14630 #[serde(default)]
14631 pub zone: Option<Box<Expression>>,
14632 #[serde(default)]
14633 pub hours: Option<Box<Expression>>,
14634 #[serde(default)]
14635 pub minutes: Option<Box<Expression>>,
14636 #[serde(default)]
14637 pub format: Option<String>,
14638 #[serde(default)]
14639 pub target_type: Option<Box<Expression>>,
14640}
14641
14642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14644#[cfg_attr(feature = "bindings", derive(TS))]
14645pub struct Uuid {
14646 #[serde(default)]
14647 pub this: Option<Box<Expression>>,
14648 #[serde(default)]
14649 pub name: Option<String>,
14650 #[serde(default)]
14651 pub is_string: Option<Box<Expression>>,
14652}
14653
14654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14656#[cfg_attr(feature = "bindings", derive(TS))]
14657pub struct TimestampFromParts {
14658 #[serde(default)]
14659 pub zone: Option<Box<Expression>>,
14660 #[serde(default)]
14661 pub milli: Option<Box<Expression>>,
14662 #[serde(default)]
14663 pub this: Option<Box<Expression>>,
14664 #[serde(default)]
14665 pub expression: Option<Box<Expression>>,
14666}
14667
14668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14670#[cfg_attr(feature = "bindings", derive(TS))]
14671pub struct TimestampTzFromParts {
14672 #[serde(default)]
14673 pub zone: Option<Box<Expression>>,
14674}
14675
14676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14678#[cfg_attr(feature = "bindings", derive(TS))]
14679pub struct Corr {
14680 pub this: Box<Expression>,
14681 pub expression: Box<Expression>,
14682 #[serde(default)]
14683 pub null_on_zero_variance: Option<Box<Expression>>,
14684}
14685
14686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14688#[cfg_attr(feature = "bindings", derive(TS))]
14689pub struct WidthBucket {
14690 pub this: Box<Expression>,
14691 #[serde(default)]
14692 pub min_value: Option<Box<Expression>>,
14693 #[serde(default)]
14694 pub max_value: Option<Box<Expression>>,
14695 #[serde(default)]
14696 pub num_buckets: Option<Box<Expression>>,
14697 #[serde(default)]
14698 pub threshold: Option<Box<Expression>>,
14699}
14700
14701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14703#[cfg_attr(feature = "bindings", derive(TS))]
14704pub struct CovarSamp {
14705 pub this: Box<Expression>,
14706 pub expression: Box<Expression>,
14707}
14708
14709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14711#[cfg_attr(feature = "bindings", derive(TS))]
14712pub struct CovarPop {
14713 pub this: Box<Expression>,
14714 pub expression: Box<Expression>,
14715}
14716
14717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14719#[cfg_attr(feature = "bindings", derive(TS))]
14720pub struct Week {
14721 pub this: Box<Expression>,
14722 #[serde(default)]
14723 pub mode: Option<Box<Expression>>,
14724}
14725
14726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14728#[cfg_attr(feature = "bindings", derive(TS))]
14729pub struct XMLElement {
14730 pub this: Box<Expression>,
14731 #[serde(default)]
14732 pub expressions: Vec<Expression>,
14733 #[serde(default)]
14734 pub evalname: Option<Box<Expression>>,
14735}
14736
14737#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14739#[cfg_attr(feature = "bindings", derive(TS))]
14740pub struct XMLGet {
14741 pub this: Box<Expression>,
14742 pub expression: Box<Expression>,
14743 #[serde(default)]
14744 pub instance: Option<Box<Expression>>,
14745}
14746
14747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14749#[cfg_attr(feature = "bindings", derive(TS))]
14750pub struct XMLTable {
14751 pub this: Box<Expression>,
14752 #[serde(default)]
14753 pub namespaces: Option<Box<Expression>>,
14754 #[serde(default)]
14755 pub passing: Option<Box<Expression>>,
14756 #[serde(default)]
14757 pub columns: Vec<Expression>,
14758 #[serde(default)]
14759 pub by_ref: Option<Box<Expression>>,
14760}
14761
14762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14764#[cfg_attr(feature = "bindings", derive(TS))]
14765pub struct XMLKeyValueOption {
14766 pub this: Box<Expression>,
14767 #[serde(default)]
14768 pub expression: Option<Box<Expression>>,
14769}
14770
14771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14773#[cfg_attr(feature = "bindings", derive(TS))]
14774pub struct Zipf {
14775 pub this: Box<Expression>,
14776 #[serde(default)]
14777 pub elementcount: Option<Box<Expression>>,
14778 #[serde(default)]
14779 pub gen: Option<Box<Expression>>,
14780}
14781
14782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14784#[cfg_attr(feature = "bindings", derive(TS))]
14785pub struct Merge {
14786 pub this: Box<Expression>,
14787 pub using: Box<Expression>,
14788 #[serde(default)]
14789 pub on: Option<Box<Expression>>,
14790 #[serde(default)]
14791 pub using_cond: Option<Box<Expression>>,
14792 #[serde(default)]
14793 pub whens: Option<Box<Expression>>,
14794 #[serde(default)]
14795 pub with_: Option<Box<Expression>>,
14796 #[serde(default)]
14797 pub returning: Option<Box<Expression>>,
14798}
14799
14800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14802#[cfg_attr(feature = "bindings", derive(TS))]
14803pub struct When {
14804 #[serde(default)]
14805 pub matched: Option<Box<Expression>>,
14806 #[serde(default)]
14807 pub source: Option<Box<Expression>>,
14808 #[serde(default)]
14809 pub condition: Option<Box<Expression>>,
14810 pub then: Box<Expression>,
14811}
14812
14813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14815#[cfg_attr(feature = "bindings", derive(TS))]
14816pub struct Whens {
14817 #[serde(default)]
14818 pub expressions: Vec<Expression>,
14819}
14820
14821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14823#[cfg_attr(feature = "bindings", derive(TS))]
14824pub struct NextValueFor {
14825 pub this: Box<Expression>,
14826 #[serde(default)]
14827 pub order: Option<Box<Expression>>,
14828}
14829
14830#[cfg(test)]
14831mod tests {
14832 use super::*;
14833
14834 #[test]
14835 #[cfg(feature = "bindings")]
14836 fn export_typescript_types() {
14837 Expression::export_all(&ts_rs::Config::default())
14840 .expect("Failed to export Expression types");
14841 }
14842
14843 #[test]
14844 fn test_simple_select_builder() {
14845 let select = Select::new()
14846 .column(Expression::star())
14847 .from(Expression::Table(Box::new(TableRef::new("users"))));
14848
14849 assert_eq!(select.expressions.len(), 1);
14850 assert!(select.from.is_some());
14851 }
14852
14853 #[test]
14854 fn test_expression_alias() {
14855 let expr = Expression::column("id").alias("user_id");
14856
14857 match expr {
14858 Expression::Alias(a) => {
14859 assert_eq!(a.alias.name, "user_id");
14860 }
14861 _ => panic!("Expected Alias"),
14862 }
14863 }
14864
14865 #[test]
14866 fn test_literal_creation() {
14867 let num = Expression::number(42);
14868 let str = Expression::string("hello");
14869
14870 match num {
14871 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14872 let Literal::Number(n) = lit.as_ref() else {
14873 unreachable!()
14874 };
14875 assert_eq!(n, "42")
14876 }
14877 _ => panic!("Expected Number"),
14878 }
14879
14880 match str {
14881 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
14882 let Literal::String(s) = lit.as_ref() else {
14883 unreachable!()
14884 };
14885 assert_eq!(s, "hello")
14886 }
14887 _ => panic!("Expected String"),
14888 }
14889 }
14890
14891 #[test]
14892 fn test_expression_sql() {
14893 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14894 assert_eq!(expr.sql(), "SELECT 1 + 2");
14895 }
14896
14897 #[test]
14898 fn test_expression_sql_for() {
14899 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14900 let sql = expr.sql_for(crate::DialectType::Generic);
14901 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
14903 }
14904}