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 DropSequence(Box<DropSequence>),
576 AlterSequence(Box<AlterSequence>),
577 CreateTrigger(Box<CreateTrigger>),
578 DropTrigger(Box<DropTrigger>),
579 CreateType(Box<CreateType>),
580 DropType(Box<DropType>),
581 Describe(Box<Describe>),
582 Show(Box<Show>),
583
584 Command(Box<Command>),
586 Kill(Box<Kill>),
587 Execute(Box<ExecuteStatement>),
589
590 Raw(Raw),
592
593 Paren(Box<Paren>),
595
596 Annotated(Box<Annotated>),
598
599 Refresh(Box<Refresh>),
602 LockingStatement(Box<LockingStatement>),
603 SequenceProperties(Box<SequenceProperties>),
604 TruncateTable(Box<TruncateTable>),
605 Clone(Box<Clone>),
606 Attach(Box<Attach>),
607 Detach(Box<Detach>),
608 Install(Box<Install>),
609 Summarize(Box<Summarize>),
610 Declare(Box<Declare>),
611 DeclareItem(Box<DeclareItem>),
612 Set(Box<Set>),
613 Heredoc(Box<Heredoc>),
614 SetItem(Box<SetItem>),
615 QueryBand(Box<QueryBand>),
616 UserDefinedFunction(Box<UserDefinedFunction>),
617 RecursiveWithSearch(Box<RecursiveWithSearch>),
618 ProjectionDef(Box<ProjectionDef>),
619 TableAlias(Box<TableAlias>),
620 ByteString(Box<ByteString>),
621 HexStringExpr(Box<HexStringExpr>),
622 UnicodeString(Box<UnicodeString>),
623 ColumnPosition(Box<ColumnPosition>),
624 ColumnDef(Box<ColumnDef>),
625 AlterColumn(Box<AlterColumn>),
626 AlterSortKey(Box<AlterSortKey>),
627 AlterSet(Box<AlterSet>),
628 RenameColumn(Box<RenameColumn>),
629 Comprehension(Box<Comprehension>),
630 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
631 MergeTreeTTL(Box<MergeTreeTTL>),
632 IndexConstraintOption(Box<IndexConstraintOption>),
633 ColumnConstraint(Box<ColumnConstraint>),
634 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
635 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
636 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
637 CheckColumnConstraint(Box<CheckColumnConstraint>),
638 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
639 CompressColumnConstraint(Box<CompressColumnConstraint>),
640 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
641 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
642 WithOperator(Box<WithOperator>),
643 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
644 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
645 CommentColumnConstraint(CommentColumnConstraint),
646 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
647 IndexColumnConstraint(Box<IndexColumnConstraint>),
648 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
649 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
650 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
651 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
652 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
653 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
654 InOutColumnConstraint(Box<InOutColumnConstraint>),
655 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
656 PathColumnConstraint(Box<PathColumnConstraint>),
657 Constraint(Box<Constraint>),
658 Export(Box<Export>),
659 Filter(Box<Filter>),
660 Changes(Box<Changes>),
661 CopyParameter(Box<CopyParameter>),
662 Credentials(Box<Credentials>),
663 Directory(Box<Directory>),
664 ForeignKey(Box<ForeignKey>),
665 ColumnPrefix(Box<ColumnPrefix>),
666 PrimaryKey(Box<PrimaryKey>),
667 IntoClause(Box<IntoClause>),
668 JoinHint(Box<JoinHint>),
669 Opclass(Box<Opclass>),
670 Index(Box<Index>),
671 IndexParameters(Box<IndexParameters>),
672 ConditionalInsert(Box<ConditionalInsert>),
673 MultitableInserts(Box<MultitableInserts>),
674 OnConflict(Box<OnConflict>),
675 OnCondition(Box<OnCondition>),
676 Returning(Box<Returning>),
677 Introducer(Box<Introducer>),
678 PartitionRange(Box<PartitionRange>),
679 Fetch(Box<Fetch>),
680 Group(Box<Group>),
681 Cube(Box<Cube>),
682 Rollup(Box<Rollup>),
683 GroupingSets(Box<GroupingSets>),
684 LimitOptions(Box<LimitOptions>),
685 Lateral(Box<Lateral>),
686 TableFromRows(Box<TableFromRows>),
687 RowsFrom(Box<RowsFrom>),
688 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
689 WithFill(Box<WithFill>),
690 Property(Box<Property>),
691 GrantPrivilege(Box<GrantPrivilege>),
692 GrantPrincipal(Box<GrantPrincipal>),
693 AllowedValuesProperty(Box<AllowedValuesProperty>),
694 AlgorithmProperty(Box<AlgorithmProperty>),
695 AutoIncrementProperty(Box<AutoIncrementProperty>),
696 AutoRefreshProperty(Box<AutoRefreshProperty>),
697 BackupProperty(Box<BackupProperty>),
698 BuildProperty(Box<BuildProperty>),
699 BlockCompressionProperty(Box<BlockCompressionProperty>),
700 CharacterSetProperty(Box<CharacterSetProperty>),
701 ChecksumProperty(Box<ChecksumProperty>),
702 CollateProperty(Box<CollateProperty>),
703 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
704 DataDeletionProperty(Box<DataDeletionProperty>),
705 DefinerProperty(Box<DefinerProperty>),
706 DistKeyProperty(Box<DistKeyProperty>),
707 DistributedByProperty(Box<DistributedByProperty>),
708 DistStyleProperty(Box<DistStyleProperty>),
709 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
710 EngineProperty(Box<EngineProperty>),
711 ToTableProperty(Box<ToTableProperty>),
712 ExecuteAsProperty(Box<ExecuteAsProperty>),
713 ExternalProperty(Box<ExternalProperty>),
714 FallbackProperty(Box<FallbackProperty>),
715 FileFormatProperty(Box<FileFormatProperty>),
716 CredentialsProperty(Box<CredentialsProperty>),
717 FreespaceProperty(Box<FreespaceProperty>),
718 InheritsProperty(Box<InheritsProperty>),
719 InputModelProperty(Box<InputModelProperty>),
720 OutputModelProperty(Box<OutputModelProperty>),
721 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
722 JournalProperty(Box<JournalProperty>),
723 LanguageProperty(Box<LanguageProperty>),
724 EnviromentProperty(Box<EnviromentProperty>),
725 ClusteredByProperty(Box<ClusteredByProperty>),
726 DictProperty(Box<DictProperty>),
727 DictRange(Box<DictRange>),
728 OnCluster(Box<OnCluster>),
729 LikeProperty(Box<LikeProperty>),
730 LocationProperty(Box<LocationProperty>),
731 LockProperty(Box<LockProperty>),
732 LockingProperty(Box<LockingProperty>),
733 LogProperty(Box<LogProperty>),
734 MaterializedProperty(Box<MaterializedProperty>),
735 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
736 OnProperty(Box<OnProperty>),
737 OnCommitProperty(Box<OnCommitProperty>),
738 PartitionedByProperty(Box<PartitionedByProperty>),
739 PartitionByProperty(Box<PartitionByProperty>),
740 PartitionedByBucket(Box<PartitionedByBucket>),
741 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
742 PartitionByTruncate(Box<PartitionByTruncate>),
743 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
744 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
745 PartitionByListProperty(Box<PartitionByListProperty>),
746 PartitionList(Box<PartitionList>),
747 Partition(Box<Partition>),
748 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
749 UniqueKeyProperty(Box<UniqueKeyProperty>),
750 RollupProperty(Box<RollupProperty>),
751 PartitionBoundSpec(Box<PartitionBoundSpec>),
752 PartitionedOfProperty(Box<PartitionedOfProperty>),
753 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
754 ReturnsProperty(Box<ReturnsProperty>),
755 RowFormatProperty(Box<RowFormatProperty>),
756 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
757 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
758 QueryTransform(Box<QueryTransform>),
759 SampleProperty(Box<SampleProperty>),
760 SecurityProperty(Box<SecurityProperty>),
761 SchemaCommentProperty(Box<SchemaCommentProperty>),
762 SemanticView(Box<SemanticView>),
763 SerdeProperties(Box<SerdeProperties>),
764 SetProperty(Box<SetProperty>),
765 SharingProperty(Box<SharingProperty>),
766 SetConfigProperty(Box<SetConfigProperty>),
767 SettingsProperty(Box<SettingsProperty>),
768 SortKeyProperty(Box<SortKeyProperty>),
769 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
770 SqlSecurityProperty(Box<SqlSecurityProperty>),
771 StabilityProperty(Box<StabilityProperty>),
772 StorageHandlerProperty(Box<StorageHandlerProperty>),
773 TemporaryProperty(Box<TemporaryProperty>),
774 Tags(Box<Tags>),
775 TransformModelProperty(Box<TransformModelProperty>),
776 TransientProperty(Box<TransientProperty>),
777 UsingTemplateProperty(Box<UsingTemplateProperty>),
778 ViewAttributeProperty(Box<ViewAttributeProperty>),
779 VolatileProperty(Box<VolatileProperty>),
780 WithDataProperty(Box<WithDataProperty>),
781 WithJournalTableProperty(Box<WithJournalTableProperty>),
782 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
783 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
784 WithProcedureOptions(Box<WithProcedureOptions>),
785 EncodeProperty(Box<EncodeProperty>),
786 IncludeProperty(Box<IncludeProperty>),
787 Properties(Box<Properties>),
788 OptionsProperty(Box<OptionsProperty>),
789 InputOutputFormat(Box<InputOutputFormat>),
790 Reference(Box<Reference>),
791 QueryOption(Box<QueryOption>),
792 WithTableHint(Box<WithTableHint>),
793 IndexTableHint(Box<IndexTableHint>),
794 HistoricalData(Box<HistoricalData>),
795 Get(Box<Get>),
796 SetOperation(Box<SetOperation>),
797 Var(Box<Var>),
798 Variadic(Box<Variadic>),
799 Version(Box<Version>),
800 Schema(Box<Schema>),
801 Lock(Box<Lock>),
802 TableSample(Box<TableSample>),
803 Tag(Box<Tag>),
804 UnpivotColumns(Box<UnpivotColumns>),
805 WindowSpec(Box<WindowSpec>),
806 SessionParameter(Box<SessionParameter>),
807 PseudoType(Box<PseudoType>),
808 ObjectIdentifier(Box<ObjectIdentifier>),
809 Transaction(Box<Transaction>),
810 Commit(Box<Commit>),
811 Rollback(Box<Rollback>),
812 AlterSession(Box<AlterSession>),
813 Analyze(Box<Analyze>),
814 AnalyzeStatistics(Box<AnalyzeStatistics>),
815 AnalyzeHistogram(Box<AnalyzeHistogram>),
816 AnalyzeSample(Box<AnalyzeSample>),
817 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
818 AnalyzeDelete(Box<AnalyzeDelete>),
819 AnalyzeWith(Box<AnalyzeWith>),
820 AnalyzeValidate(Box<AnalyzeValidate>),
821 AddPartition(Box<AddPartition>),
822 AttachOption(Box<AttachOption>),
823 DropPartition(Box<DropPartition>),
824 ReplacePartition(Box<ReplacePartition>),
825 DPipe(Box<DPipe>),
826 Operator(Box<Operator>),
827 PivotAny(Box<PivotAny>),
828 Aliases(Box<Aliases>),
829 AtIndex(Box<AtIndex>),
830 FromTimeZone(Box<FromTimeZone>),
831 FormatPhrase(Box<FormatPhrase>),
832 ForIn(Box<ForIn>),
833 TimeUnit(Box<TimeUnit>),
834 IntervalOp(Box<IntervalOp>),
835 IntervalSpan(Box<IntervalSpan>),
836 HavingMax(Box<HavingMax>),
837 CosineDistance(Box<CosineDistance>),
838 DotProduct(Box<DotProduct>),
839 EuclideanDistance(Box<EuclideanDistance>),
840 ManhattanDistance(Box<ManhattanDistance>),
841 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
842 Booland(Box<Booland>),
843 Boolor(Box<Boolor>),
844 ParameterizedAgg(Box<ParameterizedAgg>),
845 ArgMax(Box<ArgMax>),
846 ArgMin(Box<ArgMin>),
847 ApproxTopK(Box<ApproxTopK>),
848 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
849 ApproxTopKCombine(Box<ApproxTopKCombine>),
850 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
851 ApproxTopSum(Box<ApproxTopSum>),
852 ApproxQuantiles(Box<ApproxQuantiles>),
853 Minhash(Box<Minhash>),
854 FarmFingerprint(Box<FarmFingerprint>),
855 Float64(Box<Float64>),
856 Transform(Box<Transform>),
857 Translate(Box<Translate>),
858 Grouping(Box<Grouping>),
859 GroupingId(Box<GroupingId>),
860 Anonymous(Box<Anonymous>),
861 AnonymousAggFunc(Box<AnonymousAggFunc>),
862 CombinedAggFunc(Box<CombinedAggFunc>),
863 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
864 HashAgg(Box<HashAgg>),
865 Hll(Box<Hll>),
866 Apply(Box<Apply>),
867 ToBoolean(Box<ToBoolean>),
868 List(Box<List>),
869 ToMap(Box<ToMap>),
870 Pad(Box<Pad>),
871 ToChar(Box<ToChar>),
872 ToNumber(Box<ToNumber>),
873 ToDouble(Box<ToDouble>),
874 Int64(Box<UnaryFunc>),
875 StringFunc(Box<StringFunc>),
876 ToDecfloat(Box<ToDecfloat>),
877 TryToDecfloat(Box<TryToDecfloat>),
878 ToFile(Box<ToFile>),
879 Columns(Box<Columns>),
880 ConvertToCharset(Box<ConvertToCharset>),
881 ConvertTimezone(Box<ConvertTimezone>),
882 GenerateSeries(Box<GenerateSeries>),
883 AIAgg(Box<AIAgg>),
884 AIClassify(Box<AIClassify>),
885 ArrayAll(Box<ArrayAll>),
886 ArrayAny(Box<ArrayAny>),
887 ArrayConstructCompact(Box<ArrayConstructCompact>),
888 StPoint(Box<StPoint>),
889 StDistance(Box<StDistance>),
890 StringToArray(Box<StringToArray>),
891 ArraySum(Box<ArraySum>),
892 ObjectAgg(Box<ObjectAgg>),
893 CastToStrType(Box<CastToStrType>),
894 CheckJson(Box<CheckJson>),
895 CheckXml(Box<CheckXml>),
896 TranslateCharacters(Box<TranslateCharacters>),
897 CurrentSchemas(Box<CurrentSchemas>),
898 CurrentDatetime(Box<CurrentDatetime>),
899 Localtime(Box<Localtime>),
900 Localtimestamp(Box<Localtimestamp>),
901 Systimestamp(Box<Systimestamp>),
902 CurrentSchema(Box<CurrentSchema>),
903 CurrentUser(Box<CurrentUser>),
904 UtcTime(Box<UtcTime>),
905 UtcTimestamp(Box<UtcTimestamp>),
906 Timestamp(Box<TimestampFunc>),
907 DateBin(Box<DateBin>),
908 Datetime(Box<Datetime>),
909 DatetimeAdd(Box<DatetimeAdd>),
910 DatetimeSub(Box<DatetimeSub>),
911 DatetimeDiff(Box<DatetimeDiff>),
912 DatetimeTrunc(Box<DatetimeTrunc>),
913 Dayname(Box<Dayname>),
914 MakeInterval(Box<MakeInterval>),
915 PreviousDay(Box<PreviousDay>),
916 Elt(Box<Elt>),
917 TimestampAdd(Box<TimestampAdd>),
918 TimestampSub(Box<TimestampSub>),
919 TimestampDiff(Box<TimestampDiff>),
920 TimeSlice(Box<TimeSlice>),
921 TimeAdd(Box<TimeAdd>),
922 TimeSub(Box<TimeSub>),
923 TimeDiff(Box<TimeDiff>),
924 TimeTrunc(Box<TimeTrunc>),
925 DateFromParts(Box<DateFromParts>),
926 TimeFromParts(Box<TimeFromParts>),
927 DecodeCase(Box<DecodeCase>),
928 Decrypt(Box<Decrypt>),
929 DecryptRaw(Box<DecryptRaw>),
930 Encode(Box<Encode>),
931 Encrypt(Box<Encrypt>),
932 EncryptRaw(Box<EncryptRaw>),
933 EqualNull(Box<EqualNull>),
934 ToBinary(Box<ToBinary>),
935 Base64DecodeBinary(Box<Base64DecodeBinary>),
936 Base64DecodeString(Box<Base64DecodeString>),
937 Base64Encode(Box<Base64Encode>),
938 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
939 TryBase64DecodeString(Box<TryBase64DecodeString>),
940 GapFill(Box<GapFill>),
941 GenerateDateArray(Box<GenerateDateArray>),
942 GenerateTimestampArray(Box<GenerateTimestampArray>),
943 GetExtract(Box<GetExtract>),
944 Getbit(Box<Getbit>),
945 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
946 HexEncode(Box<HexEncode>),
947 Compress(Box<Compress>),
948 DecompressBinary(Box<DecompressBinary>),
949 DecompressString(Box<DecompressString>),
950 Xor(Box<Xor>),
951 Nullif(Box<Nullif>),
952 JSON(Box<JSON>),
953 JSONPath(Box<JSONPath>),
954 JSONPathFilter(Box<JSONPathFilter>),
955 JSONPathKey(Box<JSONPathKey>),
956 JSONPathRecursive(Box<JSONPathRecursive>),
957 JSONPathScript(Box<JSONPathScript>),
958 JSONPathSlice(Box<JSONPathSlice>),
959 JSONPathSelector(Box<JSONPathSelector>),
960 JSONPathSubscript(Box<JSONPathSubscript>),
961 JSONPathUnion(Box<JSONPathUnion>),
962 Format(Box<Format>),
963 JSONKeys(Box<JSONKeys>),
964 JSONKeyValue(Box<JSONKeyValue>),
965 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
966 JSONObject(Box<JSONObject>),
967 JSONObjectAgg(Box<JSONObjectAgg>),
968 JSONBObjectAgg(Box<JSONBObjectAgg>),
969 JSONArray(Box<JSONArray>),
970 JSONArrayAgg(Box<JSONArrayAgg>),
971 JSONExists(Box<JSONExists>),
972 JSONColumnDef(Box<JSONColumnDef>),
973 JSONSchema(Box<JSONSchema>),
974 JSONSet(Box<JSONSet>),
975 JSONStripNulls(Box<JSONStripNulls>),
976 JSONValue(Box<JSONValue>),
977 JSONValueArray(Box<JSONValueArray>),
978 JSONRemove(Box<JSONRemove>),
979 JSONTable(Box<JSONTable>),
980 JSONType(Box<JSONType>),
981 ObjectInsert(Box<ObjectInsert>),
982 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
983 OpenJSON(Box<OpenJSON>),
984 JSONBExists(Box<JSONBExists>),
985 JSONBContains(Box<BinaryFunc>),
986 JSONBExtract(Box<BinaryFunc>),
987 JSONCast(Box<JSONCast>),
988 JSONExtract(Box<JSONExtract>),
989 JSONExtractQuote(Box<JSONExtractQuote>),
990 JSONExtractArray(Box<JSONExtractArray>),
991 JSONExtractScalar(Box<JSONExtractScalar>),
992 JSONBExtractScalar(Box<JSONBExtractScalar>),
993 JSONFormat(Box<JSONFormat>),
994 JSONBool(Box<UnaryFunc>),
995 JSONPathRoot(JSONPathRoot),
996 JSONArrayAppend(Box<JSONArrayAppend>),
997 JSONArrayContains(Box<JSONArrayContains>),
998 JSONArrayInsert(Box<JSONArrayInsert>),
999 ParseJSON(Box<ParseJSON>),
1000 ParseUrl(Box<ParseUrl>),
1001 ParseIp(Box<ParseIp>),
1002 ParseTime(Box<ParseTime>),
1003 ParseDatetime(Box<ParseDatetime>),
1004 Map(Box<Map>),
1005 MapCat(Box<MapCat>),
1006 MapDelete(Box<MapDelete>),
1007 MapInsert(Box<MapInsert>),
1008 MapPick(Box<MapPick>),
1009 ScopeResolution(Box<ScopeResolution>),
1010 Slice(Box<Slice>),
1011 VarMap(Box<VarMap>),
1012 MatchAgainst(Box<MatchAgainst>),
1013 MD5Digest(Box<MD5Digest>),
1014 MD5NumberLower64(Box<UnaryFunc>),
1015 MD5NumberUpper64(Box<UnaryFunc>),
1016 Monthname(Box<Monthname>),
1017 Ntile(Box<Ntile>),
1018 Normalize(Box<Normalize>),
1019 Normal(Box<Normal>),
1020 Predict(Box<Predict>),
1021 MLTranslate(Box<MLTranslate>),
1022 FeaturesAtTime(Box<FeaturesAtTime>),
1023 GenerateEmbedding(Box<GenerateEmbedding>),
1024 MLForecast(Box<MLForecast>),
1025 ModelAttribute(Box<ModelAttribute>),
1026 VectorSearch(Box<VectorSearch>),
1027 Quantile(Box<Quantile>),
1028 ApproxQuantile(Box<ApproxQuantile>),
1029 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1030 Randn(Box<Randn>),
1031 Randstr(Box<Randstr>),
1032 RangeN(Box<RangeN>),
1033 RangeBucket(Box<RangeBucket>),
1034 ReadCSV(Box<ReadCSV>),
1035 ReadParquet(Box<ReadParquet>),
1036 Reduce(Box<Reduce>),
1037 RegexpExtractAll(Box<RegexpExtractAll>),
1038 RegexpILike(Box<RegexpILike>),
1039 RegexpFullMatch(Box<RegexpFullMatch>),
1040 RegexpInstr(Box<RegexpInstr>),
1041 RegexpSplit(Box<RegexpSplit>),
1042 RegexpCount(Box<RegexpCount>),
1043 RegrValx(Box<RegrValx>),
1044 RegrValy(Box<RegrValy>),
1045 RegrAvgy(Box<RegrAvgy>),
1046 RegrAvgx(Box<RegrAvgx>),
1047 RegrCount(Box<RegrCount>),
1048 RegrIntercept(Box<RegrIntercept>),
1049 RegrR2(Box<RegrR2>),
1050 RegrSxx(Box<RegrSxx>),
1051 RegrSxy(Box<RegrSxy>),
1052 RegrSyy(Box<RegrSyy>),
1053 RegrSlope(Box<RegrSlope>),
1054 SafeAdd(Box<SafeAdd>),
1055 SafeDivide(Box<SafeDivide>),
1056 SafeMultiply(Box<SafeMultiply>),
1057 SafeSubtract(Box<SafeSubtract>),
1058 SHA2(Box<SHA2>),
1059 SHA2Digest(Box<SHA2Digest>),
1060 SortArray(Box<SortArray>),
1061 SplitPart(Box<SplitPart>),
1062 SubstringIndex(Box<SubstringIndex>),
1063 StandardHash(Box<StandardHash>),
1064 StrPosition(Box<StrPosition>),
1065 Search(Box<Search>),
1066 SearchIp(Box<SearchIp>),
1067 StrToDate(Box<StrToDate>),
1068 DateStrToDate(Box<UnaryFunc>),
1069 DateToDateStr(Box<UnaryFunc>),
1070 StrToTime(Box<StrToTime>),
1071 StrToUnix(Box<StrToUnix>),
1072 StrToMap(Box<StrToMap>),
1073 NumberToStr(Box<NumberToStr>),
1074 FromBase(Box<FromBase>),
1075 Stuff(Box<Stuff>),
1076 TimeToStr(Box<TimeToStr>),
1077 TimeStrToTime(Box<TimeStrToTime>),
1078 TsOrDsAdd(Box<TsOrDsAdd>),
1079 TsOrDsDiff(Box<TsOrDsDiff>),
1080 TsOrDsToDate(Box<TsOrDsToDate>),
1081 TsOrDsToTime(Box<TsOrDsToTime>),
1082 Unhex(Box<Unhex>),
1083 Uniform(Box<Uniform>),
1084 UnixToStr(Box<UnixToStr>),
1085 UnixToTime(Box<UnixToTime>),
1086 Uuid(Box<Uuid>),
1087 TimestampFromParts(Box<TimestampFromParts>),
1088 TimestampTzFromParts(Box<TimestampTzFromParts>),
1089 Corr(Box<Corr>),
1090 WidthBucket(Box<WidthBucket>),
1091 CovarSamp(Box<CovarSamp>),
1092 CovarPop(Box<CovarPop>),
1093 Week(Box<Week>),
1094 XMLElement(Box<XMLElement>),
1095 XMLGet(Box<XMLGet>),
1096 XMLTable(Box<XMLTable>),
1097 XMLKeyValueOption(Box<XMLKeyValueOption>),
1098 Zipf(Box<Zipf>),
1099 Merge(Box<Merge>),
1100 When(Box<When>),
1101 Whens(Box<Whens>),
1102 NextValueFor(Box<NextValueFor>),
1103 ReturnStmt(Box<Expression>),
1105}
1106
1107impl Expression {
1108 #[inline]
1110 pub fn boxed_column(col: Column) -> Self {
1111 Expression::Column(Box::new(col))
1112 }
1113
1114 #[inline]
1116 pub fn boxed_table(t: TableRef) -> Self {
1117 Expression::Table(Box::new(t))
1118 }
1119
1120 pub fn is_statement(&self) -> bool {
1127 match self {
1128 Expression::Select(_)
1130 | Expression::Union(_)
1131 | Expression::Intersect(_)
1132 | Expression::Except(_)
1133 | Expression::Subquery(_)
1134 | Expression::Values(_)
1135 | Expression::PipeOperator(_)
1136
1137 | Expression::Insert(_)
1139 | Expression::Update(_)
1140 | Expression::Delete(_)
1141 | Expression::Copy(_)
1142 | Expression::Put(_)
1143 | Expression::Merge(_)
1144
1145 | Expression::CreateTable(_)
1147 | Expression::DropTable(_)
1148 | Expression::AlterTable(_)
1149 | Expression::CreateIndex(_)
1150 | Expression::DropIndex(_)
1151 | Expression::CreateView(_)
1152 | Expression::DropView(_)
1153 | Expression::AlterView(_)
1154 | Expression::AlterIndex(_)
1155 | Expression::Truncate(_)
1156 | Expression::TruncateTable(_)
1157 | Expression::CreateSchema(_)
1158 | Expression::DropSchema(_)
1159 | Expression::DropNamespace(_)
1160 | Expression::CreateDatabase(_)
1161 | Expression::DropDatabase(_)
1162 | Expression::CreateFunction(_)
1163 | Expression::DropFunction(_)
1164 | Expression::CreateProcedure(_)
1165 | Expression::DropProcedure(_)
1166 | Expression::CreateSequence(_)
1167 | Expression::DropSequence(_)
1168 | Expression::AlterSequence(_)
1169 | Expression::CreateTrigger(_)
1170 | Expression::DropTrigger(_)
1171 | Expression::CreateType(_)
1172 | Expression::DropType(_)
1173 | Expression::Comment(_)
1174
1175 | Expression::Use(_)
1177 | Expression::Set(_)
1178 | Expression::SetStatement(_)
1179 | Expression::Transaction(_)
1180 | Expression::Commit(_)
1181 | Expression::Rollback(_)
1182 | Expression::Grant(_)
1183 | Expression::Revoke(_)
1184 | Expression::Cache(_)
1185 | Expression::Uncache(_)
1186 | Expression::LoadData(_)
1187 | Expression::Pragma(_)
1188 | Expression::Describe(_)
1189 | Expression::Show(_)
1190 | Expression::Kill(_)
1191 | Expression::Execute(_)
1192 | Expression::Declare(_)
1193 | Expression::Refresh(_)
1194 | Expression::AlterSession(_)
1195 | Expression::LockingStatement(_)
1196
1197 | Expression::Analyze(_)
1199 | Expression::AnalyzeStatistics(_)
1200 | Expression::AnalyzeHistogram(_)
1201 | Expression::AnalyzeSample(_)
1202 | Expression::AnalyzeListChainedRows(_)
1203 | Expression::AnalyzeDelete(_)
1204
1205 | Expression::Attach(_)
1207 | Expression::Detach(_)
1208 | Expression::Install(_)
1209 | Expression::Summarize(_)
1210
1211 | Expression::Pivot(_)
1213 | Expression::Unpivot(_)
1214
1215 | Expression::Command(_)
1217 | Expression::Raw(_)
1218
1219 | Expression::ReturnStmt(_) => true,
1221
1222 Expression::Annotated(a) => a.this.is_statement(),
1224
1225 Expression::Alias(a) => a.this.is_statement(),
1227
1228 _ => false,
1230 }
1231 }
1232
1233 pub fn number(n: i64) -> Self {
1235 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1236 }
1237
1238 pub fn string(s: impl Into<String>) -> Self {
1240 Expression::Literal(Box::new(Literal::String(s.into())))
1241 }
1242
1243 pub fn float(f: f64) -> Self {
1245 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1246 }
1247
1248 pub fn inferred_type(&self) -> Option<&DataType> {
1254 match self {
1255 Expression::And(op)
1257 | Expression::Or(op)
1258 | Expression::Add(op)
1259 | Expression::Sub(op)
1260 | Expression::Mul(op)
1261 | Expression::Div(op)
1262 | Expression::Mod(op)
1263 | Expression::Eq(op)
1264 | Expression::Neq(op)
1265 | Expression::Lt(op)
1266 | Expression::Lte(op)
1267 | Expression::Gt(op)
1268 | Expression::Gte(op)
1269 | Expression::Concat(op)
1270 | Expression::BitwiseAnd(op)
1271 | Expression::BitwiseOr(op)
1272 | Expression::BitwiseXor(op)
1273 | Expression::Adjacent(op)
1274 | Expression::TsMatch(op)
1275 | Expression::PropertyEQ(op)
1276 | Expression::ArrayContainsAll(op)
1277 | Expression::ArrayContainedBy(op)
1278 | Expression::ArrayOverlaps(op)
1279 | Expression::JSONBContainsAllTopKeys(op)
1280 | Expression::JSONBContainsAnyTopKeys(op)
1281 | Expression::JSONBDeleteAtPath(op)
1282 | Expression::ExtendsLeft(op)
1283 | Expression::ExtendsRight(op)
1284 | Expression::Is(op)
1285 | Expression::MemberOf(op)
1286 | Expression::Match(op)
1287 | Expression::NullSafeEq(op)
1288 | Expression::NullSafeNeq(op)
1289 | Expression::Glob(op)
1290 | Expression::BitwiseLeftShift(op)
1291 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1292
1293 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1294 op.inferred_type.as_ref()
1295 }
1296
1297 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1298
1299 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1300 c.inferred_type.as_ref()
1301 }
1302
1303 Expression::Column(c) => c.inferred_type.as_ref(),
1304 Expression::Function(f) => f.inferred_type.as_ref(),
1305 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1306 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1307 Expression::Case(c) => c.inferred_type.as_ref(),
1308 Expression::Subquery(s) => s.inferred_type.as_ref(),
1309 Expression::Alias(a) => a.inferred_type.as_ref(),
1310 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1311 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1312 Expression::Count(f) => f.inferred_type.as_ref(),
1313 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1314 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1315 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1316 Expression::SumIf(f) => f.inferred_type.as_ref(),
1317
1318 Expression::Upper(f)
1320 | Expression::Lower(f)
1321 | Expression::Length(f)
1322 | Expression::LTrim(f)
1323 | Expression::RTrim(f)
1324 | Expression::Reverse(f)
1325 | Expression::Abs(f)
1326 | Expression::Sqrt(f)
1327 | Expression::Cbrt(f)
1328 | Expression::Ln(f)
1329 | Expression::Exp(f)
1330 | Expression::Sign(f)
1331 | Expression::Date(f)
1332 | Expression::Time(f)
1333 | Expression::Initcap(f)
1334 | Expression::Ascii(f)
1335 | Expression::Chr(f)
1336 | Expression::Soundex(f)
1337 | Expression::ByteLength(f)
1338 | Expression::Hex(f)
1339 | Expression::LowerHex(f)
1340 | Expression::Unicode(f)
1341 | Expression::Typeof(f)
1342 | Expression::Explode(f)
1343 | Expression::ExplodeOuter(f)
1344 | Expression::MapFromEntries(f)
1345 | Expression::MapKeys(f)
1346 | Expression::MapValues(f)
1347 | Expression::ArrayLength(f)
1348 | Expression::ArraySize(f)
1349 | Expression::Cardinality(f)
1350 | Expression::ArrayReverse(f)
1351 | Expression::ArrayDistinct(f)
1352 | Expression::ArrayFlatten(f)
1353 | Expression::ArrayCompact(f)
1354 | Expression::ToArray(f)
1355 | Expression::JsonArrayLength(f)
1356 | Expression::JsonKeys(f)
1357 | Expression::JsonType(f)
1358 | Expression::ParseJson(f)
1359 | Expression::ToJson(f)
1360 | Expression::Radians(f)
1361 | Expression::Degrees(f)
1362 | Expression::Sin(f)
1363 | Expression::Cos(f)
1364 | Expression::Tan(f)
1365 | Expression::Asin(f)
1366 | Expression::Acos(f)
1367 | Expression::Atan(f)
1368 | Expression::IsNan(f)
1369 | Expression::IsInf(f)
1370 | Expression::Year(f)
1371 | Expression::Month(f)
1372 | Expression::Day(f)
1373 | Expression::Hour(f)
1374 | Expression::Minute(f)
1375 | Expression::Second(f)
1376 | Expression::DayOfWeek(f)
1377 | Expression::DayOfWeekIso(f)
1378 | Expression::DayOfMonth(f)
1379 | Expression::DayOfYear(f)
1380 | Expression::WeekOfYear(f)
1381 | Expression::Quarter(f)
1382 | Expression::Epoch(f)
1383 | Expression::EpochMs(f)
1384 | Expression::BitwiseCount(f)
1385 | Expression::DateFromUnixDate(f)
1386 | Expression::UnixDate(f)
1387 | Expression::UnixSeconds(f)
1388 | Expression::UnixMillis(f)
1389 | Expression::UnixMicros(f)
1390 | Expression::TimeStrToDate(f)
1391 | Expression::DateToDi(f)
1392 | Expression::DiToDate(f)
1393 | Expression::TsOrDiToDi(f)
1394 | Expression::TsOrDsToDatetime(f)
1395 | Expression::TsOrDsToTimestamp(f)
1396 | Expression::YearOfWeek(f)
1397 | Expression::YearOfWeekIso(f)
1398 | Expression::SHA(f)
1399 | Expression::SHA1Digest(f)
1400 | Expression::TimeToUnix(f)
1401 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1402
1403 Expression::Power(f)
1405 | Expression::NullIf(f)
1406 | Expression::IfNull(f)
1407 | Expression::Nvl(f)
1408 | Expression::Contains(f)
1409 | Expression::StartsWith(f)
1410 | Expression::EndsWith(f)
1411 | Expression::Levenshtein(f)
1412 | Expression::ModFunc(f)
1413 | Expression::IntDiv(f)
1414 | Expression::Atan2(f)
1415 | Expression::AddMonths(f)
1416 | Expression::MonthsBetween(f)
1417 | Expression::NextDay(f)
1418 | Expression::UnixToTimeStr(f)
1419 | Expression::ArrayContains(f)
1420 | Expression::ArrayPosition(f)
1421 | Expression::ArrayAppend(f)
1422 | Expression::ArrayPrepend(f)
1423 | Expression::ArrayUnion(f)
1424 | Expression::ArrayExcept(f)
1425 | Expression::ArrayRemove(f)
1426 | Expression::StarMap(f)
1427 | Expression::MapFromArrays(f)
1428 | Expression::MapContainsKey(f)
1429 | Expression::ElementAt(f)
1430 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1431
1432 Expression::Coalesce(f)
1434 | Expression::Greatest(f)
1435 | Expression::Least(f)
1436 | Expression::ArrayConcat(f)
1437 | Expression::ArrayIntersect(f)
1438 | Expression::ArrayZip(f)
1439 | Expression::MapConcat(f)
1440 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1441
1442 Expression::Sum(f)
1444 | Expression::Avg(f)
1445 | Expression::Min(f)
1446 | Expression::Max(f)
1447 | Expression::ArrayAgg(f)
1448 | Expression::CountIf(f)
1449 | Expression::Stddev(f)
1450 | Expression::StddevPop(f)
1451 | Expression::StddevSamp(f)
1452 | Expression::Variance(f)
1453 | Expression::VarPop(f)
1454 | Expression::VarSamp(f)
1455 | Expression::Median(f)
1456 | Expression::Mode(f)
1457 | Expression::First(f)
1458 | Expression::Last(f)
1459 | Expression::AnyValue(f)
1460 | Expression::ApproxDistinct(f)
1461 | Expression::ApproxCountDistinct(f)
1462 | Expression::LogicalAnd(f)
1463 | Expression::LogicalOr(f)
1464 | Expression::Skewness(f)
1465 | Expression::ArrayConcatAgg(f)
1466 | Expression::ArrayUniqueAgg(f)
1467 | Expression::BoolXorAgg(f)
1468 | Expression::BitwiseAndAgg(f)
1469 | Expression::BitwiseOrAgg(f)
1470 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1471
1472 _ => None,
1474 }
1475 }
1476
1477 pub fn set_inferred_type(&mut self, dt: DataType) {
1482 match self {
1483 Expression::And(op)
1484 | Expression::Or(op)
1485 | Expression::Add(op)
1486 | Expression::Sub(op)
1487 | Expression::Mul(op)
1488 | Expression::Div(op)
1489 | Expression::Mod(op)
1490 | Expression::Eq(op)
1491 | Expression::Neq(op)
1492 | Expression::Lt(op)
1493 | Expression::Lte(op)
1494 | Expression::Gt(op)
1495 | Expression::Gte(op)
1496 | Expression::Concat(op)
1497 | Expression::BitwiseAnd(op)
1498 | Expression::BitwiseOr(op)
1499 | Expression::BitwiseXor(op)
1500 | Expression::Adjacent(op)
1501 | Expression::TsMatch(op)
1502 | Expression::PropertyEQ(op)
1503 | Expression::ArrayContainsAll(op)
1504 | Expression::ArrayContainedBy(op)
1505 | Expression::ArrayOverlaps(op)
1506 | Expression::JSONBContainsAllTopKeys(op)
1507 | Expression::JSONBContainsAnyTopKeys(op)
1508 | Expression::JSONBDeleteAtPath(op)
1509 | Expression::ExtendsLeft(op)
1510 | Expression::ExtendsRight(op)
1511 | Expression::Is(op)
1512 | Expression::MemberOf(op)
1513 | Expression::Match(op)
1514 | Expression::NullSafeEq(op)
1515 | Expression::NullSafeNeq(op)
1516 | Expression::Glob(op)
1517 | Expression::BitwiseLeftShift(op)
1518 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1519
1520 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1521 op.inferred_type = Some(dt)
1522 }
1523
1524 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1525
1526 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1527 c.inferred_type = Some(dt)
1528 }
1529
1530 Expression::Column(c) => c.inferred_type = Some(dt),
1531 Expression::Function(f) => f.inferred_type = Some(dt),
1532 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1533 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1534 Expression::Case(c) => c.inferred_type = Some(dt),
1535 Expression::Subquery(s) => s.inferred_type = Some(dt),
1536 Expression::Alias(a) => a.inferred_type = Some(dt),
1537 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1538 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1539 Expression::Count(f) => f.inferred_type = Some(dt),
1540 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1541 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1542 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1543 Expression::SumIf(f) => f.inferred_type = Some(dt),
1544
1545 Expression::Upper(f)
1547 | Expression::Lower(f)
1548 | Expression::Length(f)
1549 | Expression::LTrim(f)
1550 | Expression::RTrim(f)
1551 | Expression::Reverse(f)
1552 | Expression::Abs(f)
1553 | Expression::Sqrt(f)
1554 | Expression::Cbrt(f)
1555 | Expression::Ln(f)
1556 | Expression::Exp(f)
1557 | Expression::Sign(f)
1558 | Expression::Date(f)
1559 | Expression::Time(f)
1560 | Expression::Initcap(f)
1561 | Expression::Ascii(f)
1562 | Expression::Chr(f)
1563 | Expression::Soundex(f)
1564 | Expression::ByteLength(f)
1565 | Expression::Hex(f)
1566 | Expression::LowerHex(f)
1567 | Expression::Unicode(f)
1568 | Expression::Typeof(f)
1569 | Expression::Explode(f)
1570 | Expression::ExplodeOuter(f)
1571 | Expression::MapFromEntries(f)
1572 | Expression::MapKeys(f)
1573 | Expression::MapValues(f)
1574 | Expression::ArrayLength(f)
1575 | Expression::ArraySize(f)
1576 | Expression::Cardinality(f)
1577 | Expression::ArrayReverse(f)
1578 | Expression::ArrayDistinct(f)
1579 | Expression::ArrayFlatten(f)
1580 | Expression::ArrayCompact(f)
1581 | Expression::ToArray(f)
1582 | Expression::JsonArrayLength(f)
1583 | Expression::JsonKeys(f)
1584 | Expression::JsonType(f)
1585 | Expression::ParseJson(f)
1586 | Expression::ToJson(f)
1587 | Expression::Radians(f)
1588 | Expression::Degrees(f)
1589 | Expression::Sin(f)
1590 | Expression::Cos(f)
1591 | Expression::Tan(f)
1592 | Expression::Asin(f)
1593 | Expression::Acos(f)
1594 | Expression::Atan(f)
1595 | Expression::IsNan(f)
1596 | Expression::IsInf(f)
1597 | Expression::Year(f)
1598 | Expression::Month(f)
1599 | Expression::Day(f)
1600 | Expression::Hour(f)
1601 | Expression::Minute(f)
1602 | Expression::Second(f)
1603 | Expression::DayOfWeek(f)
1604 | Expression::DayOfWeekIso(f)
1605 | Expression::DayOfMonth(f)
1606 | Expression::DayOfYear(f)
1607 | Expression::WeekOfYear(f)
1608 | Expression::Quarter(f)
1609 | Expression::Epoch(f)
1610 | Expression::EpochMs(f)
1611 | Expression::BitwiseCount(f)
1612 | Expression::DateFromUnixDate(f)
1613 | Expression::UnixDate(f)
1614 | Expression::UnixSeconds(f)
1615 | Expression::UnixMillis(f)
1616 | Expression::UnixMicros(f)
1617 | Expression::TimeStrToDate(f)
1618 | Expression::DateToDi(f)
1619 | Expression::DiToDate(f)
1620 | Expression::TsOrDiToDi(f)
1621 | Expression::TsOrDsToDatetime(f)
1622 | Expression::TsOrDsToTimestamp(f)
1623 | Expression::YearOfWeek(f)
1624 | Expression::YearOfWeekIso(f)
1625 | Expression::SHA(f)
1626 | Expression::SHA1Digest(f)
1627 | Expression::TimeToUnix(f)
1628 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1629
1630 Expression::Power(f)
1632 | Expression::NullIf(f)
1633 | Expression::IfNull(f)
1634 | Expression::Nvl(f)
1635 | Expression::Contains(f)
1636 | Expression::StartsWith(f)
1637 | Expression::EndsWith(f)
1638 | Expression::Levenshtein(f)
1639 | Expression::ModFunc(f)
1640 | Expression::IntDiv(f)
1641 | Expression::Atan2(f)
1642 | Expression::AddMonths(f)
1643 | Expression::MonthsBetween(f)
1644 | Expression::NextDay(f)
1645 | Expression::UnixToTimeStr(f)
1646 | Expression::ArrayContains(f)
1647 | Expression::ArrayPosition(f)
1648 | Expression::ArrayAppend(f)
1649 | Expression::ArrayPrepend(f)
1650 | Expression::ArrayUnion(f)
1651 | Expression::ArrayExcept(f)
1652 | Expression::ArrayRemove(f)
1653 | Expression::StarMap(f)
1654 | Expression::MapFromArrays(f)
1655 | Expression::MapContainsKey(f)
1656 | Expression::ElementAt(f)
1657 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1658
1659 Expression::Coalesce(f)
1661 | Expression::Greatest(f)
1662 | Expression::Least(f)
1663 | Expression::ArrayConcat(f)
1664 | Expression::ArrayIntersect(f)
1665 | Expression::ArrayZip(f)
1666 | Expression::MapConcat(f)
1667 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1668
1669 Expression::Sum(f)
1671 | Expression::Avg(f)
1672 | Expression::Min(f)
1673 | Expression::Max(f)
1674 | Expression::ArrayAgg(f)
1675 | Expression::CountIf(f)
1676 | Expression::Stddev(f)
1677 | Expression::StddevPop(f)
1678 | Expression::StddevSamp(f)
1679 | Expression::Variance(f)
1680 | Expression::VarPop(f)
1681 | Expression::VarSamp(f)
1682 | Expression::Median(f)
1683 | Expression::Mode(f)
1684 | Expression::First(f)
1685 | Expression::Last(f)
1686 | Expression::AnyValue(f)
1687 | Expression::ApproxDistinct(f)
1688 | Expression::ApproxCountDistinct(f)
1689 | Expression::LogicalAnd(f)
1690 | Expression::LogicalOr(f)
1691 | Expression::Skewness(f)
1692 | Expression::ArrayConcatAgg(f)
1693 | Expression::ArrayUniqueAgg(f)
1694 | Expression::BoolXorAgg(f)
1695 | Expression::BitwiseAndAgg(f)
1696 | Expression::BitwiseOrAgg(f)
1697 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1698
1699 _ => {}
1701 }
1702 }
1703
1704 pub fn column(name: impl Into<String>) -> Self {
1706 Expression::Column(Box::new(Column {
1707 name: Identifier::new(name),
1708 table: None,
1709 join_mark: false,
1710 trailing_comments: Vec::new(),
1711 span: None,
1712 inferred_type: None,
1713 }))
1714 }
1715
1716 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1718 Expression::Column(Box::new(Column {
1719 name: Identifier::new(column),
1720 table: Some(Identifier::new(table)),
1721 join_mark: false,
1722 trailing_comments: Vec::new(),
1723 span: None,
1724 inferred_type: None,
1725 }))
1726 }
1727
1728 pub fn identifier(name: impl Into<String>) -> Self {
1730 Expression::Identifier(Identifier::new(name))
1731 }
1732
1733 pub fn null() -> Self {
1735 Expression::Null(Null)
1736 }
1737
1738 pub fn true_() -> Self {
1740 Expression::Boolean(BooleanLiteral { value: true })
1741 }
1742
1743 pub fn false_() -> Self {
1745 Expression::Boolean(BooleanLiteral { value: false })
1746 }
1747
1748 pub fn star() -> Self {
1750 Expression::Star(Star {
1751 table: None,
1752 except: None,
1753 replace: None,
1754 rename: None,
1755 trailing_comments: Vec::new(),
1756 span: None,
1757 })
1758 }
1759
1760 pub fn alias(self, name: impl Into<String>) -> Self {
1762 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1763 }
1764
1765 pub fn is_select(&self) -> bool {
1767 matches!(self, Expression::Select(_))
1768 }
1769
1770 pub fn as_select(&self) -> Option<&Select> {
1772 match self {
1773 Expression::Select(s) => Some(s),
1774 _ => None,
1775 }
1776 }
1777
1778 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1780 match self {
1781 Expression::Select(s) => Some(s),
1782 _ => None,
1783 }
1784 }
1785
1786 pub fn sql(&self) -> String {
1791 crate::generator::Generator::sql(self).unwrap_or_default()
1792 }
1793
1794 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1800 crate::generate(self, dialect).unwrap_or_default()
1801 }
1802}
1803
1804impl Expression {
1807 pub fn variant_name(&self) -> &'static str {
1810 match self {
1811 Expression::Literal(_) => "literal",
1812 Expression::Boolean(_) => "boolean",
1813 Expression::Null(_) => "null",
1814 Expression::Identifier(_) => "identifier",
1815 Expression::Column(_) => "column",
1816 Expression::Table(_) => "table",
1817 Expression::Star(_) => "star",
1818 Expression::BracedWildcard(_) => "braced_wildcard",
1819 Expression::Select(_) => "select",
1820 Expression::Union(_) => "union",
1821 Expression::Intersect(_) => "intersect",
1822 Expression::Except(_) => "except",
1823 Expression::Subquery(_) => "subquery",
1824 Expression::PipeOperator(_) => "pipe_operator",
1825 Expression::Pivot(_) => "pivot",
1826 Expression::PivotAlias(_) => "pivot_alias",
1827 Expression::Unpivot(_) => "unpivot",
1828 Expression::Values(_) => "values",
1829 Expression::PreWhere(_) => "pre_where",
1830 Expression::Stream(_) => "stream",
1831 Expression::UsingData(_) => "using_data",
1832 Expression::XmlNamespace(_) => "xml_namespace",
1833 Expression::Insert(_) => "insert",
1834 Expression::Update(_) => "update",
1835 Expression::Delete(_) => "delete",
1836 Expression::Copy(_) => "copy",
1837 Expression::Put(_) => "put",
1838 Expression::StageReference(_) => "stage_reference",
1839 Expression::Alias(_) => "alias",
1840 Expression::Cast(_) => "cast",
1841 Expression::Collation(_) => "collation",
1842 Expression::Case(_) => "case",
1843 Expression::And(_) => "and",
1844 Expression::Or(_) => "or",
1845 Expression::Add(_) => "add",
1846 Expression::Sub(_) => "sub",
1847 Expression::Mul(_) => "mul",
1848 Expression::Div(_) => "div",
1849 Expression::Mod(_) => "mod",
1850 Expression::Eq(_) => "eq",
1851 Expression::Neq(_) => "neq",
1852 Expression::Lt(_) => "lt",
1853 Expression::Lte(_) => "lte",
1854 Expression::Gt(_) => "gt",
1855 Expression::Gte(_) => "gte",
1856 Expression::Like(_) => "like",
1857 Expression::ILike(_) => "i_like",
1858 Expression::Match(_) => "match",
1859 Expression::BitwiseAnd(_) => "bitwise_and",
1860 Expression::BitwiseOr(_) => "bitwise_or",
1861 Expression::BitwiseXor(_) => "bitwise_xor",
1862 Expression::Concat(_) => "concat",
1863 Expression::Adjacent(_) => "adjacent",
1864 Expression::TsMatch(_) => "ts_match",
1865 Expression::PropertyEQ(_) => "property_e_q",
1866 Expression::ArrayContainsAll(_) => "array_contains_all",
1867 Expression::ArrayContainedBy(_) => "array_contained_by",
1868 Expression::ArrayOverlaps(_) => "array_overlaps",
1869 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1870 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1871 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1872 Expression::ExtendsLeft(_) => "extends_left",
1873 Expression::ExtendsRight(_) => "extends_right",
1874 Expression::Not(_) => "not",
1875 Expression::Neg(_) => "neg",
1876 Expression::BitwiseNot(_) => "bitwise_not",
1877 Expression::In(_) => "in",
1878 Expression::Between(_) => "between",
1879 Expression::IsNull(_) => "is_null",
1880 Expression::IsTrue(_) => "is_true",
1881 Expression::IsFalse(_) => "is_false",
1882 Expression::IsJson(_) => "is_json",
1883 Expression::Is(_) => "is",
1884 Expression::Exists(_) => "exists",
1885 Expression::MemberOf(_) => "member_of",
1886 Expression::Function(_) => "function",
1887 Expression::AggregateFunction(_) => "aggregate_function",
1888 Expression::WindowFunction(_) => "window_function",
1889 Expression::From(_) => "from",
1890 Expression::Join(_) => "join",
1891 Expression::JoinedTable(_) => "joined_table",
1892 Expression::Where(_) => "where",
1893 Expression::GroupBy(_) => "group_by",
1894 Expression::Having(_) => "having",
1895 Expression::OrderBy(_) => "order_by",
1896 Expression::Limit(_) => "limit",
1897 Expression::Offset(_) => "offset",
1898 Expression::Qualify(_) => "qualify",
1899 Expression::With(_) => "with",
1900 Expression::Cte(_) => "cte",
1901 Expression::DistributeBy(_) => "distribute_by",
1902 Expression::ClusterBy(_) => "cluster_by",
1903 Expression::SortBy(_) => "sort_by",
1904 Expression::LateralView(_) => "lateral_view",
1905 Expression::Hint(_) => "hint",
1906 Expression::Pseudocolumn(_) => "pseudocolumn",
1907 Expression::Connect(_) => "connect",
1908 Expression::Prior(_) => "prior",
1909 Expression::ConnectByRoot(_) => "connect_by_root",
1910 Expression::MatchRecognize(_) => "match_recognize",
1911 Expression::Ordered(_) => "ordered",
1912 Expression::Window(_) => "window",
1913 Expression::Over(_) => "over",
1914 Expression::WithinGroup(_) => "within_group",
1915 Expression::DataType(_) => "data_type",
1916 Expression::Array(_) => "array",
1917 Expression::Struct(_) => "struct",
1918 Expression::Tuple(_) => "tuple",
1919 Expression::Interval(_) => "interval",
1920 Expression::ConcatWs(_) => "concat_ws",
1921 Expression::Substring(_) => "substring",
1922 Expression::Upper(_) => "upper",
1923 Expression::Lower(_) => "lower",
1924 Expression::Length(_) => "length",
1925 Expression::Trim(_) => "trim",
1926 Expression::LTrim(_) => "l_trim",
1927 Expression::RTrim(_) => "r_trim",
1928 Expression::Replace(_) => "replace",
1929 Expression::Reverse(_) => "reverse",
1930 Expression::Left(_) => "left",
1931 Expression::Right(_) => "right",
1932 Expression::Repeat(_) => "repeat",
1933 Expression::Lpad(_) => "lpad",
1934 Expression::Rpad(_) => "rpad",
1935 Expression::Split(_) => "split",
1936 Expression::RegexpLike(_) => "regexp_like",
1937 Expression::RegexpReplace(_) => "regexp_replace",
1938 Expression::RegexpExtract(_) => "regexp_extract",
1939 Expression::Overlay(_) => "overlay",
1940 Expression::Abs(_) => "abs",
1941 Expression::Round(_) => "round",
1942 Expression::Floor(_) => "floor",
1943 Expression::Ceil(_) => "ceil",
1944 Expression::Power(_) => "power",
1945 Expression::Sqrt(_) => "sqrt",
1946 Expression::Cbrt(_) => "cbrt",
1947 Expression::Ln(_) => "ln",
1948 Expression::Log(_) => "log",
1949 Expression::Exp(_) => "exp",
1950 Expression::Sign(_) => "sign",
1951 Expression::Greatest(_) => "greatest",
1952 Expression::Least(_) => "least",
1953 Expression::CurrentDate(_) => "current_date",
1954 Expression::CurrentTime(_) => "current_time",
1955 Expression::CurrentTimestamp(_) => "current_timestamp",
1956 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1957 Expression::AtTimeZone(_) => "at_time_zone",
1958 Expression::DateAdd(_) => "date_add",
1959 Expression::DateSub(_) => "date_sub",
1960 Expression::DateDiff(_) => "date_diff",
1961 Expression::DateTrunc(_) => "date_trunc",
1962 Expression::Extract(_) => "extract",
1963 Expression::ToDate(_) => "to_date",
1964 Expression::ToTimestamp(_) => "to_timestamp",
1965 Expression::Date(_) => "date",
1966 Expression::Time(_) => "time",
1967 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1968 Expression::UnixDate(_) => "unix_date",
1969 Expression::UnixSeconds(_) => "unix_seconds",
1970 Expression::UnixMillis(_) => "unix_millis",
1971 Expression::UnixMicros(_) => "unix_micros",
1972 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1973 Expression::TimeStrToDate(_) => "time_str_to_date",
1974 Expression::DateToDi(_) => "date_to_di",
1975 Expression::DiToDate(_) => "di_to_date",
1976 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1977 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1978 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1979 Expression::YearOfWeek(_) => "year_of_week",
1980 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1981 Expression::Coalesce(_) => "coalesce",
1982 Expression::NullIf(_) => "null_if",
1983 Expression::IfFunc(_) => "if_func",
1984 Expression::IfNull(_) => "if_null",
1985 Expression::Nvl(_) => "nvl",
1986 Expression::Nvl2(_) => "nvl2",
1987 Expression::TryCast(_) => "try_cast",
1988 Expression::SafeCast(_) => "safe_cast",
1989 Expression::Count(_) => "count",
1990 Expression::Sum(_) => "sum",
1991 Expression::Avg(_) => "avg",
1992 Expression::Min(_) => "min",
1993 Expression::Max(_) => "max",
1994 Expression::GroupConcat(_) => "group_concat",
1995 Expression::StringAgg(_) => "string_agg",
1996 Expression::ListAgg(_) => "list_agg",
1997 Expression::ArrayAgg(_) => "array_agg",
1998 Expression::CountIf(_) => "count_if",
1999 Expression::SumIf(_) => "sum_if",
2000 Expression::Stddev(_) => "stddev",
2001 Expression::StddevPop(_) => "stddev_pop",
2002 Expression::StddevSamp(_) => "stddev_samp",
2003 Expression::Variance(_) => "variance",
2004 Expression::VarPop(_) => "var_pop",
2005 Expression::VarSamp(_) => "var_samp",
2006 Expression::Median(_) => "median",
2007 Expression::Mode(_) => "mode",
2008 Expression::First(_) => "first",
2009 Expression::Last(_) => "last",
2010 Expression::AnyValue(_) => "any_value",
2011 Expression::ApproxDistinct(_) => "approx_distinct",
2012 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2013 Expression::ApproxPercentile(_) => "approx_percentile",
2014 Expression::Percentile(_) => "percentile",
2015 Expression::LogicalAnd(_) => "logical_and",
2016 Expression::LogicalOr(_) => "logical_or",
2017 Expression::Skewness(_) => "skewness",
2018 Expression::BitwiseCount(_) => "bitwise_count",
2019 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2020 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2021 Expression::BoolXorAgg(_) => "bool_xor_agg",
2022 Expression::RowNumber(_) => "row_number",
2023 Expression::Rank(_) => "rank",
2024 Expression::DenseRank(_) => "dense_rank",
2025 Expression::NTile(_) => "n_tile",
2026 Expression::Lead(_) => "lead",
2027 Expression::Lag(_) => "lag",
2028 Expression::FirstValue(_) => "first_value",
2029 Expression::LastValue(_) => "last_value",
2030 Expression::NthValue(_) => "nth_value",
2031 Expression::PercentRank(_) => "percent_rank",
2032 Expression::CumeDist(_) => "cume_dist",
2033 Expression::PercentileCont(_) => "percentile_cont",
2034 Expression::PercentileDisc(_) => "percentile_disc",
2035 Expression::Contains(_) => "contains",
2036 Expression::StartsWith(_) => "starts_with",
2037 Expression::EndsWith(_) => "ends_with",
2038 Expression::Position(_) => "position",
2039 Expression::Initcap(_) => "initcap",
2040 Expression::Ascii(_) => "ascii",
2041 Expression::Chr(_) => "chr",
2042 Expression::CharFunc(_) => "char_func",
2043 Expression::Soundex(_) => "soundex",
2044 Expression::Levenshtein(_) => "levenshtein",
2045 Expression::ByteLength(_) => "byte_length",
2046 Expression::Hex(_) => "hex",
2047 Expression::LowerHex(_) => "lower_hex",
2048 Expression::Unicode(_) => "unicode",
2049 Expression::ModFunc(_) => "mod_func",
2050 Expression::Random(_) => "random",
2051 Expression::Rand(_) => "rand",
2052 Expression::TruncFunc(_) => "trunc_func",
2053 Expression::Pi(_) => "pi",
2054 Expression::Radians(_) => "radians",
2055 Expression::Degrees(_) => "degrees",
2056 Expression::Sin(_) => "sin",
2057 Expression::Cos(_) => "cos",
2058 Expression::Tan(_) => "tan",
2059 Expression::Asin(_) => "asin",
2060 Expression::Acos(_) => "acos",
2061 Expression::Atan(_) => "atan",
2062 Expression::Atan2(_) => "atan2",
2063 Expression::IsNan(_) => "is_nan",
2064 Expression::IsInf(_) => "is_inf",
2065 Expression::IntDiv(_) => "int_div",
2066 Expression::Decode(_) => "decode",
2067 Expression::DateFormat(_) => "date_format",
2068 Expression::FormatDate(_) => "format_date",
2069 Expression::Year(_) => "year",
2070 Expression::Month(_) => "month",
2071 Expression::Day(_) => "day",
2072 Expression::Hour(_) => "hour",
2073 Expression::Minute(_) => "minute",
2074 Expression::Second(_) => "second",
2075 Expression::DayOfWeek(_) => "day_of_week",
2076 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2077 Expression::DayOfMonth(_) => "day_of_month",
2078 Expression::DayOfYear(_) => "day_of_year",
2079 Expression::WeekOfYear(_) => "week_of_year",
2080 Expression::Quarter(_) => "quarter",
2081 Expression::AddMonths(_) => "add_months",
2082 Expression::MonthsBetween(_) => "months_between",
2083 Expression::LastDay(_) => "last_day",
2084 Expression::NextDay(_) => "next_day",
2085 Expression::Epoch(_) => "epoch",
2086 Expression::EpochMs(_) => "epoch_ms",
2087 Expression::FromUnixtime(_) => "from_unixtime",
2088 Expression::UnixTimestamp(_) => "unix_timestamp",
2089 Expression::MakeDate(_) => "make_date",
2090 Expression::MakeTimestamp(_) => "make_timestamp",
2091 Expression::TimestampTrunc(_) => "timestamp_trunc",
2092 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2093 Expression::SessionUser(_) => "session_user",
2094 Expression::SHA(_) => "s_h_a",
2095 Expression::SHA1Digest(_) => "s_h_a1_digest",
2096 Expression::TimeToUnix(_) => "time_to_unix",
2097 Expression::ArrayFunc(_) => "array_func",
2098 Expression::ArrayLength(_) => "array_length",
2099 Expression::ArraySize(_) => "array_size",
2100 Expression::Cardinality(_) => "cardinality",
2101 Expression::ArrayContains(_) => "array_contains",
2102 Expression::ArrayPosition(_) => "array_position",
2103 Expression::ArrayAppend(_) => "array_append",
2104 Expression::ArrayPrepend(_) => "array_prepend",
2105 Expression::ArrayConcat(_) => "array_concat",
2106 Expression::ArraySort(_) => "array_sort",
2107 Expression::ArrayReverse(_) => "array_reverse",
2108 Expression::ArrayDistinct(_) => "array_distinct",
2109 Expression::ArrayJoin(_) => "array_join",
2110 Expression::ArrayToString(_) => "array_to_string",
2111 Expression::Unnest(_) => "unnest",
2112 Expression::Explode(_) => "explode",
2113 Expression::ExplodeOuter(_) => "explode_outer",
2114 Expression::ArrayFilter(_) => "array_filter",
2115 Expression::ArrayTransform(_) => "array_transform",
2116 Expression::ArrayFlatten(_) => "array_flatten",
2117 Expression::ArrayCompact(_) => "array_compact",
2118 Expression::ArrayIntersect(_) => "array_intersect",
2119 Expression::ArrayUnion(_) => "array_union",
2120 Expression::ArrayExcept(_) => "array_except",
2121 Expression::ArrayRemove(_) => "array_remove",
2122 Expression::ArrayZip(_) => "array_zip",
2123 Expression::Sequence(_) => "sequence",
2124 Expression::Generate(_) => "generate",
2125 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2126 Expression::ToArray(_) => "to_array",
2127 Expression::StarMap(_) => "star_map",
2128 Expression::StructFunc(_) => "struct_func",
2129 Expression::StructExtract(_) => "struct_extract",
2130 Expression::NamedStruct(_) => "named_struct",
2131 Expression::MapFunc(_) => "map_func",
2132 Expression::MapFromEntries(_) => "map_from_entries",
2133 Expression::MapFromArrays(_) => "map_from_arrays",
2134 Expression::MapKeys(_) => "map_keys",
2135 Expression::MapValues(_) => "map_values",
2136 Expression::MapContainsKey(_) => "map_contains_key",
2137 Expression::MapConcat(_) => "map_concat",
2138 Expression::ElementAt(_) => "element_at",
2139 Expression::TransformKeys(_) => "transform_keys",
2140 Expression::TransformValues(_) => "transform_values",
2141 Expression::FunctionEmits(_) => "function_emits",
2142 Expression::JsonExtract(_) => "json_extract",
2143 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2144 Expression::JsonExtractPath(_) => "json_extract_path",
2145 Expression::JsonArray(_) => "json_array",
2146 Expression::JsonObject(_) => "json_object",
2147 Expression::JsonQuery(_) => "json_query",
2148 Expression::JsonValue(_) => "json_value",
2149 Expression::JsonArrayLength(_) => "json_array_length",
2150 Expression::JsonKeys(_) => "json_keys",
2151 Expression::JsonType(_) => "json_type",
2152 Expression::ParseJson(_) => "parse_json",
2153 Expression::ToJson(_) => "to_json",
2154 Expression::JsonSet(_) => "json_set",
2155 Expression::JsonInsert(_) => "json_insert",
2156 Expression::JsonRemove(_) => "json_remove",
2157 Expression::JsonMergePatch(_) => "json_merge_patch",
2158 Expression::JsonArrayAgg(_) => "json_array_agg",
2159 Expression::JsonObjectAgg(_) => "json_object_agg",
2160 Expression::Convert(_) => "convert",
2161 Expression::Typeof(_) => "typeof",
2162 Expression::Lambda(_) => "lambda",
2163 Expression::Parameter(_) => "parameter",
2164 Expression::Placeholder(_) => "placeholder",
2165 Expression::NamedArgument(_) => "named_argument",
2166 Expression::TableArgument(_) => "table_argument",
2167 Expression::SqlComment(_) => "sql_comment",
2168 Expression::NullSafeEq(_) => "null_safe_eq",
2169 Expression::NullSafeNeq(_) => "null_safe_neq",
2170 Expression::Glob(_) => "glob",
2171 Expression::SimilarTo(_) => "similar_to",
2172 Expression::Any(_) => "any",
2173 Expression::All(_) => "all",
2174 Expression::Overlaps(_) => "overlaps",
2175 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2176 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2177 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2178 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2179 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2180 Expression::Subscript(_) => "subscript",
2181 Expression::Dot(_) => "dot",
2182 Expression::MethodCall(_) => "method_call",
2183 Expression::ArraySlice(_) => "array_slice",
2184 Expression::CreateTable(_) => "create_table",
2185 Expression::DropTable(_) => "drop_table",
2186 Expression::AlterTable(_) => "alter_table",
2187 Expression::CreateIndex(_) => "create_index",
2188 Expression::DropIndex(_) => "drop_index",
2189 Expression::CreateView(_) => "create_view",
2190 Expression::DropView(_) => "drop_view",
2191 Expression::AlterView(_) => "alter_view",
2192 Expression::AlterIndex(_) => "alter_index",
2193 Expression::Truncate(_) => "truncate",
2194 Expression::Use(_) => "use",
2195 Expression::Cache(_) => "cache",
2196 Expression::Uncache(_) => "uncache",
2197 Expression::LoadData(_) => "load_data",
2198 Expression::Pragma(_) => "pragma",
2199 Expression::Grant(_) => "grant",
2200 Expression::Revoke(_) => "revoke",
2201 Expression::Comment(_) => "comment",
2202 Expression::SetStatement(_) => "set_statement",
2203 Expression::CreateSchema(_) => "create_schema",
2204 Expression::DropSchema(_) => "drop_schema",
2205 Expression::DropNamespace(_) => "drop_namespace",
2206 Expression::CreateDatabase(_) => "create_database",
2207 Expression::DropDatabase(_) => "drop_database",
2208 Expression::CreateFunction(_) => "create_function",
2209 Expression::DropFunction(_) => "drop_function",
2210 Expression::CreateProcedure(_) => "create_procedure",
2211 Expression::DropProcedure(_) => "drop_procedure",
2212 Expression::CreateSequence(_) => "create_sequence",
2213 Expression::DropSequence(_) => "drop_sequence",
2214 Expression::AlterSequence(_) => "alter_sequence",
2215 Expression::CreateTrigger(_) => "create_trigger",
2216 Expression::DropTrigger(_) => "drop_trigger",
2217 Expression::CreateType(_) => "create_type",
2218 Expression::DropType(_) => "drop_type",
2219 Expression::Describe(_) => "describe",
2220 Expression::Show(_) => "show",
2221 Expression::Command(_) => "command",
2222 Expression::Kill(_) => "kill",
2223 Expression::Execute(_) => "execute",
2224 Expression::Raw(_) => "raw",
2225 Expression::Paren(_) => "paren",
2226 Expression::Annotated(_) => "annotated",
2227 Expression::Refresh(_) => "refresh",
2228 Expression::LockingStatement(_) => "locking_statement",
2229 Expression::SequenceProperties(_) => "sequence_properties",
2230 Expression::TruncateTable(_) => "truncate_table",
2231 Expression::Clone(_) => "clone",
2232 Expression::Attach(_) => "attach",
2233 Expression::Detach(_) => "detach",
2234 Expression::Install(_) => "install",
2235 Expression::Summarize(_) => "summarize",
2236 Expression::Declare(_) => "declare",
2237 Expression::DeclareItem(_) => "declare_item",
2238 Expression::Set(_) => "set",
2239 Expression::Heredoc(_) => "heredoc",
2240 Expression::SetItem(_) => "set_item",
2241 Expression::QueryBand(_) => "query_band",
2242 Expression::UserDefinedFunction(_) => "user_defined_function",
2243 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2244 Expression::ProjectionDef(_) => "projection_def",
2245 Expression::TableAlias(_) => "table_alias",
2246 Expression::ByteString(_) => "byte_string",
2247 Expression::HexStringExpr(_) => "hex_string_expr",
2248 Expression::UnicodeString(_) => "unicode_string",
2249 Expression::ColumnPosition(_) => "column_position",
2250 Expression::ColumnDef(_) => "column_def",
2251 Expression::AlterColumn(_) => "alter_column",
2252 Expression::AlterSortKey(_) => "alter_sort_key",
2253 Expression::AlterSet(_) => "alter_set",
2254 Expression::RenameColumn(_) => "rename_column",
2255 Expression::Comprehension(_) => "comprehension",
2256 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2257 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2258 Expression::IndexConstraintOption(_) => "index_constraint_option",
2259 Expression::ColumnConstraint(_) => "column_constraint",
2260 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2261 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2262 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2263 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2264 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2265 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2266 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2267 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2268 Expression::WithOperator(_) => "with_operator",
2269 Expression::GeneratedAsIdentityColumnConstraint(_) => "generated_as_identity_column_constraint",
2270 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2271 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2272 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2273 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2274 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2275 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2276 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2277 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2278 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2279 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2280 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2281 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2282 Expression::PathColumnConstraint(_) => "path_column_constraint",
2283 Expression::Constraint(_) => "constraint",
2284 Expression::Export(_) => "export",
2285 Expression::Filter(_) => "filter",
2286 Expression::Changes(_) => "changes",
2287 Expression::CopyParameter(_) => "copy_parameter",
2288 Expression::Credentials(_) => "credentials",
2289 Expression::Directory(_) => "directory",
2290 Expression::ForeignKey(_) => "foreign_key",
2291 Expression::ColumnPrefix(_) => "column_prefix",
2292 Expression::PrimaryKey(_) => "primary_key",
2293 Expression::IntoClause(_) => "into_clause",
2294 Expression::JoinHint(_) => "join_hint",
2295 Expression::Opclass(_) => "opclass",
2296 Expression::Index(_) => "index",
2297 Expression::IndexParameters(_) => "index_parameters",
2298 Expression::ConditionalInsert(_) => "conditional_insert",
2299 Expression::MultitableInserts(_) => "multitable_inserts",
2300 Expression::OnConflict(_) => "on_conflict",
2301 Expression::OnCondition(_) => "on_condition",
2302 Expression::Returning(_) => "returning",
2303 Expression::Introducer(_) => "introducer",
2304 Expression::PartitionRange(_) => "partition_range",
2305 Expression::Fetch(_) => "fetch",
2306 Expression::Group(_) => "group",
2307 Expression::Cube(_) => "cube",
2308 Expression::Rollup(_) => "rollup",
2309 Expression::GroupingSets(_) => "grouping_sets",
2310 Expression::LimitOptions(_) => "limit_options",
2311 Expression::Lateral(_) => "lateral",
2312 Expression::TableFromRows(_) => "table_from_rows",
2313 Expression::RowsFrom(_) => "rows_from",
2314 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2315 Expression::WithFill(_) => "with_fill",
2316 Expression::Property(_) => "property",
2317 Expression::GrantPrivilege(_) => "grant_privilege",
2318 Expression::GrantPrincipal(_) => "grant_principal",
2319 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2320 Expression::AlgorithmProperty(_) => "algorithm_property",
2321 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2322 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2323 Expression::BackupProperty(_) => "backup_property",
2324 Expression::BuildProperty(_) => "build_property",
2325 Expression::BlockCompressionProperty(_) => "block_compression_property",
2326 Expression::CharacterSetProperty(_) => "character_set_property",
2327 Expression::ChecksumProperty(_) => "checksum_property",
2328 Expression::CollateProperty(_) => "collate_property",
2329 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2330 Expression::DataDeletionProperty(_) => "data_deletion_property",
2331 Expression::DefinerProperty(_) => "definer_property",
2332 Expression::DistKeyProperty(_) => "dist_key_property",
2333 Expression::DistributedByProperty(_) => "distributed_by_property",
2334 Expression::DistStyleProperty(_) => "dist_style_property",
2335 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2336 Expression::EngineProperty(_) => "engine_property",
2337 Expression::ToTableProperty(_) => "to_table_property",
2338 Expression::ExecuteAsProperty(_) => "execute_as_property",
2339 Expression::ExternalProperty(_) => "external_property",
2340 Expression::FallbackProperty(_) => "fallback_property",
2341 Expression::FileFormatProperty(_) => "file_format_property",
2342 Expression::CredentialsProperty(_) => "credentials_property",
2343 Expression::FreespaceProperty(_) => "freespace_property",
2344 Expression::InheritsProperty(_) => "inherits_property",
2345 Expression::InputModelProperty(_) => "input_model_property",
2346 Expression::OutputModelProperty(_) => "output_model_property",
2347 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2348 Expression::JournalProperty(_) => "journal_property",
2349 Expression::LanguageProperty(_) => "language_property",
2350 Expression::EnviromentProperty(_) => "enviroment_property",
2351 Expression::ClusteredByProperty(_) => "clustered_by_property",
2352 Expression::DictProperty(_) => "dict_property",
2353 Expression::DictRange(_) => "dict_range",
2354 Expression::OnCluster(_) => "on_cluster",
2355 Expression::LikeProperty(_) => "like_property",
2356 Expression::LocationProperty(_) => "location_property",
2357 Expression::LockProperty(_) => "lock_property",
2358 Expression::LockingProperty(_) => "locking_property",
2359 Expression::LogProperty(_) => "log_property",
2360 Expression::MaterializedProperty(_) => "materialized_property",
2361 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2362 Expression::OnProperty(_) => "on_property",
2363 Expression::OnCommitProperty(_) => "on_commit_property",
2364 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2365 Expression::PartitionByProperty(_) => "partition_by_property",
2366 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2367 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2368 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2369 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2370 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2371 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2372 Expression::PartitionList(_) => "partition_list",
2373 Expression::Partition(_) => "partition",
2374 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2375 Expression::UniqueKeyProperty(_) => "unique_key_property",
2376 Expression::RollupProperty(_) => "rollup_property",
2377 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2378 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2379 Expression::RemoteWithConnectionModelProperty(_) => "remote_with_connection_model_property",
2380 Expression::ReturnsProperty(_) => "returns_property",
2381 Expression::RowFormatProperty(_) => "row_format_property",
2382 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2383 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2384 Expression::QueryTransform(_) => "query_transform",
2385 Expression::SampleProperty(_) => "sample_property",
2386 Expression::SecurityProperty(_) => "security_property",
2387 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2388 Expression::SemanticView(_) => "semantic_view",
2389 Expression::SerdeProperties(_) => "serde_properties",
2390 Expression::SetProperty(_) => "set_property",
2391 Expression::SharingProperty(_) => "sharing_property",
2392 Expression::SetConfigProperty(_) => "set_config_property",
2393 Expression::SettingsProperty(_) => "settings_property",
2394 Expression::SortKeyProperty(_) => "sort_key_property",
2395 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2396 Expression::SqlSecurityProperty(_) => "sql_security_property",
2397 Expression::StabilityProperty(_) => "stability_property",
2398 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2399 Expression::TemporaryProperty(_) => "temporary_property",
2400 Expression::Tags(_) => "tags",
2401 Expression::TransformModelProperty(_) => "transform_model_property",
2402 Expression::TransientProperty(_) => "transient_property",
2403 Expression::UsingTemplateProperty(_) => "using_template_property",
2404 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2405 Expression::VolatileProperty(_) => "volatile_property",
2406 Expression::WithDataProperty(_) => "with_data_property",
2407 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2408 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2409 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2410 Expression::WithProcedureOptions(_) => "with_procedure_options",
2411 Expression::EncodeProperty(_) => "encode_property",
2412 Expression::IncludeProperty(_) => "include_property",
2413 Expression::Properties(_) => "properties",
2414 Expression::OptionsProperty(_) => "options_property",
2415 Expression::InputOutputFormat(_) => "input_output_format",
2416 Expression::Reference(_) => "reference",
2417 Expression::QueryOption(_) => "query_option",
2418 Expression::WithTableHint(_) => "with_table_hint",
2419 Expression::IndexTableHint(_) => "index_table_hint",
2420 Expression::HistoricalData(_) => "historical_data",
2421 Expression::Get(_) => "get",
2422 Expression::SetOperation(_) => "set_operation",
2423 Expression::Var(_) => "var",
2424 Expression::Variadic(_) => "variadic",
2425 Expression::Version(_) => "version",
2426 Expression::Schema(_) => "schema",
2427 Expression::Lock(_) => "lock",
2428 Expression::TableSample(_) => "table_sample",
2429 Expression::Tag(_) => "tag",
2430 Expression::UnpivotColumns(_) => "unpivot_columns",
2431 Expression::WindowSpec(_) => "window_spec",
2432 Expression::SessionParameter(_) => "session_parameter",
2433 Expression::PseudoType(_) => "pseudo_type",
2434 Expression::ObjectIdentifier(_) => "object_identifier",
2435 Expression::Transaction(_) => "transaction",
2436 Expression::Commit(_) => "commit",
2437 Expression::Rollback(_) => "rollback",
2438 Expression::AlterSession(_) => "alter_session",
2439 Expression::Analyze(_) => "analyze",
2440 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2441 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2442 Expression::AnalyzeSample(_) => "analyze_sample",
2443 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2444 Expression::AnalyzeDelete(_) => "analyze_delete",
2445 Expression::AnalyzeWith(_) => "analyze_with",
2446 Expression::AnalyzeValidate(_) => "analyze_validate",
2447 Expression::AddPartition(_) => "add_partition",
2448 Expression::AttachOption(_) => "attach_option",
2449 Expression::DropPartition(_) => "drop_partition",
2450 Expression::ReplacePartition(_) => "replace_partition",
2451 Expression::DPipe(_) => "d_pipe",
2452 Expression::Operator(_) => "operator",
2453 Expression::PivotAny(_) => "pivot_any",
2454 Expression::Aliases(_) => "aliases",
2455 Expression::AtIndex(_) => "at_index",
2456 Expression::FromTimeZone(_) => "from_time_zone",
2457 Expression::FormatPhrase(_) => "format_phrase",
2458 Expression::ForIn(_) => "for_in",
2459 Expression::TimeUnit(_) => "time_unit",
2460 Expression::IntervalOp(_) => "interval_op",
2461 Expression::IntervalSpan(_) => "interval_span",
2462 Expression::HavingMax(_) => "having_max",
2463 Expression::CosineDistance(_) => "cosine_distance",
2464 Expression::DotProduct(_) => "dot_product",
2465 Expression::EuclideanDistance(_) => "euclidean_distance",
2466 Expression::ManhattanDistance(_) => "manhattan_distance",
2467 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2468 Expression::Booland(_) => "booland",
2469 Expression::Boolor(_) => "boolor",
2470 Expression::ParameterizedAgg(_) => "parameterized_agg",
2471 Expression::ArgMax(_) => "arg_max",
2472 Expression::ArgMin(_) => "arg_min",
2473 Expression::ApproxTopK(_) => "approx_top_k",
2474 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2475 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2476 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2477 Expression::ApproxTopSum(_) => "approx_top_sum",
2478 Expression::ApproxQuantiles(_) => "approx_quantiles",
2479 Expression::Minhash(_) => "minhash",
2480 Expression::FarmFingerprint(_) => "farm_fingerprint",
2481 Expression::Float64(_) => "float64",
2482 Expression::Transform(_) => "transform",
2483 Expression::Translate(_) => "translate",
2484 Expression::Grouping(_) => "grouping",
2485 Expression::GroupingId(_) => "grouping_id",
2486 Expression::Anonymous(_) => "anonymous",
2487 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2488 Expression::CombinedAggFunc(_) => "combined_agg_func",
2489 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2490 Expression::HashAgg(_) => "hash_agg",
2491 Expression::Hll(_) => "hll",
2492 Expression::Apply(_) => "apply",
2493 Expression::ToBoolean(_) => "to_boolean",
2494 Expression::List(_) => "list",
2495 Expression::ToMap(_) => "to_map",
2496 Expression::Pad(_) => "pad",
2497 Expression::ToChar(_) => "to_char",
2498 Expression::ToNumber(_) => "to_number",
2499 Expression::ToDouble(_) => "to_double",
2500 Expression::Int64(_) => "int64",
2501 Expression::StringFunc(_) => "string_func",
2502 Expression::ToDecfloat(_) => "to_decfloat",
2503 Expression::TryToDecfloat(_) => "try_to_decfloat",
2504 Expression::ToFile(_) => "to_file",
2505 Expression::Columns(_) => "columns",
2506 Expression::ConvertToCharset(_) => "convert_to_charset",
2507 Expression::ConvertTimezone(_) => "convert_timezone",
2508 Expression::GenerateSeries(_) => "generate_series",
2509 Expression::AIAgg(_) => "a_i_agg",
2510 Expression::AIClassify(_) => "a_i_classify",
2511 Expression::ArrayAll(_) => "array_all",
2512 Expression::ArrayAny(_) => "array_any",
2513 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2514 Expression::StPoint(_) => "st_point",
2515 Expression::StDistance(_) => "st_distance",
2516 Expression::StringToArray(_) => "string_to_array",
2517 Expression::ArraySum(_) => "array_sum",
2518 Expression::ObjectAgg(_) => "object_agg",
2519 Expression::CastToStrType(_) => "cast_to_str_type",
2520 Expression::CheckJson(_) => "check_json",
2521 Expression::CheckXml(_) => "check_xml",
2522 Expression::TranslateCharacters(_) => "translate_characters",
2523 Expression::CurrentSchemas(_) => "current_schemas",
2524 Expression::CurrentDatetime(_) => "current_datetime",
2525 Expression::Localtime(_) => "localtime",
2526 Expression::Localtimestamp(_) => "localtimestamp",
2527 Expression::Systimestamp(_) => "systimestamp",
2528 Expression::CurrentSchema(_) => "current_schema",
2529 Expression::CurrentUser(_) => "current_user",
2530 Expression::UtcTime(_) => "utc_time",
2531 Expression::UtcTimestamp(_) => "utc_timestamp",
2532 Expression::Timestamp(_) => "timestamp",
2533 Expression::DateBin(_) => "date_bin",
2534 Expression::Datetime(_) => "datetime",
2535 Expression::DatetimeAdd(_) => "datetime_add",
2536 Expression::DatetimeSub(_) => "datetime_sub",
2537 Expression::DatetimeDiff(_) => "datetime_diff",
2538 Expression::DatetimeTrunc(_) => "datetime_trunc",
2539 Expression::Dayname(_) => "dayname",
2540 Expression::MakeInterval(_) => "make_interval",
2541 Expression::PreviousDay(_) => "previous_day",
2542 Expression::Elt(_) => "elt",
2543 Expression::TimestampAdd(_) => "timestamp_add",
2544 Expression::TimestampSub(_) => "timestamp_sub",
2545 Expression::TimestampDiff(_) => "timestamp_diff",
2546 Expression::TimeSlice(_) => "time_slice",
2547 Expression::TimeAdd(_) => "time_add",
2548 Expression::TimeSub(_) => "time_sub",
2549 Expression::TimeDiff(_) => "time_diff",
2550 Expression::TimeTrunc(_) => "time_trunc",
2551 Expression::DateFromParts(_) => "date_from_parts",
2552 Expression::TimeFromParts(_) => "time_from_parts",
2553 Expression::DecodeCase(_) => "decode_case",
2554 Expression::Decrypt(_) => "decrypt",
2555 Expression::DecryptRaw(_) => "decrypt_raw",
2556 Expression::Encode(_) => "encode",
2557 Expression::Encrypt(_) => "encrypt",
2558 Expression::EncryptRaw(_) => "encrypt_raw",
2559 Expression::EqualNull(_) => "equal_null",
2560 Expression::ToBinary(_) => "to_binary",
2561 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2562 Expression::Base64DecodeString(_) => "base64_decode_string",
2563 Expression::Base64Encode(_) => "base64_encode",
2564 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2565 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2566 Expression::GapFill(_) => "gap_fill",
2567 Expression::GenerateDateArray(_) => "generate_date_array",
2568 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2569 Expression::GetExtract(_) => "get_extract",
2570 Expression::Getbit(_) => "getbit",
2571 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2572 Expression::HexEncode(_) => "hex_encode",
2573 Expression::Compress(_) => "compress",
2574 Expression::DecompressBinary(_) => "decompress_binary",
2575 Expression::DecompressString(_) => "decompress_string",
2576 Expression::Xor(_) => "xor",
2577 Expression::Nullif(_) => "nullif",
2578 Expression::JSON(_) => "j_s_o_n",
2579 Expression::JSONPath(_) => "j_s_o_n_path",
2580 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2581 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2582 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2583 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2584 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2585 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2586 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2587 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2588 Expression::Format(_) => "format",
2589 Expression::JSONKeys(_) => "j_s_o_n_keys",
2590 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2591 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2592 Expression::JSONObject(_) => "j_s_o_n_object",
2593 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2594 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2595 Expression::JSONArray(_) => "j_s_o_n_array",
2596 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2597 Expression::JSONExists(_) => "j_s_o_n_exists",
2598 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2599 Expression::JSONSchema(_) => "j_s_o_n_schema",
2600 Expression::JSONSet(_) => "j_s_o_n_set",
2601 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2602 Expression::JSONValue(_) => "j_s_o_n_value",
2603 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2604 Expression::JSONRemove(_) => "j_s_o_n_remove",
2605 Expression::JSONTable(_) => "j_s_o_n_table",
2606 Expression::JSONType(_) => "j_s_o_n_type",
2607 Expression::ObjectInsert(_) => "object_insert",
2608 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2609 Expression::OpenJSON(_) => "open_j_s_o_n",
2610 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2611 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2612 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2613 Expression::JSONCast(_) => "j_s_o_n_cast",
2614 Expression::JSONExtract(_) => "j_s_o_n_extract",
2615 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2616 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2617 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2618 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2619 Expression::JSONFormat(_) => "j_s_o_n_format",
2620 Expression::JSONBool(_) => "j_s_o_n_bool",
2621 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2622 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2623 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2624 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2625 Expression::ParseJSON(_) => "parse_j_s_o_n",
2626 Expression::ParseUrl(_) => "parse_url",
2627 Expression::ParseIp(_) => "parse_ip",
2628 Expression::ParseTime(_) => "parse_time",
2629 Expression::ParseDatetime(_) => "parse_datetime",
2630 Expression::Map(_) => "map",
2631 Expression::MapCat(_) => "map_cat",
2632 Expression::MapDelete(_) => "map_delete",
2633 Expression::MapInsert(_) => "map_insert",
2634 Expression::MapPick(_) => "map_pick",
2635 Expression::ScopeResolution(_) => "scope_resolution",
2636 Expression::Slice(_) => "slice",
2637 Expression::VarMap(_) => "var_map",
2638 Expression::MatchAgainst(_) => "match_against",
2639 Expression::MD5Digest(_) => "m_d5_digest",
2640 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2641 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2642 Expression::Monthname(_) => "monthname",
2643 Expression::Ntile(_) => "ntile",
2644 Expression::Normalize(_) => "normalize",
2645 Expression::Normal(_) => "normal",
2646 Expression::Predict(_) => "predict",
2647 Expression::MLTranslate(_) => "m_l_translate",
2648 Expression::FeaturesAtTime(_) => "features_at_time",
2649 Expression::GenerateEmbedding(_) => "generate_embedding",
2650 Expression::MLForecast(_) => "m_l_forecast",
2651 Expression::ModelAttribute(_) => "model_attribute",
2652 Expression::VectorSearch(_) => "vector_search",
2653 Expression::Quantile(_) => "quantile",
2654 Expression::ApproxQuantile(_) => "approx_quantile",
2655 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2656 Expression::Randn(_) => "randn",
2657 Expression::Randstr(_) => "randstr",
2658 Expression::RangeN(_) => "range_n",
2659 Expression::RangeBucket(_) => "range_bucket",
2660 Expression::ReadCSV(_) => "read_c_s_v",
2661 Expression::ReadParquet(_) => "read_parquet",
2662 Expression::Reduce(_) => "reduce",
2663 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2664 Expression::RegexpILike(_) => "regexp_i_like",
2665 Expression::RegexpFullMatch(_) => "regexp_full_match",
2666 Expression::RegexpInstr(_) => "regexp_instr",
2667 Expression::RegexpSplit(_) => "regexp_split",
2668 Expression::RegexpCount(_) => "regexp_count",
2669 Expression::RegrValx(_) => "regr_valx",
2670 Expression::RegrValy(_) => "regr_valy",
2671 Expression::RegrAvgy(_) => "regr_avgy",
2672 Expression::RegrAvgx(_) => "regr_avgx",
2673 Expression::RegrCount(_) => "regr_count",
2674 Expression::RegrIntercept(_) => "regr_intercept",
2675 Expression::RegrR2(_) => "regr_r2",
2676 Expression::RegrSxx(_) => "regr_sxx",
2677 Expression::RegrSxy(_) => "regr_sxy",
2678 Expression::RegrSyy(_) => "regr_syy",
2679 Expression::RegrSlope(_) => "regr_slope",
2680 Expression::SafeAdd(_) => "safe_add",
2681 Expression::SafeDivide(_) => "safe_divide",
2682 Expression::SafeMultiply(_) => "safe_multiply",
2683 Expression::SafeSubtract(_) => "safe_subtract",
2684 Expression::SHA2(_) => "s_h_a2",
2685 Expression::SHA2Digest(_) => "s_h_a2_digest",
2686 Expression::SortArray(_) => "sort_array",
2687 Expression::SplitPart(_) => "split_part",
2688 Expression::SubstringIndex(_) => "substring_index",
2689 Expression::StandardHash(_) => "standard_hash",
2690 Expression::StrPosition(_) => "str_position",
2691 Expression::Search(_) => "search",
2692 Expression::SearchIp(_) => "search_ip",
2693 Expression::StrToDate(_) => "str_to_date",
2694 Expression::DateStrToDate(_) => "date_str_to_date",
2695 Expression::DateToDateStr(_) => "date_to_date_str",
2696 Expression::StrToTime(_) => "str_to_time",
2697 Expression::StrToUnix(_) => "str_to_unix",
2698 Expression::StrToMap(_) => "str_to_map",
2699 Expression::NumberToStr(_) => "number_to_str",
2700 Expression::FromBase(_) => "from_base",
2701 Expression::Stuff(_) => "stuff",
2702 Expression::TimeToStr(_) => "time_to_str",
2703 Expression::TimeStrToTime(_) => "time_str_to_time",
2704 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2705 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2706 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2707 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2708 Expression::Unhex(_) => "unhex",
2709 Expression::Uniform(_) => "uniform",
2710 Expression::UnixToStr(_) => "unix_to_str",
2711 Expression::UnixToTime(_) => "unix_to_time",
2712 Expression::Uuid(_) => "uuid",
2713 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2714 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2715 Expression::Corr(_) => "corr",
2716 Expression::WidthBucket(_) => "width_bucket",
2717 Expression::CovarSamp(_) => "covar_samp",
2718 Expression::CovarPop(_) => "covar_pop",
2719 Expression::Week(_) => "week",
2720 Expression::XMLElement(_) => "x_m_l_element",
2721 Expression::XMLGet(_) => "x_m_l_get",
2722 Expression::XMLTable(_) => "x_m_l_table",
2723 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2724 Expression::Zipf(_) => "zipf",
2725 Expression::Merge(_) => "merge",
2726 Expression::When(_) => "when",
2727 Expression::Whens(_) => "whens",
2728 Expression::NextValueFor(_) => "next_value_for",
2729 Expression::ReturnStmt(_) => "return_stmt",
2730 }
2731 }
2732
2733 pub fn get_this(&self) -> Option<&Expression> {
2735 match self {
2736 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2738 Expression::Upper(f) | Expression::Lower(f) | Expression::Length(f)
2740 | Expression::LTrim(f) | Expression::RTrim(f) | Expression::Reverse(f)
2741 | Expression::Abs(f) | Expression::Sqrt(f) | Expression::Cbrt(f)
2742 | Expression::Ln(f) | Expression::Exp(f) | Expression::Sign(f)
2743 | Expression::Date(f) | Expression::Time(f) | Expression::Initcap(f)
2744 | Expression::Ascii(f) | Expression::Chr(f) | Expression::Soundex(f)
2745 | Expression::ByteLength(f) | Expression::Hex(f) | Expression::LowerHex(f)
2746 | Expression::Unicode(f) | Expression::Typeof(f)
2747 | Expression::Explode(f) | Expression::ExplodeOuter(f)
2748 | Expression::MapFromEntries(f) | Expression::MapKeys(f) | Expression::MapValues(f)
2749 | Expression::ArrayLength(f) | Expression::ArraySize(f) | Expression::Cardinality(f)
2750 | Expression::ArrayReverse(f) | Expression::ArrayDistinct(f)
2751 | Expression::ArrayFlatten(f) | Expression::ArrayCompact(f) | Expression::ToArray(f)
2752 | Expression::JsonArrayLength(f) | Expression::JsonKeys(f) | Expression::JsonType(f)
2753 | Expression::ParseJson(f) | Expression::ToJson(f)
2754 | Expression::Radians(f) | Expression::Degrees(f)
2755 | Expression::Sin(f) | Expression::Cos(f) | Expression::Tan(f)
2756 | Expression::Asin(f) | Expression::Acos(f) | Expression::Atan(f)
2757 | Expression::IsNan(f) | Expression::IsInf(f)
2758 | Expression::Year(f) | Expression::Month(f) | Expression::Day(f)
2759 | Expression::Hour(f) | Expression::Minute(f) | Expression::Second(f)
2760 | Expression::DayOfWeek(f) | Expression::DayOfWeekIso(f)
2761 | Expression::DayOfMonth(f) | Expression::DayOfYear(f)
2762 | Expression::WeekOfYear(f) | Expression::Quarter(f)
2763 | Expression::Epoch(f) | Expression::EpochMs(f)
2764 | Expression::BitwiseCount(f)
2765 | Expression::DateFromUnixDate(f) | Expression::UnixDate(f)
2766 | Expression::UnixSeconds(f) | Expression::UnixMillis(f) | Expression::UnixMicros(f)
2767 | Expression::TimeStrToDate(f) | Expression::DateToDi(f) | Expression::DiToDate(f)
2768 | Expression::TsOrDiToDi(f) | Expression::TsOrDsToDatetime(f) | Expression::TsOrDsToTimestamp(f)
2769 | Expression::YearOfWeek(f) | Expression::YearOfWeekIso(f)
2770 | Expression::SHA(f) | Expression::SHA1Digest(f)
2771 | Expression::TimeToUnix(f) | Expression::TimeStrToUnix(f)
2772 | Expression::Int64(f) | Expression::JSONBool(f)
2773 | Expression::MD5NumberLower64(f) | Expression::MD5NumberUpper64(f)
2774 | Expression::DateStrToDate(f) | Expression::DateToDateStr(f)
2775 => Some(&f.this),
2776 Expression::Power(f) | Expression::NullIf(f) | Expression::IfNull(f)
2778 | Expression::Nvl(f) | Expression::Contains(f)
2779 | Expression::StartsWith(f) | Expression::EndsWith(f)
2780 | Expression::Levenshtein(f) | Expression::ModFunc(f) | Expression::IntDiv(f)
2781 | Expression::Atan2(f) | Expression::AddMonths(f) | Expression::MonthsBetween(f)
2782 | Expression::NextDay(f) | Expression::UnixToTimeStr(f)
2783 | Expression::ArrayContains(f) | Expression::ArrayPosition(f)
2784 | Expression::ArrayAppend(f) | Expression::ArrayPrepend(f)
2785 | Expression::ArrayUnion(f) | Expression::ArrayExcept(f)
2786 | Expression::ArrayRemove(f) | Expression::StarMap(f)
2787 | Expression::MapFromArrays(f) | Expression::MapContainsKey(f)
2788 | Expression::ElementAt(f) | Expression::JsonMergePatch(f)
2789 | Expression::JSONBContains(f) | Expression::JSONBExtract(f)
2790 => Some(&f.this),
2791 Expression::Sum(af) | Expression::Avg(af) | Expression::Min(af) | Expression::Max(af)
2793 | Expression::ArrayAgg(af) | Expression::CountIf(af)
2794 | Expression::Stddev(af) | Expression::StddevPop(af) | Expression::StddevSamp(af)
2795 | Expression::Variance(af) | Expression::VarPop(af) | Expression::VarSamp(af)
2796 | Expression::Median(af) | Expression::Mode(af)
2797 | Expression::First(af) | Expression::Last(af) | Expression::AnyValue(af)
2798 | Expression::ApproxDistinct(af) | Expression::ApproxCountDistinct(af)
2799 | Expression::LogicalAnd(af) | Expression::LogicalOr(af) | Expression::Skewness(af)
2800 | Expression::ArrayConcatAgg(af) | Expression::ArrayUniqueAgg(af) | Expression::BoolXorAgg(af)
2801 | Expression::BitwiseAndAgg(af) | Expression::BitwiseOrAgg(af) | Expression::BitwiseXorAgg(af)
2802 => Some(&af.this),
2803 Expression::And(op) | Expression::Or(op) | Expression::Add(op)
2805 | Expression::Sub(op) | Expression::Mul(op) | Expression::Div(op)
2806 | Expression::Mod(op) | Expression::Eq(op) | Expression::Neq(op)
2807 | Expression::Lt(op) | Expression::Lte(op) | Expression::Gt(op)
2808 | Expression::Gte(op) | Expression::BitwiseAnd(op) | Expression::BitwiseOr(op)
2809 | Expression::BitwiseXor(op) | Expression::Concat(op)
2810 | Expression::Adjacent(op) | Expression::TsMatch(op) | Expression::PropertyEQ(op)
2811 | Expression::ArrayContainsAll(op) | Expression::ArrayContainedBy(op)
2812 | Expression::ArrayOverlaps(op) | Expression::JSONBContainsAllTopKeys(op)
2813 | Expression::JSONBContainsAnyTopKeys(op) | Expression::JSONBDeleteAtPath(op)
2814 | Expression::ExtendsLeft(op) | Expression::ExtendsRight(op)
2815 | Expression::Is(op) | Expression::MemberOf(op) | Expression::Match(op)
2816 | Expression::NullSafeEq(op) | Expression::NullSafeNeq(op) | Expression::Glob(op)
2817 | Expression::BitwiseLeftShift(op) | Expression::BitwiseRightShift(op)
2818 => Some(&op.left),
2819 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2821 Expression::Alias(a) => Some(&a.this),
2823 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2824 Expression::Paren(p) => Some(&p.this),
2825 Expression::Annotated(a) => Some(&a.this),
2826 Expression::Subquery(s) => Some(&s.this),
2827 Expression::Where(w) => Some(&w.this),
2828 Expression::Having(h) => Some(&h.this),
2829 Expression::Qualify(q) => Some(&q.this),
2830 Expression::IsNull(i) => Some(&i.this),
2831 Expression::Exists(e) => Some(&e.this),
2832 Expression::Ordered(o) => Some(&o.this),
2833 Expression::WindowFunction(wf) => Some(&wf.this),
2834 Expression::Cte(cte) => Some(&cte.this),
2835 Expression::Between(b) => Some(&b.this),
2836 Expression::In(i) => Some(&i.this),
2837 Expression::ReturnStmt(e) => Some(e),
2838 _ => None,
2839 }
2840 }
2841
2842 pub fn get_expression(&self) -> Option<&Expression> {
2844 match self {
2845 Expression::And(op) | Expression::Or(op) | Expression::Add(op)
2847 | Expression::Sub(op) | Expression::Mul(op) | Expression::Div(op)
2848 | Expression::Mod(op) | Expression::Eq(op) | Expression::Neq(op)
2849 | Expression::Lt(op) | Expression::Lte(op) | Expression::Gt(op)
2850 | Expression::Gte(op) | Expression::BitwiseAnd(op) | Expression::BitwiseOr(op)
2851 | Expression::BitwiseXor(op) | Expression::Concat(op)
2852 | Expression::Adjacent(op) | Expression::TsMatch(op) | Expression::PropertyEQ(op)
2853 | Expression::ArrayContainsAll(op) | Expression::ArrayContainedBy(op)
2854 | Expression::ArrayOverlaps(op) | Expression::JSONBContainsAllTopKeys(op)
2855 | Expression::JSONBContainsAnyTopKeys(op) | Expression::JSONBDeleteAtPath(op)
2856 | Expression::ExtendsLeft(op) | Expression::ExtendsRight(op)
2857 | Expression::Is(op) | Expression::MemberOf(op) | Expression::Match(op)
2858 | Expression::NullSafeEq(op) | Expression::NullSafeNeq(op) | Expression::Glob(op)
2859 | Expression::BitwiseLeftShift(op) | Expression::BitwiseRightShift(op)
2860 => Some(&op.right),
2861 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
2863 Expression::Power(f) | Expression::NullIf(f) | Expression::IfNull(f)
2865 | Expression::Nvl(f) | Expression::Contains(f)
2866 | Expression::StartsWith(f) | Expression::EndsWith(f)
2867 | Expression::Levenshtein(f) | Expression::ModFunc(f) | Expression::IntDiv(f)
2868 | Expression::Atan2(f) | Expression::AddMonths(f) | Expression::MonthsBetween(f)
2869 | Expression::NextDay(f) | Expression::UnixToTimeStr(f)
2870 | Expression::ArrayContains(f) | Expression::ArrayPosition(f)
2871 | Expression::ArrayAppend(f) | Expression::ArrayPrepend(f)
2872 | Expression::ArrayUnion(f) | Expression::ArrayExcept(f)
2873 | Expression::ArrayRemove(f) | Expression::StarMap(f)
2874 | Expression::MapFromArrays(f) | Expression::MapContainsKey(f)
2875 | Expression::ElementAt(f) | Expression::JsonMergePatch(f)
2876 | Expression::JSONBContains(f) | Expression::JSONBExtract(f)
2877 => Some(&f.expression),
2878 _ => None,
2879 }
2880 }
2881
2882 pub fn get_expressions(&self) -> &[Expression] {
2884 match self {
2885 Expression::Select(s) => &s.expressions,
2886 Expression::Function(f) => &f.args,
2887 Expression::AggregateFunction(f) => &f.args,
2888 Expression::From(f) => &f.expressions,
2889 Expression::GroupBy(g) => &g.expressions,
2890 Expression::In(i) => &i.expressions,
2891 Expression::Array(a) => &a.expressions,
2892 Expression::Tuple(t) => &t.expressions,
2893 Expression::Coalesce(f) | Expression::Greatest(f) | Expression::Least(f)
2894 | Expression::ArrayConcat(f) | Expression::ArrayIntersect(f)
2895 | Expression::ArrayZip(f) | Expression::MapConcat(f)
2896 | Expression::JsonArray(f) => &f.expressions,
2897 _ => &[],
2898 }
2899 }
2900
2901 pub fn get_name(&self) -> &str {
2903 match self {
2904 Expression::Identifier(id) => &id.name,
2905 Expression::Column(col) => &col.name.name,
2906 Expression::Table(t) => &t.name.name,
2907 Expression::Literal(lit) => lit.value_str(),
2908 Expression::Star(_) => "*",
2909 Expression::Function(f) => &f.name,
2910 Expression::AggregateFunction(f) => &f.name,
2911 Expression::Alias(a) => a.this.get_name(),
2912 Expression::Boolean(b) => if b.value { "TRUE" } else { "FALSE" },
2913 Expression::Null(_) => "NULL",
2914 _ => "",
2915 }
2916 }
2917
2918 pub fn get_alias(&self) -> &str {
2920 match self {
2921 Expression::Alias(a) => &a.alias.name,
2922 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
2923 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
2924 _ => "",
2925 }
2926 }
2927
2928 pub fn get_output_name(&self) -> &str {
2930 match self {
2931 Expression::Alias(a) => &a.alias.name,
2932 Expression::Column(c) => &c.name.name,
2933 Expression::Identifier(id) => &id.name,
2934 Expression::Literal(lit) => lit.value_str(),
2935 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
2936 Expression::Star(_) => "*",
2937 _ => "",
2938 }
2939 }
2940
2941 pub fn get_comments(&self) -> Vec<&str> {
2943 match self {
2944 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
2945 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
2946 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
2947 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
2948 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
2949 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
2950 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
2951 Expression::And(op) | Expression::Or(op) | Expression::Add(op)
2952 | Expression::Sub(op) | Expression::Mul(op) | Expression::Div(op)
2953 | Expression::Mod(op) | Expression::Eq(op) | Expression::Neq(op)
2954 | Expression::Lt(op) | Expression::Lte(op) | Expression::Gt(op)
2955 | Expression::Gte(op) | Expression::Concat(op)
2956 | Expression::BitwiseAnd(op) | Expression::BitwiseOr(op) | Expression::BitwiseXor(op)
2957 => op.trailing_comments.iter().map(|s| s.as_str()).collect(),
2958 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
2959 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
2960 _ => Vec::new(),
2961 }
2962 }
2963}
2964
2965impl fmt::Display for Expression {
2966 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2967 match self {
2969 Expression::Literal(lit) => write!(f, "{}", lit),
2970 Expression::Identifier(id) => write!(f, "{}", id),
2971 Expression::Column(col) => write!(f, "{}", col),
2972 Expression::Star(_) => write!(f, "*"),
2973 Expression::Null(_) => write!(f, "NULL"),
2974 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
2975 Expression::Select(_) => write!(f, "SELECT ..."),
2976 _ => write!(f, "{:?}", self),
2977 }
2978 }
2979}
2980
2981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2991#[cfg_attr(feature = "bindings", derive(TS))]
2992#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
2993pub enum Literal {
2994 String(String),
2996 Number(String),
2998 HexString(String),
3000 HexNumber(String),
3002 BitString(String),
3003 ByteString(String),
3005 NationalString(String),
3007 Date(String),
3009 Time(String),
3011 Timestamp(String),
3013 Datetime(String),
3015 TripleQuotedString(String, char),
3018 EscapeString(String),
3020 DollarString(String),
3022 RawString(String),
3026}
3027
3028impl Literal {
3029 pub fn value_str(&self) -> &str {
3031 match self {
3032 Literal::String(s)
3033 | Literal::Number(s)
3034 | Literal::HexString(s)
3035 | Literal::HexNumber(s)
3036 | Literal::BitString(s)
3037 | Literal::ByteString(s)
3038 | Literal::NationalString(s)
3039 | Literal::Date(s)
3040 | Literal::Time(s)
3041 | Literal::Timestamp(s)
3042 | Literal::Datetime(s)
3043 | Literal::EscapeString(s)
3044 | Literal::DollarString(s)
3045 | Literal::RawString(s) => s.as_str(),
3046 Literal::TripleQuotedString(s, _) => s.as_str(),
3047 }
3048 }
3049
3050 pub fn is_string(&self) -> bool {
3052 matches!(
3053 self,
3054 Literal::String(_)
3055 | Literal::NationalString(_)
3056 | Literal::EscapeString(_)
3057 | Literal::DollarString(_)
3058 | Literal::RawString(_)
3059 | Literal::TripleQuotedString(_, _)
3060 )
3061 }
3062
3063 pub fn is_number(&self) -> bool {
3065 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3066 }
3067}
3068
3069impl fmt::Display for Literal {
3070 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3071 match self {
3072 Literal::String(s) => write!(f, "'{}'", s),
3073 Literal::Number(n) => write!(f, "{}", n),
3074 Literal::HexString(h) => write!(f, "X'{}'", h),
3075 Literal::HexNumber(h) => write!(f, "0x{}", h),
3076 Literal::BitString(b) => write!(f, "B'{}'", b),
3077 Literal::ByteString(b) => write!(f, "b'{}'", b),
3078 Literal::NationalString(s) => write!(f, "N'{}'", s),
3079 Literal::Date(d) => write!(f, "DATE '{}'", d),
3080 Literal::Time(t) => write!(f, "TIME '{}'", t),
3081 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3082 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3083 Literal::TripleQuotedString(s, q) => {
3084 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3085 }
3086 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3087 Literal::DollarString(s) => write!(f, "$${}$$", s),
3088 Literal::RawString(s) => write!(f, "r'{}'", s),
3089 }
3090 }
3091}
3092
3093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3095#[cfg_attr(feature = "bindings", derive(TS))]
3096pub struct BooleanLiteral {
3097 pub value: bool,
3098}
3099
3100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3102#[cfg_attr(feature = "bindings", derive(TS))]
3103pub struct Null;
3104
3105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3112#[cfg_attr(feature = "bindings", derive(TS))]
3113pub struct Identifier {
3114 pub name: String,
3116 pub quoted: bool,
3118 #[serde(default)]
3119 pub trailing_comments: Vec<String>,
3120 #[serde(default, skip_serializing_if = "Option::is_none")]
3122 pub span: Option<Span>,
3123}
3124
3125impl Identifier {
3126 pub fn new(name: impl Into<String>) -> Self {
3127 Self {
3128 name: name.into(),
3129 quoted: false,
3130 trailing_comments: Vec::new(),
3131 span: None,
3132 }
3133 }
3134
3135 pub fn quoted(name: impl Into<String>) -> Self {
3136 Self {
3137 name: name.into(),
3138 quoted: true,
3139 trailing_comments: Vec::new(),
3140 span: None,
3141 }
3142 }
3143
3144 pub fn empty() -> Self {
3145 Self {
3146 name: String::new(),
3147 quoted: false,
3148 trailing_comments: Vec::new(),
3149 span: None,
3150 }
3151 }
3152
3153 pub fn is_empty(&self) -> bool {
3154 self.name.is_empty()
3155 }
3156
3157 pub fn with_span(mut self, span: Span) -> Self {
3159 self.span = Some(span);
3160 self
3161 }
3162}
3163
3164impl fmt::Display for Identifier {
3165 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3166 if self.quoted {
3167 write!(f, "\"{}\"", self.name)
3168 } else {
3169 write!(f, "{}", self.name)
3170 }
3171 }
3172}
3173
3174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3180#[cfg_attr(feature = "bindings", derive(TS))]
3181pub struct Column {
3182 pub name: Identifier,
3184 pub table: Option<Identifier>,
3186 #[serde(default)]
3188 pub join_mark: bool,
3189 #[serde(default)]
3191 pub trailing_comments: Vec<String>,
3192 #[serde(default, skip_serializing_if = "Option::is_none")]
3194 pub span: Option<Span>,
3195 #[serde(default, skip_serializing_if = "Option::is_none")]
3197 pub inferred_type: Option<DataType>,
3198}
3199
3200impl fmt::Display for Column {
3201 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3202 if let Some(table) = &self.table {
3203 write!(f, "{}.{}", table, self.name)
3204 } else {
3205 write!(f, "{}", self.name)
3206 }
3207 }
3208}
3209
3210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3217#[cfg_attr(feature = "bindings", derive(TS))]
3218pub struct TableRef {
3219 pub name: Identifier,
3221 pub schema: Option<Identifier>,
3223 pub catalog: Option<Identifier>,
3225 pub alias: Option<Identifier>,
3227 #[serde(default)]
3229 pub alias_explicit_as: bool,
3230 #[serde(default)]
3232 pub column_aliases: Vec<Identifier>,
3233 #[serde(default)]
3235 pub trailing_comments: Vec<String>,
3236 #[serde(default)]
3238 pub when: Option<Box<HistoricalData>>,
3239 #[serde(default)]
3241 pub only: bool,
3242 #[serde(default)]
3244 pub final_: bool,
3245 #[serde(default, skip_serializing_if = "Option::is_none")]
3247 pub table_sample: Option<Box<Sample>>,
3248 #[serde(default)]
3250 pub hints: Vec<Expression>,
3251 #[serde(default, skip_serializing_if = "Option::is_none")]
3254 pub system_time: Option<String>,
3255 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3257 pub partitions: Vec<Identifier>,
3258 #[serde(default, skip_serializing_if = "Option::is_none")]
3261 pub identifier_func: Option<Box<Expression>>,
3262 #[serde(default, skip_serializing_if = "Option::is_none")]
3264 pub changes: Option<Box<Changes>>,
3265 #[serde(default, skip_serializing_if = "Option::is_none")]
3267 pub version: Option<Box<Version>>,
3268 #[serde(default, skip_serializing_if = "Option::is_none")]
3270 pub span: Option<Span>,
3271}
3272
3273impl TableRef {
3274 pub fn new(name: impl Into<String>) -> Self {
3275 Self {
3276 name: Identifier::new(name),
3277 schema: None,
3278 catalog: None,
3279 alias: None,
3280 alias_explicit_as: false,
3281 column_aliases: Vec::new(),
3282 trailing_comments: Vec::new(),
3283 when: None,
3284 only: false,
3285 final_: false,
3286 table_sample: None,
3287 hints: Vec::new(),
3288 system_time: None,
3289 partitions: Vec::new(),
3290 identifier_func: None,
3291 changes: None,
3292 version: None,
3293 span: None,
3294 }
3295 }
3296
3297 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3299 let mut t = Self::new(name);
3300 t.schema = Some(Identifier::new(schema));
3301 t
3302 }
3303
3304 pub fn new_with_catalog(
3306 name: impl Into<String>,
3307 schema: impl Into<String>,
3308 catalog: impl Into<String>,
3309 ) -> Self {
3310 let mut t = Self::new(name);
3311 t.schema = Some(Identifier::new(schema));
3312 t.catalog = Some(Identifier::new(catalog));
3313 t
3314 }
3315
3316 pub fn from_identifier(name: Identifier) -> Self {
3318 Self {
3319 name,
3320 schema: None,
3321 catalog: None,
3322 alias: None,
3323 alias_explicit_as: false,
3324 column_aliases: Vec::new(),
3325 trailing_comments: Vec::new(),
3326 when: None,
3327 only: false,
3328 final_: false,
3329 table_sample: None,
3330 hints: Vec::new(),
3331 system_time: None,
3332 partitions: Vec::new(),
3333 identifier_func: None,
3334 changes: None,
3335 version: None,
3336 span: None,
3337 }
3338 }
3339
3340 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3341 self.alias = Some(Identifier::new(alias));
3342 self
3343 }
3344
3345 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3346 self.schema = Some(Identifier::new(schema));
3347 self
3348 }
3349}
3350
3351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3356#[cfg_attr(feature = "bindings", derive(TS))]
3357pub struct Star {
3358 pub table: Option<Identifier>,
3360 pub except: Option<Vec<Identifier>>,
3362 pub replace: Option<Vec<Alias>>,
3364 pub rename: Option<Vec<(Identifier, Identifier)>>,
3366 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3368 pub trailing_comments: Vec<String>,
3369 #[serde(default, skip_serializing_if = "Option::is_none")]
3371 pub span: Option<Span>,
3372}
3373
3374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3398#[cfg_attr(feature = "bindings", derive(TS))]
3399pub struct Select {
3400 pub expressions: Vec<Expression>,
3402 pub from: Option<From>,
3404 pub joins: Vec<Join>,
3406 pub lateral_views: Vec<LateralView>,
3407 #[serde(default, skip_serializing_if = "Option::is_none")]
3409 pub prewhere: Option<Expression>,
3410 pub where_clause: Option<Where>,
3411 pub group_by: Option<GroupBy>,
3412 pub having: Option<Having>,
3413 pub qualify: Option<Qualify>,
3414 pub order_by: Option<OrderBy>,
3415 pub distribute_by: Option<DistributeBy>,
3416 pub cluster_by: Option<ClusterBy>,
3417 pub sort_by: Option<SortBy>,
3418 pub limit: Option<Limit>,
3419 pub offset: Option<Offset>,
3420 #[serde(default, skip_serializing_if = "Option::is_none")]
3422 pub limit_by: Option<Vec<Expression>>,
3423 pub fetch: Option<Fetch>,
3424 pub distinct: bool,
3425 pub distinct_on: Option<Vec<Expression>>,
3426 pub top: Option<Top>,
3427 pub with: Option<With>,
3428 pub sample: Option<Sample>,
3429 #[serde(default, skip_serializing_if = "Option::is_none")]
3431 pub settings: Option<Vec<Expression>>,
3432 #[serde(default, skip_serializing_if = "Option::is_none")]
3434 pub format: Option<Expression>,
3435 pub windows: Option<Vec<NamedWindow>>,
3436 pub hint: Option<Hint>,
3437 pub connect: Option<Connect>,
3439 pub into: Option<SelectInto>,
3441 #[serde(default)]
3443 pub locks: Vec<Lock>,
3444 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3446 pub for_xml: Vec<Expression>,
3447 #[serde(default)]
3449 pub leading_comments: Vec<String>,
3450 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3453 pub post_select_comments: Vec<String>,
3454 #[serde(default, skip_serializing_if = "Option::is_none")]
3456 pub kind: Option<String>,
3457 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3459 pub operation_modifiers: Vec<String>,
3460 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3462 pub qualify_after_window: bool,
3463 #[serde(default, skip_serializing_if = "Option::is_none")]
3465 pub option: Option<String>,
3466 #[serde(default, skip_serializing_if = "Option::is_none")]
3469 pub exclude: Option<Vec<Expression>>,
3470}
3471
3472impl Select {
3473 pub fn new() -> Self {
3474 Self {
3475 expressions: Vec::new(),
3476 from: None,
3477 joins: Vec::new(),
3478 lateral_views: Vec::new(),
3479 prewhere: None,
3480 where_clause: None,
3481 group_by: None,
3482 having: None,
3483 qualify: None,
3484 order_by: None,
3485 distribute_by: None,
3486 cluster_by: None,
3487 sort_by: None,
3488 limit: None,
3489 offset: None,
3490 limit_by: None,
3491 fetch: None,
3492 distinct: false,
3493 distinct_on: None,
3494 top: None,
3495 with: None,
3496 sample: None,
3497 settings: None,
3498 format: None,
3499 windows: None,
3500 hint: None,
3501 connect: None,
3502 into: None,
3503 locks: Vec::new(),
3504 for_xml: Vec::new(),
3505 leading_comments: Vec::new(),
3506 post_select_comments: Vec::new(),
3507 kind: None,
3508 operation_modifiers: Vec::new(),
3509 qualify_after_window: false,
3510 option: None,
3511 exclude: None,
3512 }
3513 }
3514
3515 pub fn column(mut self, expr: Expression) -> Self {
3517 self.expressions.push(expr);
3518 self
3519 }
3520
3521 pub fn from(mut self, table: Expression) -> Self {
3523 self.from = Some(From {
3524 expressions: vec![table],
3525 });
3526 self
3527 }
3528
3529 pub fn where_(mut self, condition: Expression) -> Self {
3531 self.where_clause = Some(Where { this: condition });
3532 self
3533 }
3534
3535 pub fn distinct(mut self) -> Self {
3537 self.distinct = true;
3538 self
3539 }
3540
3541 pub fn join(mut self, join: Join) -> Self {
3543 self.joins.push(join);
3544 self
3545 }
3546
3547 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3549 self.order_by = Some(OrderBy {
3550 expressions,
3551 siblings: false,
3552 comments: Vec::new(),
3553 });
3554 self
3555 }
3556
3557 pub fn limit(mut self, n: Expression) -> Self {
3559 self.limit = Some(Limit {
3560 this: n,
3561 percent: false,
3562 comments: Vec::new(),
3563 });
3564 self
3565 }
3566
3567 pub fn offset(mut self, n: Expression) -> Self {
3569 self.offset = Some(Offset {
3570 this: n,
3571 rows: None,
3572 });
3573 self
3574 }
3575}
3576
3577impl Default for Select {
3578 fn default() -> Self {
3579 Self::new()
3580 }
3581}
3582
3583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3589#[cfg_attr(feature = "bindings", derive(TS))]
3590pub struct Union {
3591 pub left: Expression,
3593 pub right: Expression,
3595 pub all: bool,
3597 #[serde(default)]
3599 pub distinct: bool,
3600 pub with: Option<With>,
3602 pub order_by: Option<OrderBy>,
3604 pub limit: Option<Box<Expression>>,
3606 pub offset: Option<Box<Expression>>,
3608 #[serde(default, skip_serializing_if = "Option::is_none")]
3610 pub distribute_by: Option<DistributeBy>,
3611 #[serde(default, skip_serializing_if = "Option::is_none")]
3613 pub sort_by: Option<SortBy>,
3614 #[serde(default, skip_serializing_if = "Option::is_none")]
3616 pub cluster_by: Option<ClusterBy>,
3617 #[serde(default)]
3619 pub by_name: bool,
3620 #[serde(default, skip_serializing_if = "Option::is_none")]
3622 pub side: Option<String>,
3623 #[serde(default, skip_serializing_if = "Option::is_none")]
3625 pub kind: Option<String>,
3626 #[serde(default)]
3628 pub corresponding: bool,
3629 #[serde(default)]
3631 pub strict: bool,
3632 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub on_columns: Vec<Expression>,
3635}
3636
3637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3642#[cfg_attr(feature = "bindings", derive(TS))]
3643pub struct Intersect {
3644 pub left: Expression,
3646 pub right: Expression,
3648 pub all: bool,
3650 #[serde(default)]
3652 pub distinct: bool,
3653 pub with: Option<With>,
3655 pub order_by: Option<OrderBy>,
3657 pub limit: Option<Box<Expression>>,
3659 pub offset: Option<Box<Expression>>,
3661 #[serde(default, skip_serializing_if = "Option::is_none")]
3663 pub distribute_by: Option<DistributeBy>,
3664 #[serde(default, skip_serializing_if = "Option::is_none")]
3666 pub sort_by: Option<SortBy>,
3667 #[serde(default, skip_serializing_if = "Option::is_none")]
3669 pub cluster_by: Option<ClusterBy>,
3670 #[serde(default)]
3672 pub by_name: bool,
3673 #[serde(default, skip_serializing_if = "Option::is_none")]
3675 pub side: Option<String>,
3676 #[serde(default, skip_serializing_if = "Option::is_none")]
3678 pub kind: Option<String>,
3679 #[serde(default)]
3681 pub corresponding: bool,
3682 #[serde(default)]
3684 pub strict: bool,
3685 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3687 pub on_columns: Vec<Expression>,
3688}
3689
3690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3695#[cfg_attr(feature = "bindings", derive(TS))]
3696pub struct Except {
3697 pub left: Expression,
3699 pub right: Expression,
3701 pub all: bool,
3703 #[serde(default)]
3705 pub distinct: bool,
3706 pub with: Option<With>,
3708 pub order_by: Option<OrderBy>,
3710 pub limit: Option<Box<Expression>>,
3712 pub offset: Option<Box<Expression>>,
3714 #[serde(default, skip_serializing_if = "Option::is_none")]
3716 pub distribute_by: Option<DistributeBy>,
3717 #[serde(default, skip_serializing_if = "Option::is_none")]
3719 pub sort_by: Option<SortBy>,
3720 #[serde(default, skip_serializing_if = "Option::is_none")]
3722 pub cluster_by: Option<ClusterBy>,
3723 #[serde(default)]
3725 pub by_name: bool,
3726 #[serde(default, skip_serializing_if = "Option::is_none")]
3728 pub side: Option<String>,
3729 #[serde(default, skip_serializing_if = "Option::is_none")]
3731 pub kind: Option<String>,
3732 #[serde(default)]
3734 pub corresponding: bool,
3735 #[serde(default)]
3737 pub strict: bool,
3738 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3740 pub on_columns: Vec<Expression>,
3741}
3742
3743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3745#[cfg_attr(feature = "bindings", derive(TS))]
3746pub struct SelectInto {
3747 pub this: Expression,
3749 #[serde(default)]
3751 pub temporary: bool,
3752 #[serde(default)]
3754 pub unlogged: bool,
3755 #[serde(default)]
3757 pub bulk_collect: bool,
3758 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3760 pub expressions: Vec<Expression>,
3761}
3762
3763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3773#[cfg_attr(feature = "bindings", derive(TS))]
3774pub struct Subquery {
3775 pub this: Expression,
3777 pub alias: Option<Identifier>,
3779 pub column_aliases: Vec<Identifier>,
3781 pub order_by: Option<OrderBy>,
3783 pub limit: Option<Limit>,
3785 pub offset: Option<Offset>,
3787 #[serde(default, skip_serializing_if = "Option::is_none")]
3789 pub distribute_by: Option<DistributeBy>,
3790 #[serde(default, skip_serializing_if = "Option::is_none")]
3792 pub sort_by: Option<SortBy>,
3793 #[serde(default, skip_serializing_if = "Option::is_none")]
3795 pub cluster_by: Option<ClusterBy>,
3796 #[serde(default)]
3798 pub lateral: bool,
3799 #[serde(default)]
3803 pub modifiers_inside: bool,
3804 #[serde(default)]
3806 pub trailing_comments: Vec<String>,
3807 #[serde(default, skip_serializing_if = "Option::is_none")]
3809 pub inferred_type: Option<DataType>,
3810}
3811
3812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3817#[cfg_attr(feature = "bindings", derive(TS))]
3818pub struct PipeOperator {
3819 pub this: Expression,
3821 pub expression: Expression,
3823}
3824
3825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3827#[cfg_attr(feature = "bindings", derive(TS))]
3828pub struct Values {
3829 pub expressions: Vec<Tuple>,
3831 pub alias: Option<Identifier>,
3833 pub column_aliases: Vec<Identifier>,
3835}
3836
3837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3847#[cfg_attr(feature = "bindings", derive(TS))]
3848pub struct Pivot {
3849 pub this: Expression,
3851 #[serde(default)]
3854 pub expressions: Vec<Expression>,
3855 #[serde(default)]
3857 pub fields: Vec<Expression>,
3858 #[serde(default)]
3860 pub using: Vec<Expression>,
3861 #[serde(default)]
3863 pub group: Option<Box<Expression>>,
3864 #[serde(default)]
3866 pub unpivot: bool,
3867 #[serde(default)]
3869 pub into: Option<Box<Expression>>,
3870 #[serde(default)]
3872 pub alias: Option<Identifier>,
3873 #[serde(default)]
3875 pub include_nulls: Option<bool>,
3876 #[serde(default)]
3878 pub default_on_null: Option<Box<Expression>>,
3879 #[serde(default, skip_serializing_if = "Option::is_none")]
3881 pub with: Option<With>,
3882}
3883
3884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3886#[cfg_attr(feature = "bindings", derive(TS))]
3887pub struct Unpivot {
3888 pub this: Expression,
3889 pub value_column: Identifier,
3890 pub name_column: Identifier,
3891 pub columns: Vec<Expression>,
3892 pub alias: Option<Identifier>,
3893 #[serde(default)]
3895 pub value_column_parenthesized: bool,
3896 #[serde(default)]
3898 pub include_nulls: Option<bool>,
3899 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3901 pub extra_value_columns: Vec<Identifier>,
3902}
3903
3904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3907#[cfg_attr(feature = "bindings", derive(TS))]
3908pub struct PivotAlias {
3909 pub this: Expression,
3910 pub alias: Expression,
3911}
3912
3913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3915#[cfg_attr(feature = "bindings", derive(TS))]
3916pub struct PreWhere {
3917 pub this: Expression,
3918}
3919
3920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3922#[cfg_attr(feature = "bindings", derive(TS))]
3923pub struct Stream {
3924 pub this: Expression,
3925 #[serde(skip_serializing_if = "Option::is_none")]
3926 pub on: Option<Expression>,
3927 #[serde(skip_serializing_if = "Option::is_none")]
3928 pub show_initial_rows: Option<bool>,
3929}
3930
3931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3933#[cfg_attr(feature = "bindings", derive(TS))]
3934pub struct UsingData {
3935 pub this: Expression,
3936}
3937
3938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3940#[cfg_attr(feature = "bindings", derive(TS))]
3941pub struct XmlNamespace {
3942 pub this: Expression,
3943 #[serde(skip_serializing_if = "Option::is_none")]
3944 pub alias: Option<Identifier>,
3945}
3946
3947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3949#[cfg_attr(feature = "bindings", derive(TS))]
3950pub struct RowFormat {
3951 pub delimited: bool,
3952 pub fields_terminated_by: Option<String>,
3953 pub collection_items_terminated_by: Option<String>,
3954 pub map_keys_terminated_by: Option<String>,
3955 pub lines_terminated_by: Option<String>,
3956 pub null_defined_as: Option<String>,
3957}
3958
3959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3961#[cfg_attr(feature = "bindings", derive(TS))]
3962pub struct DirectoryInsert {
3963 pub local: bool,
3964 pub path: String,
3965 pub row_format: Option<RowFormat>,
3966 #[serde(default)]
3968 pub stored_as: Option<String>,
3969}
3970
3971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3973#[cfg_attr(feature = "bindings", derive(TS))]
3974pub struct Insert {
3975 pub table: TableRef,
3976 pub columns: Vec<Identifier>,
3977 pub values: Vec<Vec<Expression>>,
3978 pub query: Option<Expression>,
3979 pub overwrite: bool,
3981 pub partition: Vec<(Identifier, Option<Expression>)>,
3983 #[serde(default)]
3985 pub directory: Option<DirectoryInsert>,
3986 #[serde(default)]
3988 pub returning: Vec<Expression>,
3989 #[serde(default)]
3991 pub output: Option<OutputClause>,
3992 #[serde(default)]
3994 pub on_conflict: Option<Box<Expression>>,
3995 #[serde(default)]
3997 pub leading_comments: Vec<String>,
3998 #[serde(default)]
4000 pub if_exists: bool,
4001 #[serde(default)]
4003 pub with: Option<With>,
4004 #[serde(default)]
4006 pub ignore: bool,
4007 #[serde(default)]
4009 pub source_alias: Option<Identifier>,
4010 #[serde(default)]
4012 pub alias: Option<Identifier>,
4013 #[serde(default)]
4015 pub alias_explicit_as: bool,
4016 #[serde(default)]
4018 pub default_values: bool,
4019 #[serde(default)]
4021 pub by_name: bool,
4022 #[serde(default, skip_serializing_if = "Option::is_none")]
4024 pub conflict_action: Option<String>,
4025 #[serde(default)]
4027 pub is_replace: bool,
4028 #[serde(default, skip_serializing_if = "Option::is_none")]
4030 pub hint: Option<Hint>,
4031 #[serde(default)]
4033 pub replace_where: Option<Box<Expression>>,
4034 #[serde(default)]
4036 pub source: Option<Box<Expression>>,
4037 #[serde(default, skip_serializing_if = "Option::is_none")]
4039 pub function_target: Option<Box<Expression>>,
4040 #[serde(default, skip_serializing_if = "Option::is_none")]
4042 pub partition_by: Option<Box<Expression>>,
4043 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4045 pub settings: Vec<Expression>,
4046}
4047
4048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4050#[cfg_attr(feature = "bindings", derive(TS))]
4051pub struct OutputClause {
4052 pub columns: Vec<Expression>,
4054 #[serde(default)]
4056 pub into_table: Option<Expression>,
4057}
4058
4059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4061#[cfg_attr(feature = "bindings", derive(TS))]
4062pub struct Update {
4063 pub table: TableRef,
4064 #[serde(default)]
4066 pub extra_tables: Vec<TableRef>,
4067 #[serde(default)]
4069 pub table_joins: Vec<Join>,
4070 pub set: Vec<(Identifier, Expression)>,
4071 pub from_clause: Option<From>,
4072 #[serde(default)]
4074 pub from_joins: Vec<Join>,
4075 pub where_clause: Option<Where>,
4076 #[serde(default)]
4078 pub returning: Vec<Expression>,
4079 #[serde(default)]
4081 pub output: Option<OutputClause>,
4082 #[serde(default)]
4084 pub with: Option<With>,
4085 #[serde(default)]
4087 pub leading_comments: Vec<String>,
4088 #[serde(default)]
4090 pub limit: Option<Expression>,
4091 #[serde(default)]
4093 pub order_by: Option<OrderBy>,
4094 #[serde(default)]
4096 pub from_before_set: bool,
4097}
4098
4099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4101#[cfg_attr(feature = "bindings", derive(TS))]
4102pub struct Delete {
4103 pub table: TableRef,
4104 #[serde(default, skip_serializing_if = "Option::is_none")]
4106 pub on_cluster: Option<OnCluster>,
4107 pub alias: Option<Identifier>,
4109 #[serde(default)]
4111 pub alias_explicit_as: bool,
4112 pub using: Vec<TableRef>,
4114 pub where_clause: Option<Where>,
4115 #[serde(default)]
4117 pub output: Option<OutputClause>,
4118 #[serde(default)]
4120 pub leading_comments: Vec<String>,
4121 #[serde(default)]
4123 pub with: Option<With>,
4124 #[serde(default)]
4126 pub limit: Option<Expression>,
4127 #[serde(default)]
4129 pub order_by: Option<OrderBy>,
4130 #[serde(default)]
4132 pub returning: Vec<Expression>,
4133 #[serde(default)]
4136 pub tables: Vec<TableRef>,
4137 #[serde(default)]
4140 pub tables_from_using: bool,
4141 #[serde(default)]
4143 pub joins: Vec<Join>,
4144 #[serde(default)]
4146 pub force_index: Option<String>,
4147 #[serde(default)]
4149 pub no_from: bool,
4150}
4151
4152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4154#[cfg_attr(feature = "bindings", derive(TS))]
4155pub struct CopyStmt {
4156 pub this: Expression,
4158 pub kind: bool,
4160 pub files: Vec<Expression>,
4162 #[serde(default)]
4164 pub params: Vec<CopyParameter>,
4165 #[serde(default)]
4167 pub credentials: Option<Box<Credentials>>,
4168 #[serde(default)]
4170 pub is_into: bool,
4171 #[serde(default)]
4173 pub with_wrapped: bool,
4174}
4175
4176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4178#[cfg_attr(feature = "bindings", derive(TS))]
4179pub struct CopyParameter {
4180 pub name: String,
4181 pub value: Option<Expression>,
4182 pub values: Vec<Expression>,
4183 #[serde(default)]
4185 pub eq: bool,
4186}
4187
4188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4190#[cfg_attr(feature = "bindings", derive(TS))]
4191pub struct Credentials {
4192 pub credentials: Vec<(String, String)>,
4193 pub encryption: Option<String>,
4194 pub storage: Option<String>,
4195}
4196
4197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4199#[cfg_attr(feature = "bindings", derive(TS))]
4200pub struct PutStmt {
4201 pub source: String,
4203 #[serde(default)]
4205 pub source_quoted: bool,
4206 pub target: Expression,
4208 #[serde(default)]
4210 pub params: Vec<CopyParameter>,
4211}
4212
4213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4215#[cfg_attr(feature = "bindings", derive(TS))]
4216pub struct StageReference {
4217 pub name: String,
4219 #[serde(default)]
4221 pub path: Option<String>,
4222 #[serde(default)]
4224 pub file_format: Option<Expression>,
4225 #[serde(default)]
4227 pub pattern: Option<String>,
4228 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4230 pub quoted: bool,
4231}
4232
4233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4235#[cfg_attr(feature = "bindings", derive(TS))]
4236pub struct HistoricalData {
4237 pub this: Box<Expression>,
4239 pub kind: String,
4241 pub expression: Box<Expression>,
4243}
4244
4245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4250#[cfg_attr(feature = "bindings", derive(TS))]
4251pub struct Alias {
4252 pub this: Expression,
4254 pub alias: Identifier,
4256 #[serde(default)]
4258 pub column_aliases: Vec<Identifier>,
4259 #[serde(default)]
4261 pub pre_alias_comments: Vec<String>,
4262 #[serde(default)]
4264 pub trailing_comments: Vec<String>,
4265 #[serde(default, skip_serializing_if = "Option::is_none")]
4267 pub inferred_type: Option<DataType>,
4268}
4269
4270impl Alias {
4271 pub fn new(this: Expression, alias: Identifier) -> Self {
4273 Self {
4274 this,
4275 alias,
4276 column_aliases: Vec::new(),
4277 pre_alias_comments: Vec::new(),
4278 trailing_comments: Vec::new(),
4279 inferred_type: None,
4280 }
4281 }
4282
4283 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4285 Self {
4286 this,
4287 alias: Identifier::empty(),
4288 column_aliases,
4289 pre_alias_comments: Vec::new(),
4290 trailing_comments: Vec::new(),
4291 inferred_type: None,
4292 }
4293 }
4294}
4295
4296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4303#[cfg_attr(feature = "bindings", derive(TS))]
4304pub struct Cast {
4305 pub this: Expression,
4307 pub to: DataType,
4309 #[serde(default)]
4310 pub trailing_comments: Vec<String>,
4311 #[serde(default)]
4313 pub double_colon_syntax: bool,
4314 #[serde(skip_serializing_if = "Option::is_none", default)]
4316 pub format: Option<Box<Expression>>,
4317 #[serde(skip_serializing_if = "Option::is_none", default)]
4319 pub default: Option<Box<Expression>>,
4320 #[serde(default, skip_serializing_if = "Option::is_none")]
4322 pub inferred_type: Option<DataType>,
4323}
4324
4325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4327#[cfg_attr(feature = "bindings", derive(TS))]
4328pub struct CollationExpr {
4329 pub this: Expression,
4330 pub collation: String,
4331 #[serde(default)]
4333 pub quoted: bool,
4334 #[serde(default)]
4336 pub double_quoted: bool,
4337}
4338
4339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4345#[cfg_attr(feature = "bindings", derive(TS))]
4346pub struct Case {
4347 pub operand: Option<Expression>,
4349 pub whens: Vec<(Expression, Expression)>,
4351 pub else_: Option<Expression>,
4353 #[serde(default)]
4355 #[serde(skip_serializing_if = "Vec::is_empty")]
4356 pub comments: Vec<String>,
4357 #[serde(default, skip_serializing_if = "Option::is_none")]
4359 pub inferred_type: Option<DataType>,
4360}
4361
4362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4370#[cfg_attr(feature = "bindings", derive(TS))]
4371pub struct BinaryOp {
4372 pub left: Expression,
4373 pub right: Expression,
4374 #[serde(default)]
4376 pub left_comments: Vec<String>,
4377 #[serde(default)]
4379 pub operator_comments: Vec<String>,
4380 #[serde(default)]
4382 pub trailing_comments: Vec<String>,
4383 #[serde(default, skip_serializing_if = "Option::is_none")]
4385 pub inferred_type: Option<DataType>,
4386}
4387
4388impl BinaryOp {
4389 pub fn new(left: Expression, right: Expression) -> Self {
4390 Self {
4391 left,
4392 right,
4393 left_comments: Vec::new(),
4394 operator_comments: Vec::new(),
4395 trailing_comments: Vec::new(),
4396 inferred_type: None,
4397 }
4398 }
4399}
4400
4401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4403#[cfg_attr(feature = "bindings", derive(TS))]
4404pub struct LikeOp {
4405 pub left: Expression,
4406 pub right: Expression,
4407 #[serde(default)]
4409 pub escape: Option<Expression>,
4410 #[serde(default)]
4412 pub quantifier: Option<String>,
4413 #[serde(default, skip_serializing_if = "Option::is_none")]
4415 pub inferred_type: Option<DataType>,
4416}
4417
4418impl LikeOp {
4419 pub fn new(left: Expression, right: Expression) -> Self {
4420 Self {
4421 left,
4422 right,
4423 escape: None,
4424 quantifier: None,
4425 inferred_type: None,
4426 }
4427 }
4428
4429 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4430 Self {
4431 left,
4432 right,
4433 escape: Some(escape),
4434 quantifier: None,
4435 inferred_type: None,
4436 }
4437 }
4438}
4439
4440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4444#[cfg_attr(feature = "bindings", derive(TS))]
4445pub struct UnaryOp {
4446 pub this: Expression,
4448 #[serde(default, skip_serializing_if = "Option::is_none")]
4450 pub inferred_type: Option<DataType>,
4451}
4452
4453impl UnaryOp {
4454 pub fn new(this: Expression) -> Self {
4455 Self {
4456 this,
4457 inferred_type: None,
4458 }
4459 }
4460}
4461
4462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4467#[cfg_attr(feature = "bindings", derive(TS))]
4468pub struct In {
4469 pub this: Expression,
4471 pub expressions: Vec<Expression>,
4473 pub query: Option<Expression>,
4475 pub not: bool,
4477 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4478 pub global: bool,
4479 #[serde(default, skip_serializing_if = "Option::is_none")]
4481 pub unnest: Option<Box<Expression>>,
4482 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4486 pub is_field: bool,
4487}
4488
4489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4491#[cfg_attr(feature = "bindings", derive(TS))]
4492pub struct Between {
4493 pub this: Expression,
4495 pub low: Expression,
4497 pub high: Expression,
4499 pub not: bool,
4501 #[serde(default)]
4503 pub symmetric: Option<bool>,
4504}
4505
4506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4508#[cfg_attr(feature = "bindings", derive(TS))]
4509pub struct IsNull {
4510 pub this: Expression,
4511 pub not: bool,
4512 #[serde(default)]
4514 pub postfix_form: bool,
4515}
4516
4517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4519#[cfg_attr(feature = "bindings", derive(TS))]
4520pub struct IsTrueFalse {
4521 pub this: Expression,
4522 pub not: bool,
4523}
4524
4525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4528#[cfg_attr(feature = "bindings", derive(TS))]
4529pub struct IsJson {
4530 pub this: Expression,
4531 pub json_type: Option<String>,
4533 pub unique_keys: Option<JsonUniqueKeys>,
4535 pub negated: bool,
4537}
4538
4539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4541#[cfg_attr(feature = "bindings", derive(TS))]
4542pub enum JsonUniqueKeys {
4543 With,
4545 Without,
4547 Shorthand,
4549}
4550
4551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4553#[cfg_attr(feature = "bindings", derive(TS))]
4554pub struct Exists {
4555 pub this: Expression,
4557 pub not: bool,
4559}
4560
4561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4568#[cfg_attr(feature = "bindings", derive(TS))]
4569pub struct Function {
4570 pub name: String,
4572 pub args: Vec<Expression>,
4574 pub distinct: bool,
4576 #[serde(default)]
4577 pub trailing_comments: Vec<String>,
4578 #[serde(default)]
4580 pub use_bracket_syntax: bool,
4581 #[serde(default)]
4583 pub no_parens: bool,
4584 #[serde(default)]
4586 pub quoted: bool,
4587 #[serde(default, skip_serializing_if = "Option::is_none")]
4589 pub span: Option<Span>,
4590 #[serde(default, skip_serializing_if = "Option::is_none")]
4592 pub inferred_type: Option<DataType>,
4593}
4594
4595impl Default for Function {
4596 fn default() -> Self {
4597 Self {
4598 name: String::new(),
4599 args: Vec::new(),
4600 distinct: false,
4601 trailing_comments: Vec::new(),
4602 use_bracket_syntax: false,
4603 no_parens: false,
4604 quoted: false,
4605 span: None,
4606 inferred_type: None,
4607 }
4608 }
4609}
4610
4611impl Function {
4612 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4613 Self {
4614 name: name.into(),
4615 args,
4616 distinct: false,
4617 trailing_comments: Vec::new(),
4618 use_bracket_syntax: false,
4619 no_parens: false,
4620 quoted: false,
4621 span: None,
4622 inferred_type: None,
4623 }
4624 }
4625}
4626
4627#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4634#[cfg_attr(feature = "bindings", derive(TS))]
4635pub struct AggregateFunction {
4636 pub name: String,
4638 pub args: Vec<Expression>,
4640 pub distinct: bool,
4642 pub filter: Option<Expression>,
4644 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4646 pub order_by: Vec<Ordered>,
4647 #[serde(default, skip_serializing_if = "Option::is_none")]
4649 pub limit: Option<Box<Expression>>,
4650 #[serde(default, skip_serializing_if = "Option::is_none")]
4652 pub ignore_nulls: Option<bool>,
4653 #[serde(default, skip_serializing_if = "Option::is_none")]
4655 pub inferred_type: Option<DataType>,
4656}
4657
4658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4665#[cfg_attr(feature = "bindings", derive(TS))]
4666pub struct WindowFunction {
4667 pub this: Expression,
4669 pub over: Over,
4671 #[serde(default, skip_serializing_if = "Option::is_none")]
4673 pub keep: Option<Keep>,
4674 #[serde(default, skip_serializing_if = "Option::is_none")]
4676 pub inferred_type: Option<DataType>,
4677}
4678
4679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4682#[cfg_attr(feature = "bindings", derive(TS))]
4683pub struct Keep {
4684 pub first: bool,
4686 pub order_by: Vec<Ordered>,
4688}
4689
4690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4692#[cfg_attr(feature = "bindings", derive(TS))]
4693pub struct WithinGroup {
4694 pub this: Expression,
4696 pub order_by: Vec<Ordered>,
4698}
4699
4700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4705#[cfg_attr(feature = "bindings", derive(TS))]
4706pub struct From {
4707 pub expressions: Vec<Expression>,
4709}
4710
4711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4717#[cfg_attr(feature = "bindings", derive(TS))]
4718pub struct Join {
4719 pub this: Expression,
4721 pub on: Option<Expression>,
4723 pub using: Vec<Identifier>,
4725 pub kind: JoinKind,
4727 pub use_inner_keyword: bool,
4729 pub use_outer_keyword: bool,
4731 pub deferred_condition: bool,
4733 #[serde(default, skip_serializing_if = "Option::is_none")]
4735 pub join_hint: Option<String>,
4736 #[serde(default, skip_serializing_if = "Option::is_none")]
4738 pub match_condition: Option<Expression>,
4739 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4741 pub pivots: Vec<Expression>,
4742 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4744 pub comments: Vec<String>,
4745 #[serde(default)]
4749 pub nesting_group: usize,
4750 #[serde(default)]
4752 pub directed: bool,
4753}
4754
4755#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4762#[cfg_attr(feature = "bindings", derive(TS))]
4763pub enum JoinKind {
4764 Inner,
4765 Left,
4766 Right,
4767 Full,
4768 Outer, Cross,
4770 Natural,
4771 NaturalLeft,
4772 NaturalRight,
4773 NaturalFull,
4774 Semi,
4775 Anti,
4776 LeftSemi,
4778 LeftAnti,
4779 RightSemi,
4780 RightAnti,
4781 CrossApply,
4783 OuterApply,
4784 AsOf,
4786 AsOfLeft,
4787 AsOfRight,
4788 Lateral,
4790 LeftLateral,
4791 Straight,
4793 Implicit,
4795 Array,
4797 LeftArray,
4798 Paste,
4800 Positional,
4802}
4803
4804impl Default for JoinKind {
4805 fn default() -> Self {
4806 JoinKind::Inner
4807 }
4808}
4809
4810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4813#[cfg_attr(feature = "bindings", derive(TS))]
4814pub struct JoinedTable {
4815 pub left: Expression,
4817 pub joins: Vec<Join>,
4819 pub lateral_views: Vec<LateralView>,
4821 pub alias: Option<Identifier>,
4823}
4824
4825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4827#[cfg_attr(feature = "bindings", derive(TS))]
4828pub struct Where {
4829 pub this: Expression,
4831}
4832
4833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4838#[cfg_attr(feature = "bindings", derive(TS))]
4839pub struct GroupBy {
4840 pub expressions: Vec<Expression>,
4842 #[serde(default)]
4844 pub all: Option<bool>,
4845 #[serde(default)]
4847 pub totals: bool,
4848 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4850 pub comments: Vec<String>,
4851}
4852
4853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4855#[cfg_attr(feature = "bindings", derive(TS))]
4856pub struct Having {
4857 pub this: Expression,
4859 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4861 pub comments: Vec<String>,
4862}
4863
4864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4866#[cfg_attr(feature = "bindings", derive(TS))]
4867pub struct OrderBy {
4868 pub expressions: Vec<Ordered>,
4870 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4872 pub siblings: bool,
4873 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4875 pub comments: Vec<String>,
4876}
4877
4878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4885#[cfg_attr(feature = "bindings", derive(TS))]
4886pub struct Ordered {
4887 pub this: Expression,
4889 pub desc: bool,
4891 pub nulls_first: Option<bool>,
4893 #[serde(default)]
4895 pub explicit_asc: bool,
4896 #[serde(default, skip_serializing_if = "Option::is_none")]
4898 pub with_fill: Option<Box<WithFill>>,
4899}
4900
4901impl Ordered {
4902 pub fn asc(expr: Expression) -> Self {
4903 Self {
4904 this: expr,
4905 desc: false,
4906 nulls_first: None,
4907 explicit_asc: false,
4908 with_fill: None,
4909 }
4910 }
4911
4912 pub fn desc(expr: Expression) -> Self {
4913 Self {
4914 this: expr,
4915 desc: true,
4916 nulls_first: None,
4917 explicit_asc: false,
4918 with_fill: None,
4919 }
4920 }
4921}
4922
4923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4926#[cfg_attr(feature = "bindings", derive(TS))]
4927#[cfg_attr(feature = "bindings", ts(export))]
4928pub struct DistributeBy {
4929 pub expressions: Vec<Expression>,
4930}
4931
4932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4935#[cfg_attr(feature = "bindings", derive(TS))]
4936#[cfg_attr(feature = "bindings", ts(export))]
4937pub struct ClusterBy {
4938 pub expressions: Vec<Ordered>,
4939}
4940
4941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4944#[cfg_attr(feature = "bindings", derive(TS))]
4945#[cfg_attr(feature = "bindings", ts(export))]
4946pub struct SortBy {
4947 pub expressions: Vec<Ordered>,
4948}
4949
4950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4953#[cfg_attr(feature = "bindings", derive(TS))]
4954#[cfg_attr(feature = "bindings", ts(export))]
4955pub struct LateralView {
4956 pub this: Expression,
4958 pub table_alias: Option<Identifier>,
4960 pub column_aliases: Vec<Identifier>,
4962 pub outer: bool,
4964}
4965
4966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4968#[cfg_attr(feature = "bindings", derive(TS))]
4969#[cfg_attr(feature = "bindings", ts(export))]
4970pub struct Hint {
4971 pub expressions: Vec<HintExpression>,
4972}
4973
4974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4976#[cfg_attr(feature = "bindings", derive(TS))]
4977#[cfg_attr(feature = "bindings", ts(export))]
4978pub enum HintExpression {
4979 Function { name: String, args: Vec<Expression> },
4981 Identifier(String),
4983 Raw(String),
4985}
4986
4987#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4989#[cfg_attr(feature = "bindings", derive(TS))]
4990#[cfg_attr(feature = "bindings", ts(export))]
4991pub enum PseudocolumnType {
4992 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
4999
5000impl PseudocolumnType {
5001 pub fn as_str(&self) -> &'static str {
5002 match self {
5003 PseudocolumnType::Rownum => "ROWNUM",
5004 PseudocolumnType::Rowid => "ROWID",
5005 PseudocolumnType::Level => "LEVEL",
5006 PseudocolumnType::Sysdate => "SYSDATE",
5007 PseudocolumnType::ObjectId => "OBJECT_ID",
5008 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5009 }
5010 }
5011
5012 pub fn from_str(s: &str) -> Option<Self> {
5013 match s.to_uppercase().as_str() {
5014 "ROWNUM" => Some(PseudocolumnType::Rownum),
5015 "ROWID" => Some(PseudocolumnType::Rowid),
5016 "LEVEL" => Some(PseudocolumnType::Level),
5017 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5018 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5019 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5020 _ => None,
5021 }
5022 }
5023}
5024
5025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5028#[cfg_attr(feature = "bindings", derive(TS))]
5029#[cfg_attr(feature = "bindings", ts(export))]
5030pub struct Pseudocolumn {
5031 pub kind: PseudocolumnType,
5032}
5033
5034impl Pseudocolumn {
5035 pub fn rownum() -> Self {
5036 Self {
5037 kind: PseudocolumnType::Rownum,
5038 }
5039 }
5040
5041 pub fn rowid() -> Self {
5042 Self {
5043 kind: PseudocolumnType::Rowid,
5044 }
5045 }
5046
5047 pub fn level() -> Self {
5048 Self {
5049 kind: PseudocolumnType::Level,
5050 }
5051 }
5052}
5053
5054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5056#[cfg_attr(feature = "bindings", derive(TS))]
5057#[cfg_attr(feature = "bindings", ts(export))]
5058pub struct Connect {
5059 pub start: Option<Expression>,
5061 pub connect: Expression,
5063 pub nocycle: bool,
5065}
5066
5067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5069#[cfg_attr(feature = "bindings", derive(TS))]
5070#[cfg_attr(feature = "bindings", ts(export))]
5071pub struct Prior {
5072 pub this: Expression,
5073}
5074
5075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5077#[cfg_attr(feature = "bindings", derive(TS))]
5078#[cfg_attr(feature = "bindings", ts(export))]
5079pub struct ConnectByRoot {
5080 pub this: Expression,
5081}
5082
5083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5085#[cfg_attr(feature = "bindings", derive(TS))]
5086#[cfg_attr(feature = "bindings", ts(export))]
5087pub struct MatchRecognize {
5088 pub this: Option<Box<Expression>>,
5090 pub partition_by: Option<Vec<Expression>>,
5092 pub order_by: Option<Vec<Ordered>>,
5094 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5096 pub rows: Option<MatchRecognizeRows>,
5098 pub after: Option<MatchRecognizeAfter>,
5100 pub pattern: Option<String>,
5102 pub define: Option<Vec<(Identifier, Expression)>>,
5104 pub alias: Option<Identifier>,
5106 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5108 pub alias_explicit_as: bool,
5109}
5110
5111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5113#[cfg_attr(feature = "bindings", derive(TS))]
5114#[cfg_attr(feature = "bindings", ts(export))]
5115pub struct MatchRecognizeMeasure {
5116 pub this: Expression,
5118 pub window_frame: Option<MatchRecognizeSemantics>,
5120}
5121
5122#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5124#[cfg_attr(feature = "bindings", derive(TS))]
5125#[cfg_attr(feature = "bindings", ts(export))]
5126pub enum MatchRecognizeSemantics {
5127 Running,
5128 Final,
5129}
5130
5131#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5133#[cfg_attr(feature = "bindings", derive(TS))]
5134#[cfg_attr(feature = "bindings", ts(export))]
5135pub enum MatchRecognizeRows {
5136 OneRowPerMatch,
5137 AllRowsPerMatch,
5138 AllRowsPerMatchShowEmptyMatches,
5139 AllRowsPerMatchOmitEmptyMatches,
5140 AllRowsPerMatchWithUnmatchedRows,
5141}
5142
5143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5145#[cfg_attr(feature = "bindings", derive(TS))]
5146#[cfg_attr(feature = "bindings", ts(export))]
5147pub enum MatchRecognizeAfter {
5148 PastLastRow,
5149 ToNextRow,
5150 ToFirst(Identifier),
5151 ToLast(Identifier),
5152}
5153
5154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5156#[cfg_attr(feature = "bindings", derive(TS))]
5157pub struct Limit {
5158 pub this: Expression,
5160 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5162 pub percent: bool,
5163 #[serde(default)]
5165 #[serde(skip_serializing_if = "Vec::is_empty")]
5166 pub comments: Vec<String>,
5167}
5168
5169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5171#[cfg_attr(feature = "bindings", derive(TS))]
5172pub struct Offset {
5173 pub this: Expression,
5174 #[serde(skip_serializing_if = "Option::is_none", default)]
5176 pub rows: Option<bool>,
5177}
5178
5179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5181#[cfg_attr(feature = "bindings", derive(TS))]
5182pub struct Top {
5183 pub this: Expression,
5184 pub percent: bool,
5185 pub with_ties: bool,
5186 #[serde(default)]
5188 pub parenthesized: bool,
5189}
5190
5191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5193#[cfg_attr(feature = "bindings", derive(TS))]
5194pub struct Fetch {
5195 pub direction: String,
5197 pub count: Option<Expression>,
5199 pub percent: bool,
5201 pub rows: bool,
5203 pub with_ties: bool,
5205}
5206
5207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5213#[cfg_attr(feature = "bindings", derive(TS))]
5214pub struct Qualify {
5215 pub this: Expression,
5217}
5218
5219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5221#[cfg_attr(feature = "bindings", derive(TS))]
5222pub struct Sample {
5223 pub method: SampleMethod,
5224 pub size: Expression,
5225 pub seed: Option<Expression>,
5226 #[serde(default)]
5228 pub offset: Option<Expression>,
5229 pub unit_after_size: bool,
5231 #[serde(default)]
5233 pub use_sample_keyword: bool,
5234 #[serde(default)]
5236 pub explicit_method: bool,
5237 #[serde(default)]
5239 pub method_before_size: bool,
5240 #[serde(default)]
5242 pub use_seed_keyword: bool,
5243 pub bucket_numerator: Option<Box<Expression>>,
5245 pub bucket_denominator: Option<Box<Expression>>,
5247 pub bucket_field: Option<Box<Expression>>,
5249 #[serde(default)]
5251 pub is_using_sample: bool,
5252 #[serde(default)]
5254 pub is_percent: bool,
5255 #[serde(default)]
5257 pub suppress_method_output: bool,
5258}
5259
5260#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5262#[cfg_attr(feature = "bindings", derive(TS))]
5263pub enum SampleMethod {
5264 Bernoulli,
5265 System,
5266 Block,
5267 Row,
5268 Percent,
5269 Bucket,
5271 Reservoir,
5273}
5274
5275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5277#[cfg_attr(feature = "bindings", derive(TS))]
5278pub struct NamedWindow {
5279 pub name: Identifier,
5280 pub spec: Over,
5281}
5282
5283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5289#[cfg_attr(feature = "bindings", derive(TS))]
5290pub struct With {
5291 pub ctes: Vec<Cte>,
5293 pub recursive: bool,
5295 #[serde(default)]
5297 pub leading_comments: Vec<String>,
5298 #[serde(default, skip_serializing_if = "Option::is_none")]
5300 pub search: Option<Box<Expression>>,
5301}
5302
5303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5310#[cfg_attr(feature = "bindings", derive(TS))]
5311pub struct Cte {
5312 pub alias: Identifier,
5314 pub this: Expression,
5316 pub columns: Vec<Identifier>,
5318 pub materialized: Option<bool>,
5320 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5322 pub key_expressions: Vec<Identifier>,
5323 #[serde(default)]
5325 pub alias_first: bool,
5326 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5328 pub comments: Vec<String>,
5329}
5330
5331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5333#[cfg_attr(feature = "bindings", derive(TS))]
5334pub struct WindowSpec {
5335 pub partition_by: Vec<Expression>,
5336 pub order_by: Vec<Ordered>,
5337 pub frame: Option<WindowFrame>,
5338}
5339
5340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5342#[cfg_attr(feature = "bindings", derive(TS))]
5343pub struct Over {
5344 pub window_name: Option<Identifier>,
5346 pub partition_by: Vec<Expression>,
5347 pub order_by: Vec<Ordered>,
5348 pub frame: Option<WindowFrame>,
5349 pub alias: Option<Identifier>,
5350}
5351
5352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5354#[cfg_attr(feature = "bindings", derive(TS))]
5355pub struct WindowFrame {
5356 pub kind: WindowFrameKind,
5357 pub start: WindowFrameBound,
5358 pub end: Option<WindowFrameBound>,
5359 pub exclude: Option<WindowFrameExclude>,
5360 #[serde(default, skip_serializing_if = "Option::is_none")]
5362 pub kind_text: Option<String>,
5363 #[serde(default, skip_serializing_if = "Option::is_none")]
5365 pub start_side_text: Option<String>,
5366 #[serde(default, skip_serializing_if = "Option::is_none")]
5368 pub end_side_text: Option<String>,
5369}
5370
5371#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5372#[cfg_attr(feature = "bindings", derive(TS))]
5373pub enum WindowFrameKind {
5374 Rows,
5375 Range,
5376 Groups,
5377}
5378
5379#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5381#[cfg_attr(feature = "bindings", derive(TS))]
5382pub enum WindowFrameExclude {
5383 CurrentRow,
5384 Group,
5385 Ties,
5386 NoOthers,
5387}
5388
5389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5390#[cfg_attr(feature = "bindings", derive(TS))]
5391pub enum WindowFrameBound {
5392 CurrentRow,
5393 UnboundedPreceding,
5394 UnboundedFollowing,
5395 Preceding(Box<Expression>),
5396 Following(Box<Expression>),
5397 BarePreceding,
5399 BareFollowing,
5401 Value(Box<Expression>),
5403}
5404
5405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5407#[cfg_attr(feature = "bindings", derive(TS))]
5408pub struct StructField {
5409 pub name: String,
5410 pub data_type: DataType,
5411 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5412 pub options: Vec<Expression>,
5413 #[serde(default, skip_serializing_if = "Option::is_none")]
5414 pub comment: Option<String>,
5415}
5416
5417impl StructField {
5418 pub fn new(name: String, data_type: DataType) -> Self {
5420 Self {
5421 name,
5422 data_type,
5423 options: Vec::new(),
5424 comment: None,
5425 }
5426 }
5427
5428 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5430 Self {
5431 name,
5432 data_type,
5433 options,
5434 comment: None,
5435 }
5436 }
5437
5438 pub fn with_options_and_comment(
5440 name: String,
5441 data_type: DataType,
5442 options: Vec<Expression>,
5443 comment: Option<String>,
5444 ) -> Self {
5445 Self {
5446 name,
5447 data_type,
5448 options,
5449 comment,
5450 }
5451 }
5452}
5453
5454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5466#[cfg_attr(feature = "bindings", derive(TS))]
5467#[serde(tag = "data_type", rename_all = "snake_case")]
5468pub enum DataType {
5469 Boolean,
5471 TinyInt {
5472 length: Option<u32>,
5473 },
5474 SmallInt {
5475 length: Option<u32>,
5476 },
5477 Int {
5481 length: Option<u32>,
5482 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5483 integer_spelling: bool,
5484 },
5485 BigInt {
5486 length: Option<u32>,
5487 },
5488 Float {
5492 precision: Option<u32>,
5493 scale: Option<u32>,
5494 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5495 real_spelling: bool,
5496 },
5497 Double {
5498 precision: Option<u32>,
5499 scale: Option<u32>,
5500 },
5501 Decimal {
5502 precision: Option<u32>,
5503 scale: Option<u32>,
5504 },
5505
5506 Char {
5508 length: Option<u32>,
5509 },
5510 VarChar {
5513 length: Option<u32>,
5514 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5515 parenthesized_length: bool,
5516 },
5517 String {
5519 length: Option<u32>,
5520 },
5521 Text,
5522 TextWithLength {
5524 length: u32,
5525 },
5526
5527 Binary {
5529 length: Option<u32>,
5530 },
5531 VarBinary {
5532 length: Option<u32>,
5533 },
5534 Blob,
5535
5536 Bit {
5538 length: Option<u32>,
5539 },
5540 VarBit {
5541 length: Option<u32>,
5542 },
5543
5544 Date,
5546 Time {
5547 precision: Option<u32>,
5548 #[serde(default)]
5549 timezone: bool,
5550 },
5551 Timestamp {
5552 precision: Option<u32>,
5553 timezone: bool,
5554 },
5555 Interval {
5556 unit: Option<String>,
5557 #[serde(default, skip_serializing_if = "Option::is_none")]
5559 to: Option<String>,
5560 },
5561
5562 Json,
5564 JsonB,
5565
5566 Uuid,
5568
5569 Array {
5571 element_type: Box<DataType>,
5572 #[serde(default, skip_serializing_if = "Option::is_none")]
5574 dimension: Option<u32>,
5575 },
5576
5577 List {
5580 element_type: Box<DataType>,
5581 },
5582
5583 Struct {
5587 fields: Vec<StructField>,
5588 nested: bool,
5589 },
5590 Map {
5591 key_type: Box<DataType>,
5592 value_type: Box<DataType>,
5593 },
5594
5595 Enum {
5597 values: Vec<String>,
5598 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5599 assignments: Vec<Option<String>>,
5600 },
5601
5602 Set {
5604 values: Vec<String>,
5605 },
5606
5607 Union {
5609 fields: Vec<(String, DataType)>,
5610 },
5611
5612 Vector {
5614 #[serde(default)]
5615 element_type: Option<Box<DataType>>,
5616 dimension: Option<u32>,
5617 },
5618
5619 Object {
5622 fields: Vec<(String, DataType, bool)>,
5623 modifier: Option<String>,
5624 },
5625
5626 Nullable {
5628 inner: Box<DataType>,
5629 },
5630
5631 Custom {
5633 name: String,
5634 },
5635
5636 Geometry {
5638 subtype: Option<String>,
5639 srid: Option<u32>,
5640 },
5641 Geography {
5642 subtype: Option<String>,
5643 srid: Option<u32>,
5644 },
5645
5646 CharacterSet {
5649 name: String,
5650 },
5651
5652 Unknown,
5654}
5655
5656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5658#[cfg_attr(feature = "bindings", derive(TS))]
5659#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5660pub struct Array {
5661 pub expressions: Vec<Expression>,
5662}
5663
5664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5666#[cfg_attr(feature = "bindings", derive(TS))]
5667pub struct Struct {
5668 pub fields: Vec<(Option<String>, Expression)>,
5669}
5670
5671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5673#[cfg_attr(feature = "bindings", derive(TS))]
5674pub struct Tuple {
5675 pub expressions: Vec<Expression>,
5676}
5677
5678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5680#[cfg_attr(feature = "bindings", derive(TS))]
5681pub struct Interval {
5682 pub this: Option<Expression>,
5684 pub unit: Option<IntervalUnitSpec>,
5686}
5687
5688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5690#[cfg_attr(feature = "bindings", derive(TS))]
5691#[serde(tag = "type", rename_all = "snake_case")]
5692pub enum IntervalUnitSpec {
5693 Simple {
5695 unit: IntervalUnit,
5696 use_plural: bool,
5698 },
5699 Span(IntervalSpan),
5701 ExprSpan(IntervalSpanExpr),
5704 Expr(Box<Expression>),
5706}
5707
5708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5710#[cfg_attr(feature = "bindings", derive(TS))]
5711pub struct IntervalSpan {
5712 pub this: IntervalUnit,
5714 pub expression: IntervalUnit,
5716}
5717
5718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5721#[cfg_attr(feature = "bindings", derive(TS))]
5722pub struct IntervalSpanExpr {
5723 pub this: Box<Expression>,
5725 pub expression: Box<Expression>,
5727}
5728
5729#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5730#[cfg_attr(feature = "bindings", derive(TS))]
5731pub enum IntervalUnit {
5732 Year,
5733 Quarter,
5734 Month,
5735 Week,
5736 Day,
5737 Hour,
5738 Minute,
5739 Second,
5740 Millisecond,
5741 Microsecond,
5742 Nanosecond,
5743}
5744
5745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5747#[cfg_attr(feature = "bindings", derive(TS))]
5748pub struct Command {
5749 pub this: String,
5751}
5752
5753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5756#[cfg_attr(feature = "bindings", derive(TS))]
5757pub struct ExecuteStatement {
5758 pub this: Expression,
5760 #[serde(default)]
5762 pub parameters: Vec<ExecuteParameter>,
5763}
5764
5765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5767#[cfg_attr(feature = "bindings", derive(TS))]
5768pub struct ExecuteParameter {
5769 pub name: String,
5771 pub value: Expression,
5773 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5775 pub positional: bool,
5776}
5777
5778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5781#[cfg_attr(feature = "bindings", derive(TS))]
5782pub struct Kill {
5783 pub this: Expression,
5785 pub kind: Option<String>,
5787}
5788
5789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5791#[cfg_attr(feature = "bindings", derive(TS))]
5792pub struct Raw {
5793 pub sql: String,
5794}
5795
5796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5802#[cfg_attr(feature = "bindings", derive(TS))]
5803pub struct UnaryFunc {
5804 pub this: Expression,
5805 #[serde(skip_serializing_if = "Option::is_none", default)]
5807 pub original_name: Option<String>,
5808 #[serde(default, skip_serializing_if = "Option::is_none")]
5810 pub inferred_type: Option<DataType>,
5811}
5812
5813impl UnaryFunc {
5814 pub fn new(this: Expression) -> Self {
5816 Self {
5817 this,
5818 original_name: None,
5819 inferred_type: None,
5820 }
5821 }
5822
5823 pub fn with_name(this: Expression, name: String) -> Self {
5825 Self {
5826 this,
5827 original_name: Some(name),
5828 inferred_type: None,
5829 }
5830 }
5831}
5832
5833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5837#[cfg_attr(feature = "bindings", derive(TS))]
5838pub struct CharFunc {
5839 pub args: Vec<Expression>,
5840 #[serde(skip_serializing_if = "Option::is_none", default)]
5841 pub charset: Option<String>,
5842 #[serde(skip_serializing_if = "Option::is_none", default)]
5844 pub name: Option<String>,
5845}
5846
5847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5849#[cfg_attr(feature = "bindings", derive(TS))]
5850pub struct BinaryFunc {
5851 pub this: Expression,
5852 pub expression: Expression,
5853 #[serde(skip_serializing_if = "Option::is_none", default)]
5855 pub original_name: Option<String>,
5856 #[serde(default, skip_serializing_if = "Option::is_none")]
5858 pub inferred_type: Option<DataType>,
5859}
5860
5861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5863#[cfg_attr(feature = "bindings", derive(TS))]
5864pub struct VarArgFunc {
5865 pub expressions: Vec<Expression>,
5866 #[serde(skip_serializing_if = "Option::is_none", default)]
5868 pub original_name: Option<String>,
5869 #[serde(default, skip_serializing_if = "Option::is_none")]
5871 pub inferred_type: Option<DataType>,
5872}
5873
5874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5876#[cfg_attr(feature = "bindings", derive(TS))]
5877pub struct ConcatWs {
5878 pub separator: Expression,
5879 pub expressions: Vec<Expression>,
5880}
5881
5882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5884#[cfg_attr(feature = "bindings", derive(TS))]
5885pub struct SubstringFunc {
5886 pub this: Expression,
5887 pub start: Expression,
5888 pub length: Option<Expression>,
5889 #[serde(default)]
5891 pub from_for_syntax: bool,
5892}
5893
5894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5896#[cfg_attr(feature = "bindings", derive(TS))]
5897pub struct OverlayFunc {
5898 pub this: Expression,
5899 pub replacement: Expression,
5900 pub from: Expression,
5901 pub length: Option<Expression>,
5902}
5903
5904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5906#[cfg_attr(feature = "bindings", derive(TS))]
5907pub struct TrimFunc {
5908 pub this: Expression,
5909 pub characters: Option<Expression>,
5910 pub position: TrimPosition,
5911 #[serde(default)]
5913 pub sql_standard_syntax: bool,
5914 #[serde(default)]
5916 pub position_explicit: bool,
5917}
5918
5919#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5920#[cfg_attr(feature = "bindings", derive(TS))]
5921pub enum TrimPosition {
5922 Both,
5923 Leading,
5924 Trailing,
5925}
5926
5927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5929#[cfg_attr(feature = "bindings", derive(TS))]
5930pub struct ReplaceFunc {
5931 pub this: Expression,
5932 pub old: Expression,
5933 pub new: Expression,
5934}
5935
5936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5938#[cfg_attr(feature = "bindings", derive(TS))]
5939pub struct LeftRightFunc {
5940 pub this: Expression,
5941 pub length: Expression,
5942}
5943
5944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5946#[cfg_attr(feature = "bindings", derive(TS))]
5947pub struct RepeatFunc {
5948 pub this: Expression,
5949 pub times: Expression,
5950}
5951
5952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5954#[cfg_attr(feature = "bindings", derive(TS))]
5955pub struct PadFunc {
5956 pub this: Expression,
5957 pub length: Expression,
5958 pub fill: Option<Expression>,
5959}
5960
5961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5963#[cfg_attr(feature = "bindings", derive(TS))]
5964pub struct SplitFunc {
5965 pub this: Expression,
5966 pub delimiter: Expression,
5967}
5968
5969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5971#[cfg_attr(feature = "bindings", derive(TS))]
5972pub struct RegexpFunc {
5973 pub this: Expression,
5974 pub pattern: Expression,
5975 pub flags: Option<Expression>,
5976}
5977
5978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5980#[cfg_attr(feature = "bindings", derive(TS))]
5981pub struct RegexpReplaceFunc {
5982 pub this: Expression,
5983 pub pattern: Expression,
5984 pub replacement: Expression,
5985 pub flags: Option<Expression>,
5986}
5987
5988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5990#[cfg_attr(feature = "bindings", derive(TS))]
5991pub struct RegexpExtractFunc {
5992 pub this: Expression,
5993 pub pattern: Expression,
5994 pub group: Option<Expression>,
5995}
5996
5997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5999#[cfg_attr(feature = "bindings", derive(TS))]
6000pub struct RoundFunc {
6001 pub this: Expression,
6002 pub decimals: Option<Expression>,
6003}
6004
6005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6007#[cfg_attr(feature = "bindings", derive(TS))]
6008pub struct FloorFunc {
6009 pub this: Expression,
6010 pub scale: Option<Expression>,
6011 #[serde(skip_serializing_if = "Option::is_none", default)]
6013 pub to: Option<Expression>,
6014}
6015
6016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6018#[cfg_attr(feature = "bindings", derive(TS))]
6019pub struct CeilFunc {
6020 pub this: Expression,
6021 #[serde(skip_serializing_if = "Option::is_none", default)]
6022 pub decimals: Option<Expression>,
6023 #[serde(skip_serializing_if = "Option::is_none", default)]
6025 pub to: Option<Expression>,
6026}
6027
6028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6030#[cfg_attr(feature = "bindings", derive(TS))]
6031pub struct LogFunc {
6032 pub this: Expression,
6033 pub base: Option<Expression>,
6034}
6035
6036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6038#[cfg_attr(feature = "bindings", derive(TS))]
6039pub struct CurrentDate;
6040
6041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6043#[cfg_attr(feature = "bindings", derive(TS))]
6044pub struct CurrentTime {
6045 pub precision: Option<u32>,
6046}
6047
6048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6050#[cfg_attr(feature = "bindings", derive(TS))]
6051pub struct CurrentTimestamp {
6052 pub precision: Option<u32>,
6053 #[serde(default)]
6055 pub sysdate: bool,
6056}
6057
6058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6060#[cfg_attr(feature = "bindings", derive(TS))]
6061pub struct CurrentTimestampLTZ {
6062 pub precision: Option<u32>,
6063}
6064
6065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6067#[cfg_attr(feature = "bindings", derive(TS))]
6068pub struct AtTimeZone {
6069 pub this: Expression,
6071 pub zone: Expression,
6073}
6074
6075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6077#[cfg_attr(feature = "bindings", derive(TS))]
6078pub struct DateAddFunc {
6079 pub this: Expression,
6080 pub interval: Expression,
6081 pub unit: IntervalUnit,
6082}
6083
6084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6086#[cfg_attr(feature = "bindings", derive(TS))]
6087pub struct DateDiffFunc {
6088 pub this: Expression,
6089 pub expression: Expression,
6090 pub unit: Option<IntervalUnit>,
6091}
6092
6093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6095#[cfg_attr(feature = "bindings", derive(TS))]
6096pub struct DateTruncFunc {
6097 pub this: Expression,
6098 pub unit: DateTimeField,
6099}
6100
6101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6103#[cfg_attr(feature = "bindings", derive(TS))]
6104pub struct ExtractFunc {
6105 pub this: Expression,
6106 pub field: DateTimeField,
6107}
6108
6109#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6110#[cfg_attr(feature = "bindings", derive(TS))]
6111pub enum DateTimeField {
6112 Year,
6113 Month,
6114 Day,
6115 Hour,
6116 Minute,
6117 Second,
6118 Millisecond,
6119 Microsecond,
6120 DayOfWeek,
6121 DayOfYear,
6122 Week,
6123 WeekWithModifier(String),
6125 Quarter,
6126 Epoch,
6127 Timezone,
6128 TimezoneHour,
6129 TimezoneMinute,
6130 Date,
6131 Time,
6132 Custom(String),
6134}
6135
6136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6138#[cfg_attr(feature = "bindings", derive(TS))]
6139pub struct ToDateFunc {
6140 pub this: Expression,
6141 pub format: Option<Expression>,
6142}
6143
6144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6146#[cfg_attr(feature = "bindings", derive(TS))]
6147pub struct ToTimestampFunc {
6148 pub this: Expression,
6149 pub format: Option<Expression>,
6150}
6151
6152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6154#[cfg_attr(feature = "bindings", derive(TS))]
6155pub struct IfFunc {
6156 pub condition: Expression,
6157 pub true_value: Expression,
6158 pub false_value: Option<Expression>,
6159 #[serde(skip_serializing_if = "Option::is_none", default)]
6161 pub original_name: Option<String>,
6162 #[serde(default, skip_serializing_if = "Option::is_none")]
6164 pub inferred_type: Option<DataType>,
6165}
6166
6167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6169#[cfg_attr(feature = "bindings", derive(TS))]
6170pub struct Nvl2Func {
6171 pub this: Expression,
6172 pub true_value: Expression,
6173 pub false_value: Expression,
6174 #[serde(default, skip_serializing_if = "Option::is_none")]
6176 pub inferred_type: Option<DataType>,
6177}
6178
6179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6185#[cfg_attr(feature = "bindings", derive(TS))]
6186pub struct AggFunc {
6187 pub this: Expression,
6188 pub distinct: bool,
6189 pub filter: Option<Expression>,
6190 pub order_by: Vec<Ordered>,
6191 #[serde(skip_serializing_if = "Option::is_none", default)]
6193 pub name: Option<String>,
6194 #[serde(skip_serializing_if = "Option::is_none", default)]
6196 pub ignore_nulls: Option<bool>,
6197 #[serde(skip_serializing_if = "Option::is_none", default)]
6200 pub having_max: Option<(Box<Expression>, bool)>,
6201 #[serde(skip_serializing_if = "Option::is_none", default)]
6203 pub limit: Option<Box<Expression>>,
6204 #[serde(default, skip_serializing_if = "Option::is_none")]
6206 pub inferred_type: Option<DataType>,
6207}
6208
6209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6211#[cfg_attr(feature = "bindings", derive(TS))]
6212pub struct CountFunc {
6213 pub this: Option<Expression>,
6214 pub star: bool,
6215 pub distinct: bool,
6216 pub filter: Option<Expression>,
6217 #[serde(default, skip_serializing_if = "Option::is_none")]
6219 pub ignore_nulls: Option<bool>,
6220 #[serde(default, skip_serializing_if = "Option::is_none")]
6222 pub original_name: Option<String>,
6223 #[serde(default, skip_serializing_if = "Option::is_none")]
6225 pub inferred_type: Option<DataType>,
6226}
6227
6228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6230#[cfg_attr(feature = "bindings", derive(TS))]
6231pub struct GroupConcatFunc {
6232 pub this: Expression,
6233 pub separator: Option<Expression>,
6234 pub order_by: Option<Vec<Ordered>>,
6235 pub distinct: bool,
6236 pub filter: Option<Expression>,
6237 #[serde(default, skip_serializing_if = "Option::is_none")]
6239 pub inferred_type: Option<DataType>,
6240}
6241
6242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6244#[cfg_attr(feature = "bindings", derive(TS))]
6245pub struct StringAggFunc {
6246 pub this: Expression,
6247 #[serde(default)]
6248 pub separator: Option<Expression>,
6249 #[serde(default)]
6250 pub order_by: Option<Vec<Ordered>>,
6251 #[serde(default)]
6252 pub distinct: bool,
6253 #[serde(default)]
6254 pub filter: Option<Expression>,
6255 #[serde(default, skip_serializing_if = "Option::is_none")]
6257 pub limit: Option<Box<Expression>>,
6258 #[serde(default, skip_serializing_if = "Option::is_none")]
6260 pub inferred_type: Option<DataType>,
6261}
6262
6263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6265#[cfg_attr(feature = "bindings", derive(TS))]
6266pub struct ListAggFunc {
6267 pub this: Expression,
6268 pub separator: Option<Expression>,
6269 pub on_overflow: Option<ListAggOverflow>,
6270 pub order_by: Option<Vec<Ordered>>,
6271 pub distinct: bool,
6272 pub filter: Option<Expression>,
6273 #[serde(default, skip_serializing_if = "Option::is_none")]
6275 pub inferred_type: Option<DataType>,
6276}
6277
6278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6280#[cfg_attr(feature = "bindings", derive(TS))]
6281pub enum ListAggOverflow {
6282 Error,
6283 Truncate {
6284 filler: Option<Expression>,
6285 with_count: bool,
6286 },
6287}
6288
6289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6291#[cfg_attr(feature = "bindings", derive(TS))]
6292pub struct SumIfFunc {
6293 pub this: Expression,
6294 pub condition: Expression,
6295 pub filter: Option<Expression>,
6296 #[serde(default, skip_serializing_if = "Option::is_none")]
6298 pub inferred_type: Option<DataType>,
6299}
6300
6301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6303#[cfg_attr(feature = "bindings", derive(TS))]
6304pub struct ApproxPercentileFunc {
6305 pub this: Expression,
6306 pub percentile: Expression,
6307 pub accuracy: Option<Expression>,
6308 pub filter: Option<Expression>,
6309}
6310
6311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6313#[cfg_attr(feature = "bindings", derive(TS))]
6314pub struct PercentileFunc {
6315 pub this: Expression,
6316 pub percentile: Expression,
6317 pub order_by: Option<Vec<Ordered>>,
6318 pub filter: Option<Expression>,
6319}
6320
6321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6327#[cfg_attr(feature = "bindings", derive(TS))]
6328pub struct RowNumber;
6329
6330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6332#[cfg_attr(feature = "bindings", derive(TS))]
6333pub struct Rank {
6334 #[serde(default, skip_serializing_if = "Option::is_none")]
6336 pub order_by: Option<Vec<Ordered>>,
6337 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6339 pub args: Vec<Expression>,
6340}
6341
6342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6344#[cfg_attr(feature = "bindings", derive(TS))]
6345pub struct DenseRank {
6346 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6348 pub args: Vec<Expression>,
6349}
6350
6351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6353#[cfg_attr(feature = "bindings", derive(TS))]
6354pub struct NTileFunc {
6355 #[serde(default, skip_serializing_if = "Option::is_none")]
6357 pub num_buckets: Option<Expression>,
6358 #[serde(default, skip_serializing_if = "Option::is_none")]
6360 pub order_by: Option<Vec<Ordered>>,
6361}
6362
6363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6365#[cfg_attr(feature = "bindings", derive(TS))]
6366pub struct LeadLagFunc {
6367 pub this: Expression,
6368 pub offset: Option<Expression>,
6369 pub default: Option<Expression>,
6370 #[serde(default, skip_serializing_if = "Option::is_none")]
6372 pub ignore_nulls: Option<bool>,
6373}
6374
6375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6377#[cfg_attr(feature = "bindings", derive(TS))]
6378pub struct ValueFunc {
6379 pub this: Expression,
6380 #[serde(default, skip_serializing_if = "Option::is_none")]
6382 pub ignore_nulls: Option<bool>,
6383 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6385 pub order_by: Vec<Ordered>,
6386}
6387
6388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6390#[cfg_attr(feature = "bindings", derive(TS))]
6391pub struct NthValueFunc {
6392 pub this: Expression,
6393 pub offset: Expression,
6394 #[serde(default, skip_serializing_if = "Option::is_none")]
6396 pub ignore_nulls: Option<bool>,
6397 #[serde(default, skip_serializing_if = "Option::is_none")]
6400 pub from_first: Option<bool>,
6401}
6402
6403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6405#[cfg_attr(feature = "bindings", derive(TS))]
6406pub struct PercentRank {
6407 #[serde(default, skip_serializing_if = "Option::is_none")]
6409 pub order_by: Option<Vec<Ordered>>,
6410 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6412 pub args: Vec<Expression>,
6413}
6414
6415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6417#[cfg_attr(feature = "bindings", derive(TS))]
6418pub struct CumeDist {
6419 #[serde(default, skip_serializing_if = "Option::is_none")]
6421 pub order_by: Option<Vec<Ordered>>,
6422 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6424 pub args: Vec<Expression>,
6425}
6426
6427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6433#[cfg_attr(feature = "bindings", derive(TS))]
6434pub struct PositionFunc {
6435 pub substring: Expression,
6436 pub string: Expression,
6437 pub start: Option<Expression>,
6438}
6439
6440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6446#[cfg_attr(feature = "bindings", derive(TS))]
6447pub struct Random;
6448
6449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6451#[cfg_attr(feature = "bindings", derive(TS))]
6452pub struct Rand {
6453 pub seed: Option<Box<Expression>>,
6454 #[serde(default)]
6456 pub lower: Option<Box<Expression>>,
6457 #[serde(default)]
6459 pub upper: Option<Box<Expression>>,
6460}
6461
6462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6464#[cfg_attr(feature = "bindings", derive(TS))]
6465pub struct TruncateFunc {
6466 pub this: Expression,
6467 pub decimals: Option<Expression>,
6468}
6469
6470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6472#[cfg_attr(feature = "bindings", derive(TS))]
6473pub struct Pi;
6474
6475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6481#[cfg_attr(feature = "bindings", derive(TS))]
6482pub struct DecodeFunc {
6483 pub this: Expression,
6484 pub search_results: Vec<(Expression, Expression)>,
6485 pub default: Option<Expression>,
6486}
6487
6488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6494#[cfg_attr(feature = "bindings", derive(TS))]
6495pub struct DateFormatFunc {
6496 pub this: Expression,
6497 pub format: Expression,
6498}
6499
6500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6502#[cfg_attr(feature = "bindings", derive(TS))]
6503pub struct FromUnixtimeFunc {
6504 pub this: Expression,
6505 pub format: Option<Expression>,
6506}
6507
6508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6510#[cfg_attr(feature = "bindings", derive(TS))]
6511pub struct UnixTimestampFunc {
6512 pub this: Option<Expression>,
6513 pub format: Option<Expression>,
6514}
6515
6516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6518#[cfg_attr(feature = "bindings", derive(TS))]
6519pub struct MakeDateFunc {
6520 pub year: Expression,
6521 pub month: Expression,
6522 pub day: Expression,
6523}
6524
6525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6527#[cfg_attr(feature = "bindings", derive(TS))]
6528pub struct MakeTimestampFunc {
6529 pub year: Expression,
6530 pub month: Expression,
6531 pub day: Expression,
6532 pub hour: Expression,
6533 pub minute: Expression,
6534 pub second: Expression,
6535 pub timezone: Option<Expression>,
6536}
6537
6538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6540#[cfg_attr(feature = "bindings", derive(TS))]
6541pub struct LastDayFunc {
6542 pub this: Expression,
6543 #[serde(skip_serializing_if = "Option::is_none", default)]
6545 pub unit: Option<DateTimeField>,
6546}
6547
6548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6554#[cfg_attr(feature = "bindings", derive(TS))]
6555pub struct ArrayConstructor {
6556 pub expressions: Vec<Expression>,
6557 pub bracket_notation: bool,
6558 pub use_list_keyword: bool,
6560}
6561
6562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6564#[cfg_attr(feature = "bindings", derive(TS))]
6565pub struct ArraySortFunc {
6566 pub this: Expression,
6567 pub comparator: Option<Expression>,
6568 pub desc: bool,
6569 pub nulls_first: Option<bool>,
6570}
6571
6572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6574#[cfg_attr(feature = "bindings", derive(TS))]
6575pub struct ArrayJoinFunc {
6576 pub this: Expression,
6577 pub separator: Expression,
6578 pub null_replacement: Option<Expression>,
6579}
6580
6581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6583#[cfg_attr(feature = "bindings", derive(TS))]
6584pub struct UnnestFunc {
6585 pub this: Expression,
6586 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6588 pub expressions: Vec<Expression>,
6589 pub with_ordinality: bool,
6590 pub alias: Option<Identifier>,
6591 #[serde(default, skip_serializing_if = "Option::is_none")]
6593 pub offset_alias: Option<Identifier>,
6594}
6595
6596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6598#[cfg_attr(feature = "bindings", derive(TS))]
6599pub struct ArrayFilterFunc {
6600 pub this: Expression,
6601 pub filter: Expression,
6602}
6603
6604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6606#[cfg_attr(feature = "bindings", derive(TS))]
6607pub struct ArrayTransformFunc {
6608 pub this: Expression,
6609 pub transform: Expression,
6610}
6611
6612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6614#[cfg_attr(feature = "bindings", derive(TS))]
6615pub struct SequenceFunc {
6616 pub start: Expression,
6617 pub stop: Expression,
6618 pub step: Option<Expression>,
6619}
6620
6621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6627#[cfg_attr(feature = "bindings", derive(TS))]
6628pub struct StructConstructor {
6629 pub fields: Vec<(Option<Identifier>, Expression)>,
6630}
6631
6632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6634#[cfg_attr(feature = "bindings", derive(TS))]
6635pub struct StructExtractFunc {
6636 pub this: Expression,
6637 pub field: Identifier,
6638}
6639
6640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6642#[cfg_attr(feature = "bindings", derive(TS))]
6643pub struct NamedStructFunc {
6644 pub pairs: Vec<(Expression, Expression)>,
6645}
6646
6647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6653#[cfg_attr(feature = "bindings", derive(TS))]
6654pub struct MapConstructor {
6655 pub keys: Vec<Expression>,
6656 pub values: Vec<Expression>,
6657 #[serde(default)]
6659 pub curly_brace_syntax: bool,
6660 #[serde(default)]
6662 pub with_map_keyword: bool,
6663}
6664
6665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6667#[cfg_attr(feature = "bindings", derive(TS))]
6668pub struct TransformFunc {
6669 pub this: Expression,
6670 pub transform: Expression,
6671}
6672
6673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6676#[cfg_attr(feature = "bindings", derive(TS))]
6677pub struct FunctionEmits {
6678 pub this: Expression,
6680 pub emits: Expression,
6682}
6683
6684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6690#[cfg_attr(feature = "bindings", derive(TS))]
6691pub struct JsonExtractFunc {
6692 pub this: Expression,
6693 pub path: Expression,
6694 pub returning: Option<DataType>,
6695 #[serde(default)]
6697 pub arrow_syntax: bool,
6698 #[serde(default)]
6700 pub hash_arrow_syntax: bool,
6701 #[serde(default)]
6703 pub wrapper_option: Option<String>,
6704 #[serde(default)]
6706 pub quotes_option: Option<String>,
6707 #[serde(default)]
6709 pub on_scalar_string: bool,
6710 #[serde(default)]
6712 pub on_error: Option<String>,
6713}
6714
6715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6717#[cfg_attr(feature = "bindings", derive(TS))]
6718pub struct JsonPathFunc {
6719 pub this: Expression,
6720 pub paths: Vec<Expression>,
6721}
6722
6723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6725#[cfg_attr(feature = "bindings", derive(TS))]
6726pub struct JsonObjectFunc {
6727 pub pairs: Vec<(Expression, Expression)>,
6728 pub null_handling: Option<JsonNullHandling>,
6729 #[serde(default)]
6730 pub with_unique_keys: bool,
6731 #[serde(default)]
6732 pub returning_type: Option<DataType>,
6733 #[serde(default)]
6734 pub format_json: bool,
6735 #[serde(default)]
6736 pub encoding: Option<String>,
6737 #[serde(default)]
6739 pub star: bool,
6740}
6741
6742#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6744#[cfg_attr(feature = "bindings", derive(TS))]
6745pub enum JsonNullHandling {
6746 NullOnNull,
6747 AbsentOnNull,
6748}
6749
6750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6752#[cfg_attr(feature = "bindings", derive(TS))]
6753pub struct JsonModifyFunc {
6754 pub this: Expression,
6755 pub path_values: Vec<(Expression, Expression)>,
6756}
6757
6758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6760#[cfg_attr(feature = "bindings", derive(TS))]
6761pub struct JsonArrayAggFunc {
6762 pub this: Expression,
6763 pub order_by: Option<Vec<Ordered>>,
6764 pub null_handling: Option<JsonNullHandling>,
6765 pub filter: Option<Expression>,
6766}
6767
6768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6770#[cfg_attr(feature = "bindings", derive(TS))]
6771pub struct JsonObjectAggFunc {
6772 pub key: Expression,
6773 pub value: Expression,
6774 pub null_handling: Option<JsonNullHandling>,
6775 pub filter: Option<Expression>,
6776}
6777
6778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6784#[cfg_attr(feature = "bindings", derive(TS))]
6785pub struct ConvertFunc {
6786 pub this: Expression,
6787 pub to: DataType,
6788 pub style: Option<Expression>,
6789}
6790
6791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6797#[cfg_attr(feature = "bindings", derive(TS))]
6798pub struct LambdaExpr {
6799 pub parameters: Vec<Identifier>,
6800 pub body: Expression,
6801 #[serde(default)]
6803 pub colon: bool,
6804 #[serde(default)]
6807 pub parameter_types: Vec<Option<DataType>>,
6808}
6809
6810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6812#[cfg_attr(feature = "bindings", derive(TS))]
6813pub struct Parameter {
6814 pub name: Option<String>,
6815 pub index: Option<u32>,
6816 pub style: ParameterStyle,
6817 #[serde(default)]
6819 pub quoted: bool,
6820 #[serde(default)]
6822 pub string_quoted: bool,
6823 #[serde(default)]
6825 pub expression: Option<String>,
6826}
6827
6828#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6830#[cfg_attr(feature = "bindings", derive(TS))]
6831pub enum ParameterStyle {
6832 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
6842
6843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6845#[cfg_attr(feature = "bindings", derive(TS))]
6846pub struct Placeholder {
6847 pub index: Option<u32>,
6848}
6849
6850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6852#[cfg_attr(feature = "bindings", derive(TS))]
6853pub struct NamedArgument {
6854 pub name: Identifier,
6855 pub value: Expression,
6856 pub separator: NamedArgSeparator,
6858}
6859
6860#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6862#[cfg_attr(feature = "bindings", derive(TS))]
6863pub enum NamedArgSeparator {
6864 DArrow,
6866 ColonEq,
6868 Eq,
6870}
6871
6872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6875#[cfg_attr(feature = "bindings", derive(TS))]
6876pub struct TableArgument {
6877 pub prefix: String,
6879 pub this: Expression,
6881}
6882
6883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6885#[cfg_attr(feature = "bindings", derive(TS))]
6886pub struct SqlComment {
6887 pub text: String,
6888 pub is_block: bool,
6889}
6890
6891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6897#[cfg_attr(feature = "bindings", derive(TS))]
6898pub struct SimilarToExpr {
6899 pub this: Expression,
6900 pub pattern: Expression,
6901 pub escape: Option<Expression>,
6902 pub not: bool,
6903}
6904
6905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6907#[cfg_attr(feature = "bindings", derive(TS))]
6908pub struct QuantifiedExpr {
6909 pub this: Expression,
6910 pub subquery: Expression,
6911 pub op: Option<QuantifiedOp>,
6912}
6913
6914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6916#[cfg_attr(feature = "bindings", derive(TS))]
6917pub enum QuantifiedOp {
6918 Eq,
6919 Neq,
6920 Lt,
6921 Lte,
6922 Gt,
6923 Gte,
6924}
6925
6926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6931#[cfg_attr(feature = "bindings", derive(TS))]
6932pub struct OverlapsExpr {
6933 #[serde(skip_serializing_if = "Option::is_none")]
6935 pub this: Option<Expression>,
6936 #[serde(skip_serializing_if = "Option::is_none")]
6938 pub expression: Option<Expression>,
6939 #[serde(skip_serializing_if = "Option::is_none")]
6941 pub left_start: Option<Expression>,
6942 #[serde(skip_serializing_if = "Option::is_none")]
6944 pub left_end: Option<Expression>,
6945 #[serde(skip_serializing_if = "Option::is_none")]
6947 pub right_start: Option<Expression>,
6948 #[serde(skip_serializing_if = "Option::is_none")]
6950 pub right_end: Option<Expression>,
6951}
6952
6953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6959#[cfg_attr(feature = "bindings", derive(TS))]
6960pub struct Subscript {
6961 pub this: Expression,
6962 pub index: Expression,
6963}
6964
6965#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6967#[cfg_attr(feature = "bindings", derive(TS))]
6968pub struct DotAccess {
6969 pub this: Expression,
6970 pub field: Identifier,
6971}
6972
6973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6975#[cfg_attr(feature = "bindings", derive(TS))]
6976pub struct MethodCall {
6977 pub this: Expression,
6978 pub method: Identifier,
6979 pub args: Vec<Expression>,
6980}
6981
6982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6984#[cfg_attr(feature = "bindings", derive(TS))]
6985pub struct ArraySlice {
6986 pub this: Expression,
6987 pub start: Option<Expression>,
6988 pub end: Option<Expression>,
6989}
6990
6991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6997#[cfg_attr(feature = "bindings", derive(TS))]
6998pub enum OnCommit {
6999 PreserveRows,
7001 DeleteRows,
7003}
7004
7005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7007#[cfg_attr(feature = "bindings", derive(TS))]
7008pub struct CreateTable {
7009 pub name: TableRef,
7010 #[serde(default, skip_serializing_if = "Option::is_none")]
7012 pub on_cluster: Option<OnCluster>,
7013 pub columns: Vec<ColumnDef>,
7014 pub constraints: Vec<TableConstraint>,
7015 pub if_not_exists: bool,
7016 pub temporary: bool,
7017 pub or_replace: bool,
7018 #[serde(default, skip_serializing_if = "Option::is_none")]
7020 pub table_modifier: Option<String>,
7021 pub as_select: Option<Expression>,
7022 #[serde(default)]
7024 pub as_select_parenthesized: bool,
7025 #[serde(default)]
7027 pub on_commit: Option<OnCommit>,
7028 #[serde(default)]
7030 pub clone_source: Option<TableRef>,
7031 #[serde(default, skip_serializing_if = "Option::is_none")]
7033 pub clone_at_clause: Option<Expression>,
7034 #[serde(default)]
7036 pub is_copy: bool,
7037 #[serde(default)]
7039 pub shallow_clone: bool,
7040 #[serde(default)]
7042 pub leading_comments: Vec<String>,
7043 #[serde(default)]
7045 pub with_properties: Vec<(String, String)>,
7046 #[serde(default)]
7048 pub teradata_post_name_options: Vec<String>,
7049 #[serde(default)]
7051 pub with_data: Option<bool>,
7052 #[serde(default)]
7054 pub with_statistics: Option<bool>,
7055 #[serde(default)]
7057 pub teradata_indexes: Vec<TeradataIndex>,
7058 #[serde(default)]
7060 pub with_cte: Option<With>,
7061 #[serde(default)]
7063 pub properties: Vec<Expression>,
7064 #[serde(default, skip_serializing_if = "Option::is_none")]
7066 pub partition_of: Option<Expression>,
7067 #[serde(default)]
7069 pub post_table_properties: Vec<Expression>,
7070 #[serde(default)]
7072 pub mysql_table_options: Vec<(String, String)>,
7073 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7075 pub inherits: Vec<TableRef>,
7076 #[serde(default, skip_serializing_if = "Option::is_none")]
7078 pub on_property: Option<OnProperty>,
7079 #[serde(default)]
7081 pub copy_grants: bool,
7082 #[serde(default, skip_serializing_if = "Option::is_none")]
7084 pub using_template: Option<Box<Expression>>,
7085 #[serde(default, skip_serializing_if = "Option::is_none")]
7087 pub rollup: Option<RollupProperty>,
7088}
7089
7090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7092#[cfg_attr(feature = "bindings", derive(TS))]
7093pub struct TeradataIndex {
7094 pub kind: TeradataIndexKind,
7096 pub name: Option<String>,
7098 pub columns: Vec<String>,
7100}
7101
7102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7104#[cfg_attr(feature = "bindings", derive(TS))]
7105pub enum TeradataIndexKind {
7106 NoPrimary,
7108 Primary,
7110 PrimaryAmp,
7112 Unique,
7114 UniquePrimary,
7116 Secondary,
7118}
7119
7120impl CreateTable {
7121 pub fn new(name: impl Into<String>) -> Self {
7122 Self {
7123 name: TableRef::new(name),
7124 on_cluster: None,
7125 columns: Vec::new(),
7126 constraints: Vec::new(),
7127 if_not_exists: false,
7128 temporary: false,
7129 or_replace: false,
7130 table_modifier: None,
7131 as_select: None,
7132 as_select_parenthesized: false,
7133 on_commit: None,
7134 clone_source: None,
7135 clone_at_clause: None,
7136 shallow_clone: false,
7137 is_copy: false,
7138 leading_comments: Vec::new(),
7139 with_properties: Vec::new(),
7140 teradata_post_name_options: Vec::new(),
7141 with_data: None,
7142 with_statistics: None,
7143 teradata_indexes: Vec::new(),
7144 with_cte: None,
7145 properties: Vec::new(),
7146 partition_of: None,
7147 post_table_properties: Vec::new(),
7148 mysql_table_options: Vec::new(),
7149 inherits: Vec::new(),
7150 on_property: None,
7151 copy_grants: false,
7152 using_template: None,
7153 rollup: None,
7154 }
7155 }
7156}
7157
7158#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7160#[cfg_attr(feature = "bindings", derive(TS))]
7161pub enum SortOrder {
7162 Asc,
7163 Desc,
7164}
7165
7166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7168#[cfg_attr(feature = "bindings", derive(TS))]
7169pub enum ConstraintType {
7170 NotNull,
7171 Null,
7172 PrimaryKey,
7173 Unique,
7174 Default,
7175 AutoIncrement,
7176 Collate,
7177 Comment,
7178 References,
7179 Check,
7180 GeneratedAsIdentity,
7181 Tags,
7183 ComputedColumn,
7185 GeneratedAsRow,
7187 OnUpdate,
7189 Path,
7191 Encode,
7193}
7194
7195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7197#[cfg_attr(feature = "bindings", derive(TS))]
7198pub struct ColumnDef {
7199 pub name: Identifier,
7200 pub data_type: DataType,
7201 pub nullable: Option<bool>,
7202 pub default: Option<Expression>,
7203 pub primary_key: bool,
7204 #[serde(default)]
7206 pub primary_key_order: Option<SortOrder>,
7207 pub unique: bool,
7208 #[serde(default)]
7210 pub unique_nulls_not_distinct: bool,
7211 pub auto_increment: bool,
7212 pub comment: Option<String>,
7213 pub constraints: Vec<ColumnConstraint>,
7214 #[serde(default)]
7216 pub constraint_order: Vec<ConstraintType>,
7217 #[serde(default)]
7219 pub format: Option<String>,
7220 #[serde(default)]
7222 pub title: Option<String>,
7223 #[serde(default)]
7225 pub inline_length: Option<u64>,
7226 #[serde(default)]
7228 pub compress: Option<Vec<Expression>>,
7229 #[serde(default)]
7231 pub character_set: Option<String>,
7232 #[serde(default)]
7234 pub uppercase: bool,
7235 #[serde(default)]
7237 pub casespecific: Option<bool>,
7238 #[serde(default)]
7240 pub auto_increment_start: Option<Box<Expression>>,
7241 #[serde(default)]
7243 pub auto_increment_increment: Option<Box<Expression>>,
7244 #[serde(default)]
7246 pub auto_increment_order: Option<bool>,
7247 #[serde(default)]
7249 pub unsigned: bool,
7250 #[serde(default)]
7252 pub zerofill: bool,
7253 #[serde(default, skip_serializing_if = "Option::is_none")]
7255 pub on_update: Option<Expression>,
7256 #[serde(default, skip_serializing_if = "Option::is_none")]
7258 pub unique_constraint_name: Option<String>,
7259 #[serde(default, skip_serializing_if = "Option::is_none")]
7261 pub not_null_constraint_name: Option<String>,
7262 #[serde(default, skip_serializing_if = "Option::is_none")]
7264 pub primary_key_constraint_name: Option<String>,
7265 #[serde(default, skip_serializing_if = "Option::is_none")]
7267 pub check_constraint_name: Option<String>,
7268 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7270 pub options: Vec<Expression>,
7271 #[serde(default)]
7273 pub no_type: bool,
7274 #[serde(default, skip_serializing_if = "Option::is_none")]
7276 pub encoding: Option<String>,
7277 #[serde(default, skip_serializing_if = "Option::is_none")]
7279 pub codec: Option<String>,
7280 #[serde(default, skip_serializing_if = "Option::is_none")]
7282 pub ephemeral: Option<Option<Box<Expression>>>,
7283 #[serde(default, skip_serializing_if = "Option::is_none")]
7285 pub materialized_expr: Option<Box<Expression>>,
7286 #[serde(default, skip_serializing_if = "Option::is_none")]
7288 pub alias_expr: Option<Box<Expression>>,
7289 #[serde(default, skip_serializing_if = "Option::is_none")]
7291 pub ttl_expr: Option<Box<Expression>>,
7292 #[serde(default)]
7294 pub not_for_replication: bool,
7295}
7296
7297impl ColumnDef {
7298 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7299 Self {
7300 name: Identifier::new(name),
7301 data_type,
7302 nullable: None,
7303 default: None,
7304 primary_key: false,
7305 primary_key_order: None,
7306 unique: false,
7307 unique_nulls_not_distinct: false,
7308 auto_increment: false,
7309 comment: None,
7310 constraints: Vec::new(),
7311 constraint_order: Vec::new(),
7312 format: None,
7313 title: None,
7314 inline_length: None,
7315 compress: None,
7316 character_set: None,
7317 uppercase: false,
7318 casespecific: None,
7319 auto_increment_start: None,
7320 auto_increment_increment: None,
7321 auto_increment_order: None,
7322 unsigned: false,
7323 zerofill: false,
7324 on_update: None,
7325 unique_constraint_name: None,
7326 not_null_constraint_name: None,
7327 primary_key_constraint_name: None,
7328 check_constraint_name: None,
7329 options: Vec::new(),
7330 no_type: false,
7331 encoding: None,
7332 codec: None,
7333 ephemeral: None,
7334 materialized_expr: None,
7335 alias_expr: None,
7336 ttl_expr: None,
7337 not_for_replication: false,
7338 }
7339 }
7340}
7341
7342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7344#[cfg_attr(feature = "bindings", derive(TS))]
7345pub enum ColumnConstraint {
7346 NotNull,
7347 Null,
7348 Unique,
7349 PrimaryKey,
7350 Default(Expression),
7351 Check(Expression),
7352 References(ForeignKeyRef),
7353 GeneratedAsIdentity(GeneratedAsIdentity),
7354 Collate(Identifier),
7355 Comment(String),
7356 Tags(Tags),
7358 ComputedColumn(ComputedColumn),
7361 GeneratedAsRow(GeneratedAsRow),
7363 Path(Expression),
7365}
7366
7367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7369#[cfg_attr(feature = "bindings", derive(TS))]
7370pub struct ComputedColumn {
7371 pub expression: Box<Expression>,
7373 #[serde(default)]
7375 pub persisted: bool,
7376 #[serde(default)]
7378 pub not_null: bool,
7379 #[serde(default)]
7382 pub persistence_kind: Option<String>,
7383 #[serde(default, skip_serializing_if = "Option::is_none")]
7385 pub data_type: Option<DataType>,
7386}
7387
7388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7390#[cfg_attr(feature = "bindings", derive(TS))]
7391pub struct GeneratedAsRow {
7392 pub start: bool,
7394 #[serde(default)]
7396 pub hidden: bool,
7397}
7398
7399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7401#[cfg_attr(feature = "bindings", derive(TS))]
7402pub struct GeneratedAsIdentity {
7403 pub always: bool,
7405 pub on_null: bool,
7407 pub start: Option<Box<Expression>>,
7409 pub increment: Option<Box<Expression>>,
7411 pub minvalue: Option<Box<Expression>>,
7413 pub maxvalue: Option<Box<Expression>>,
7415 pub cycle: Option<bool>,
7417}
7418
7419#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7421#[cfg_attr(feature = "bindings", derive(TS))]
7422pub struct ConstraintModifiers {
7423 pub enforced: Option<bool>,
7425 pub deferrable: Option<bool>,
7427 pub initially_deferred: Option<bool>,
7429 pub norely: bool,
7431 pub rely: bool,
7433 #[serde(default)]
7435 pub using: Option<String>,
7436 #[serde(default)]
7438 pub using_before_columns: bool,
7439 #[serde(default, skip_serializing_if = "Option::is_none")]
7441 pub comment: Option<String>,
7442 #[serde(default, skip_serializing_if = "Option::is_none")]
7444 pub visible: Option<bool>,
7445 #[serde(default, skip_serializing_if = "Option::is_none")]
7447 pub engine_attribute: Option<String>,
7448 #[serde(default, skip_serializing_if = "Option::is_none")]
7450 pub with_parser: Option<String>,
7451 #[serde(default)]
7453 pub not_valid: bool,
7454 #[serde(default, skip_serializing_if = "Option::is_none")]
7456 pub clustered: Option<String>,
7457 #[serde(default, skip_serializing_if = "Option::is_none")]
7459 pub on_conflict: Option<String>,
7460 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7462 pub with_options: Vec<(String, String)>,
7463 #[serde(default, skip_serializing_if = "Option::is_none")]
7465 pub on_filegroup: Option<Identifier>,
7466}
7467
7468#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7470#[cfg_attr(feature = "bindings", derive(TS))]
7471pub enum TableConstraint {
7472 PrimaryKey {
7473 name: Option<Identifier>,
7474 columns: Vec<Identifier>,
7475 #[serde(default)]
7477 include_columns: Vec<Identifier>,
7478 #[serde(default)]
7479 modifiers: ConstraintModifiers,
7480 #[serde(default)]
7482 has_constraint_keyword: bool,
7483 },
7484 Unique {
7485 name: Option<Identifier>,
7486 columns: Vec<Identifier>,
7487 #[serde(default)]
7489 columns_parenthesized: bool,
7490 #[serde(default)]
7491 modifiers: ConstraintModifiers,
7492 #[serde(default)]
7494 has_constraint_keyword: bool,
7495 #[serde(default)]
7497 nulls_not_distinct: bool,
7498 },
7499 ForeignKey {
7500 name: Option<Identifier>,
7501 columns: Vec<Identifier>,
7502 #[serde(default)]
7503 references: Option<ForeignKeyRef>,
7504 #[serde(default)]
7506 on_delete: Option<ReferentialAction>,
7507 #[serde(default)]
7509 on_update: Option<ReferentialAction>,
7510 #[serde(default)]
7511 modifiers: ConstraintModifiers,
7512 },
7513 Check {
7514 name: Option<Identifier>,
7515 expression: Expression,
7516 #[serde(default)]
7517 modifiers: ConstraintModifiers,
7518 },
7519 Assume {
7521 name: Option<Identifier>,
7522 expression: Expression,
7523 },
7524 Index {
7526 name: Option<Identifier>,
7527 columns: Vec<Identifier>,
7528 #[serde(default)]
7530 kind: Option<String>,
7531 #[serde(default)]
7532 modifiers: ConstraintModifiers,
7533 #[serde(default)]
7535 use_key_keyword: bool,
7536 #[serde(default, skip_serializing_if = "Option::is_none")]
7538 expression: Option<Box<Expression>>,
7539 #[serde(default, skip_serializing_if = "Option::is_none")]
7541 index_type: Option<Box<Expression>>,
7542 #[serde(default, skip_serializing_if = "Option::is_none")]
7544 granularity: Option<Box<Expression>>,
7545 },
7546 Projection {
7548 name: Identifier,
7549 expression: Expression,
7550 },
7551 Like {
7553 source: TableRef,
7554 options: Vec<(LikeOptionAction, String)>,
7556 },
7557 PeriodForSystemTime {
7559 start_col: Identifier,
7560 end_col: Identifier,
7561 },
7562 Exclude {
7565 name: Option<Identifier>,
7566 #[serde(default)]
7568 using: Option<String>,
7569 elements: Vec<ExcludeElement>,
7571 #[serde(default)]
7573 include_columns: Vec<Identifier>,
7574 #[serde(default)]
7576 where_clause: Option<Box<Expression>>,
7577 #[serde(default)]
7579 with_params: Vec<(String, String)>,
7580 #[serde(default)]
7582 using_index_tablespace: Option<String>,
7583 #[serde(default)]
7584 modifiers: ConstraintModifiers,
7585 },
7586 Tags(Tags),
7588 InitiallyDeferred {
7592 deferred: bool,
7594 },
7595}
7596
7597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7599#[cfg_attr(feature = "bindings", derive(TS))]
7600pub struct ExcludeElement {
7601 pub expression: String,
7603 pub operator: String,
7605}
7606
7607#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7609#[cfg_attr(feature = "bindings", derive(TS))]
7610pub enum LikeOptionAction {
7611 Including,
7612 Excluding,
7613}
7614
7615#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7617#[cfg_attr(feature = "bindings", derive(TS))]
7618pub enum MatchType {
7619 Full,
7620 Partial,
7621 Simple,
7622}
7623
7624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7626#[cfg_attr(feature = "bindings", derive(TS))]
7627pub struct ForeignKeyRef {
7628 pub table: TableRef,
7629 pub columns: Vec<Identifier>,
7630 pub on_delete: Option<ReferentialAction>,
7631 pub on_update: Option<ReferentialAction>,
7632 #[serde(default)]
7634 pub on_update_first: bool,
7635 #[serde(default)]
7637 pub match_type: Option<MatchType>,
7638 #[serde(default)]
7640 pub match_after_actions: bool,
7641 #[serde(default)]
7643 pub constraint_name: Option<String>,
7644 #[serde(default)]
7646 pub deferrable: Option<bool>,
7647 #[serde(default)]
7649 pub has_foreign_key_keywords: bool,
7650}
7651
7652#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7654#[cfg_attr(feature = "bindings", derive(TS))]
7655pub enum ReferentialAction {
7656 Cascade,
7657 SetNull,
7658 SetDefault,
7659 Restrict,
7660 NoAction,
7661}
7662
7663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7665#[cfg_attr(feature = "bindings", derive(TS))]
7666pub struct DropTable {
7667 pub names: Vec<TableRef>,
7668 pub if_exists: bool,
7669 pub cascade: bool,
7670 #[serde(default)]
7672 pub cascade_constraints: bool,
7673 #[serde(default)]
7675 pub purge: bool,
7676 #[serde(default)]
7678 pub leading_comments: Vec<String>,
7679 #[serde(default, skip_serializing_if = "Option::is_none")]
7682 pub object_id_args: Option<String>,
7683 #[serde(default)]
7685 pub sync: bool,
7686}
7687
7688impl DropTable {
7689 pub fn new(name: impl Into<String>) -> Self {
7690 Self {
7691 names: vec![TableRef::new(name)],
7692 if_exists: false,
7693 cascade: false,
7694 cascade_constraints: false,
7695 purge: false,
7696 leading_comments: Vec::new(),
7697 object_id_args: None,
7698 sync: false,
7699 }
7700 }
7701}
7702
7703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7705#[cfg_attr(feature = "bindings", derive(TS))]
7706pub struct AlterTable {
7707 pub name: TableRef,
7708 pub actions: Vec<AlterTableAction>,
7709 #[serde(default)]
7711 pub if_exists: bool,
7712 #[serde(default, skip_serializing_if = "Option::is_none")]
7714 pub algorithm: Option<String>,
7715 #[serde(default, skip_serializing_if = "Option::is_none")]
7717 pub lock: Option<String>,
7718 #[serde(default, skip_serializing_if = "Option::is_none")]
7720 pub with_check: Option<String>,
7721 #[serde(default, skip_serializing_if = "Option::is_none")]
7723 pub partition: Option<Vec<(Identifier, Expression)>>,
7724 #[serde(default, skip_serializing_if = "Option::is_none")]
7726 pub on_cluster: Option<OnCluster>,
7727}
7728
7729impl AlterTable {
7730 pub fn new(name: impl Into<String>) -> Self {
7731 Self {
7732 name: TableRef::new(name),
7733 actions: Vec::new(),
7734 if_exists: false,
7735 algorithm: None,
7736 lock: None,
7737 with_check: None,
7738 partition: None,
7739 on_cluster: None,
7740 }
7741 }
7742}
7743
7744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7746#[cfg_attr(feature = "bindings", derive(TS))]
7747pub enum ColumnPosition {
7748 First,
7749 After(Identifier),
7750}
7751
7752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7754#[cfg_attr(feature = "bindings", derive(TS))]
7755pub enum AlterTableAction {
7756 AddColumn {
7757 column: ColumnDef,
7758 if_not_exists: bool,
7759 position: Option<ColumnPosition>,
7760 },
7761 DropColumn {
7762 name: Identifier,
7763 if_exists: bool,
7764 cascade: bool,
7765 },
7766 RenameColumn {
7767 old_name: Identifier,
7768 new_name: Identifier,
7769 if_exists: bool,
7770 },
7771 AlterColumn {
7772 name: Identifier,
7773 action: AlterColumnAction,
7774 #[serde(default)]
7776 use_modify_keyword: bool,
7777 },
7778 RenameTable(TableRef),
7779 AddConstraint(TableConstraint),
7780 DropConstraint {
7781 name: Identifier,
7782 if_exists: bool,
7783 },
7784 DropForeignKey {
7786 name: Identifier,
7787 },
7788 DropPartition {
7790 partitions: Vec<Vec<(Identifier, Expression)>>,
7792 if_exists: bool,
7793 },
7794 AddPartition {
7796 partition: Expression,
7798 if_not_exists: bool,
7799 location: Option<Expression>,
7800 },
7801 Delete {
7803 where_clause: Expression,
7804 },
7805 SwapWith(TableRef),
7807 SetProperty {
7809 properties: Vec<(String, Expression)>,
7810 },
7811 UnsetProperty {
7813 properties: Vec<String>,
7814 },
7815 ClusterBy {
7817 expressions: Vec<Expression>,
7818 },
7819 SetTag {
7821 expressions: Vec<(String, Expression)>,
7822 },
7823 UnsetTag {
7825 names: Vec<String>,
7826 },
7827 SetOptions {
7829 expressions: Vec<Expression>,
7830 },
7831 AlterIndex {
7833 name: Identifier,
7834 visible: bool,
7835 },
7836 SetAttribute {
7838 attribute: String,
7839 },
7840 SetStageFileFormat {
7842 options: Option<Expression>,
7843 },
7844 SetStageCopyOptions {
7846 options: Option<Expression>,
7847 },
7848 AddColumns {
7850 columns: Vec<ColumnDef>,
7851 cascade: bool,
7852 },
7853 DropColumns {
7855 names: Vec<Identifier>,
7856 },
7857 ChangeColumn {
7860 old_name: Identifier,
7861 new_name: Identifier,
7862 #[serde(default, skip_serializing_if = "Option::is_none")]
7863 data_type: Option<DataType>,
7864 comment: Option<String>,
7865 #[serde(default)]
7866 cascade: bool,
7867 },
7868 AlterSortKey {
7871 this: Option<String>,
7873 expressions: Vec<Expression>,
7875 compound: bool,
7877 },
7878 AlterDistStyle {
7882 style: String,
7884 distkey: Option<Identifier>,
7886 },
7887 SetTableProperties {
7889 properties: Vec<(Expression, Expression)>,
7890 },
7891 SetLocation {
7893 location: String,
7894 },
7895 SetFileFormat {
7897 format: String,
7898 },
7899 ReplacePartition {
7901 partition: Expression,
7902 source: Option<Box<Expression>>,
7903 },
7904 Raw {
7906 sql: String,
7907 },
7908}
7909
7910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7912#[cfg_attr(feature = "bindings", derive(TS))]
7913pub enum AlterColumnAction {
7914 SetDataType {
7915 data_type: DataType,
7916 using: Option<Expression>,
7918 #[serde(default, skip_serializing_if = "Option::is_none")]
7920 collate: Option<String>,
7921 },
7922 SetDefault(Expression),
7923 DropDefault,
7924 SetNotNull,
7925 DropNotNull,
7926 Comment(String),
7928 SetVisible,
7930 SetInvisible,
7932}
7933
7934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7936#[cfg_attr(feature = "bindings", derive(TS))]
7937pub struct CreateIndex {
7938 pub name: Identifier,
7939 pub table: TableRef,
7940 pub columns: Vec<IndexColumn>,
7941 pub unique: bool,
7942 pub if_not_exists: bool,
7943 pub using: Option<String>,
7944 #[serde(default)]
7946 pub clustered: Option<String>,
7947 #[serde(default)]
7949 pub concurrently: bool,
7950 #[serde(default)]
7952 pub where_clause: Option<Box<Expression>>,
7953 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7955 pub include_columns: Vec<Identifier>,
7956 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7958 pub with_options: Vec<(String, String)>,
7959 #[serde(default)]
7961 pub on_filegroup: Option<String>,
7962}
7963
7964impl CreateIndex {
7965 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
7966 Self {
7967 name: Identifier::new(name),
7968 table: TableRef::new(table),
7969 columns: Vec::new(),
7970 unique: false,
7971 if_not_exists: false,
7972 using: None,
7973 clustered: None,
7974 concurrently: false,
7975 where_clause: None,
7976 include_columns: Vec::new(),
7977 with_options: Vec::new(),
7978 on_filegroup: None,
7979 }
7980 }
7981}
7982
7983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7985#[cfg_attr(feature = "bindings", derive(TS))]
7986pub struct IndexColumn {
7987 pub column: Identifier,
7988 pub desc: bool,
7989 #[serde(default)]
7991 pub asc: bool,
7992 pub nulls_first: Option<bool>,
7993 #[serde(default, skip_serializing_if = "Option::is_none")]
7995 pub opclass: Option<String>,
7996}
7997
7998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8000#[cfg_attr(feature = "bindings", derive(TS))]
8001pub struct DropIndex {
8002 pub name: Identifier,
8003 pub table: Option<TableRef>,
8004 pub if_exists: bool,
8005 #[serde(default)]
8007 pub concurrently: bool,
8008}
8009
8010impl DropIndex {
8011 pub fn new(name: impl Into<String>) -> Self {
8012 Self {
8013 name: Identifier::new(name),
8014 table: None,
8015 if_exists: false,
8016 concurrently: false,
8017 }
8018 }
8019}
8020
8021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8023#[cfg_attr(feature = "bindings", derive(TS))]
8024pub struct ViewColumn {
8025 pub name: Identifier,
8026 pub comment: Option<String>,
8027 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8029 pub options: Vec<Expression>,
8030}
8031
8032impl ViewColumn {
8033 pub fn new(name: impl Into<String>) -> Self {
8034 Self {
8035 name: Identifier::new(name),
8036 comment: None,
8037 options: Vec::new(),
8038 }
8039 }
8040
8041 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8042 Self {
8043 name: Identifier::new(name),
8044 comment: Some(comment.into()),
8045 options: Vec::new(),
8046 }
8047 }
8048}
8049
8050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8052#[cfg_attr(feature = "bindings", derive(TS))]
8053pub struct CreateView {
8054 pub name: TableRef,
8055 pub columns: Vec<ViewColumn>,
8056 pub query: Expression,
8057 pub or_replace: bool,
8058 pub if_not_exists: bool,
8059 pub materialized: bool,
8060 pub temporary: bool,
8061 #[serde(default)]
8063 pub secure: bool,
8064 #[serde(skip_serializing_if = "Option::is_none")]
8066 pub algorithm: Option<String>,
8067 #[serde(skip_serializing_if = "Option::is_none")]
8069 pub definer: Option<String>,
8070 #[serde(skip_serializing_if = "Option::is_none")]
8072 pub security: Option<FunctionSecurity>,
8073 #[serde(default = "default_true")]
8075 pub security_sql_style: bool,
8076 #[serde(default)]
8078 pub security_after_name: bool,
8079 #[serde(default)]
8081 pub query_parenthesized: bool,
8082 #[serde(skip_serializing_if = "Option::is_none")]
8084 pub locking_mode: Option<String>,
8085 #[serde(skip_serializing_if = "Option::is_none")]
8087 pub locking_access: Option<String>,
8088 #[serde(default)]
8090 pub copy_grants: bool,
8091 #[serde(skip_serializing_if = "Option::is_none", default)]
8093 pub comment: Option<String>,
8094 #[serde(default)]
8096 pub tags: Vec<(String, String)>,
8097 #[serde(default)]
8099 pub options: Vec<Expression>,
8100 #[serde(skip_serializing_if = "Option::is_none", default)]
8102 pub build: Option<String>,
8103 #[serde(skip_serializing_if = "Option::is_none", default)]
8105 pub refresh: Option<Box<RefreshTriggerProperty>>,
8106 #[serde(skip_serializing_if = "Option::is_none", default)]
8109 pub schema: Option<Box<Schema>>,
8110 #[serde(skip_serializing_if = "Option::is_none", default)]
8112 pub unique_key: Option<Box<UniqueKeyProperty>>,
8113 #[serde(default)]
8115 pub no_schema_binding: bool,
8116 #[serde(skip_serializing_if = "Option::is_none", default)]
8118 pub auto_refresh: Option<bool>,
8119 #[serde(default, skip_serializing_if = "Option::is_none")]
8121 pub on_cluster: Option<OnCluster>,
8122 #[serde(default, skip_serializing_if = "Option::is_none")]
8124 pub to_table: Option<TableRef>,
8125 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8127 pub table_properties: Vec<Expression>,
8128}
8129
8130impl CreateView {
8131 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8132 Self {
8133 name: TableRef::new(name),
8134 columns: Vec::new(),
8135 query,
8136 or_replace: false,
8137 if_not_exists: false,
8138 materialized: false,
8139 temporary: false,
8140 secure: false,
8141 algorithm: None,
8142 definer: None,
8143 security: None,
8144 security_sql_style: true,
8145 security_after_name: false,
8146 query_parenthesized: false,
8147 locking_mode: None,
8148 locking_access: None,
8149 copy_grants: false,
8150 comment: None,
8151 tags: Vec::new(),
8152 options: Vec::new(),
8153 build: None,
8154 refresh: None,
8155 schema: None,
8156 unique_key: None,
8157 no_schema_binding: false,
8158 auto_refresh: None,
8159 on_cluster: None,
8160 to_table: None,
8161 table_properties: Vec::new(),
8162 }
8163 }
8164}
8165
8166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8168#[cfg_attr(feature = "bindings", derive(TS))]
8169pub struct DropView {
8170 pub name: TableRef,
8171 pub if_exists: bool,
8172 pub materialized: bool,
8173}
8174
8175impl DropView {
8176 pub fn new(name: impl Into<String>) -> Self {
8177 Self {
8178 name: TableRef::new(name),
8179 if_exists: false,
8180 materialized: false,
8181 }
8182 }
8183}
8184
8185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8187#[cfg_attr(feature = "bindings", derive(TS))]
8188pub struct Truncate {
8189 #[serde(default)]
8191 pub target: TruncateTarget,
8192 #[serde(default)]
8194 pub if_exists: bool,
8195 pub table: TableRef,
8196 #[serde(default, skip_serializing_if = "Option::is_none")]
8198 pub on_cluster: Option<OnCluster>,
8199 pub cascade: bool,
8200 #[serde(default)]
8202 pub extra_tables: Vec<TruncateTableEntry>,
8203 #[serde(default)]
8205 pub identity: Option<TruncateIdentity>,
8206 #[serde(default)]
8208 pub restrict: bool,
8209 #[serde(default, skip_serializing_if = "Option::is_none")]
8211 pub partition: Option<Box<Expression>>,
8212}
8213
8214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8216#[cfg_attr(feature = "bindings", derive(TS))]
8217pub struct TruncateTableEntry {
8218 pub table: TableRef,
8219 #[serde(default)]
8221 pub star: bool,
8222}
8223
8224#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8226#[cfg_attr(feature = "bindings", derive(TS))]
8227pub enum TruncateTarget {
8228 Table,
8229 Database,
8230}
8231
8232impl Default for TruncateTarget {
8233 fn default() -> Self {
8234 TruncateTarget::Table
8235 }
8236}
8237
8238#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8240#[cfg_attr(feature = "bindings", derive(TS))]
8241pub enum TruncateIdentity {
8242 Restart,
8243 Continue,
8244}
8245
8246impl Truncate {
8247 pub fn new(table: impl Into<String>) -> Self {
8248 Self {
8249 target: TruncateTarget::Table,
8250 if_exists: false,
8251 table: TableRef::new(table),
8252 on_cluster: None,
8253 cascade: false,
8254 extra_tables: Vec::new(),
8255 identity: None,
8256 restrict: false,
8257 partition: None,
8258 }
8259 }
8260}
8261
8262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8264#[cfg_attr(feature = "bindings", derive(TS))]
8265pub struct Use {
8266 pub kind: Option<UseKind>,
8268 pub this: Identifier,
8270}
8271
8272#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8274#[cfg_attr(feature = "bindings", derive(TS))]
8275pub enum UseKind {
8276 Database,
8277 Schema,
8278 Role,
8279 Warehouse,
8280 Catalog,
8281 SecondaryRoles,
8283}
8284
8285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8287#[cfg_attr(feature = "bindings", derive(TS))]
8288pub struct SetStatement {
8289 pub items: Vec<SetItem>,
8291}
8292
8293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8295#[cfg_attr(feature = "bindings", derive(TS))]
8296pub struct SetItem {
8297 pub name: Expression,
8299 pub value: Expression,
8301 pub kind: Option<String>,
8303 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8305 pub no_equals: bool,
8306}
8307
8308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8310#[cfg_attr(feature = "bindings", derive(TS))]
8311pub struct Cache {
8312 pub table: Identifier,
8314 pub lazy: bool,
8316 pub options: Vec<(Expression, Expression)>,
8318 pub query: Option<Expression>,
8320}
8321
8322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8324#[cfg_attr(feature = "bindings", derive(TS))]
8325pub struct Uncache {
8326 pub table: Identifier,
8328 pub if_exists: bool,
8330}
8331
8332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8334#[cfg_attr(feature = "bindings", derive(TS))]
8335pub struct LoadData {
8336 pub local: bool,
8338 pub inpath: String,
8340 pub overwrite: bool,
8342 pub table: Expression,
8344 pub partition: Vec<(Identifier, Expression)>,
8346 pub input_format: Option<String>,
8348 pub serde: Option<String>,
8350}
8351
8352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8354#[cfg_attr(feature = "bindings", derive(TS))]
8355pub struct Pragma {
8356 pub schema: Option<Identifier>,
8358 pub name: Identifier,
8360 pub value: Option<Expression>,
8362 pub args: Vec<Expression>,
8364}
8365
8366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8369#[cfg_attr(feature = "bindings", derive(TS))]
8370pub struct Privilege {
8371 pub name: String,
8373 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8375 pub columns: Vec<String>,
8376}
8377
8378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8380#[cfg_attr(feature = "bindings", derive(TS))]
8381pub struct GrantPrincipal {
8382 pub name: Identifier,
8384 pub is_role: bool,
8386 #[serde(default)]
8388 pub is_group: bool,
8389}
8390
8391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8393#[cfg_attr(feature = "bindings", derive(TS))]
8394pub struct Grant {
8395 pub privileges: Vec<Privilege>,
8397 pub kind: Option<String>,
8399 pub securable: Identifier,
8401 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8403 pub function_params: Vec<String>,
8404 pub principals: Vec<GrantPrincipal>,
8406 pub grant_option: bool,
8408 #[serde(default, skip_serializing_if = "Option::is_none")]
8410 pub as_principal: Option<Identifier>,
8411}
8412
8413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8415#[cfg_attr(feature = "bindings", derive(TS))]
8416pub struct Revoke {
8417 pub privileges: Vec<Privilege>,
8419 pub kind: Option<String>,
8421 pub securable: Identifier,
8423 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8425 pub function_params: Vec<String>,
8426 pub principals: Vec<GrantPrincipal>,
8428 pub grant_option: bool,
8430 pub cascade: bool,
8432 #[serde(default)]
8434 pub restrict: bool,
8435}
8436
8437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8439#[cfg_attr(feature = "bindings", derive(TS))]
8440pub struct Comment {
8441 pub this: Expression,
8443 pub kind: String,
8445 pub expression: Expression,
8447 pub exists: bool,
8449 pub materialized: bool,
8451}
8452
8453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8459#[cfg_attr(feature = "bindings", derive(TS))]
8460pub struct AlterView {
8461 pub name: TableRef,
8462 pub actions: Vec<AlterViewAction>,
8463 #[serde(default, skip_serializing_if = "Option::is_none")]
8465 pub algorithm: Option<String>,
8466 #[serde(default, skip_serializing_if = "Option::is_none")]
8468 pub definer: Option<String>,
8469 #[serde(default, skip_serializing_if = "Option::is_none")]
8471 pub sql_security: Option<String>,
8472 #[serde(default, skip_serializing_if = "Option::is_none")]
8474 pub with_option: Option<String>,
8475 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8477 pub columns: Vec<ViewColumn>,
8478}
8479
8480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8482#[cfg_attr(feature = "bindings", derive(TS))]
8483pub enum AlterViewAction {
8484 Rename(TableRef),
8486 OwnerTo(Identifier),
8488 SetSchema(Identifier),
8490 SetAuthorization(String),
8492 AlterColumn {
8494 name: Identifier,
8495 action: AlterColumnAction,
8496 },
8497 AsSelect(Box<Expression>),
8499 SetTblproperties(Vec<(String, String)>),
8501 UnsetTblproperties(Vec<String>),
8503}
8504
8505impl AlterView {
8506 pub fn new(name: impl Into<String>) -> Self {
8507 Self {
8508 name: TableRef::new(name),
8509 actions: Vec::new(),
8510 algorithm: None,
8511 definer: None,
8512 sql_security: None,
8513 with_option: None,
8514 columns: Vec::new(),
8515 }
8516 }
8517}
8518
8519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8521#[cfg_attr(feature = "bindings", derive(TS))]
8522pub struct AlterIndex {
8523 pub name: Identifier,
8524 pub table: Option<TableRef>,
8525 pub actions: Vec<AlterIndexAction>,
8526}
8527
8528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8530#[cfg_attr(feature = "bindings", derive(TS))]
8531pub enum AlterIndexAction {
8532 Rename(Identifier),
8534 SetTablespace(Identifier),
8536 Visible(bool),
8538}
8539
8540impl AlterIndex {
8541 pub fn new(name: impl Into<String>) -> Self {
8542 Self {
8543 name: Identifier::new(name),
8544 table: None,
8545 actions: Vec::new(),
8546 }
8547 }
8548}
8549
8550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8552#[cfg_attr(feature = "bindings", derive(TS))]
8553pub struct CreateSchema {
8554 pub name: Identifier,
8555 pub if_not_exists: bool,
8556 pub authorization: Option<Identifier>,
8557 #[serde(default)]
8558 pub clone_from: Option<Identifier>,
8559 #[serde(default)]
8561 pub at_clause: Option<Expression>,
8562 #[serde(default)]
8564 pub properties: Vec<Expression>,
8565 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8567 pub leading_comments: Vec<String>,
8568}
8569
8570impl CreateSchema {
8571 pub fn new(name: impl Into<String>) -> Self {
8572 Self {
8573 name: Identifier::new(name),
8574 if_not_exists: false,
8575 authorization: None,
8576 clone_from: None,
8577 at_clause: None,
8578 properties: Vec::new(),
8579 leading_comments: Vec::new(),
8580 }
8581 }
8582}
8583
8584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8586#[cfg_attr(feature = "bindings", derive(TS))]
8587pub struct DropSchema {
8588 pub name: Identifier,
8589 pub if_exists: bool,
8590 pub cascade: bool,
8591}
8592
8593impl DropSchema {
8594 pub fn new(name: impl Into<String>) -> Self {
8595 Self {
8596 name: Identifier::new(name),
8597 if_exists: false,
8598 cascade: false,
8599 }
8600 }
8601}
8602
8603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8605#[cfg_attr(feature = "bindings", derive(TS))]
8606pub struct DropNamespace {
8607 pub name: Identifier,
8608 pub if_exists: bool,
8609 pub cascade: bool,
8610}
8611
8612impl DropNamespace {
8613 pub fn new(name: impl Into<String>) -> Self {
8614 Self {
8615 name: Identifier::new(name),
8616 if_exists: false,
8617 cascade: false,
8618 }
8619 }
8620}
8621
8622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8624#[cfg_attr(feature = "bindings", derive(TS))]
8625pub struct CreateDatabase {
8626 pub name: Identifier,
8627 pub if_not_exists: bool,
8628 pub options: Vec<DatabaseOption>,
8629 #[serde(default)]
8631 pub clone_from: Option<Identifier>,
8632 #[serde(default)]
8634 pub at_clause: Option<Expression>,
8635}
8636
8637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8639#[cfg_attr(feature = "bindings", derive(TS))]
8640pub enum DatabaseOption {
8641 CharacterSet(String),
8642 Collate(String),
8643 Owner(Identifier),
8644 Template(Identifier),
8645 Encoding(String),
8646 Location(String),
8647}
8648
8649impl CreateDatabase {
8650 pub fn new(name: impl Into<String>) -> Self {
8651 Self {
8652 name: Identifier::new(name),
8653 if_not_exists: false,
8654 options: Vec::new(),
8655 clone_from: None,
8656 at_clause: None,
8657 }
8658 }
8659}
8660
8661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8663#[cfg_attr(feature = "bindings", derive(TS))]
8664pub struct DropDatabase {
8665 pub name: Identifier,
8666 pub if_exists: bool,
8667 #[serde(default)]
8669 pub sync: bool,
8670}
8671
8672impl DropDatabase {
8673 pub fn new(name: impl Into<String>) -> Self {
8674 Self {
8675 name: Identifier::new(name),
8676 if_exists: false,
8677 sync: false,
8678 }
8679 }
8680}
8681
8682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8684#[cfg_attr(feature = "bindings", derive(TS))]
8685pub struct CreateFunction {
8686 pub name: TableRef,
8687 pub parameters: Vec<FunctionParameter>,
8688 pub return_type: Option<DataType>,
8689 pub body: Option<FunctionBody>,
8690 pub or_replace: bool,
8691 pub if_not_exists: bool,
8692 pub temporary: bool,
8693 pub language: Option<String>,
8694 pub deterministic: Option<bool>,
8695 pub returns_null_on_null_input: Option<bool>,
8696 pub security: Option<FunctionSecurity>,
8697 #[serde(default = "default_true")]
8699 pub has_parens: bool,
8700 #[serde(default)]
8702 pub sql_data_access: Option<SqlDataAccess>,
8703 #[serde(default, skip_serializing_if = "Option::is_none")]
8705 pub returns_table_body: Option<String>,
8706 #[serde(default)]
8708 pub language_first: bool,
8709 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8711 pub set_options: Vec<FunctionSetOption>,
8712 #[serde(default)]
8714 pub strict: bool,
8715 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8717 pub options: Vec<Expression>,
8718 #[serde(default)]
8720 pub is_table_function: bool,
8721 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8723 pub property_order: Vec<FunctionPropertyKind>,
8724 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8726 pub environment: Vec<Expression>,
8727 #[serde(default, skip_serializing_if = "Option::is_none")]
8729 pub handler: Option<String>,
8730 #[serde(default, skip_serializing_if = "Option::is_none")]
8732 pub parameter_style: Option<String>,
8733}
8734
8735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8737#[cfg_attr(feature = "bindings", derive(TS))]
8738pub struct FunctionSetOption {
8739 pub name: String,
8740 pub value: FunctionSetValue,
8741}
8742
8743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8745#[cfg_attr(feature = "bindings", derive(TS))]
8746pub enum FunctionSetValue {
8747 Value { value: String, use_to: bool },
8749 FromCurrent,
8751}
8752
8753#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8755#[cfg_attr(feature = "bindings", derive(TS))]
8756pub enum SqlDataAccess {
8757 NoSql,
8759 ContainsSql,
8761 ReadsSqlData,
8763 ModifiesSqlData,
8765}
8766
8767#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8769#[cfg_attr(feature = "bindings", derive(TS))]
8770pub enum FunctionPropertyKind {
8771 Set,
8773 As,
8775 Language,
8777 Determinism,
8779 NullInput,
8781 Security,
8783 SqlDataAccess,
8785 Options,
8787 Environment,
8789 Handler,
8791 ParameterStyle,
8793}
8794
8795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8797#[cfg_attr(feature = "bindings", derive(TS))]
8798pub struct FunctionParameter {
8799 pub name: Option<Identifier>,
8800 pub data_type: DataType,
8801 pub mode: Option<ParameterMode>,
8802 pub default: Option<Expression>,
8803 #[serde(default, skip_serializing_if = "Option::is_none")]
8805 pub mode_text: Option<String>,
8806}
8807
8808#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8810#[cfg_attr(feature = "bindings", derive(TS))]
8811pub enum ParameterMode {
8812 In,
8813 Out,
8814 InOut,
8815 Variadic,
8816}
8817
8818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8820#[cfg_attr(feature = "bindings", derive(TS))]
8821pub enum FunctionBody {
8822 Block(String),
8824 StringLiteral(String),
8826 Expression(Expression),
8828 External(String),
8830 Return(Expression),
8832 Statements(Vec<Expression>),
8834 DollarQuoted {
8837 content: String,
8838 tag: Option<String>,
8839 },
8840}
8841
8842#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8844#[cfg_attr(feature = "bindings", derive(TS))]
8845pub enum FunctionSecurity {
8846 Definer,
8847 Invoker,
8848 None,
8850}
8851
8852impl CreateFunction {
8853 pub fn new(name: impl Into<String>) -> Self {
8854 Self {
8855 name: TableRef::new(name),
8856 parameters: Vec::new(),
8857 return_type: None,
8858 body: None,
8859 or_replace: false,
8860 if_not_exists: false,
8861 temporary: false,
8862 language: None,
8863 deterministic: None,
8864 returns_null_on_null_input: None,
8865 security: None,
8866 has_parens: true,
8867 sql_data_access: None,
8868 returns_table_body: None,
8869 language_first: false,
8870 set_options: Vec::new(),
8871 strict: false,
8872 options: Vec::new(),
8873 is_table_function: false,
8874 property_order: Vec::new(),
8875 environment: Vec::new(),
8876 handler: None,
8877 parameter_style: None,
8878 }
8879 }
8880}
8881
8882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8884#[cfg_attr(feature = "bindings", derive(TS))]
8885pub struct DropFunction {
8886 pub name: TableRef,
8887 pub parameters: Option<Vec<DataType>>,
8888 pub if_exists: bool,
8889 pub cascade: bool,
8890}
8891
8892impl DropFunction {
8893 pub fn new(name: impl Into<String>) -> Self {
8894 Self {
8895 name: TableRef::new(name),
8896 parameters: None,
8897 if_exists: false,
8898 cascade: false,
8899 }
8900 }
8901}
8902
8903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8905#[cfg_attr(feature = "bindings", derive(TS))]
8906pub struct CreateProcedure {
8907 pub name: TableRef,
8908 pub parameters: Vec<FunctionParameter>,
8909 pub body: Option<FunctionBody>,
8910 pub or_replace: bool,
8911 pub if_not_exists: bool,
8912 pub language: Option<String>,
8913 pub security: Option<FunctionSecurity>,
8914 #[serde(default)]
8916 pub return_type: Option<DataType>,
8917 #[serde(default)]
8919 pub execute_as: Option<String>,
8920 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8922 pub with_options: Vec<String>,
8923 #[serde(default = "default_true", skip_serializing_if = "is_true")]
8925 pub has_parens: bool,
8926 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8928 pub use_proc_keyword: bool,
8929}
8930
8931impl CreateProcedure {
8932 pub fn new(name: impl Into<String>) -> Self {
8933 Self {
8934 name: TableRef::new(name),
8935 parameters: Vec::new(),
8936 body: None,
8937 or_replace: false,
8938 if_not_exists: false,
8939 language: None,
8940 security: None,
8941 return_type: None,
8942 execute_as: None,
8943 with_options: Vec::new(),
8944 has_parens: true,
8945 use_proc_keyword: false,
8946 }
8947 }
8948}
8949
8950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8952#[cfg_attr(feature = "bindings", derive(TS))]
8953pub struct DropProcedure {
8954 pub name: TableRef,
8955 pub parameters: Option<Vec<DataType>>,
8956 pub if_exists: bool,
8957 pub cascade: bool,
8958}
8959
8960impl DropProcedure {
8961 pub fn new(name: impl Into<String>) -> Self {
8962 Self {
8963 name: TableRef::new(name),
8964 parameters: None,
8965 if_exists: false,
8966 cascade: false,
8967 }
8968 }
8969}
8970
8971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8973#[cfg_attr(feature = "bindings", derive(TS))]
8974pub enum SeqPropKind {
8975 Start,
8976 Increment,
8977 Minvalue,
8978 Maxvalue,
8979 Cache,
8980 NoCache,
8981 Cycle,
8982 NoCycle,
8983 OwnedBy,
8984 Order,
8985 NoOrder,
8986 Comment,
8987 Sharing,
8989 Keep,
8991 NoKeep,
8993 Scale,
8995 NoScale,
8997 Shard,
8999 NoShard,
9001 Session,
9003 Global,
9005 NoCacheWord,
9007 NoCycleWord,
9009 NoMinvalueWord,
9011 NoMaxvalueWord,
9013}
9014
9015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9017#[cfg_attr(feature = "bindings", derive(TS))]
9018pub struct CreateSequence {
9019 pub name: TableRef,
9020 pub if_not_exists: bool,
9021 pub temporary: bool,
9022 #[serde(default)]
9023 pub or_replace: bool,
9024 #[serde(default, skip_serializing_if = "Option::is_none")]
9026 pub as_type: Option<DataType>,
9027 pub increment: Option<i64>,
9028 pub minvalue: Option<SequenceBound>,
9029 pub maxvalue: Option<SequenceBound>,
9030 pub start: Option<i64>,
9031 pub cache: Option<i64>,
9032 pub cycle: bool,
9033 pub owned_by: Option<TableRef>,
9034 #[serde(default)]
9036 pub owned_by_none: bool,
9037 #[serde(default)]
9039 pub order: Option<bool>,
9040 #[serde(default)]
9042 pub comment: Option<String>,
9043 #[serde(default, skip_serializing_if = "Option::is_none")]
9045 pub sharing: Option<String>,
9046 #[serde(default, skip_serializing_if = "Option::is_none")]
9048 pub scale_modifier: Option<String>,
9049 #[serde(default, skip_serializing_if = "Option::is_none")]
9051 pub shard_modifier: Option<String>,
9052 #[serde(default)]
9054 pub property_order: Vec<SeqPropKind>,
9055}
9056
9057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9059#[cfg_attr(feature = "bindings", derive(TS))]
9060pub enum SequenceBound {
9061 Value(i64),
9062 None,
9063}
9064
9065impl CreateSequence {
9066 pub fn new(name: impl Into<String>) -> Self {
9067 Self {
9068 name: TableRef::new(name),
9069 if_not_exists: false,
9070 temporary: false,
9071 or_replace: false,
9072 as_type: None,
9073 increment: None,
9074 minvalue: None,
9075 maxvalue: None,
9076 start: None,
9077 cache: None,
9078 cycle: false,
9079 owned_by: None,
9080 owned_by_none: false,
9081 order: None,
9082 comment: None,
9083 sharing: None,
9084 scale_modifier: None,
9085 shard_modifier: None,
9086 property_order: Vec::new(),
9087 }
9088 }
9089}
9090
9091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9093#[cfg_attr(feature = "bindings", derive(TS))]
9094pub struct DropSequence {
9095 pub name: TableRef,
9096 pub if_exists: bool,
9097 pub cascade: bool,
9098}
9099
9100impl DropSequence {
9101 pub fn new(name: impl Into<String>) -> Self {
9102 Self {
9103 name: TableRef::new(name),
9104 if_exists: false,
9105 cascade: false,
9106 }
9107 }
9108}
9109
9110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9112#[cfg_attr(feature = "bindings", derive(TS))]
9113pub struct AlterSequence {
9114 pub name: TableRef,
9115 pub if_exists: bool,
9116 pub increment: Option<i64>,
9117 pub minvalue: Option<SequenceBound>,
9118 pub maxvalue: Option<SequenceBound>,
9119 pub start: Option<i64>,
9120 pub restart: Option<Option<i64>>,
9121 pub cache: Option<i64>,
9122 pub cycle: Option<bool>,
9123 pub owned_by: Option<Option<TableRef>>,
9124}
9125
9126impl AlterSequence {
9127 pub fn new(name: impl Into<String>) -> Self {
9128 Self {
9129 name: TableRef::new(name),
9130 if_exists: false,
9131 increment: None,
9132 minvalue: None,
9133 maxvalue: None,
9134 start: None,
9135 restart: None,
9136 cache: None,
9137 cycle: None,
9138 owned_by: None,
9139 }
9140 }
9141}
9142
9143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9145#[cfg_attr(feature = "bindings", derive(TS))]
9146pub struct CreateTrigger {
9147 pub name: Identifier,
9148 pub table: TableRef,
9149 pub timing: TriggerTiming,
9150 pub events: Vec<TriggerEvent>,
9151 #[serde(default, skip_serializing_if = "Option::is_none")]
9152 pub for_each: Option<TriggerForEach>,
9153 pub when: Option<Expression>,
9154 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9156 pub when_paren: bool,
9157 pub body: TriggerBody,
9158 pub or_replace: bool,
9159 pub constraint: bool,
9160 pub deferrable: Option<bool>,
9161 pub initially_deferred: Option<bool>,
9162 pub referencing: Option<TriggerReferencing>,
9163}
9164
9165#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9167#[cfg_attr(feature = "bindings", derive(TS))]
9168pub enum TriggerTiming {
9169 Before,
9170 After,
9171 InsteadOf,
9172}
9173
9174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9176#[cfg_attr(feature = "bindings", derive(TS))]
9177pub enum TriggerEvent {
9178 Insert,
9179 Update(Option<Vec<Identifier>>),
9180 Delete,
9181 Truncate,
9182}
9183
9184#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9186#[cfg_attr(feature = "bindings", derive(TS))]
9187pub enum TriggerForEach {
9188 Row,
9189 Statement,
9190}
9191
9192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9194#[cfg_attr(feature = "bindings", derive(TS))]
9195pub enum TriggerBody {
9196 Execute {
9198 function: TableRef,
9199 args: Vec<Expression>,
9200 },
9201 Block(String),
9203}
9204
9205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9207#[cfg_attr(feature = "bindings", derive(TS))]
9208pub struct TriggerReferencing {
9209 pub old_table: Option<Identifier>,
9210 pub new_table: Option<Identifier>,
9211 pub old_row: Option<Identifier>,
9212 pub new_row: Option<Identifier>,
9213}
9214
9215impl CreateTrigger {
9216 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9217 Self {
9218 name: Identifier::new(name),
9219 table: TableRef::new(table),
9220 timing: TriggerTiming::Before,
9221 events: Vec::new(),
9222 for_each: Some(TriggerForEach::Row),
9223 when: None,
9224 when_paren: false,
9225 body: TriggerBody::Execute {
9226 function: TableRef::new(""),
9227 args: Vec::new(),
9228 },
9229 or_replace: false,
9230 constraint: false,
9231 deferrable: None,
9232 initially_deferred: None,
9233 referencing: None,
9234 }
9235 }
9236}
9237
9238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9240#[cfg_attr(feature = "bindings", derive(TS))]
9241pub struct DropTrigger {
9242 pub name: Identifier,
9243 pub table: Option<TableRef>,
9244 pub if_exists: bool,
9245 pub cascade: bool,
9246}
9247
9248impl DropTrigger {
9249 pub fn new(name: impl Into<String>) -> Self {
9250 Self {
9251 name: Identifier::new(name),
9252 table: None,
9253 if_exists: false,
9254 cascade: false,
9255 }
9256 }
9257}
9258
9259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9261#[cfg_attr(feature = "bindings", derive(TS))]
9262pub struct CreateType {
9263 pub name: TableRef,
9264 pub definition: TypeDefinition,
9265 pub if_not_exists: bool,
9266}
9267
9268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9270#[cfg_attr(feature = "bindings", derive(TS))]
9271pub enum TypeDefinition {
9272 Enum(Vec<String>),
9274 Composite(Vec<TypeAttribute>),
9276 Range {
9278 subtype: DataType,
9279 subtype_diff: Option<String>,
9280 canonical: Option<String>,
9281 },
9282 Base {
9284 input: String,
9285 output: String,
9286 internallength: Option<i32>,
9287 },
9288 Domain {
9290 base_type: DataType,
9291 default: Option<Expression>,
9292 constraints: Vec<DomainConstraint>,
9293 },
9294}
9295
9296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9298#[cfg_attr(feature = "bindings", derive(TS))]
9299pub struct TypeAttribute {
9300 pub name: Identifier,
9301 pub data_type: DataType,
9302 pub collate: Option<Identifier>,
9303}
9304
9305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9307#[cfg_attr(feature = "bindings", derive(TS))]
9308pub struct DomainConstraint {
9309 pub name: Option<Identifier>,
9310 pub check: Expression,
9311}
9312
9313impl CreateType {
9314 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9315 Self {
9316 name: TableRef::new(name),
9317 definition: TypeDefinition::Enum(values),
9318 if_not_exists: false,
9319 }
9320 }
9321
9322 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9323 Self {
9324 name: TableRef::new(name),
9325 definition: TypeDefinition::Composite(attributes),
9326 if_not_exists: false,
9327 }
9328 }
9329}
9330
9331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9333#[cfg_attr(feature = "bindings", derive(TS))]
9334pub struct DropType {
9335 pub name: TableRef,
9336 pub if_exists: bool,
9337 pub cascade: bool,
9338}
9339
9340impl DropType {
9341 pub fn new(name: impl Into<String>) -> Self {
9342 Self {
9343 name: TableRef::new(name),
9344 if_exists: false,
9345 cascade: false,
9346 }
9347 }
9348}
9349
9350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9352#[cfg_attr(feature = "bindings", derive(TS))]
9353pub struct Describe {
9354 pub target: Expression,
9356 pub extended: bool,
9358 pub formatted: bool,
9360 #[serde(default)]
9362 pub kind: Option<String>,
9363 #[serde(default)]
9365 pub properties: Vec<(String, String)>,
9366 #[serde(default, skip_serializing_if = "Option::is_none")]
9368 pub style: Option<String>,
9369 #[serde(default)]
9371 pub partition: Option<Box<Expression>>,
9372 #[serde(default)]
9374 pub leading_comments: Vec<String>,
9375 #[serde(default)]
9377 pub as_json: bool,
9378}
9379
9380impl Describe {
9381 pub fn new(target: Expression) -> Self {
9382 Self {
9383 target,
9384 extended: false,
9385 formatted: false,
9386 kind: None,
9387 properties: Vec::new(),
9388 style: None,
9389 partition: None,
9390 leading_comments: Vec::new(),
9391 as_json: false,
9392 }
9393 }
9394}
9395
9396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9398#[cfg_attr(feature = "bindings", derive(TS))]
9399pub struct Show {
9400 pub this: String,
9402 #[serde(default)]
9404 pub terse: bool,
9405 #[serde(default)]
9407 pub history: bool,
9408 pub like: Option<Expression>,
9410 pub scope_kind: Option<String>,
9412 pub scope: Option<Expression>,
9414 pub starts_with: Option<Expression>,
9416 pub limit: Option<Box<Limit>>,
9418 pub from: Option<Expression>,
9420 #[serde(default, skip_serializing_if = "Option::is_none")]
9422 pub where_clause: Option<Expression>,
9423 #[serde(default, skip_serializing_if = "Option::is_none")]
9425 pub for_target: Option<Expression>,
9426 #[serde(default, skip_serializing_if = "Option::is_none")]
9428 pub db: Option<Expression>,
9429 #[serde(default, skip_serializing_if = "Option::is_none")]
9431 pub target: Option<Expression>,
9432 #[serde(default, skip_serializing_if = "Option::is_none")]
9434 pub mutex: Option<bool>,
9435 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9437 pub privileges: Vec<String>,
9438}
9439
9440impl Show {
9441 pub fn new(this: impl Into<String>) -> Self {
9442 Self {
9443 this: this.into(),
9444 terse: false,
9445 history: false,
9446 like: None,
9447 scope_kind: None,
9448 scope: None,
9449 starts_with: None,
9450 limit: None,
9451 from: None,
9452 where_clause: None,
9453 for_target: None,
9454 db: None,
9455 target: None,
9456 mutex: None,
9457 privileges: Vec::new(),
9458 }
9459 }
9460}
9461
9462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9467#[cfg_attr(feature = "bindings", derive(TS))]
9468pub struct Paren {
9469 pub this: Expression,
9471 #[serde(default)]
9472 pub trailing_comments: Vec<String>,
9473}
9474
9475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9477#[cfg_attr(feature = "bindings", derive(TS))]
9478pub struct Annotated {
9479 pub this: Expression,
9480 pub trailing_comments: Vec<String>,
9481}
9482
9483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9488#[cfg_attr(feature = "bindings", derive(TS))]
9489pub struct Refresh {
9490 pub this: Box<Expression>,
9491 pub kind: String,
9492}
9493
9494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9496#[cfg_attr(feature = "bindings", derive(TS))]
9497pub struct LockingStatement {
9498 pub this: Box<Expression>,
9499 pub expression: Box<Expression>,
9500}
9501
9502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9504#[cfg_attr(feature = "bindings", derive(TS))]
9505pub struct SequenceProperties {
9506 #[serde(default)]
9507 pub increment: Option<Box<Expression>>,
9508 #[serde(default)]
9509 pub minvalue: Option<Box<Expression>>,
9510 #[serde(default)]
9511 pub maxvalue: Option<Box<Expression>>,
9512 #[serde(default)]
9513 pub cache: Option<Box<Expression>>,
9514 #[serde(default)]
9515 pub start: Option<Box<Expression>>,
9516 #[serde(default)]
9517 pub owned: Option<Box<Expression>>,
9518 #[serde(default)]
9519 pub options: Vec<Expression>,
9520}
9521
9522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9524#[cfg_attr(feature = "bindings", derive(TS))]
9525pub struct TruncateTable {
9526 #[serde(default)]
9527 pub expressions: Vec<Expression>,
9528 #[serde(default)]
9529 pub is_database: Option<Box<Expression>>,
9530 #[serde(default)]
9531 pub exists: bool,
9532 #[serde(default)]
9533 pub only: Option<Box<Expression>>,
9534 #[serde(default)]
9535 pub cluster: Option<Box<Expression>>,
9536 #[serde(default)]
9537 pub identity: Option<Box<Expression>>,
9538 #[serde(default)]
9539 pub option: Option<Box<Expression>>,
9540 #[serde(default)]
9541 pub partition: Option<Box<Expression>>,
9542}
9543
9544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9546#[cfg_attr(feature = "bindings", derive(TS))]
9547pub struct Clone {
9548 pub this: Box<Expression>,
9549 #[serde(default)]
9550 pub shallow: Option<Box<Expression>>,
9551 #[serde(default)]
9552 pub copy: Option<Box<Expression>>,
9553}
9554
9555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9557#[cfg_attr(feature = "bindings", derive(TS))]
9558pub struct Attach {
9559 pub this: Box<Expression>,
9560 #[serde(default)]
9561 pub exists: bool,
9562 #[serde(default)]
9563 pub expressions: Vec<Expression>,
9564}
9565
9566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9568#[cfg_attr(feature = "bindings", derive(TS))]
9569pub struct Detach {
9570 pub this: Box<Expression>,
9571 #[serde(default)]
9572 pub exists: bool,
9573}
9574
9575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9577#[cfg_attr(feature = "bindings", derive(TS))]
9578pub struct Install {
9579 pub this: Box<Expression>,
9580 #[serde(default)]
9581 pub from_: Option<Box<Expression>>,
9582 #[serde(default)]
9583 pub force: Option<Box<Expression>>,
9584}
9585
9586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9588#[cfg_attr(feature = "bindings", derive(TS))]
9589pub struct Summarize {
9590 pub this: Box<Expression>,
9591 #[serde(default)]
9592 pub table: Option<Box<Expression>>,
9593}
9594
9595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9597#[cfg_attr(feature = "bindings", derive(TS))]
9598pub struct Declare {
9599 #[serde(default)]
9600 pub expressions: Vec<Expression>,
9601 #[serde(default)]
9602 pub replace: bool,
9603}
9604
9605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9607#[cfg_attr(feature = "bindings", derive(TS))]
9608pub struct DeclareItem {
9609 pub this: Box<Expression>,
9610 #[serde(default)]
9611 pub kind: Option<String>,
9612 #[serde(default)]
9613 pub default: Option<Box<Expression>>,
9614 #[serde(default)]
9615 pub has_as: bool,
9616 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9618 pub additional_names: Vec<Expression>,
9619}
9620
9621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9623#[cfg_attr(feature = "bindings", derive(TS))]
9624pub struct Set {
9625 #[serde(default)]
9626 pub expressions: Vec<Expression>,
9627 #[serde(default)]
9628 pub unset: Option<Box<Expression>>,
9629 #[serde(default)]
9630 pub tag: Option<Box<Expression>>,
9631}
9632
9633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9635#[cfg_attr(feature = "bindings", derive(TS))]
9636pub struct Heredoc {
9637 pub this: Box<Expression>,
9638 #[serde(default)]
9639 pub tag: Option<Box<Expression>>,
9640}
9641
9642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9644#[cfg_attr(feature = "bindings", derive(TS))]
9645pub struct QueryBand {
9646 pub this: Box<Expression>,
9647 #[serde(default)]
9648 pub scope: Option<Box<Expression>>,
9649 #[serde(default)]
9650 pub update: Option<Box<Expression>>,
9651}
9652
9653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9655#[cfg_attr(feature = "bindings", derive(TS))]
9656pub struct UserDefinedFunction {
9657 pub this: Box<Expression>,
9658 #[serde(default)]
9659 pub expressions: Vec<Expression>,
9660 #[serde(default)]
9661 pub wrapped: Option<Box<Expression>>,
9662}
9663
9664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9666#[cfg_attr(feature = "bindings", derive(TS))]
9667pub struct RecursiveWithSearch {
9668 pub kind: String,
9669 pub this: Box<Expression>,
9670 pub expression: Box<Expression>,
9671 #[serde(default)]
9672 pub using: Option<Box<Expression>>,
9673}
9674
9675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9677#[cfg_attr(feature = "bindings", derive(TS))]
9678pub struct ProjectionDef {
9679 pub this: Box<Expression>,
9680 pub expression: Box<Expression>,
9681}
9682
9683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9685#[cfg_attr(feature = "bindings", derive(TS))]
9686pub struct TableAlias {
9687 #[serde(default)]
9688 pub this: Option<Box<Expression>>,
9689 #[serde(default)]
9690 pub columns: Vec<Expression>,
9691}
9692
9693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9695#[cfg_attr(feature = "bindings", derive(TS))]
9696pub struct ByteString {
9697 pub this: Box<Expression>,
9698 #[serde(default)]
9699 pub is_bytes: Option<Box<Expression>>,
9700}
9701
9702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9705#[cfg_attr(feature = "bindings", derive(TS))]
9706pub struct HexStringExpr {
9707 pub this: Box<Expression>,
9708 #[serde(default)]
9709 pub is_integer: Option<bool>,
9710}
9711
9712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9714#[cfg_attr(feature = "bindings", derive(TS))]
9715pub struct UnicodeString {
9716 pub this: Box<Expression>,
9717 #[serde(default)]
9718 pub escape: Option<Box<Expression>>,
9719}
9720
9721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9723#[cfg_attr(feature = "bindings", derive(TS))]
9724pub struct AlterColumn {
9725 pub this: Box<Expression>,
9726 #[serde(default)]
9727 pub dtype: Option<Box<Expression>>,
9728 #[serde(default)]
9729 pub collate: Option<Box<Expression>>,
9730 #[serde(default)]
9731 pub using: Option<Box<Expression>>,
9732 #[serde(default)]
9733 pub default: Option<Box<Expression>>,
9734 #[serde(default)]
9735 pub drop: Option<Box<Expression>>,
9736 #[serde(default)]
9737 pub comment: Option<Box<Expression>>,
9738 #[serde(default)]
9739 pub allow_null: Option<Box<Expression>>,
9740 #[serde(default)]
9741 pub visible: Option<Box<Expression>>,
9742 #[serde(default)]
9743 pub rename_to: Option<Box<Expression>>,
9744}
9745
9746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9748#[cfg_attr(feature = "bindings", derive(TS))]
9749pub struct AlterSortKey {
9750 #[serde(default)]
9751 pub this: Option<Box<Expression>>,
9752 #[serde(default)]
9753 pub expressions: Vec<Expression>,
9754 #[serde(default)]
9755 pub compound: Option<Box<Expression>>,
9756}
9757
9758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9760#[cfg_attr(feature = "bindings", derive(TS))]
9761pub struct AlterSet {
9762 #[serde(default)]
9763 pub expressions: Vec<Expression>,
9764 #[serde(default)]
9765 pub option: Option<Box<Expression>>,
9766 #[serde(default)]
9767 pub tablespace: Option<Box<Expression>>,
9768 #[serde(default)]
9769 pub access_method: Option<Box<Expression>>,
9770 #[serde(default)]
9771 pub file_format: Option<Box<Expression>>,
9772 #[serde(default)]
9773 pub copy_options: Option<Box<Expression>>,
9774 #[serde(default)]
9775 pub tag: Option<Box<Expression>>,
9776 #[serde(default)]
9777 pub location: Option<Box<Expression>>,
9778 #[serde(default)]
9779 pub serde: Option<Box<Expression>>,
9780}
9781
9782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9784#[cfg_attr(feature = "bindings", derive(TS))]
9785pub struct RenameColumn {
9786 pub this: Box<Expression>,
9787 #[serde(default)]
9788 pub to: Option<Box<Expression>>,
9789 #[serde(default)]
9790 pub exists: bool,
9791}
9792
9793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9795#[cfg_attr(feature = "bindings", derive(TS))]
9796pub struct Comprehension {
9797 pub this: Box<Expression>,
9798 pub expression: Box<Expression>,
9799 #[serde(default)]
9800 pub position: Option<Box<Expression>>,
9801 #[serde(default)]
9802 pub iterator: Option<Box<Expression>>,
9803 #[serde(default)]
9804 pub condition: Option<Box<Expression>>,
9805}
9806
9807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9809#[cfg_attr(feature = "bindings", derive(TS))]
9810pub struct MergeTreeTTLAction {
9811 pub this: Box<Expression>,
9812 #[serde(default)]
9813 pub delete: Option<Box<Expression>>,
9814 #[serde(default)]
9815 pub recompress: Option<Box<Expression>>,
9816 #[serde(default)]
9817 pub to_disk: Option<Box<Expression>>,
9818 #[serde(default)]
9819 pub to_volume: Option<Box<Expression>>,
9820}
9821
9822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9824#[cfg_attr(feature = "bindings", derive(TS))]
9825pub struct MergeTreeTTL {
9826 #[serde(default)]
9827 pub expressions: Vec<Expression>,
9828 #[serde(default)]
9829 pub where_: Option<Box<Expression>>,
9830 #[serde(default)]
9831 pub group: Option<Box<Expression>>,
9832 #[serde(default)]
9833 pub aggregates: Option<Box<Expression>>,
9834}
9835
9836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9838#[cfg_attr(feature = "bindings", derive(TS))]
9839pub struct IndexConstraintOption {
9840 #[serde(default)]
9841 pub key_block_size: Option<Box<Expression>>,
9842 #[serde(default)]
9843 pub using: Option<Box<Expression>>,
9844 #[serde(default)]
9845 pub parser: Option<Box<Expression>>,
9846 #[serde(default)]
9847 pub comment: Option<Box<Expression>>,
9848 #[serde(default)]
9849 pub visible: Option<Box<Expression>>,
9850 #[serde(default)]
9851 pub engine_attr: Option<Box<Expression>>,
9852 #[serde(default)]
9853 pub secondary_engine_attr: Option<Box<Expression>>,
9854}
9855
9856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9858#[cfg_attr(feature = "bindings", derive(TS))]
9859pub struct PeriodForSystemTimeConstraint {
9860 pub this: Box<Expression>,
9861 pub expression: Box<Expression>,
9862}
9863
9864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9866#[cfg_attr(feature = "bindings", derive(TS))]
9867pub struct CaseSpecificColumnConstraint {
9868 #[serde(default)]
9869 pub not_: Option<Box<Expression>>,
9870}
9871
9872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9874#[cfg_attr(feature = "bindings", derive(TS))]
9875pub struct CharacterSetColumnConstraint {
9876 pub this: Box<Expression>,
9877}
9878
9879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9881#[cfg_attr(feature = "bindings", derive(TS))]
9882pub struct CheckColumnConstraint {
9883 pub this: Box<Expression>,
9884 #[serde(default)]
9885 pub enforced: Option<Box<Expression>>,
9886}
9887
9888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9890#[cfg_attr(feature = "bindings", derive(TS))]
9891pub struct AssumeColumnConstraint {
9892 pub this: Box<Expression>,
9893}
9894
9895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9897#[cfg_attr(feature = "bindings", derive(TS))]
9898pub struct CompressColumnConstraint {
9899 #[serde(default)]
9900 pub this: Option<Box<Expression>>,
9901}
9902
9903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9905#[cfg_attr(feature = "bindings", derive(TS))]
9906pub struct DateFormatColumnConstraint {
9907 pub this: Box<Expression>,
9908}
9909
9910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9912#[cfg_attr(feature = "bindings", derive(TS))]
9913pub struct EphemeralColumnConstraint {
9914 #[serde(default)]
9915 pub this: Option<Box<Expression>>,
9916}
9917
9918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9920#[cfg_attr(feature = "bindings", derive(TS))]
9921pub struct WithOperator {
9922 pub this: Box<Expression>,
9923 pub op: String,
9924}
9925
9926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9928#[cfg_attr(feature = "bindings", derive(TS))]
9929pub struct GeneratedAsIdentityColumnConstraint {
9930 #[serde(default)]
9931 pub this: Option<Box<Expression>>,
9932 #[serde(default)]
9933 pub expression: Option<Box<Expression>>,
9934 #[serde(default)]
9935 pub on_null: Option<Box<Expression>>,
9936 #[serde(default)]
9937 pub start: Option<Box<Expression>>,
9938 #[serde(default)]
9939 pub increment: Option<Box<Expression>>,
9940 #[serde(default)]
9941 pub minvalue: Option<Box<Expression>>,
9942 #[serde(default)]
9943 pub maxvalue: Option<Box<Expression>>,
9944 #[serde(default)]
9945 pub cycle: Option<Box<Expression>>,
9946 #[serde(default)]
9947 pub order: Option<Box<Expression>>,
9948}
9949
9950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9953#[cfg_attr(feature = "bindings", derive(TS))]
9954pub struct AutoIncrementColumnConstraint;
9955
9956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9958#[cfg_attr(feature = "bindings", derive(TS))]
9959pub struct CommentColumnConstraint;
9960
9961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9963#[cfg_attr(feature = "bindings", derive(TS))]
9964pub struct GeneratedAsRowColumnConstraint {
9965 #[serde(default)]
9966 pub start: Option<Box<Expression>>,
9967 #[serde(default)]
9968 pub hidden: Option<Box<Expression>>,
9969}
9970
9971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9973#[cfg_attr(feature = "bindings", derive(TS))]
9974pub struct IndexColumnConstraint {
9975 #[serde(default)]
9976 pub this: Option<Box<Expression>>,
9977 #[serde(default)]
9978 pub expressions: Vec<Expression>,
9979 #[serde(default)]
9980 pub kind: Option<String>,
9981 #[serde(default)]
9982 pub index_type: Option<Box<Expression>>,
9983 #[serde(default)]
9984 pub options: Vec<Expression>,
9985 #[serde(default)]
9986 pub expression: Option<Box<Expression>>,
9987 #[serde(default)]
9988 pub granularity: Option<Box<Expression>>,
9989}
9990
9991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9993#[cfg_attr(feature = "bindings", derive(TS))]
9994pub struct MaskingPolicyColumnConstraint {
9995 pub this: Box<Expression>,
9996 #[serde(default)]
9997 pub expressions: Vec<Expression>,
9998}
9999
10000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10002#[cfg_attr(feature = "bindings", derive(TS))]
10003pub struct NotNullColumnConstraint {
10004 #[serde(default)]
10005 pub allow_null: Option<Box<Expression>>,
10006}
10007
10008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10010#[cfg_attr(feature = "bindings", derive(TS))]
10011pub struct DefaultColumnConstraint {
10012 pub this: Box<Expression>,
10013}
10014
10015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10017#[cfg_attr(feature = "bindings", derive(TS))]
10018pub struct PrimaryKeyColumnConstraint {
10019 #[serde(default)]
10020 pub desc: Option<Box<Expression>>,
10021 #[serde(default)]
10022 pub options: Vec<Expression>,
10023}
10024
10025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10027#[cfg_attr(feature = "bindings", derive(TS))]
10028pub struct UniqueColumnConstraint {
10029 #[serde(default)]
10030 pub this: Option<Box<Expression>>,
10031 #[serde(default)]
10032 pub index_type: Option<Box<Expression>>,
10033 #[serde(default)]
10034 pub on_conflict: Option<Box<Expression>>,
10035 #[serde(default)]
10036 pub nulls: Option<Box<Expression>>,
10037 #[serde(default)]
10038 pub options: Vec<Expression>,
10039}
10040
10041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10043#[cfg_attr(feature = "bindings", derive(TS))]
10044pub struct WatermarkColumnConstraint {
10045 pub this: Box<Expression>,
10046 pub expression: Box<Expression>,
10047}
10048
10049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10051#[cfg_attr(feature = "bindings", derive(TS))]
10052pub struct ComputedColumnConstraint {
10053 pub this: Box<Expression>,
10054 #[serde(default)]
10055 pub persisted: Option<Box<Expression>>,
10056 #[serde(default)]
10057 pub not_null: Option<Box<Expression>>,
10058 #[serde(default)]
10059 pub data_type: Option<Box<Expression>>,
10060}
10061
10062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10064#[cfg_attr(feature = "bindings", derive(TS))]
10065pub struct InOutColumnConstraint {
10066 #[serde(default)]
10067 pub input_: Option<Box<Expression>>,
10068 #[serde(default)]
10069 pub output: Option<Box<Expression>>,
10070}
10071
10072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10074#[cfg_attr(feature = "bindings", derive(TS))]
10075pub struct PathColumnConstraint {
10076 pub this: Box<Expression>,
10077}
10078
10079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10081#[cfg_attr(feature = "bindings", derive(TS))]
10082pub struct Constraint {
10083 pub this: Box<Expression>,
10084 #[serde(default)]
10085 pub expressions: Vec<Expression>,
10086}
10087
10088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10090#[cfg_attr(feature = "bindings", derive(TS))]
10091pub struct Export {
10092 pub this: Box<Expression>,
10093 #[serde(default)]
10094 pub connection: Option<Box<Expression>>,
10095 #[serde(default)]
10096 pub options: Vec<Expression>,
10097}
10098
10099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10101#[cfg_attr(feature = "bindings", derive(TS))]
10102pub struct Filter {
10103 pub this: Box<Expression>,
10104 pub expression: Box<Expression>,
10105}
10106
10107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10109#[cfg_attr(feature = "bindings", derive(TS))]
10110pub struct Changes {
10111 #[serde(default)]
10112 pub information: Option<Box<Expression>>,
10113 #[serde(default)]
10114 pub at_before: Option<Box<Expression>>,
10115 #[serde(default)]
10116 pub end: Option<Box<Expression>>,
10117}
10118
10119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10121#[cfg_attr(feature = "bindings", derive(TS))]
10122pub struct Directory {
10123 pub this: Box<Expression>,
10124 #[serde(default)]
10125 pub local: Option<Box<Expression>>,
10126 #[serde(default)]
10127 pub row_format: Option<Box<Expression>>,
10128}
10129
10130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10132#[cfg_attr(feature = "bindings", derive(TS))]
10133pub struct ForeignKey {
10134 #[serde(default)]
10135 pub expressions: Vec<Expression>,
10136 #[serde(default)]
10137 pub reference: Option<Box<Expression>>,
10138 #[serde(default)]
10139 pub delete: Option<Box<Expression>>,
10140 #[serde(default)]
10141 pub update: Option<Box<Expression>>,
10142 #[serde(default)]
10143 pub options: Vec<Expression>,
10144}
10145
10146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10148#[cfg_attr(feature = "bindings", derive(TS))]
10149pub struct ColumnPrefix {
10150 pub this: Box<Expression>,
10151 pub expression: Box<Expression>,
10152}
10153
10154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10156#[cfg_attr(feature = "bindings", derive(TS))]
10157pub struct PrimaryKey {
10158 #[serde(default)]
10159 pub this: Option<Box<Expression>>,
10160 #[serde(default)]
10161 pub expressions: Vec<Expression>,
10162 #[serde(default)]
10163 pub options: Vec<Expression>,
10164 #[serde(default)]
10165 pub include: Option<Box<Expression>>,
10166}
10167
10168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10170#[cfg_attr(feature = "bindings", derive(TS))]
10171pub struct IntoClause {
10172 #[serde(default)]
10173 pub this: Option<Box<Expression>>,
10174 #[serde(default)]
10175 pub temporary: bool,
10176 #[serde(default)]
10177 pub unlogged: Option<Box<Expression>>,
10178 #[serde(default)]
10179 pub bulk_collect: Option<Box<Expression>>,
10180 #[serde(default)]
10181 pub expressions: Vec<Expression>,
10182}
10183
10184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10186#[cfg_attr(feature = "bindings", derive(TS))]
10187pub struct JoinHint {
10188 pub this: Box<Expression>,
10189 #[serde(default)]
10190 pub expressions: Vec<Expression>,
10191}
10192
10193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10195#[cfg_attr(feature = "bindings", derive(TS))]
10196pub struct Opclass {
10197 pub this: Box<Expression>,
10198 pub expression: Box<Expression>,
10199}
10200
10201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10203#[cfg_attr(feature = "bindings", derive(TS))]
10204pub struct Index {
10205 #[serde(default)]
10206 pub this: Option<Box<Expression>>,
10207 #[serde(default)]
10208 pub table: Option<Box<Expression>>,
10209 #[serde(default)]
10210 pub unique: bool,
10211 #[serde(default)]
10212 pub primary: Option<Box<Expression>>,
10213 #[serde(default)]
10214 pub amp: Option<Box<Expression>>,
10215 #[serde(default)]
10216 pub params: Vec<Expression>,
10217}
10218
10219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10221#[cfg_attr(feature = "bindings", derive(TS))]
10222pub struct IndexParameters {
10223 #[serde(default)]
10224 pub using: Option<Box<Expression>>,
10225 #[serde(default)]
10226 pub include: Option<Box<Expression>>,
10227 #[serde(default)]
10228 pub columns: Vec<Expression>,
10229 #[serde(default)]
10230 pub with_storage: Option<Box<Expression>>,
10231 #[serde(default)]
10232 pub partition_by: Option<Box<Expression>>,
10233 #[serde(default)]
10234 pub tablespace: Option<Box<Expression>>,
10235 #[serde(default)]
10236 pub where_: Option<Box<Expression>>,
10237 #[serde(default)]
10238 pub on: Option<Box<Expression>>,
10239}
10240
10241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10243#[cfg_attr(feature = "bindings", derive(TS))]
10244pub struct ConditionalInsert {
10245 pub this: Box<Expression>,
10246 #[serde(default)]
10247 pub expression: Option<Box<Expression>>,
10248 #[serde(default)]
10249 pub else_: Option<Box<Expression>>,
10250}
10251
10252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10254#[cfg_attr(feature = "bindings", derive(TS))]
10255pub struct MultitableInserts {
10256 #[serde(default)]
10257 pub expressions: Vec<Expression>,
10258 pub kind: String,
10259 #[serde(default)]
10260 pub source: Option<Box<Expression>>,
10261 #[serde(default)]
10263 pub leading_comments: Vec<String>,
10264}
10265
10266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10268#[cfg_attr(feature = "bindings", derive(TS))]
10269pub struct OnConflict {
10270 #[serde(default)]
10271 pub duplicate: Option<Box<Expression>>,
10272 #[serde(default)]
10273 pub expressions: Vec<Expression>,
10274 #[serde(default)]
10275 pub action: Option<Box<Expression>>,
10276 #[serde(default)]
10277 pub conflict_keys: Option<Box<Expression>>,
10278 #[serde(default)]
10279 pub index_predicate: Option<Box<Expression>>,
10280 #[serde(default)]
10281 pub constraint: Option<Box<Expression>>,
10282 #[serde(default)]
10283 pub where_: Option<Box<Expression>>,
10284}
10285
10286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10288#[cfg_attr(feature = "bindings", derive(TS))]
10289pub struct OnCondition {
10290 #[serde(default)]
10291 pub error: Option<Box<Expression>>,
10292 #[serde(default)]
10293 pub empty: Option<Box<Expression>>,
10294 #[serde(default)]
10295 pub null: Option<Box<Expression>>,
10296}
10297
10298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10300#[cfg_attr(feature = "bindings", derive(TS))]
10301pub struct Returning {
10302 #[serde(default)]
10303 pub expressions: Vec<Expression>,
10304 #[serde(default)]
10305 pub into: Option<Box<Expression>>,
10306}
10307
10308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10310#[cfg_attr(feature = "bindings", derive(TS))]
10311pub struct Introducer {
10312 pub this: Box<Expression>,
10313 pub expression: Box<Expression>,
10314}
10315
10316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10318#[cfg_attr(feature = "bindings", derive(TS))]
10319pub struct PartitionRange {
10320 pub this: Box<Expression>,
10321 #[serde(default)]
10322 pub expression: Option<Box<Expression>>,
10323 #[serde(default)]
10324 pub expressions: Vec<Expression>,
10325}
10326
10327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10329#[cfg_attr(feature = "bindings", derive(TS))]
10330pub struct Group {
10331 #[serde(default)]
10332 pub expressions: Vec<Expression>,
10333 #[serde(default)]
10334 pub grouping_sets: Option<Box<Expression>>,
10335 #[serde(default)]
10336 pub cube: Option<Box<Expression>>,
10337 #[serde(default)]
10338 pub rollup: Option<Box<Expression>>,
10339 #[serde(default)]
10340 pub totals: Option<Box<Expression>>,
10341 #[serde(default)]
10343 pub all: Option<bool>,
10344}
10345
10346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10348#[cfg_attr(feature = "bindings", derive(TS))]
10349pub struct Cube {
10350 #[serde(default)]
10351 pub expressions: Vec<Expression>,
10352}
10353
10354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10356#[cfg_attr(feature = "bindings", derive(TS))]
10357pub struct Rollup {
10358 #[serde(default)]
10359 pub expressions: Vec<Expression>,
10360}
10361
10362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10364#[cfg_attr(feature = "bindings", derive(TS))]
10365pub struct GroupingSets {
10366 #[serde(default)]
10367 pub expressions: Vec<Expression>,
10368}
10369
10370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10372#[cfg_attr(feature = "bindings", derive(TS))]
10373pub struct LimitOptions {
10374 #[serde(default)]
10375 pub percent: Option<Box<Expression>>,
10376 #[serde(default)]
10377 pub rows: Option<Box<Expression>>,
10378 #[serde(default)]
10379 pub with_ties: Option<Box<Expression>>,
10380}
10381
10382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10384#[cfg_attr(feature = "bindings", derive(TS))]
10385pub struct Lateral {
10386 pub this: Box<Expression>,
10387 #[serde(default)]
10388 pub view: Option<Box<Expression>>,
10389 #[serde(default)]
10390 pub outer: Option<Box<Expression>>,
10391 #[serde(default)]
10392 pub alias: Option<String>,
10393 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10395 pub alias_quoted: bool,
10396 #[serde(default)]
10397 pub cross_apply: Option<Box<Expression>>,
10398 #[serde(default)]
10399 pub ordinality: Option<Box<Expression>>,
10400 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10402 pub column_aliases: Vec<String>,
10403}
10404
10405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10407#[cfg_attr(feature = "bindings", derive(TS))]
10408pub struct TableFromRows {
10409 pub this: Box<Expression>,
10410 #[serde(default)]
10411 pub alias: Option<String>,
10412 #[serde(default)]
10413 pub joins: Vec<Expression>,
10414 #[serde(default)]
10415 pub pivots: Option<Box<Expression>>,
10416 #[serde(default)]
10417 pub sample: Option<Box<Expression>>,
10418}
10419
10420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10423#[cfg_attr(feature = "bindings", derive(TS))]
10424pub struct RowsFrom {
10425 pub expressions: Vec<Expression>,
10427 #[serde(default)]
10429 pub ordinality: bool,
10430 #[serde(default)]
10432 pub alias: Option<Box<Expression>>,
10433}
10434
10435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10437#[cfg_attr(feature = "bindings", derive(TS))]
10438pub struct WithFill {
10439 #[serde(default)]
10440 pub from_: Option<Box<Expression>>,
10441 #[serde(default)]
10442 pub to: Option<Box<Expression>>,
10443 #[serde(default)]
10444 pub step: Option<Box<Expression>>,
10445 #[serde(default)]
10446 pub staleness: Option<Box<Expression>>,
10447 #[serde(default)]
10448 pub interpolate: Option<Box<Expression>>,
10449}
10450
10451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10453#[cfg_attr(feature = "bindings", derive(TS))]
10454pub struct Property {
10455 pub this: Box<Expression>,
10456 #[serde(default)]
10457 pub value: Option<Box<Expression>>,
10458}
10459
10460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10462#[cfg_attr(feature = "bindings", derive(TS))]
10463pub struct GrantPrivilege {
10464 pub this: Box<Expression>,
10465 #[serde(default)]
10466 pub expressions: Vec<Expression>,
10467}
10468
10469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10471#[cfg_attr(feature = "bindings", derive(TS))]
10472pub struct AllowedValuesProperty {
10473 #[serde(default)]
10474 pub expressions: Vec<Expression>,
10475}
10476
10477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10479#[cfg_attr(feature = "bindings", derive(TS))]
10480pub struct AlgorithmProperty {
10481 pub this: Box<Expression>,
10482}
10483
10484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10486#[cfg_attr(feature = "bindings", derive(TS))]
10487pub struct AutoIncrementProperty {
10488 pub this: Box<Expression>,
10489}
10490
10491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10493#[cfg_attr(feature = "bindings", derive(TS))]
10494pub struct AutoRefreshProperty {
10495 pub this: Box<Expression>,
10496}
10497
10498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10500#[cfg_attr(feature = "bindings", derive(TS))]
10501pub struct BackupProperty {
10502 pub this: Box<Expression>,
10503}
10504
10505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10507#[cfg_attr(feature = "bindings", derive(TS))]
10508pub struct BuildProperty {
10509 pub this: Box<Expression>,
10510}
10511
10512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10514#[cfg_attr(feature = "bindings", derive(TS))]
10515pub struct BlockCompressionProperty {
10516 #[serde(default)]
10517 pub autotemp: Option<Box<Expression>>,
10518 #[serde(default)]
10519 pub always: Option<Box<Expression>>,
10520 #[serde(default)]
10521 pub default: Option<Box<Expression>>,
10522 #[serde(default)]
10523 pub manual: Option<Box<Expression>>,
10524 #[serde(default)]
10525 pub never: Option<Box<Expression>>,
10526}
10527
10528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10530#[cfg_attr(feature = "bindings", derive(TS))]
10531pub struct CharacterSetProperty {
10532 pub this: Box<Expression>,
10533 #[serde(default)]
10534 pub default: Option<Box<Expression>>,
10535}
10536
10537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10539#[cfg_attr(feature = "bindings", derive(TS))]
10540pub struct ChecksumProperty {
10541 #[serde(default)]
10542 pub on: Option<Box<Expression>>,
10543 #[serde(default)]
10544 pub default: Option<Box<Expression>>,
10545}
10546
10547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10549#[cfg_attr(feature = "bindings", derive(TS))]
10550pub struct CollateProperty {
10551 pub this: Box<Expression>,
10552 #[serde(default)]
10553 pub default: Option<Box<Expression>>,
10554}
10555
10556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10558#[cfg_attr(feature = "bindings", derive(TS))]
10559pub struct DataBlocksizeProperty {
10560 #[serde(default)]
10561 pub size: Option<i64>,
10562 #[serde(default)]
10563 pub units: Option<Box<Expression>>,
10564 #[serde(default)]
10565 pub minimum: Option<Box<Expression>>,
10566 #[serde(default)]
10567 pub maximum: Option<Box<Expression>>,
10568 #[serde(default)]
10569 pub default: Option<Box<Expression>>,
10570}
10571
10572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10574#[cfg_attr(feature = "bindings", derive(TS))]
10575pub struct DataDeletionProperty {
10576 pub on: Box<Expression>,
10577 #[serde(default)]
10578 pub filter_column: Option<Box<Expression>>,
10579 #[serde(default)]
10580 pub retention_period: Option<Box<Expression>>,
10581}
10582
10583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10585#[cfg_attr(feature = "bindings", derive(TS))]
10586pub struct DefinerProperty {
10587 pub this: Box<Expression>,
10588}
10589
10590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10592#[cfg_attr(feature = "bindings", derive(TS))]
10593pub struct DistKeyProperty {
10594 pub this: Box<Expression>,
10595}
10596
10597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10599#[cfg_attr(feature = "bindings", derive(TS))]
10600pub struct DistributedByProperty {
10601 #[serde(default)]
10602 pub expressions: Vec<Expression>,
10603 pub kind: String,
10604 #[serde(default)]
10605 pub buckets: Option<Box<Expression>>,
10606 #[serde(default)]
10607 pub order: Option<Box<Expression>>,
10608}
10609
10610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10612#[cfg_attr(feature = "bindings", derive(TS))]
10613pub struct DistStyleProperty {
10614 pub this: Box<Expression>,
10615}
10616
10617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10619#[cfg_attr(feature = "bindings", derive(TS))]
10620pub struct DuplicateKeyProperty {
10621 #[serde(default)]
10622 pub expressions: Vec<Expression>,
10623}
10624
10625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10627#[cfg_attr(feature = "bindings", derive(TS))]
10628pub struct EngineProperty {
10629 pub this: Box<Expression>,
10630}
10631
10632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10634#[cfg_attr(feature = "bindings", derive(TS))]
10635pub struct ToTableProperty {
10636 pub this: Box<Expression>,
10637}
10638
10639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10641#[cfg_attr(feature = "bindings", derive(TS))]
10642pub struct ExecuteAsProperty {
10643 pub this: Box<Expression>,
10644}
10645
10646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10648#[cfg_attr(feature = "bindings", derive(TS))]
10649pub struct ExternalProperty {
10650 #[serde(default)]
10651 pub this: Option<Box<Expression>>,
10652}
10653
10654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10656#[cfg_attr(feature = "bindings", derive(TS))]
10657pub struct FallbackProperty {
10658 #[serde(default)]
10659 pub no: Option<Box<Expression>>,
10660 #[serde(default)]
10661 pub protection: Option<Box<Expression>>,
10662}
10663
10664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10666#[cfg_attr(feature = "bindings", derive(TS))]
10667pub struct FileFormatProperty {
10668 #[serde(default)]
10669 pub this: Option<Box<Expression>>,
10670 #[serde(default)]
10671 pub expressions: Vec<Expression>,
10672 #[serde(default)]
10673 pub hive_format: Option<Box<Expression>>,
10674}
10675
10676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10678#[cfg_attr(feature = "bindings", derive(TS))]
10679pub struct CredentialsProperty {
10680 #[serde(default)]
10681 pub expressions: Vec<Expression>,
10682}
10683
10684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10686#[cfg_attr(feature = "bindings", derive(TS))]
10687pub struct FreespaceProperty {
10688 pub this: Box<Expression>,
10689 #[serde(default)]
10690 pub percent: Option<Box<Expression>>,
10691}
10692
10693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10695#[cfg_attr(feature = "bindings", derive(TS))]
10696pub struct InheritsProperty {
10697 #[serde(default)]
10698 pub expressions: Vec<Expression>,
10699}
10700
10701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10703#[cfg_attr(feature = "bindings", derive(TS))]
10704pub struct InputModelProperty {
10705 pub this: Box<Expression>,
10706}
10707
10708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10710#[cfg_attr(feature = "bindings", derive(TS))]
10711pub struct OutputModelProperty {
10712 pub this: Box<Expression>,
10713}
10714
10715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10717#[cfg_attr(feature = "bindings", derive(TS))]
10718pub struct IsolatedLoadingProperty {
10719 #[serde(default)]
10720 pub no: Option<Box<Expression>>,
10721 #[serde(default)]
10722 pub concurrent: Option<Box<Expression>>,
10723 #[serde(default)]
10724 pub target: Option<Box<Expression>>,
10725}
10726
10727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10729#[cfg_attr(feature = "bindings", derive(TS))]
10730pub struct JournalProperty {
10731 #[serde(default)]
10732 pub no: Option<Box<Expression>>,
10733 #[serde(default)]
10734 pub dual: Option<Box<Expression>>,
10735 #[serde(default)]
10736 pub before: Option<Box<Expression>>,
10737 #[serde(default)]
10738 pub local: Option<Box<Expression>>,
10739 #[serde(default)]
10740 pub after: Option<Box<Expression>>,
10741}
10742
10743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10745#[cfg_attr(feature = "bindings", derive(TS))]
10746pub struct LanguageProperty {
10747 pub this: Box<Expression>,
10748}
10749
10750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10752#[cfg_attr(feature = "bindings", derive(TS))]
10753pub struct EnviromentProperty {
10754 #[serde(default)]
10755 pub expressions: Vec<Expression>,
10756}
10757
10758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10760#[cfg_attr(feature = "bindings", derive(TS))]
10761pub struct ClusteredByProperty {
10762 #[serde(default)]
10763 pub expressions: Vec<Expression>,
10764 #[serde(default)]
10765 pub sorted_by: Option<Box<Expression>>,
10766 #[serde(default)]
10767 pub buckets: Option<Box<Expression>>,
10768}
10769
10770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10772#[cfg_attr(feature = "bindings", derive(TS))]
10773pub struct DictProperty {
10774 pub this: Box<Expression>,
10775 pub kind: String,
10776 #[serde(default)]
10777 pub settings: Option<Box<Expression>>,
10778}
10779
10780#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10782#[cfg_attr(feature = "bindings", derive(TS))]
10783pub struct DictRange {
10784 pub this: Box<Expression>,
10785 #[serde(default)]
10786 pub min: Option<Box<Expression>>,
10787 #[serde(default)]
10788 pub max: Option<Box<Expression>>,
10789}
10790
10791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10793#[cfg_attr(feature = "bindings", derive(TS))]
10794pub struct OnCluster {
10795 pub this: Box<Expression>,
10796}
10797
10798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10800#[cfg_attr(feature = "bindings", derive(TS))]
10801pub struct LikeProperty {
10802 pub this: Box<Expression>,
10803 #[serde(default)]
10804 pub expressions: Vec<Expression>,
10805}
10806
10807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10809#[cfg_attr(feature = "bindings", derive(TS))]
10810pub struct LocationProperty {
10811 pub this: Box<Expression>,
10812}
10813
10814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10816#[cfg_attr(feature = "bindings", derive(TS))]
10817pub struct LockProperty {
10818 pub this: Box<Expression>,
10819}
10820
10821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10823#[cfg_attr(feature = "bindings", derive(TS))]
10824pub struct LockingProperty {
10825 #[serde(default)]
10826 pub this: Option<Box<Expression>>,
10827 pub kind: String,
10828 #[serde(default)]
10829 pub for_or_in: Option<Box<Expression>>,
10830 #[serde(default)]
10831 pub lock_type: Option<Box<Expression>>,
10832 #[serde(default)]
10833 pub override_: Option<Box<Expression>>,
10834}
10835
10836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10838#[cfg_attr(feature = "bindings", derive(TS))]
10839pub struct LogProperty {
10840 #[serde(default)]
10841 pub no: Option<Box<Expression>>,
10842}
10843
10844#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10846#[cfg_attr(feature = "bindings", derive(TS))]
10847pub struct MaterializedProperty {
10848 #[serde(default)]
10849 pub this: Option<Box<Expression>>,
10850}
10851
10852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10854#[cfg_attr(feature = "bindings", derive(TS))]
10855pub struct MergeBlockRatioProperty {
10856 #[serde(default)]
10857 pub this: Option<Box<Expression>>,
10858 #[serde(default)]
10859 pub no: Option<Box<Expression>>,
10860 #[serde(default)]
10861 pub default: Option<Box<Expression>>,
10862 #[serde(default)]
10863 pub percent: Option<Box<Expression>>,
10864}
10865
10866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10868#[cfg_attr(feature = "bindings", derive(TS))]
10869pub struct OnProperty {
10870 pub this: Box<Expression>,
10871}
10872
10873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10875#[cfg_attr(feature = "bindings", derive(TS))]
10876pub struct OnCommitProperty {
10877 #[serde(default)]
10878 pub delete: Option<Box<Expression>>,
10879}
10880
10881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10883#[cfg_attr(feature = "bindings", derive(TS))]
10884pub struct PartitionedByProperty {
10885 pub this: Box<Expression>,
10886}
10887
10888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10890#[cfg_attr(feature = "bindings", derive(TS))]
10891pub struct PartitionByProperty {
10892 #[serde(default)]
10893 pub expressions: Vec<Expression>,
10894}
10895
10896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10898#[cfg_attr(feature = "bindings", derive(TS))]
10899pub struct PartitionedByBucket {
10900 pub this: Box<Expression>,
10901 pub expression: Box<Expression>,
10902}
10903
10904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10906#[cfg_attr(feature = "bindings", derive(TS))]
10907pub struct ClusterByColumnsProperty {
10908 #[serde(default)]
10909 pub columns: Vec<Identifier>,
10910}
10911
10912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10914#[cfg_attr(feature = "bindings", derive(TS))]
10915pub struct PartitionByTruncate {
10916 pub this: Box<Expression>,
10917 pub expression: Box<Expression>,
10918}
10919
10920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10922#[cfg_attr(feature = "bindings", derive(TS))]
10923pub struct PartitionByRangeProperty {
10924 #[serde(default)]
10925 pub partition_expressions: Option<Box<Expression>>,
10926 #[serde(default)]
10927 pub create_expressions: Option<Box<Expression>>,
10928}
10929
10930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10932#[cfg_attr(feature = "bindings", derive(TS))]
10933pub struct PartitionByRangePropertyDynamic {
10934 #[serde(default)]
10935 pub this: Option<Box<Expression>>,
10936 #[serde(default)]
10937 pub start: Option<Box<Expression>>,
10938 #[serde(default)]
10940 pub use_start_end: bool,
10941 #[serde(default)]
10942 pub end: Option<Box<Expression>>,
10943 #[serde(default)]
10944 pub every: Option<Box<Expression>>,
10945}
10946
10947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10949#[cfg_attr(feature = "bindings", derive(TS))]
10950pub struct PartitionByListProperty {
10951 #[serde(default)]
10952 pub partition_expressions: Option<Box<Expression>>,
10953 #[serde(default)]
10954 pub create_expressions: Option<Box<Expression>>,
10955}
10956
10957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10959#[cfg_attr(feature = "bindings", derive(TS))]
10960pub struct PartitionList {
10961 pub this: Box<Expression>,
10962 #[serde(default)]
10963 pub expressions: Vec<Expression>,
10964}
10965
10966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10968#[cfg_attr(feature = "bindings", derive(TS))]
10969pub struct Partition {
10970 pub expressions: Vec<Expression>,
10971 #[serde(default)]
10972 pub subpartition: bool,
10973}
10974
10975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10978#[cfg_attr(feature = "bindings", derive(TS))]
10979pub struct RefreshTriggerProperty {
10980 pub method: String,
10982 #[serde(default)]
10984 pub kind: Option<String>,
10985 #[serde(default)]
10987 pub every: Option<Box<Expression>>,
10988 #[serde(default)]
10990 pub unit: Option<String>,
10991 #[serde(default)]
10993 pub starts: Option<Box<Expression>>,
10994}
10995
10996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10998#[cfg_attr(feature = "bindings", derive(TS))]
10999pub struct UniqueKeyProperty {
11000 #[serde(default)]
11001 pub expressions: Vec<Expression>,
11002}
11003
11004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11006#[cfg_attr(feature = "bindings", derive(TS))]
11007pub struct RollupProperty {
11008 pub expressions: Vec<RollupIndex>,
11009}
11010
11011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11013#[cfg_attr(feature = "bindings", derive(TS))]
11014pub struct RollupIndex {
11015 pub name: Identifier,
11016 pub expressions: Vec<Identifier>,
11017}
11018
11019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11021#[cfg_attr(feature = "bindings", derive(TS))]
11022pub struct PartitionBoundSpec {
11023 #[serde(default)]
11024 pub this: Option<Box<Expression>>,
11025 #[serde(default)]
11026 pub expression: Option<Box<Expression>>,
11027 #[serde(default)]
11028 pub from_expressions: Option<Box<Expression>>,
11029 #[serde(default)]
11030 pub to_expressions: Option<Box<Expression>>,
11031}
11032
11033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11035#[cfg_attr(feature = "bindings", derive(TS))]
11036pub struct PartitionedOfProperty {
11037 pub this: Box<Expression>,
11038 pub expression: Box<Expression>,
11039}
11040
11041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11043#[cfg_attr(feature = "bindings", derive(TS))]
11044pub struct RemoteWithConnectionModelProperty {
11045 pub this: Box<Expression>,
11046}
11047
11048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11050#[cfg_attr(feature = "bindings", derive(TS))]
11051pub struct ReturnsProperty {
11052 #[serde(default)]
11053 pub this: Option<Box<Expression>>,
11054 #[serde(default)]
11055 pub is_table: Option<Box<Expression>>,
11056 #[serde(default)]
11057 pub table: Option<Box<Expression>>,
11058 #[serde(default)]
11059 pub null: Option<Box<Expression>>,
11060}
11061
11062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11064#[cfg_attr(feature = "bindings", derive(TS))]
11065pub struct RowFormatProperty {
11066 pub this: Box<Expression>,
11067}
11068
11069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11071#[cfg_attr(feature = "bindings", derive(TS))]
11072pub struct RowFormatDelimitedProperty {
11073 #[serde(default)]
11074 pub fields: Option<Box<Expression>>,
11075 #[serde(default)]
11076 pub escaped: Option<Box<Expression>>,
11077 #[serde(default)]
11078 pub collection_items: Option<Box<Expression>>,
11079 #[serde(default)]
11080 pub map_keys: Option<Box<Expression>>,
11081 #[serde(default)]
11082 pub lines: Option<Box<Expression>>,
11083 #[serde(default)]
11084 pub null: Option<Box<Expression>>,
11085 #[serde(default)]
11086 pub serde: Option<Box<Expression>>,
11087}
11088
11089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11091#[cfg_attr(feature = "bindings", derive(TS))]
11092pub struct RowFormatSerdeProperty {
11093 pub this: Box<Expression>,
11094 #[serde(default)]
11095 pub serde_properties: Option<Box<Expression>>,
11096}
11097
11098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11100#[cfg_attr(feature = "bindings", derive(TS))]
11101pub struct QueryTransform {
11102 #[serde(default)]
11103 pub expressions: Vec<Expression>,
11104 #[serde(default)]
11105 pub command_script: Option<Box<Expression>>,
11106 #[serde(default)]
11107 pub schema: Option<Box<Expression>>,
11108 #[serde(default)]
11109 pub row_format_before: Option<Box<Expression>>,
11110 #[serde(default)]
11111 pub record_writer: Option<Box<Expression>>,
11112 #[serde(default)]
11113 pub row_format_after: Option<Box<Expression>>,
11114 #[serde(default)]
11115 pub record_reader: Option<Box<Expression>>,
11116}
11117
11118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11120#[cfg_attr(feature = "bindings", derive(TS))]
11121pub struct SampleProperty {
11122 pub this: Box<Expression>,
11123}
11124
11125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11127#[cfg_attr(feature = "bindings", derive(TS))]
11128pub struct SecurityProperty {
11129 pub this: Box<Expression>,
11130}
11131
11132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11134#[cfg_attr(feature = "bindings", derive(TS))]
11135pub struct SchemaCommentProperty {
11136 pub this: Box<Expression>,
11137}
11138
11139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11141#[cfg_attr(feature = "bindings", derive(TS))]
11142pub struct SemanticView {
11143 pub this: Box<Expression>,
11144 #[serde(default)]
11145 pub metrics: Option<Box<Expression>>,
11146 #[serde(default)]
11147 pub dimensions: Option<Box<Expression>>,
11148 #[serde(default)]
11149 pub facts: Option<Box<Expression>>,
11150 #[serde(default)]
11151 pub where_: Option<Box<Expression>>,
11152}
11153
11154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11156#[cfg_attr(feature = "bindings", derive(TS))]
11157pub struct SerdeProperties {
11158 #[serde(default)]
11159 pub expressions: Vec<Expression>,
11160 #[serde(default)]
11161 pub with_: Option<Box<Expression>>,
11162}
11163
11164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11166#[cfg_attr(feature = "bindings", derive(TS))]
11167pub struct SetProperty {
11168 #[serde(default)]
11169 pub multi: Option<Box<Expression>>,
11170}
11171
11172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11174#[cfg_attr(feature = "bindings", derive(TS))]
11175pub struct SharingProperty {
11176 #[serde(default)]
11177 pub this: Option<Box<Expression>>,
11178}
11179
11180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11182#[cfg_attr(feature = "bindings", derive(TS))]
11183pub struct SetConfigProperty {
11184 pub this: Box<Expression>,
11185}
11186
11187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11189#[cfg_attr(feature = "bindings", derive(TS))]
11190pub struct SettingsProperty {
11191 #[serde(default)]
11192 pub expressions: Vec<Expression>,
11193}
11194
11195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11197#[cfg_attr(feature = "bindings", derive(TS))]
11198pub struct SortKeyProperty {
11199 pub this: Box<Expression>,
11200 #[serde(default)]
11201 pub compound: Option<Box<Expression>>,
11202}
11203
11204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11206#[cfg_attr(feature = "bindings", derive(TS))]
11207pub struct SqlReadWriteProperty {
11208 pub this: Box<Expression>,
11209}
11210
11211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11213#[cfg_attr(feature = "bindings", derive(TS))]
11214pub struct SqlSecurityProperty {
11215 pub this: Box<Expression>,
11216}
11217
11218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11220#[cfg_attr(feature = "bindings", derive(TS))]
11221pub struct StabilityProperty {
11222 pub this: Box<Expression>,
11223}
11224
11225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11227#[cfg_attr(feature = "bindings", derive(TS))]
11228pub struct StorageHandlerProperty {
11229 pub this: Box<Expression>,
11230}
11231
11232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11234#[cfg_attr(feature = "bindings", derive(TS))]
11235pub struct TemporaryProperty {
11236 #[serde(default)]
11237 pub this: Option<Box<Expression>>,
11238}
11239
11240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11242#[cfg_attr(feature = "bindings", derive(TS))]
11243pub struct Tags {
11244 #[serde(default)]
11245 pub expressions: Vec<Expression>,
11246}
11247
11248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11250#[cfg_attr(feature = "bindings", derive(TS))]
11251pub struct TransformModelProperty {
11252 #[serde(default)]
11253 pub expressions: Vec<Expression>,
11254}
11255
11256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11258#[cfg_attr(feature = "bindings", derive(TS))]
11259pub struct TransientProperty {
11260 #[serde(default)]
11261 pub this: Option<Box<Expression>>,
11262}
11263
11264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11266#[cfg_attr(feature = "bindings", derive(TS))]
11267pub struct UsingTemplateProperty {
11268 pub this: Box<Expression>,
11269}
11270
11271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11273#[cfg_attr(feature = "bindings", derive(TS))]
11274pub struct ViewAttributeProperty {
11275 pub this: Box<Expression>,
11276}
11277
11278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11280#[cfg_attr(feature = "bindings", derive(TS))]
11281pub struct VolatileProperty {
11282 #[serde(default)]
11283 pub this: Option<Box<Expression>>,
11284}
11285
11286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11288#[cfg_attr(feature = "bindings", derive(TS))]
11289pub struct WithDataProperty {
11290 #[serde(default)]
11291 pub no: Option<Box<Expression>>,
11292 #[serde(default)]
11293 pub statistics: Option<Box<Expression>>,
11294}
11295
11296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11298#[cfg_attr(feature = "bindings", derive(TS))]
11299pub struct WithJournalTableProperty {
11300 pub this: Box<Expression>,
11301}
11302
11303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11305#[cfg_attr(feature = "bindings", derive(TS))]
11306pub struct WithSchemaBindingProperty {
11307 pub this: Box<Expression>,
11308}
11309
11310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11312#[cfg_attr(feature = "bindings", derive(TS))]
11313pub struct WithSystemVersioningProperty {
11314 #[serde(default)]
11315 pub on: Option<Box<Expression>>,
11316 #[serde(default)]
11317 pub this: Option<Box<Expression>>,
11318 #[serde(default)]
11319 pub data_consistency: Option<Box<Expression>>,
11320 #[serde(default)]
11321 pub retention_period: Option<Box<Expression>>,
11322 #[serde(default)]
11323 pub with_: Option<Box<Expression>>,
11324}
11325
11326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11328#[cfg_attr(feature = "bindings", derive(TS))]
11329pub struct WithProcedureOptions {
11330 #[serde(default)]
11331 pub expressions: Vec<Expression>,
11332}
11333
11334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11336#[cfg_attr(feature = "bindings", derive(TS))]
11337pub struct EncodeProperty {
11338 pub this: Box<Expression>,
11339 #[serde(default)]
11340 pub properties: Vec<Expression>,
11341 #[serde(default)]
11342 pub key: Option<Box<Expression>>,
11343}
11344
11345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11347#[cfg_attr(feature = "bindings", derive(TS))]
11348pub struct IncludeProperty {
11349 pub this: Box<Expression>,
11350 #[serde(default)]
11351 pub alias: Option<String>,
11352 #[serde(default)]
11353 pub column_def: Option<Box<Expression>>,
11354}
11355
11356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11358#[cfg_attr(feature = "bindings", derive(TS))]
11359pub struct Properties {
11360 #[serde(default)]
11361 pub expressions: Vec<Expression>,
11362}
11363
11364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11366#[cfg_attr(feature = "bindings", derive(TS))]
11367pub struct OptionEntry {
11368 pub key: Identifier,
11369 pub value: Expression,
11370}
11371
11372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11374#[cfg_attr(feature = "bindings", derive(TS))]
11375pub struct OptionsProperty {
11376 #[serde(default)]
11377 pub entries: Vec<OptionEntry>,
11378}
11379
11380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11382#[cfg_attr(feature = "bindings", derive(TS))]
11383pub struct InputOutputFormat {
11384 #[serde(default)]
11385 pub input_format: Option<Box<Expression>>,
11386 #[serde(default)]
11387 pub output_format: Option<Box<Expression>>,
11388}
11389
11390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11392#[cfg_attr(feature = "bindings", derive(TS))]
11393pub struct Reference {
11394 pub this: Box<Expression>,
11395 #[serde(default)]
11396 pub expressions: Vec<Expression>,
11397 #[serde(default)]
11398 pub options: Vec<Expression>,
11399}
11400
11401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11403#[cfg_attr(feature = "bindings", derive(TS))]
11404pub struct QueryOption {
11405 pub this: Box<Expression>,
11406 #[serde(default)]
11407 pub expression: Option<Box<Expression>>,
11408}
11409
11410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11412#[cfg_attr(feature = "bindings", derive(TS))]
11413pub struct WithTableHint {
11414 #[serde(default)]
11415 pub expressions: Vec<Expression>,
11416}
11417
11418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11420#[cfg_attr(feature = "bindings", derive(TS))]
11421pub struct IndexTableHint {
11422 pub this: Box<Expression>,
11423 #[serde(default)]
11424 pub expressions: Vec<Expression>,
11425 #[serde(default)]
11426 pub target: Option<Box<Expression>>,
11427}
11428
11429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11431#[cfg_attr(feature = "bindings", derive(TS))]
11432pub struct Get {
11433 pub this: Box<Expression>,
11434 #[serde(default)]
11435 pub target: Option<Box<Expression>>,
11436 #[serde(default)]
11437 pub properties: Vec<Expression>,
11438}
11439
11440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11442#[cfg_attr(feature = "bindings", derive(TS))]
11443pub struct SetOperation {
11444 #[serde(default)]
11445 pub with_: Option<Box<Expression>>,
11446 pub this: Box<Expression>,
11447 pub expression: Box<Expression>,
11448 #[serde(default)]
11449 pub distinct: bool,
11450 #[serde(default)]
11451 pub by_name: Option<Box<Expression>>,
11452 #[serde(default)]
11453 pub side: Option<Box<Expression>>,
11454 #[serde(default)]
11455 pub kind: Option<String>,
11456 #[serde(default)]
11457 pub on: Option<Box<Expression>>,
11458}
11459
11460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11462#[cfg_attr(feature = "bindings", derive(TS))]
11463pub struct Var {
11464 pub this: String,
11465}
11466
11467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11469#[cfg_attr(feature = "bindings", derive(TS))]
11470pub struct Variadic {
11471 pub this: Box<Expression>,
11472}
11473
11474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11476#[cfg_attr(feature = "bindings", derive(TS))]
11477pub struct Version {
11478 pub this: Box<Expression>,
11479 pub kind: String,
11480 #[serde(default)]
11481 pub expression: Option<Box<Expression>>,
11482}
11483
11484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11486#[cfg_attr(feature = "bindings", derive(TS))]
11487pub struct Schema {
11488 #[serde(default)]
11489 pub this: Option<Box<Expression>>,
11490 #[serde(default)]
11491 pub expressions: Vec<Expression>,
11492}
11493
11494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11496#[cfg_attr(feature = "bindings", derive(TS))]
11497pub struct Lock {
11498 #[serde(default)]
11499 pub update: Option<Box<Expression>>,
11500 #[serde(default)]
11501 pub expressions: Vec<Expression>,
11502 #[serde(default)]
11503 pub wait: Option<Box<Expression>>,
11504 #[serde(default)]
11505 pub key: Option<Box<Expression>>,
11506}
11507
11508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11511#[cfg_attr(feature = "bindings", derive(TS))]
11512pub struct TableSample {
11513 #[serde(default, skip_serializing_if = "Option::is_none")]
11515 pub this: Option<Box<Expression>>,
11516 #[serde(default, skip_serializing_if = "Option::is_none")]
11518 pub sample: Option<Box<Sample>>,
11519 #[serde(default)]
11520 pub expressions: Vec<Expression>,
11521 #[serde(default)]
11522 pub method: Option<String>,
11523 #[serde(default)]
11524 pub bucket_numerator: Option<Box<Expression>>,
11525 #[serde(default)]
11526 pub bucket_denominator: Option<Box<Expression>>,
11527 #[serde(default)]
11528 pub bucket_field: Option<Box<Expression>>,
11529 #[serde(default)]
11530 pub percent: Option<Box<Expression>>,
11531 #[serde(default)]
11532 pub rows: Option<Box<Expression>>,
11533 #[serde(default)]
11534 pub size: Option<i64>,
11535 #[serde(default)]
11536 pub seed: Option<Box<Expression>>,
11537}
11538
11539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11541#[cfg_attr(feature = "bindings", derive(TS))]
11542pub struct Tag {
11543 #[serde(default)]
11544 pub this: Option<Box<Expression>>,
11545 #[serde(default)]
11546 pub prefix: Option<Box<Expression>>,
11547 #[serde(default)]
11548 pub postfix: Option<Box<Expression>>,
11549}
11550
11551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11553#[cfg_attr(feature = "bindings", derive(TS))]
11554pub struct UnpivotColumns {
11555 pub this: Box<Expression>,
11556 #[serde(default)]
11557 pub expressions: Vec<Expression>,
11558}
11559
11560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11562#[cfg_attr(feature = "bindings", derive(TS))]
11563pub struct SessionParameter {
11564 pub this: Box<Expression>,
11565 #[serde(default)]
11566 pub kind: Option<String>,
11567}
11568
11569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11571#[cfg_attr(feature = "bindings", derive(TS))]
11572pub struct PseudoType {
11573 pub this: Box<Expression>,
11574}
11575
11576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11578#[cfg_attr(feature = "bindings", derive(TS))]
11579pub struct ObjectIdentifier {
11580 pub this: Box<Expression>,
11581}
11582
11583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11585#[cfg_attr(feature = "bindings", derive(TS))]
11586pub struct Transaction {
11587 #[serde(default)]
11588 pub this: Option<Box<Expression>>,
11589 #[serde(default)]
11590 pub modes: Option<Box<Expression>>,
11591 #[serde(default)]
11592 pub mark: Option<Box<Expression>>,
11593}
11594
11595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11597#[cfg_attr(feature = "bindings", derive(TS))]
11598pub struct Commit {
11599 #[serde(default)]
11600 pub chain: Option<Box<Expression>>,
11601 #[serde(default)]
11602 pub this: Option<Box<Expression>>,
11603 #[serde(default)]
11604 pub durability: Option<Box<Expression>>,
11605}
11606
11607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11609#[cfg_attr(feature = "bindings", derive(TS))]
11610pub struct Rollback {
11611 #[serde(default)]
11612 pub savepoint: Option<Box<Expression>>,
11613 #[serde(default)]
11614 pub this: Option<Box<Expression>>,
11615}
11616
11617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11619#[cfg_attr(feature = "bindings", derive(TS))]
11620pub struct AlterSession {
11621 #[serde(default)]
11622 pub expressions: Vec<Expression>,
11623 #[serde(default)]
11624 pub unset: Option<Box<Expression>>,
11625}
11626
11627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11629#[cfg_attr(feature = "bindings", derive(TS))]
11630pub struct Analyze {
11631 #[serde(default)]
11632 pub kind: Option<String>,
11633 #[serde(default)]
11634 pub this: Option<Box<Expression>>,
11635 #[serde(default)]
11636 pub options: Vec<Expression>,
11637 #[serde(default)]
11638 pub mode: Option<Box<Expression>>,
11639 #[serde(default)]
11640 pub partition: Option<Box<Expression>>,
11641 #[serde(default)]
11642 pub expression: Option<Box<Expression>>,
11643 #[serde(default)]
11644 pub properties: Vec<Expression>,
11645 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11647 pub columns: Vec<String>,
11648}
11649
11650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11652#[cfg_attr(feature = "bindings", derive(TS))]
11653pub struct AnalyzeStatistics {
11654 pub kind: String,
11655 #[serde(default)]
11656 pub option: Option<Box<Expression>>,
11657 #[serde(default)]
11658 pub this: Option<Box<Expression>>,
11659 #[serde(default)]
11660 pub expressions: Vec<Expression>,
11661}
11662
11663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11665#[cfg_attr(feature = "bindings", derive(TS))]
11666pub struct AnalyzeHistogram {
11667 pub this: Box<Expression>,
11668 #[serde(default)]
11669 pub expressions: Vec<Expression>,
11670 #[serde(default)]
11671 pub expression: Option<Box<Expression>>,
11672 #[serde(default)]
11673 pub update_options: Option<Box<Expression>>,
11674}
11675
11676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11678#[cfg_attr(feature = "bindings", derive(TS))]
11679pub struct AnalyzeSample {
11680 pub kind: String,
11681 #[serde(default)]
11682 pub sample: Option<Box<Expression>>,
11683}
11684
11685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11687#[cfg_attr(feature = "bindings", derive(TS))]
11688pub struct AnalyzeListChainedRows {
11689 #[serde(default)]
11690 pub expression: Option<Box<Expression>>,
11691}
11692
11693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11695#[cfg_attr(feature = "bindings", derive(TS))]
11696pub struct AnalyzeDelete {
11697 #[serde(default)]
11698 pub kind: Option<String>,
11699}
11700
11701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11703#[cfg_attr(feature = "bindings", derive(TS))]
11704pub struct AnalyzeWith {
11705 #[serde(default)]
11706 pub expressions: Vec<Expression>,
11707}
11708
11709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11711#[cfg_attr(feature = "bindings", derive(TS))]
11712pub struct AnalyzeValidate {
11713 pub kind: String,
11714 #[serde(default)]
11715 pub this: Option<Box<Expression>>,
11716 #[serde(default)]
11717 pub expression: Option<Box<Expression>>,
11718}
11719
11720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11722#[cfg_attr(feature = "bindings", derive(TS))]
11723pub struct AddPartition {
11724 pub this: Box<Expression>,
11725 #[serde(default)]
11726 pub exists: bool,
11727 #[serde(default)]
11728 pub location: Option<Box<Expression>>,
11729}
11730
11731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11733#[cfg_attr(feature = "bindings", derive(TS))]
11734pub struct AttachOption {
11735 pub this: Box<Expression>,
11736 #[serde(default)]
11737 pub expression: Option<Box<Expression>>,
11738}
11739
11740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11742#[cfg_attr(feature = "bindings", derive(TS))]
11743pub struct DropPartition {
11744 #[serde(default)]
11745 pub expressions: Vec<Expression>,
11746 #[serde(default)]
11747 pub exists: bool,
11748}
11749
11750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11752#[cfg_attr(feature = "bindings", derive(TS))]
11753pub struct ReplacePartition {
11754 pub expression: Box<Expression>,
11755 #[serde(default)]
11756 pub source: Option<Box<Expression>>,
11757}
11758
11759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11761#[cfg_attr(feature = "bindings", derive(TS))]
11762pub struct DPipe {
11763 pub this: Box<Expression>,
11764 pub expression: Box<Expression>,
11765 #[serde(default)]
11766 pub safe: Option<Box<Expression>>,
11767}
11768
11769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11771#[cfg_attr(feature = "bindings", derive(TS))]
11772pub struct Operator {
11773 pub this: Box<Expression>,
11774 #[serde(default)]
11775 pub operator: Option<Box<Expression>>,
11776 pub expression: Box<Expression>,
11777 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11779 pub comments: Vec<String>,
11780}
11781
11782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11784#[cfg_attr(feature = "bindings", derive(TS))]
11785pub struct PivotAny {
11786 #[serde(default)]
11787 pub this: Option<Box<Expression>>,
11788}
11789
11790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11792#[cfg_attr(feature = "bindings", derive(TS))]
11793pub struct Aliases {
11794 pub this: Box<Expression>,
11795 #[serde(default)]
11796 pub expressions: Vec<Expression>,
11797}
11798
11799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11801#[cfg_attr(feature = "bindings", derive(TS))]
11802pub struct AtIndex {
11803 pub this: Box<Expression>,
11804 pub expression: Box<Expression>,
11805}
11806
11807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11809#[cfg_attr(feature = "bindings", derive(TS))]
11810pub struct FromTimeZone {
11811 pub this: Box<Expression>,
11812 #[serde(default)]
11813 pub zone: Option<Box<Expression>>,
11814}
11815
11816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11818#[cfg_attr(feature = "bindings", derive(TS))]
11819pub struct FormatPhrase {
11820 pub this: Box<Expression>,
11821 pub format: String,
11822}
11823
11824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11826#[cfg_attr(feature = "bindings", derive(TS))]
11827pub struct ForIn {
11828 pub this: Box<Expression>,
11829 pub expression: Box<Expression>,
11830}
11831
11832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11834#[cfg_attr(feature = "bindings", derive(TS))]
11835pub struct TimeUnit {
11836 #[serde(default)]
11837 pub unit: Option<String>,
11838}
11839
11840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11842#[cfg_attr(feature = "bindings", derive(TS))]
11843pub struct IntervalOp {
11844 #[serde(default)]
11845 pub unit: Option<String>,
11846 pub expression: Box<Expression>,
11847}
11848
11849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11851#[cfg_attr(feature = "bindings", derive(TS))]
11852pub struct HavingMax {
11853 pub this: Box<Expression>,
11854 pub expression: Box<Expression>,
11855 #[serde(default)]
11856 pub max: Option<Box<Expression>>,
11857}
11858
11859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11861#[cfg_attr(feature = "bindings", derive(TS))]
11862pub struct CosineDistance {
11863 pub this: Box<Expression>,
11864 pub expression: Box<Expression>,
11865}
11866
11867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11869#[cfg_attr(feature = "bindings", derive(TS))]
11870pub struct DotProduct {
11871 pub this: Box<Expression>,
11872 pub expression: Box<Expression>,
11873}
11874
11875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11877#[cfg_attr(feature = "bindings", derive(TS))]
11878pub struct EuclideanDistance {
11879 pub this: Box<Expression>,
11880 pub expression: Box<Expression>,
11881}
11882
11883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11885#[cfg_attr(feature = "bindings", derive(TS))]
11886pub struct ManhattanDistance {
11887 pub this: Box<Expression>,
11888 pub expression: Box<Expression>,
11889}
11890
11891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11893#[cfg_attr(feature = "bindings", derive(TS))]
11894pub struct JarowinklerSimilarity {
11895 pub this: Box<Expression>,
11896 pub expression: Box<Expression>,
11897}
11898
11899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11901#[cfg_attr(feature = "bindings", derive(TS))]
11902pub struct Booland {
11903 pub this: Box<Expression>,
11904 pub expression: Box<Expression>,
11905}
11906
11907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11909#[cfg_attr(feature = "bindings", derive(TS))]
11910pub struct Boolor {
11911 pub this: Box<Expression>,
11912 pub expression: Box<Expression>,
11913}
11914
11915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11917#[cfg_attr(feature = "bindings", derive(TS))]
11918pub struct ParameterizedAgg {
11919 pub this: Box<Expression>,
11920 #[serde(default)]
11921 pub expressions: Vec<Expression>,
11922 #[serde(default)]
11923 pub params: Vec<Expression>,
11924}
11925
11926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11928#[cfg_attr(feature = "bindings", derive(TS))]
11929pub struct ArgMax {
11930 pub this: Box<Expression>,
11931 pub expression: Box<Expression>,
11932 #[serde(default)]
11933 pub count: Option<Box<Expression>>,
11934}
11935
11936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11938#[cfg_attr(feature = "bindings", derive(TS))]
11939pub struct ArgMin {
11940 pub this: Box<Expression>,
11941 pub expression: Box<Expression>,
11942 #[serde(default)]
11943 pub count: Option<Box<Expression>>,
11944}
11945
11946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11948#[cfg_attr(feature = "bindings", derive(TS))]
11949pub struct ApproxTopK {
11950 pub this: Box<Expression>,
11951 #[serde(default)]
11952 pub expression: Option<Box<Expression>>,
11953 #[serde(default)]
11954 pub counters: Option<Box<Expression>>,
11955}
11956
11957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11959#[cfg_attr(feature = "bindings", derive(TS))]
11960pub struct ApproxTopKAccumulate {
11961 pub this: Box<Expression>,
11962 #[serde(default)]
11963 pub expression: Option<Box<Expression>>,
11964}
11965
11966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11968#[cfg_attr(feature = "bindings", derive(TS))]
11969pub struct ApproxTopKCombine {
11970 pub this: Box<Expression>,
11971 #[serde(default)]
11972 pub expression: Option<Box<Expression>>,
11973}
11974
11975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11977#[cfg_attr(feature = "bindings", derive(TS))]
11978pub struct ApproxTopKEstimate {
11979 pub this: Box<Expression>,
11980 #[serde(default)]
11981 pub expression: Option<Box<Expression>>,
11982}
11983
11984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11986#[cfg_attr(feature = "bindings", derive(TS))]
11987pub struct ApproxTopSum {
11988 pub this: Box<Expression>,
11989 pub expression: Box<Expression>,
11990 #[serde(default)]
11991 pub count: Option<Box<Expression>>,
11992}
11993
11994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11996#[cfg_attr(feature = "bindings", derive(TS))]
11997pub struct ApproxQuantiles {
11998 pub this: Box<Expression>,
11999 #[serde(default)]
12000 pub expression: Option<Box<Expression>>,
12001}
12002
12003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12005#[cfg_attr(feature = "bindings", derive(TS))]
12006pub struct Minhash {
12007 pub this: Box<Expression>,
12008 #[serde(default)]
12009 pub expressions: Vec<Expression>,
12010}
12011
12012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12014#[cfg_attr(feature = "bindings", derive(TS))]
12015pub struct FarmFingerprint {
12016 #[serde(default)]
12017 pub expressions: Vec<Expression>,
12018}
12019
12020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12022#[cfg_attr(feature = "bindings", derive(TS))]
12023pub struct Float64 {
12024 pub this: Box<Expression>,
12025 #[serde(default)]
12026 pub expression: Option<Box<Expression>>,
12027}
12028
12029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12031#[cfg_attr(feature = "bindings", derive(TS))]
12032pub struct Transform {
12033 pub this: Box<Expression>,
12034 pub expression: Box<Expression>,
12035}
12036
12037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12039#[cfg_attr(feature = "bindings", derive(TS))]
12040pub struct Translate {
12041 pub this: Box<Expression>,
12042 #[serde(default)]
12043 pub from_: Option<Box<Expression>>,
12044 #[serde(default)]
12045 pub to: Option<Box<Expression>>,
12046}
12047
12048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12050#[cfg_attr(feature = "bindings", derive(TS))]
12051pub struct Grouping {
12052 #[serde(default)]
12053 pub expressions: Vec<Expression>,
12054}
12055
12056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12058#[cfg_attr(feature = "bindings", derive(TS))]
12059pub struct GroupingId {
12060 #[serde(default)]
12061 pub expressions: Vec<Expression>,
12062}
12063
12064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12066#[cfg_attr(feature = "bindings", derive(TS))]
12067pub struct Anonymous {
12068 pub this: Box<Expression>,
12069 #[serde(default)]
12070 pub expressions: Vec<Expression>,
12071}
12072
12073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12075#[cfg_attr(feature = "bindings", derive(TS))]
12076pub struct AnonymousAggFunc {
12077 pub this: Box<Expression>,
12078 #[serde(default)]
12079 pub expressions: Vec<Expression>,
12080}
12081
12082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12084#[cfg_attr(feature = "bindings", derive(TS))]
12085pub struct CombinedAggFunc {
12086 pub this: Box<Expression>,
12087 #[serde(default)]
12088 pub expressions: Vec<Expression>,
12089}
12090
12091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12093#[cfg_attr(feature = "bindings", derive(TS))]
12094pub struct CombinedParameterizedAgg {
12095 pub this: Box<Expression>,
12096 #[serde(default)]
12097 pub expressions: Vec<Expression>,
12098 #[serde(default)]
12099 pub params: Vec<Expression>,
12100}
12101
12102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12104#[cfg_attr(feature = "bindings", derive(TS))]
12105pub struct HashAgg {
12106 pub this: Box<Expression>,
12107 #[serde(default)]
12108 pub expressions: Vec<Expression>,
12109}
12110
12111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12113#[cfg_attr(feature = "bindings", derive(TS))]
12114pub struct Hll {
12115 pub this: Box<Expression>,
12116 #[serde(default)]
12117 pub expressions: Vec<Expression>,
12118}
12119
12120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12122#[cfg_attr(feature = "bindings", derive(TS))]
12123pub struct Apply {
12124 pub this: Box<Expression>,
12125 pub expression: Box<Expression>,
12126}
12127
12128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12130#[cfg_attr(feature = "bindings", derive(TS))]
12131pub struct ToBoolean {
12132 pub this: Box<Expression>,
12133 #[serde(default)]
12134 pub safe: Option<Box<Expression>>,
12135}
12136
12137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12139#[cfg_attr(feature = "bindings", derive(TS))]
12140pub struct List {
12141 #[serde(default)]
12142 pub expressions: Vec<Expression>,
12143}
12144
12145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12150#[cfg_attr(feature = "bindings", derive(TS))]
12151pub struct ToMap {
12152 pub this: Box<Expression>,
12154}
12155
12156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12158#[cfg_attr(feature = "bindings", derive(TS))]
12159pub struct Pad {
12160 pub this: Box<Expression>,
12161 pub expression: Box<Expression>,
12162 #[serde(default)]
12163 pub fill_pattern: Option<Box<Expression>>,
12164 #[serde(default)]
12165 pub is_left: Option<Box<Expression>>,
12166}
12167
12168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12170#[cfg_attr(feature = "bindings", derive(TS))]
12171pub struct ToChar {
12172 pub this: Box<Expression>,
12173 #[serde(default)]
12174 pub format: Option<String>,
12175 #[serde(default)]
12176 pub nlsparam: Option<Box<Expression>>,
12177 #[serde(default)]
12178 pub is_numeric: Option<Box<Expression>>,
12179}
12180
12181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12183#[cfg_attr(feature = "bindings", derive(TS))]
12184pub struct StringFunc {
12185 pub this: Box<Expression>,
12186 #[serde(default)]
12187 pub zone: Option<Box<Expression>>,
12188}
12189
12190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12192#[cfg_attr(feature = "bindings", derive(TS))]
12193pub struct ToNumber {
12194 pub this: Box<Expression>,
12195 #[serde(default)]
12196 pub format: Option<Box<Expression>>,
12197 #[serde(default)]
12198 pub nlsparam: Option<Box<Expression>>,
12199 #[serde(default)]
12200 pub precision: Option<Box<Expression>>,
12201 #[serde(default)]
12202 pub scale: Option<Box<Expression>>,
12203 #[serde(default)]
12204 pub safe: Option<Box<Expression>>,
12205 #[serde(default)]
12206 pub safe_name: Option<Box<Expression>>,
12207}
12208
12209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12211#[cfg_attr(feature = "bindings", derive(TS))]
12212pub struct ToDouble {
12213 pub this: Box<Expression>,
12214 #[serde(default)]
12215 pub format: Option<String>,
12216 #[serde(default)]
12217 pub safe: Option<Box<Expression>>,
12218}
12219
12220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12222#[cfg_attr(feature = "bindings", derive(TS))]
12223pub struct ToDecfloat {
12224 pub this: Box<Expression>,
12225 #[serde(default)]
12226 pub format: Option<String>,
12227}
12228
12229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12231#[cfg_attr(feature = "bindings", derive(TS))]
12232pub struct TryToDecfloat {
12233 pub this: Box<Expression>,
12234 #[serde(default)]
12235 pub format: Option<String>,
12236}
12237
12238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12240#[cfg_attr(feature = "bindings", derive(TS))]
12241pub struct ToFile {
12242 pub this: Box<Expression>,
12243 #[serde(default)]
12244 pub path: Option<Box<Expression>>,
12245 #[serde(default)]
12246 pub safe: Option<Box<Expression>>,
12247}
12248
12249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12251#[cfg_attr(feature = "bindings", derive(TS))]
12252pub struct Columns {
12253 pub this: Box<Expression>,
12254 #[serde(default)]
12255 pub unpack: Option<Box<Expression>>,
12256}
12257
12258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12260#[cfg_attr(feature = "bindings", derive(TS))]
12261pub struct ConvertToCharset {
12262 pub this: Box<Expression>,
12263 #[serde(default)]
12264 pub dest: Option<Box<Expression>>,
12265 #[serde(default)]
12266 pub source: Option<Box<Expression>>,
12267}
12268
12269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12271#[cfg_attr(feature = "bindings", derive(TS))]
12272pub struct ConvertTimezone {
12273 #[serde(default)]
12274 pub source_tz: Option<Box<Expression>>,
12275 #[serde(default)]
12276 pub target_tz: Option<Box<Expression>>,
12277 #[serde(default)]
12278 pub timestamp: Option<Box<Expression>>,
12279 #[serde(default)]
12280 pub options: Vec<Expression>,
12281}
12282
12283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12285#[cfg_attr(feature = "bindings", derive(TS))]
12286pub struct GenerateSeries {
12287 #[serde(default)]
12288 pub start: Option<Box<Expression>>,
12289 #[serde(default)]
12290 pub end: Option<Box<Expression>>,
12291 #[serde(default)]
12292 pub step: Option<Box<Expression>>,
12293 #[serde(default)]
12294 pub is_end_exclusive: Option<Box<Expression>>,
12295}
12296
12297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12299#[cfg_attr(feature = "bindings", derive(TS))]
12300pub struct AIAgg {
12301 pub this: Box<Expression>,
12302 pub expression: Box<Expression>,
12303}
12304
12305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12307#[cfg_attr(feature = "bindings", derive(TS))]
12308pub struct AIClassify {
12309 pub this: Box<Expression>,
12310 #[serde(default)]
12311 pub categories: Option<Box<Expression>>,
12312 #[serde(default)]
12313 pub config: Option<Box<Expression>>,
12314}
12315
12316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12318#[cfg_attr(feature = "bindings", derive(TS))]
12319pub struct ArrayAll {
12320 pub this: Box<Expression>,
12321 pub expression: Box<Expression>,
12322}
12323
12324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12326#[cfg_attr(feature = "bindings", derive(TS))]
12327pub struct ArrayAny {
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 ArrayConstructCompact {
12336 #[serde(default)]
12337 pub expressions: Vec<Expression>,
12338}
12339
12340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12342#[cfg_attr(feature = "bindings", derive(TS))]
12343pub struct StPoint {
12344 pub this: Box<Expression>,
12345 pub expression: Box<Expression>,
12346 #[serde(default)]
12347 pub null: Option<Box<Expression>>,
12348}
12349
12350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12352#[cfg_attr(feature = "bindings", derive(TS))]
12353pub struct StDistance {
12354 pub this: Box<Expression>,
12355 pub expression: Box<Expression>,
12356 #[serde(default)]
12357 pub use_spheroid: Option<Box<Expression>>,
12358}
12359
12360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12362#[cfg_attr(feature = "bindings", derive(TS))]
12363pub struct StringToArray {
12364 pub this: Box<Expression>,
12365 #[serde(default)]
12366 pub expression: Option<Box<Expression>>,
12367 #[serde(default)]
12368 pub null: Option<Box<Expression>>,
12369}
12370
12371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12373#[cfg_attr(feature = "bindings", derive(TS))]
12374pub struct ArraySum {
12375 pub this: Box<Expression>,
12376 #[serde(default)]
12377 pub expression: Option<Box<Expression>>,
12378}
12379
12380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12382#[cfg_attr(feature = "bindings", derive(TS))]
12383pub struct ObjectAgg {
12384 pub this: Box<Expression>,
12385 pub expression: Box<Expression>,
12386}
12387
12388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12390#[cfg_attr(feature = "bindings", derive(TS))]
12391pub struct CastToStrType {
12392 pub this: Box<Expression>,
12393 #[serde(default)]
12394 pub to: Option<Box<Expression>>,
12395}
12396
12397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12399#[cfg_attr(feature = "bindings", derive(TS))]
12400pub struct CheckJson {
12401 pub this: Box<Expression>,
12402}
12403
12404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12406#[cfg_attr(feature = "bindings", derive(TS))]
12407pub struct CheckXml {
12408 pub this: Box<Expression>,
12409 #[serde(default)]
12410 pub disable_auto_convert: Option<Box<Expression>>,
12411}
12412
12413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12415#[cfg_attr(feature = "bindings", derive(TS))]
12416pub struct TranslateCharacters {
12417 pub this: Box<Expression>,
12418 pub expression: Box<Expression>,
12419 #[serde(default)]
12420 pub with_error: Option<Box<Expression>>,
12421}
12422
12423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12425#[cfg_attr(feature = "bindings", derive(TS))]
12426pub struct CurrentSchemas {
12427 #[serde(default)]
12428 pub this: Option<Box<Expression>>,
12429}
12430
12431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12433#[cfg_attr(feature = "bindings", derive(TS))]
12434pub struct CurrentDatetime {
12435 #[serde(default)]
12436 pub this: Option<Box<Expression>>,
12437}
12438
12439#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12441#[cfg_attr(feature = "bindings", derive(TS))]
12442pub struct Localtime {
12443 #[serde(default)]
12444 pub this: Option<Box<Expression>>,
12445}
12446
12447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12449#[cfg_attr(feature = "bindings", derive(TS))]
12450pub struct Localtimestamp {
12451 #[serde(default)]
12452 pub this: Option<Box<Expression>>,
12453}
12454
12455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12457#[cfg_attr(feature = "bindings", derive(TS))]
12458pub struct Systimestamp {
12459 #[serde(default)]
12460 pub this: Option<Box<Expression>>,
12461}
12462
12463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12465#[cfg_attr(feature = "bindings", derive(TS))]
12466pub struct CurrentSchema {
12467 #[serde(default)]
12468 pub this: Option<Box<Expression>>,
12469}
12470
12471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12473#[cfg_attr(feature = "bindings", derive(TS))]
12474pub struct CurrentUser {
12475 #[serde(default)]
12476 pub this: Option<Box<Expression>>,
12477}
12478
12479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12481#[cfg_attr(feature = "bindings", derive(TS))]
12482pub struct SessionUser;
12483
12484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12486#[cfg_attr(feature = "bindings", derive(TS))]
12487pub struct JSONPathRoot;
12488
12489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12491#[cfg_attr(feature = "bindings", derive(TS))]
12492pub struct UtcTime {
12493 #[serde(default)]
12494 pub this: Option<Box<Expression>>,
12495}
12496
12497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12499#[cfg_attr(feature = "bindings", derive(TS))]
12500pub struct UtcTimestamp {
12501 #[serde(default)]
12502 pub this: Option<Box<Expression>>,
12503}
12504
12505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12507#[cfg_attr(feature = "bindings", derive(TS))]
12508pub struct TimestampFunc {
12509 #[serde(default)]
12510 pub this: Option<Box<Expression>>,
12511 #[serde(default)]
12512 pub zone: Option<Box<Expression>>,
12513 #[serde(default)]
12514 pub with_tz: Option<bool>,
12515 #[serde(default)]
12516 pub safe: Option<bool>,
12517}
12518
12519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12521#[cfg_attr(feature = "bindings", derive(TS))]
12522pub struct DateBin {
12523 pub this: Box<Expression>,
12524 pub expression: Box<Expression>,
12525 #[serde(default)]
12526 pub unit: Option<String>,
12527 #[serde(default)]
12528 pub zone: Option<Box<Expression>>,
12529 #[serde(default)]
12530 pub origin: Option<Box<Expression>>,
12531}
12532
12533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12535#[cfg_attr(feature = "bindings", derive(TS))]
12536pub struct Datetime {
12537 pub this: Box<Expression>,
12538 #[serde(default)]
12539 pub expression: Option<Box<Expression>>,
12540}
12541
12542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12544#[cfg_attr(feature = "bindings", derive(TS))]
12545pub struct DatetimeAdd {
12546 pub this: Box<Expression>,
12547 pub expression: Box<Expression>,
12548 #[serde(default)]
12549 pub unit: Option<String>,
12550}
12551
12552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12554#[cfg_attr(feature = "bindings", derive(TS))]
12555pub struct DatetimeSub {
12556 pub this: Box<Expression>,
12557 pub expression: Box<Expression>,
12558 #[serde(default)]
12559 pub unit: Option<String>,
12560}
12561
12562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12564#[cfg_attr(feature = "bindings", derive(TS))]
12565pub struct DatetimeDiff {
12566 pub this: Box<Expression>,
12567 pub expression: Box<Expression>,
12568 #[serde(default)]
12569 pub unit: Option<String>,
12570}
12571
12572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12574#[cfg_attr(feature = "bindings", derive(TS))]
12575pub struct DatetimeTrunc {
12576 pub this: Box<Expression>,
12577 pub unit: String,
12578 #[serde(default)]
12579 pub zone: Option<Box<Expression>>,
12580}
12581
12582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12584#[cfg_attr(feature = "bindings", derive(TS))]
12585pub struct Dayname {
12586 pub this: Box<Expression>,
12587 #[serde(default)]
12588 pub abbreviated: Option<Box<Expression>>,
12589}
12590
12591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12593#[cfg_attr(feature = "bindings", derive(TS))]
12594pub struct MakeInterval {
12595 #[serde(default)]
12596 pub year: Option<Box<Expression>>,
12597 #[serde(default)]
12598 pub month: Option<Box<Expression>>,
12599 #[serde(default)]
12600 pub week: Option<Box<Expression>>,
12601 #[serde(default)]
12602 pub day: Option<Box<Expression>>,
12603 #[serde(default)]
12604 pub hour: Option<Box<Expression>>,
12605 #[serde(default)]
12606 pub minute: Option<Box<Expression>>,
12607 #[serde(default)]
12608 pub second: Option<Box<Expression>>,
12609}
12610
12611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12613#[cfg_attr(feature = "bindings", derive(TS))]
12614pub struct PreviousDay {
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 Elt {
12623 pub this: Box<Expression>,
12624 #[serde(default)]
12625 pub expressions: Vec<Expression>,
12626}
12627
12628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12630#[cfg_attr(feature = "bindings", derive(TS))]
12631pub struct TimestampAdd {
12632 pub this: Box<Expression>,
12633 pub expression: Box<Expression>,
12634 #[serde(default)]
12635 pub unit: Option<String>,
12636}
12637
12638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12640#[cfg_attr(feature = "bindings", derive(TS))]
12641pub struct TimestampSub {
12642 pub this: Box<Expression>,
12643 pub expression: Box<Expression>,
12644 #[serde(default)]
12645 pub unit: Option<String>,
12646}
12647
12648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12650#[cfg_attr(feature = "bindings", derive(TS))]
12651pub struct TimestampDiff {
12652 pub this: Box<Expression>,
12653 pub expression: Box<Expression>,
12654 #[serde(default)]
12655 pub unit: Option<String>,
12656}
12657
12658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12660#[cfg_attr(feature = "bindings", derive(TS))]
12661pub struct TimeSlice {
12662 pub this: Box<Expression>,
12663 pub expression: Box<Expression>,
12664 pub unit: String,
12665 #[serde(default)]
12666 pub kind: Option<String>,
12667}
12668
12669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12671#[cfg_attr(feature = "bindings", derive(TS))]
12672pub struct TimeAdd {
12673 pub this: Box<Expression>,
12674 pub expression: Box<Expression>,
12675 #[serde(default)]
12676 pub unit: Option<String>,
12677}
12678
12679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12681#[cfg_attr(feature = "bindings", derive(TS))]
12682pub struct TimeSub {
12683 pub this: Box<Expression>,
12684 pub expression: Box<Expression>,
12685 #[serde(default)]
12686 pub unit: Option<String>,
12687}
12688
12689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12691#[cfg_attr(feature = "bindings", derive(TS))]
12692pub struct TimeDiff {
12693 pub this: Box<Expression>,
12694 pub expression: Box<Expression>,
12695 #[serde(default)]
12696 pub unit: Option<String>,
12697}
12698
12699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12701#[cfg_attr(feature = "bindings", derive(TS))]
12702pub struct TimeTrunc {
12703 pub this: Box<Expression>,
12704 pub unit: String,
12705 #[serde(default)]
12706 pub zone: Option<Box<Expression>>,
12707}
12708
12709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12711#[cfg_attr(feature = "bindings", derive(TS))]
12712pub struct DateFromParts {
12713 #[serde(default)]
12714 pub year: Option<Box<Expression>>,
12715 #[serde(default)]
12716 pub month: Option<Box<Expression>>,
12717 #[serde(default)]
12718 pub day: Option<Box<Expression>>,
12719 #[serde(default)]
12720 pub allow_overflow: Option<Box<Expression>>,
12721}
12722
12723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12725#[cfg_attr(feature = "bindings", derive(TS))]
12726pub struct TimeFromParts {
12727 #[serde(default)]
12728 pub hour: Option<Box<Expression>>,
12729 #[serde(default)]
12730 pub min: Option<Box<Expression>>,
12731 #[serde(default)]
12732 pub sec: Option<Box<Expression>>,
12733 #[serde(default)]
12734 pub nano: Option<Box<Expression>>,
12735 #[serde(default)]
12736 pub fractions: Option<Box<Expression>>,
12737 #[serde(default)]
12738 pub precision: Option<i64>,
12739}
12740
12741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12743#[cfg_attr(feature = "bindings", derive(TS))]
12744pub struct DecodeCase {
12745 #[serde(default)]
12746 pub expressions: Vec<Expression>,
12747}
12748
12749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12751#[cfg_attr(feature = "bindings", derive(TS))]
12752pub struct Decrypt {
12753 pub this: Box<Expression>,
12754 #[serde(default)]
12755 pub passphrase: Option<Box<Expression>>,
12756 #[serde(default)]
12757 pub aad: Option<Box<Expression>>,
12758 #[serde(default)]
12759 pub encryption_method: Option<Box<Expression>>,
12760 #[serde(default)]
12761 pub safe: Option<Box<Expression>>,
12762}
12763
12764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12766#[cfg_attr(feature = "bindings", derive(TS))]
12767pub struct DecryptRaw {
12768 pub this: Box<Expression>,
12769 #[serde(default)]
12770 pub key: Option<Box<Expression>>,
12771 #[serde(default)]
12772 pub iv: Option<Box<Expression>>,
12773 #[serde(default)]
12774 pub aad: Option<Box<Expression>>,
12775 #[serde(default)]
12776 pub encryption_method: Option<Box<Expression>>,
12777 #[serde(default)]
12778 pub aead: Option<Box<Expression>>,
12779 #[serde(default)]
12780 pub safe: Option<Box<Expression>>,
12781}
12782
12783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12785#[cfg_attr(feature = "bindings", derive(TS))]
12786pub struct Encode {
12787 pub this: Box<Expression>,
12788 #[serde(default)]
12789 pub charset: Option<Box<Expression>>,
12790}
12791
12792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12794#[cfg_attr(feature = "bindings", derive(TS))]
12795pub struct Encrypt {
12796 pub this: Box<Expression>,
12797 #[serde(default)]
12798 pub passphrase: Option<Box<Expression>>,
12799 #[serde(default)]
12800 pub aad: Option<Box<Expression>>,
12801 #[serde(default)]
12802 pub encryption_method: Option<Box<Expression>>,
12803}
12804
12805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12807#[cfg_attr(feature = "bindings", derive(TS))]
12808pub struct EncryptRaw {
12809 pub this: Box<Expression>,
12810 #[serde(default)]
12811 pub key: Option<Box<Expression>>,
12812 #[serde(default)]
12813 pub iv: Option<Box<Expression>>,
12814 #[serde(default)]
12815 pub aad: Option<Box<Expression>>,
12816 #[serde(default)]
12817 pub encryption_method: Option<Box<Expression>>,
12818}
12819
12820#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12822#[cfg_attr(feature = "bindings", derive(TS))]
12823pub struct EqualNull {
12824 pub this: Box<Expression>,
12825 pub expression: Box<Expression>,
12826}
12827
12828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12830#[cfg_attr(feature = "bindings", derive(TS))]
12831pub struct ToBinary {
12832 pub this: Box<Expression>,
12833 #[serde(default)]
12834 pub format: Option<String>,
12835 #[serde(default)]
12836 pub safe: Option<Box<Expression>>,
12837}
12838
12839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12841#[cfg_attr(feature = "bindings", derive(TS))]
12842pub struct Base64DecodeBinary {
12843 pub this: Box<Expression>,
12844 #[serde(default)]
12845 pub alphabet: Option<Box<Expression>>,
12846}
12847
12848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12850#[cfg_attr(feature = "bindings", derive(TS))]
12851pub struct Base64DecodeString {
12852 pub this: Box<Expression>,
12853 #[serde(default)]
12854 pub alphabet: Option<Box<Expression>>,
12855}
12856
12857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12859#[cfg_attr(feature = "bindings", derive(TS))]
12860pub struct Base64Encode {
12861 pub this: Box<Expression>,
12862 #[serde(default)]
12863 pub max_line_length: Option<Box<Expression>>,
12864 #[serde(default)]
12865 pub alphabet: Option<Box<Expression>>,
12866}
12867
12868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12870#[cfg_attr(feature = "bindings", derive(TS))]
12871pub struct TryBase64DecodeBinary {
12872 pub this: Box<Expression>,
12873 #[serde(default)]
12874 pub alphabet: Option<Box<Expression>>,
12875}
12876
12877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12879#[cfg_attr(feature = "bindings", derive(TS))]
12880pub struct TryBase64DecodeString {
12881 pub this: Box<Expression>,
12882 #[serde(default)]
12883 pub alphabet: Option<Box<Expression>>,
12884}
12885
12886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12888#[cfg_attr(feature = "bindings", derive(TS))]
12889pub struct GapFill {
12890 pub this: Box<Expression>,
12891 #[serde(default)]
12892 pub ts_column: Option<Box<Expression>>,
12893 #[serde(default)]
12894 pub bucket_width: Option<Box<Expression>>,
12895 #[serde(default)]
12896 pub partitioning_columns: Option<Box<Expression>>,
12897 #[serde(default)]
12898 pub value_columns: Option<Box<Expression>>,
12899 #[serde(default)]
12900 pub origin: Option<Box<Expression>>,
12901 #[serde(default)]
12902 pub ignore_nulls: Option<Box<Expression>>,
12903}
12904
12905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12907#[cfg_attr(feature = "bindings", derive(TS))]
12908pub struct GenerateDateArray {
12909 #[serde(default)]
12910 pub start: Option<Box<Expression>>,
12911 #[serde(default)]
12912 pub end: Option<Box<Expression>>,
12913 #[serde(default)]
12914 pub step: Option<Box<Expression>>,
12915}
12916
12917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12919#[cfg_attr(feature = "bindings", derive(TS))]
12920pub struct GenerateTimestampArray {
12921 #[serde(default)]
12922 pub start: Option<Box<Expression>>,
12923 #[serde(default)]
12924 pub end: Option<Box<Expression>>,
12925 #[serde(default)]
12926 pub step: Option<Box<Expression>>,
12927}
12928
12929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12931#[cfg_attr(feature = "bindings", derive(TS))]
12932pub struct GetExtract {
12933 pub this: Box<Expression>,
12934 pub expression: Box<Expression>,
12935}
12936
12937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12939#[cfg_attr(feature = "bindings", derive(TS))]
12940pub struct Getbit {
12941 pub this: Box<Expression>,
12942 pub expression: Box<Expression>,
12943 #[serde(default)]
12944 pub zero_is_msb: Option<Box<Expression>>,
12945}
12946
12947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12949#[cfg_attr(feature = "bindings", derive(TS))]
12950pub struct OverflowTruncateBehavior {
12951 #[serde(default)]
12952 pub this: Option<Box<Expression>>,
12953 #[serde(default)]
12954 pub with_count: Option<Box<Expression>>,
12955}
12956
12957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12959#[cfg_attr(feature = "bindings", derive(TS))]
12960pub struct HexEncode {
12961 pub this: Box<Expression>,
12962 #[serde(default)]
12963 pub case: Option<Box<Expression>>,
12964}
12965
12966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12968#[cfg_attr(feature = "bindings", derive(TS))]
12969pub struct Compress {
12970 pub this: Box<Expression>,
12971 #[serde(default)]
12972 pub method: Option<String>,
12973}
12974
12975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12977#[cfg_attr(feature = "bindings", derive(TS))]
12978pub struct DecompressBinary {
12979 pub this: Box<Expression>,
12980 pub method: String,
12981}
12982
12983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12985#[cfg_attr(feature = "bindings", derive(TS))]
12986pub struct DecompressString {
12987 pub this: Box<Expression>,
12988 pub method: String,
12989}
12990
12991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12993#[cfg_attr(feature = "bindings", derive(TS))]
12994pub struct Xor {
12995 #[serde(default)]
12996 pub this: Option<Box<Expression>>,
12997 #[serde(default)]
12998 pub expression: Option<Box<Expression>>,
12999 #[serde(default)]
13000 pub expressions: Vec<Expression>,
13001}
13002
13003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13005#[cfg_attr(feature = "bindings", derive(TS))]
13006pub struct Nullif {
13007 pub this: Box<Expression>,
13008 pub expression: Box<Expression>,
13009}
13010
13011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13013#[cfg_attr(feature = "bindings", derive(TS))]
13014pub struct JSON {
13015 #[serde(default)]
13016 pub this: Option<Box<Expression>>,
13017 #[serde(default)]
13018 pub with_: Option<Box<Expression>>,
13019 #[serde(default)]
13020 pub unique: bool,
13021}
13022
13023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13025#[cfg_attr(feature = "bindings", derive(TS))]
13026pub struct JSONPath {
13027 #[serde(default)]
13028 pub expressions: Vec<Expression>,
13029 #[serde(default)]
13030 pub escape: Option<Box<Expression>>,
13031}
13032
13033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13035#[cfg_attr(feature = "bindings", derive(TS))]
13036pub struct JSONPathFilter {
13037 pub this: Box<Expression>,
13038}
13039
13040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13042#[cfg_attr(feature = "bindings", derive(TS))]
13043pub struct JSONPathKey {
13044 pub this: Box<Expression>,
13045}
13046
13047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13049#[cfg_attr(feature = "bindings", derive(TS))]
13050pub struct JSONPathRecursive {
13051 #[serde(default)]
13052 pub this: Option<Box<Expression>>,
13053}
13054
13055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13057#[cfg_attr(feature = "bindings", derive(TS))]
13058pub struct JSONPathScript {
13059 pub this: Box<Expression>,
13060}
13061
13062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13064#[cfg_attr(feature = "bindings", derive(TS))]
13065pub struct JSONPathSlice {
13066 #[serde(default)]
13067 pub start: Option<Box<Expression>>,
13068 #[serde(default)]
13069 pub end: Option<Box<Expression>>,
13070 #[serde(default)]
13071 pub step: Option<Box<Expression>>,
13072}
13073
13074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13076#[cfg_attr(feature = "bindings", derive(TS))]
13077pub struct JSONPathSelector {
13078 pub this: Box<Expression>,
13079}
13080
13081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13083#[cfg_attr(feature = "bindings", derive(TS))]
13084pub struct JSONPathSubscript {
13085 pub this: Box<Expression>,
13086}
13087
13088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13090#[cfg_attr(feature = "bindings", derive(TS))]
13091pub struct JSONPathUnion {
13092 #[serde(default)]
13093 pub expressions: Vec<Expression>,
13094}
13095
13096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13098#[cfg_attr(feature = "bindings", derive(TS))]
13099pub struct Format {
13100 pub this: Box<Expression>,
13101 #[serde(default)]
13102 pub expressions: Vec<Expression>,
13103}
13104
13105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13107#[cfg_attr(feature = "bindings", derive(TS))]
13108pub struct JSONKeys {
13109 pub this: Box<Expression>,
13110 #[serde(default)]
13111 pub expression: Option<Box<Expression>>,
13112 #[serde(default)]
13113 pub expressions: Vec<Expression>,
13114}
13115
13116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13118#[cfg_attr(feature = "bindings", derive(TS))]
13119pub struct JSONKeyValue {
13120 pub this: Box<Expression>,
13121 pub expression: Box<Expression>,
13122}
13123
13124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13126#[cfg_attr(feature = "bindings", derive(TS))]
13127pub struct JSONKeysAtDepth {
13128 pub this: Box<Expression>,
13129 #[serde(default)]
13130 pub expression: Option<Box<Expression>>,
13131 #[serde(default)]
13132 pub mode: Option<Box<Expression>>,
13133}
13134
13135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13137#[cfg_attr(feature = "bindings", derive(TS))]
13138pub struct JSONObject {
13139 #[serde(default)]
13140 pub expressions: Vec<Expression>,
13141 #[serde(default)]
13142 pub null_handling: Option<Box<Expression>>,
13143 #[serde(default)]
13144 pub unique_keys: Option<Box<Expression>>,
13145 #[serde(default)]
13146 pub return_type: Option<Box<Expression>>,
13147 #[serde(default)]
13148 pub encoding: Option<Box<Expression>>,
13149}
13150
13151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13153#[cfg_attr(feature = "bindings", derive(TS))]
13154pub struct JSONObjectAgg {
13155 #[serde(default)]
13156 pub expressions: Vec<Expression>,
13157 #[serde(default)]
13158 pub null_handling: Option<Box<Expression>>,
13159 #[serde(default)]
13160 pub unique_keys: Option<Box<Expression>>,
13161 #[serde(default)]
13162 pub return_type: Option<Box<Expression>>,
13163 #[serde(default)]
13164 pub encoding: Option<Box<Expression>>,
13165}
13166
13167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13169#[cfg_attr(feature = "bindings", derive(TS))]
13170pub struct JSONBObjectAgg {
13171 pub this: Box<Expression>,
13172 pub expression: Box<Expression>,
13173}
13174
13175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13177#[cfg_attr(feature = "bindings", derive(TS))]
13178pub struct JSONArray {
13179 #[serde(default)]
13180 pub expressions: Vec<Expression>,
13181 #[serde(default)]
13182 pub null_handling: Option<Box<Expression>>,
13183 #[serde(default)]
13184 pub return_type: Option<Box<Expression>>,
13185 #[serde(default)]
13186 pub strict: Option<Box<Expression>>,
13187}
13188
13189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13191#[cfg_attr(feature = "bindings", derive(TS))]
13192pub struct JSONArrayAgg {
13193 pub this: Box<Expression>,
13194 #[serde(default)]
13195 pub order: Option<Box<Expression>>,
13196 #[serde(default)]
13197 pub null_handling: Option<Box<Expression>>,
13198 #[serde(default)]
13199 pub return_type: Option<Box<Expression>>,
13200 #[serde(default)]
13201 pub strict: Option<Box<Expression>>,
13202}
13203
13204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13206#[cfg_attr(feature = "bindings", derive(TS))]
13207pub struct JSONExists {
13208 pub this: Box<Expression>,
13209 #[serde(default)]
13210 pub path: Option<Box<Expression>>,
13211 #[serde(default)]
13212 pub passing: Option<Box<Expression>>,
13213 #[serde(default)]
13214 pub on_condition: Option<Box<Expression>>,
13215 #[serde(default)]
13216 pub from_dcolonqmark: Option<Box<Expression>>,
13217}
13218
13219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13221#[cfg_attr(feature = "bindings", derive(TS))]
13222pub struct JSONColumnDef {
13223 #[serde(default)]
13224 pub this: Option<Box<Expression>>,
13225 #[serde(default)]
13226 pub kind: Option<String>,
13227 #[serde(default)]
13228 pub path: Option<Box<Expression>>,
13229 #[serde(default)]
13230 pub nested_schema: Option<Box<Expression>>,
13231 #[serde(default)]
13232 pub ordinality: Option<Box<Expression>>,
13233}
13234
13235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13237#[cfg_attr(feature = "bindings", derive(TS))]
13238pub struct JSONSchema {
13239 #[serde(default)]
13240 pub expressions: Vec<Expression>,
13241}
13242
13243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13245#[cfg_attr(feature = "bindings", derive(TS))]
13246pub struct JSONSet {
13247 pub this: Box<Expression>,
13248 #[serde(default)]
13249 pub expressions: Vec<Expression>,
13250}
13251
13252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13254#[cfg_attr(feature = "bindings", derive(TS))]
13255pub struct JSONStripNulls {
13256 pub this: Box<Expression>,
13257 #[serde(default)]
13258 pub expression: Option<Box<Expression>>,
13259 #[serde(default)]
13260 pub include_arrays: Option<Box<Expression>>,
13261 #[serde(default)]
13262 pub remove_empty: Option<Box<Expression>>,
13263}
13264
13265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13267#[cfg_attr(feature = "bindings", derive(TS))]
13268pub struct JSONValue {
13269 pub this: Box<Expression>,
13270 #[serde(default)]
13271 pub path: Option<Box<Expression>>,
13272 #[serde(default)]
13273 pub returning: Option<Box<Expression>>,
13274 #[serde(default)]
13275 pub on_condition: Option<Box<Expression>>,
13276}
13277
13278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13280#[cfg_attr(feature = "bindings", derive(TS))]
13281pub struct JSONValueArray {
13282 pub this: Box<Expression>,
13283 #[serde(default)]
13284 pub expression: Option<Box<Expression>>,
13285}
13286
13287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13289#[cfg_attr(feature = "bindings", derive(TS))]
13290pub struct JSONRemove {
13291 pub this: Box<Expression>,
13292 #[serde(default)]
13293 pub expressions: Vec<Expression>,
13294}
13295
13296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13298#[cfg_attr(feature = "bindings", derive(TS))]
13299pub struct JSONTable {
13300 pub this: Box<Expression>,
13301 #[serde(default)]
13302 pub schema: Option<Box<Expression>>,
13303 #[serde(default)]
13304 pub path: Option<Box<Expression>>,
13305 #[serde(default)]
13306 pub error_handling: Option<Box<Expression>>,
13307 #[serde(default)]
13308 pub empty_handling: Option<Box<Expression>>,
13309}
13310
13311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13313#[cfg_attr(feature = "bindings", derive(TS))]
13314pub struct JSONType {
13315 pub this: Box<Expression>,
13316 #[serde(default)]
13317 pub expression: Option<Box<Expression>>,
13318}
13319
13320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13322#[cfg_attr(feature = "bindings", derive(TS))]
13323pub struct ObjectInsert {
13324 pub this: Box<Expression>,
13325 #[serde(default)]
13326 pub key: Option<Box<Expression>>,
13327 #[serde(default)]
13328 pub value: Option<Box<Expression>>,
13329 #[serde(default)]
13330 pub update_flag: Option<Box<Expression>>,
13331}
13332
13333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13335#[cfg_attr(feature = "bindings", derive(TS))]
13336pub struct OpenJSONColumnDef {
13337 pub this: Box<Expression>,
13338 pub kind: String,
13339 #[serde(default)]
13340 pub path: Option<Box<Expression>>,
13341 #[serde(default)]
13342 pub as_json: Option<Box<Expression>>,
13343 #[serde(default, skip_serializing_if = "Option::is_none")]
13345 pub data_type: Option<DataType>,
13346}
13347
13348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13350#[cfg_attr(feature = "bindings", derive(TS))]
13351pub struct OpenJSON {
13352 pub this: Box<Expression>,
13353 #[serde(default)]
13354 pub path: Option<Box<Expression>>,
13355 #[serde(default)]
13356 pub expressions: Vec<Expression>,
13357}
13358
13359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13361#[cfg_attr(feature = "bindings", derive(TS))]
13362pub struct JSONBExists {
13363 pub this: Box<Expression>,
13364 #[serde(default)]
13365 pub path: Option<Box<Expression>>,
13366}
13367
13368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13370#[cfg_attr(feature = "bindings", derive(TS))]
13371pub struct JSONCast {
13372 pub this: Box<Expression>,
13373 pub to: DataType,
13374}
13375
13376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13378#[cfg_attr(feature = "bindings", derive(TS))]
13379pub struct JSONExtract {
13380 pub this: Box<Expression>,
13381 pub expression: Box<Expression>,
13382 #[serde(default)]
13383 pub only_json_types: Option<Box<Expression>>,
13384 #[serde(default)]
13385 pub expressions: Vec<Expression>,
13386 #[serde(default)]
13387 pub variant_extract: Option<Box<Expression>>,
13388 #[serde(default)]
13389 pub json_query: Option<Box<Expression>>,
13390 #[serde(default)]
13391 pub option: Option<Box<Expression>>,
13392 #[serde(default)]
13393 pub quote: Option<Box<Expression>>,
13394 #[serde(default)]
13395 pub on_condition: Option<Box<Expression>>,
13396 #[serde(default)]
13397 pub requires_json: Option<Box<Expression>>,
13398}
13399
13400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13402#[cfg_attr(feature = "bindings", derive(TS))]
13403pub struct JSONExtractQuote {
13404 #[serde(default)]
13405 pub option: Option<Box<Expression>>,
13406 #[serde(default)]
13407 pub scalar: Option<Box<Expression>>,
13408}
13409
13410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13412#[cfg_attr(feature = "bindings", derive(TS))]
13413pub struct JSONExtractArray {
13414 pub this: Box<Expression>,
13415 #[serde(default)]
13416 pub expression: Option<Box<Expression>>,
13417}
13418
13419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13421#[cfg_attr(feature = "bindings", derive(TS))]
13422pub struct JSONExtractScalar {
13423 pub this: Box<Expression>,
13424 pub expression: Box<Expression>,
13425 #[serde(default)]
13426 pub only_json_types: Option<Box<Expression>>,
13427 #[serde(default)]
13428 pub expressions: Vec<Expression>,
13429 #[serde(default)]
13430 pub json_type: Option<Box<Expression>>,
13431 #[serde(default)]
13432 pub scalar_only: Option<Box<Expression>>,
13433}
13434
13435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13437#[cfg_attr(feature = "bindings", derive(TS))]
13438pub struct JSONBExtractScalar {
13439 pub this: Box<Expression>,
13440 pub expression: Box<Expression>,
13441 #[serde(default)]
13442 pub json_type: Option<Box<Expression>>,
13443}
13444
13445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13447#[cfg_attr(feature = "bindings", derive(TS))]
13448pub struct JSONFormat {
13449 #[serde(default)]
13450 pub this: Option<Box<Expression>>,
13451 #[serde(default)]
13452 pub options: Vec<Expression>,
13453 #[serde(default)]
13454 pub is_json: Option<Box<Expression>>,
13455 #[serde(default)]
13456 pub to_json: Option<Box<Expression>>,
13457}
13458
13459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13461#[cfg_attr(feature = "bindings", derive(TS))]
13462pub struct JSONArrayAppend {
13463 pub this: Box<Expression>,
13464 #[serde(default)]
13465 pub expressions: Vec<Expression>,
13466}
13467
13468#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13470#[cfg_attr(feature = "bindings", derive(TS))]
13471pub struct JSONArrayContains {
13472 pub this: Box<Expression>,
13473 pub expression: Box<Expression>,
13474 #[serde(default)]
13475 pub json_type: Option<Box<Expression>>,
13476}
13477
13478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13480#[cfg_attr(feature = "bindings", derive(TS))]
13481pub struct JSONArrayInsert {
13482 pub this: Box<Expression>,
13483 #[serde(default)]
13484 pub expressions: Vec<Expression>,
13485}
13486
13487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13489#[cfg_attr(feature = "bindings", derive(TS))]
13490pub struct ParseJSON {
13491 pub this: Box<Expression>,
13492 #[serde(default)]
13493 pub expression: Option<Box<Expression>>,
13494 #[serde(default)]
13495 pub safe: Option<Box<Expression>>,
13496}
13497
13498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13500#[cfg_attr(feature = "bindings", derive(TS))]
13501pub struct ParseUrl {
13502 pub this: Box<Expression>,
13503 #[serde(default)]
13504 pub part_to_extract: Option<Box<Expression>>,
13505 #[serde(default)]
13506 pub key: Option<Box<Expression>>,
13507 #[serde(default)]
13508 pub permissive: Option<Box<Expression>>,
13509}
13510
13511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13513#[cfg_attr(feature = "bindings", derive(TS))]
13514pub struct ParseIp {
13515 pub this: Box<Expression>,
13516 #[serde(default)]
13517 pub type_: Option<Box<Expression>>,
13518 #[serde(default)]
13519 pub permissive: Option<Box<Expression>>,
13520}
13521
13522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13524#[cfg_attr(feature = "bindings", derive(TS))]
13525pub struct ParseTime {
13526 pub this: Box<Expression>,
13527 pub format: String,
13528}
13529
13530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13532#[cfg_attr(feature = "bindings", derive(TS))]
13533pub struct ParseDatetime {
13534 pub this: Box<Expression>,
13535 #[serde(default)]
13536 pub format: Option<String>,
13537 #[serde(default)]
13538 pub zone: Option<Box<Expression>>,
13539}
13540
13541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13543#[cfg_attr(feature = "bindings", derive(TS))]
13544pub struct Map {
13545 #[serde(default)]
13546 pub keys: Vec<Expression>,
13547 #[serde(default)]
13548 pub values: Vec<Expression>,
13549}
13550
13551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13553#[cfg_attr(feature = "bindings", derive(TS))]
13554pub struct MapCat {
13555 pub this: Box<Expression>,
13556 pub expression: Box<Expression>,
13557}
13558
13559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13561#[cfg_attr(feature = "bindings", derive(TS))]
13562pub struct MapDelete {
13563 pub this: Box<Expression>,
13564 #[serde(default)]
13565 pub expressions: Vec<Expression>,
13566}
13567
13568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13570#[cfg_attr(feature = "bindings", derive(TS))]
13571pub struct MapInsert {
13572 pub this: Box<Expression>,
13573 #[serde(default)]
13574 pub key: Option<Box<Expression>>,
13575 #[serde(default)]
13576 pub value: Option<Box<Expression>>,
13577 #[serde(default)]
13578 pub update_flag: Option<Box<Expression>>,
13579}
13580
13581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13583#[cfg_attr(feature = "bindings", derive(TS))]
13584pub struct MapPick {
13585 pub this: Box<Expression>,
13586 #[serde(default)]
13587 pub expressions: Vec<Expression>,
13588}
13589
13590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13592#[cfg_attr(feature = "bindings", derive(TS))]
13593pub struct ScopeResolution {
13594 #[serde(default)]
13595 pub this: Option<Box<Expression>>,
13596 pub expression: Box<Expression>,
13597}
13598
13599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13601#[cfg_attr(feature = "bindings", derive(TS))]
13602pub struct Slice {
13603 #[serde(default)]
13604 pub this: Option<Box<Expression>>,
13605 #[serde(default)]
13606 pub expression: Option<Box<Expression>>,
13607 #[serde(default)]
13608 pub step: Option<Box<Expression>>,
13609}
13610
13611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13613#[cfg_attr(feature = "bindings", derive(TS))]
13614pub struct VarMap {
13615 #[serde(default)]
13616 pub keys: Vec<Expression>,
13617 #[serde(default)]
13618 pub values: Vec<Expression>,
13619}
13620
13621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13623#[cfg_attr(feature = "bindings", derive(TS))]
13624pub struct MatchAgainst {
13625 pub this: Box<Expression>,
13626 #[serde(default)]
13627 pub expressions: Vec<Expression>,
13628 #[serde(default)]
13629 pub modifier: Option<Box<Expression>>,
13630}
13631
13632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13634#[cfg_attr(feature = "bindings", derive(TS))]
13635pub struct MD5Digest {
13636 pub this: Box<Expression>,
13637 #[serde(default)]
13638 pub expressions: Vec<Expression>,
13639}
13640
13641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13643#[cfg_attr(feature = "bindings", derive(TS))]
13644pub struct Monthname {
13645 pub this: Box<Expression>,
13646 #[serde(default)]
13647 pub abbreviated: Option<Box<Expression>>,
13648}
13649
13650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13652#[cfg_attr(feature = "bindings", derive(TS))]
13653pub struct Ntile {
13654 #[serde(default)]
13655 pub this: Option<Box<Expression>>,
13656}
13657
13658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13660#[cfg_attr(feature = "bindings", derive(TS))]
13661pub struct Normalize {
13662 pub this: Box<Expression>,
13663 #[serde(default)]
13664 pub form: Option<Box<Expression>>,
13665 #[serde(default)]
13666 pub is_casefold: Option<Box<Expression>>,
13667}
13668
13669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13671#[cfg_attr(feature = "bindings", derive(TS))]
13672pub struct Normal {
13673 pub this: Box<Expression>,
13674 #[serde(default)]
13675 pub stddev: Option<Box<Expression>>,
13676 #[serde(default)]
13677 pub gen: Option<Box<Expression>>,
13678}
13679
13680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13682#[cfg_attr(feature = "bindings", derive(TS))]
13683pub struct Predict {
13684 pub this: Box<Expression>,
13685 pub expression: Box<Expression>,
13686 #[serde(default)]
13687 pub params_struct: Option<Box<Expression>>,
13688}
13689
13690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13692#[cfg_attr(feature = "bindings", derive(TS))]
13693pub struct MLTranslate {
13694 pub this: Box<Expression>,
13695 pub expression: Box<Expression>,
13696 #[serde(default)]
13697 pub params_struct: Option<Box<Expression>>,
13698}
13699
13700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13702#[cfg_attr(feature = "bindings", derive(TS))]
13703pub struct FeaturesAtTime {
13704 pub this: Box<Expression>,
13705 #[serde(default)]
13706 pub time: Option<Box<Expression>>,
13707 #[serde(default)]
13708 pub num_rows: Option<Box<Expression>>,
13709 #[serde(default)]
13710 pub ignore_feature_nulls: Option<Box<Expression>>,
13711}
13712
13713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13715#[cfg_attr(feature = "bindings", derive(TS))]
13716pub struct GenerateEmbedding {
13717 pub this: Box<Expression>,
13718 pub expression: Box<Expression>,
13719 #[serde(default)]
13720 pub params_struct: Option<Box<Expression>>,
13721 #[serde(default)]
13722 pub is_text: Option<Box<Expression>>,
13723}
13724
13725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13727#[cfg_attr(feature = "bindings", derive(TS))]
13728pub struct MLForecast {
13729 pub this: Box<Expression>,
13730 #[serde(default)]
13731 pub expression: Option<Box<Expression>>,
13732 #[serde(default)]
13733 pub params_struct: Option<Box<Expression>>,
13734}
13735
13736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13738#[cfg_attr(feature = "bindings", derive(TS))]
13739pub struct ModelAttribute {
13740 pub this: Box<Expression>,
13741 pub expression: Box<Expression>,
13742}
13743
13744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13746#[cfg_attr(feature = "bindings", derive(TS))]
13747pub struct VectorSearch {
13748 pub this: Box<Expression>,
13749 #[serde(default)]
13750 pub column_to_search: Option<Box<Expression>>,
13751 #[serde(default)]
13752 pub query_table: Option<Box<Expression>>,
13753 #[serde(default)]
13754 pub query_column_to_search: Option<Box<Expression>>,
13755 #[serde(default)]
13756 pub top_k: Option<Box<Expression>>,
13757 #[serde(default)]
13758 pub distance_type: Option<Box<Expression>>,
13759 #[serde(default)]
13760 pub options: Vec<Expression>,
13761}
13762
13763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13765#[cfg_attr(feature = "bindings", derive(TS))]
13766pub struct Quantile {
13767 pub this: Box<Expression>,
13768 #[serde(default)]
13769 pub quantile: Option<Box<Expression>>,
13770}
13771
13772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13774#[cfg_attr(feature = "bindings", derive(TS))]
13775pub struct ApproxQuantile {
13776 pub this: Box<Expression>,
13777 #[serde(default)]
13778 pub quantile: Option<Box<Expression>>,
13779 #[serde(default)]
13780 pub accuracy: Option<Box<Expression>>,
13781 #[serde(default)]
13782 pub weight: Option<Box<Expression>>,
13783 #[serde(default)]
13784 pub error_tolerance: Option<Box<Expression>>,
13785}
13786
13787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13789#[cfg_attr(feature = "bindings", derive(TS))]
13790pub struct ApproxPercentileEstimate {
13791 pub this: Box<Expression>,
13792 #[serde(default)]
13793 pub percentile: Option<Box<Expression>>,
13794}
13795
13796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13798#[cfg_attr(feature = "bindings", derive(TS))]
13799pub struct Randn {
13800 #[serde(default)]
13801 pub this: Option<Box<Expression>>,
13802}
13803
13804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13806#[cfg_attr(feature = "bindings", derive(TS))]
13807pub struct Randstr {
13808 pub this: Box<Expression>,
13809 #[serde(default)]
13810 pub generator: Option<Box<Expression>>,
13811}
13812
13813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13815#[cfg_attr(feature = "bindings", derive(TS))]
13816pub struct RangeN {
13817 pub this: Box<Expression>,
13818 #[serde(default)]
13819 pub expressions: Vec<Expression>,
13820 #[serde(default)]
13821 pub each: Option<Box<Expression>>,
13822}
13823
13824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13826#[cfg_attr(feature = "bindings", derive(TS))]
13827pub struct RangeBucket {
13828 pub this: Box<Expression>,
13829 pub expression: Box<Expression>,
13830}
13831
13832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13834#[cfg_attr(feature = "bindings", derive(TS))]
13835pub struct ReadCSV {
13836 pub this: Box<Expression>,
13837 #[serde(default)]
13838 pub expressions: Vec<Expression>,
13839}
13840
13841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13843#[cfg_attr(feature = "bindings", derive(TS))]
13844pub struct ReadParquet {
13845 #[serde(default)]
13846 pub expressions: Vec<Expression>,
13847}
13848
13849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13851#[cfg_attr(feature = "bindings", derive(TS))]
13852pub struct Reduce {
13853 pub this: Box<Expression>,
13854 #[serde(default)]
13855 pub initial: Option<Box<Expression>>,
13856 #[serde(default)]
13857 pub merge: Option<Box<Expression>>,
13858 #[serde(default)]
13859 pub finish: Option<Box<Expression>>,
13860}
13861
13862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13864#[cfg_attr(feature = "bindings", derive(TS))]
13865pub struct RegexpExtractAll {
13866 pub this: Box<Expression>,
13867 pub expression: Box<Expression>,
13868 #[serde(default)]
13869 pub group: Option<Box<Expression>>,
13870 #[serde(default)]
13871 pub parameters: Option<Box<Expression>>,
13872 #[serde(default)]
13873 pub position: Option<Box<Expression>>,
13874 #[serde(default)]
13875 pub occurrence: Option<Box<Expression>>,
13876}
13877
13878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13880#[cfg_attr(feature = "bindings", derive(TS))]
13881pub struct RegexpILike {
13882 pub this: Box<Expression>,
13883 pub expression: Box<Expression>,
13884 #[serde(default)]
13885 pub flag: Option<Box<Expression>>,
13886}
13887
13888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13890#[cfg_attr(feature = "bindings", derive(TS))]
13891pub struct RegexpFullMatch {
13892 pub this: Box<Expression>,
13893 pub expression: Box<Expression>,
13894 #[serde(default)]
13895 pub options: Vec<Expression>,
13896}
13897
13898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13900#[cfg_attr(feature = "bindings", derive(TS))]
13901pub struct RegexpInstr {
13902 pub this: Box<Expression>,
13903 pub expression: Box<Expression>,
13904 #[serde(default)]
13905 pub position: Option<Box<Expression>>,
13906 #[serde(default)]
13907 pub occurrence: Option<Box<Expression>>,
13908 #[serde(default)]
13909 pub option: Option<Box<Expression>>,
13910 #[serde(default)]
13911 pub parameters: Option<Box<Expression>>,
13912 #[serde(default)]
13913 pub group: Option<Box<Expression>>,
13914}
13915
13916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13918#[cfg_attr(feature = "bindings", derive(TS))]
13919pub struct RegexpSplit {
13920 pub this: Box<Expression>,
13921 pub expression: Box<Expression>,
13922 #[serde(default)]
13923 pub limit: Option<Box<Expression>>,
13924}
13925
13926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13928#[cfg_attr(feature = "bindings", derive(TS))]
13929pub struct RegexpCount {
13930 pub this: Box<Expression>,
13931 pub expression: Box<Expression>,
13932 #[serde(default)]
13933 pub position: Option<Box<Expression>>,
13934 #[serde(default)]
13935 pub parameters: Option<Box<Expression>>,
13936}
13937
13938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13940#[cfg_attr(feature = "bindings", derive(TS))]
13941pub struct RegrValx {
13942 pub this: Box<Expression>,
13943 pub expression: Box<Expression>,
13944}
13945
13946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13948#[cfg_attr(feature = "bindings", derive(TS))]
13949pub struct RegrValy {
13950 pub this: Box<Expression>,
13951 pub expression: Box<Expression>,
13952}
13953
13954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13956#[cfg_attr(feature = "bindings", derive(TS))]
13957pub struct RegrAvgy {
13958 pub this: Box<Expression>,
13959 pub expression: Box<Expression>,
13960}
13961
13962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13964#[cfg_attr(feature = "bindings", derive(TS))]
13965pub struct RegrAvgx {
13966 pub this: Box<Expression>,
13967 pub expression: Box<Expression>,
13968}
13969
13970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13972#[cfg_attr(feature = "bindings", derive(TS))]
13973pub struct RegrCount {
13974 pub this: Box<Expression>,
13975 pub expression: Box<Expression>,
13976}
13977
13978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13980#[cfg_attr(feature = "bindings", derive(TS))]
13981pub struct RegrIntercept {
13982 pub this: Box<Expression>,
13983 pub expression: Box<Expression>,
13984}
13985
13986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13988#[cfg_attr(feature = "bindings", derive(TS))]
13989pub struct RegrR2 {
13990 pub this: Box<Expression>,
13991 pub expression: Box<Expression>,
13992}
13993
13994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13996#[cfg_attr(feature = "bindings", derive(TS))]
13997pub struct RegrSxx {
13998 pub this: Box<Expression>,
13999 pub expression: Box<Expression>,
14000}
14001
14002#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14004#[cfg_attr(feature = "bindings", derive(TS))]
14005pub struct RegrSxy {
14006 pub this: Box<Expression>,
14007 pub expression: Box<Expression>,
14008}
14009
14010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14012#[cfg_attr(feature = "bindings", derive(TS))]
14013pub struct RegrSyy {
14014 pub this: Box<Expression>,
14015 pub expression: Box<Expression>,
14016}
14017
14018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14020#[cfg_attr(feature = "bindings", derive(TS))]
14021pub struct RegrSlope {
14022 pub this: Box<Expression>,
14023 pub expression: Box<Expression>,
14024}
14025
14026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14028#[cfg_attr(feature = "bindings", derive(TS))]
14029pub struct SafeAdd {
14030 pub this: Box<Expression>,
14031 pub expression: Box<Expression>,
14032}
14033
14034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14036#[cfg_attr(feature = "bindings", derive(TS))]
14037pub struct SafeDivide {
14038 pub this: Box<Expression>,
14039 pub expression: Box<Expression>,
14040}
14041
14042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14044#[cfg_attr(feature = "bindings", derive(TS))]
14045pub struct SafeMultiply {
14046 pub this: Box<Expression>,
14047 pub expression: Box<Expression>,
14048}
14049
14050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14052#[cfg_attr(feature = "bindings", derive(TS))]
14053pub struct SafeSubtract {
14054 pub this: Box<Expression>,
14055 pub expression: Box<Expression>,
14056}
14057
14058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14060#[cfg_attr(feature = "bindings", derive(TS))]
14061pub struct SHA2 {
14062 pub this: Box<Expression>,
14063 #[serde(default)]
14064 pub length: Option<i64>,
14065}
14066
14067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14069#[cfg_attr(feature = "bindings", derive(TS))]
14070pub struct SHA2Digest {
14071 pub this: Box<Expression>,
14072 #[serde(default)]
14073 pub length: Option<i64>,
14074}
14075
14076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14078#[cfg_attr(feature = "bindings", derive(TS))]
14079pub struct SortArray {
14080 pub this: Box<Expression>,
14081 #[serde(default)]
14082 pub asc: Option<Box<Expression>>,
14083 #[serde(default)]
14084 pub nulls_first: Option<Box<Expression>>,
14085}
14086
14087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14089#[cfg_attr(feature = "bindings", derive(TS))]
14090pub struct SplitPart {
14091 pub this: Box<Expression>,
14092 #[serde(default)]
14093 pub delimiter: Option<Box<Expression>>,
14094 #[serde(default)]
14095 pub part_index: Option<Box<Expression>>,
14096}
14097
14098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14100#[cfg_attr(feature = "bindings", derive(TS))]
14101pub struct SubstringIndex {
14102 pub this: Box<Expression>,
14103 #[serde(default)]
14104 pub delimiter: Option<Box<Expression>>,
14105 #[serde(default)]
14106 pub count: Option<Box<Expression>>,
14107}
14108
14109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14111#[cfg_attr(feature = "bindings", derive(TS))]
14112pub struct StandardHash {
14113 pub this: Box<Expression>,
14114 #[serde(default)]
14115 pub expression: Option<Box<Expression>>,
14116}
14117
14118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14120#[cfg_attr(feature = "bindings", derive(TS))]
14121pub struct StrPosition {
14122 pub this: Box<Expression>,
14123 #[serde(default)]
14124 pub substr: Option<Box<Expression>>,
14125 #[serde(default)]
14126 pub position: Option<Box<Expression>>,
14127 #[serde(default)]
14128 pub occurrence: Option<Box<Expression>>,
14129}
14130
14131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14133#[cfg_attr(feature = "bindings", derive(TS))]
14134pub struct Search {
14135 pub this: Box<Expression>,
14136 pub expression: Box<Expression>,
14137 #[serde(default)]
14138 pub json_scope: Option<Box<Expression>>,
14139 #[serde(default)]
14140 pub analyzer: Option<Box<Expression>>,
14141 #[serde(default)]
14142 pub analyzer_options: Option<Box<Expression>>,
14143 #[serde(default)]
14144 pub search_mode: Option<Box<Expression>>,
14145}
14146
14147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14149#[cfg_attr(feature = "bindings", derive(TS))]
14150pub struct SearchIp {
14151 pub this: Box<Expression>,
14152 pub expression: Box<Expression>,
14153}
14154
14155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14157#[cfg_attr(feature = "bindings", derive(TS))]
14158pub struct StrToDate {
14159 pub this: Box<Expression>,
14160 #[serde(default)]
14161 pub format: Option<String>,
14162 #[serde(default)]
14163 pub safe: Option<Box<Expression>>,
14164}
14165
14166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14168#[cfg_attr(feature = "bindings", derive(TS))]
14169pub struct StrToTime {
14170 pub this: Box<Expression>,
14171 pub format: String,
14172 #[serde(default)]
14173 pub zone: Option<Box<Expression>>,
14174 #[serde(default)]
14175 pub safe: Option<Box<Expression>>,
14176 #[serde(default)]
14177 pub target_type: Option<Box<Expression>>,
14178}
14179
14180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14182#[cfg_attr(feature = "bindings", derive(TS))]
14183pub struct StrToUnix {
14184 #[serde(default)]
14185 pub this: Option<Box<Expression>>,
14186 #[serde(default)]
14187 pub format: Option<String>,
14188}
14189
14190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14192#[cfg_attr(feature = "bindings", derive(TS))]
14193pub struct StrToMap {
14194 pub this: Box<Expression>,
14195 #[serde(default)]
14196 pub pair_delim: Option<Box<Expression>>,
14197 #[serde(default)]
14198 pub key_value_delim: Option<Box<Expression>>,
14199 #[serde(default)]
14200 pub duplicate_resolution_callback: Option<Box<Expression>>,
14201}
14202
14203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14205#[cfg_attr(feature = "bindings", derive(TS))]
14206pub struct NumberToStr {
14207 pub this: Box<Expression>,
14208 pub format: String,
14209 #[serde(default)]
14210 pub culture: Option<Box<Expression>>,
14211}
14212
14213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14215#[cfg_attr(feature = "bindings", derive(TS))]
14216pub struct FromBase {
14217 pub this: Box<Expression>,
14218 pub expression: Box<Expression>,
14219}
14220
14221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14223#[cfg_attr(feature = "bindings", derive(TS))]
14224pub struct Stuff {
14225 pub this: Box<Expression>,
14226 #[serde(default)]
14227 pub start: Option<Box<Expression>>,
14228 #[serde(default)]
14229 pub length: Option<i64>,
14230 pub expression: Box<Expression>,
14231}
14232
14233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14235#[cfg_attr(feature = "bindings", derive(TS))]
14236pub struct TimeToStr {
14237 pub this: Box<Expression>,
14238 pub format: String,
14239 #[serde(default)]
14240 pub culture: Option<Box<Expression>>,
14241 #[serde(default)]
14242 pub zone: Option<Box<Expression>>,
14243}
14244
14245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14247#[cfg_attr(feature = "bindings", derive(TS))]
14248pub struct TimeStrToTime {
14249 pub this: Box<Expression>,
14250 #[serde(default)]
14251 pub zone: Option<Box<Expression>>,
14252}
14253
14254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14256#[cfg_attr(feature = "bindings", derive(TS))]
14257pub struct TsOrDsAdd {
14258 pub this: Box<Expression>,
14259 pub expression: Box<Expression>,
14260 #[serde(default)]
14261 pub unit: Option<String>,
14262 #[serde(default)]
14263 pub return_type: Option<Box<Expression>>,
14264}
14265
14266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14268#[cfg_attr(feature = "bindings", derive(TS))]
14269pub struct TsOrDsDiff {
14270 pub this: Box<Expression>,
14271 pub expression: Box<Expression>,
14272 #[serde(default)]
14273 pub unit: Option<String>,
14274}
14275
14276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14278#[cfg_attr(feature = "bindings", derive(TS))]
14279pub struct TsOrDsToDate {
14280 pub this: Box<Expression>,
14281 #[serde(default)]
14282 pub format: Option<String>,
14283 #[serde(default)]
14284 pub safe: Option<Box<Expression>>,
14285}
14286
14287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14289#[cfg_attr(feature = "bindings", derive(TS))]
14290pub struct TsOrDsToTime {
14291 pub this: Box<Expression>,
14292 #[serde(default)]
14293 pub format: Option<String>,
14294 #[serde(default)]
14295 pub safe: Option<Box<Expression>>,
14296}
14297
14298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14300#[cfg_attr(feature = "bindings", derive(TS))]
14301pub struct Unhex {
14302 pub this: Box<Expression>,
14303 #[serde(default)]
14304 pub expression: Option<Box<Expression>>,
14305}
14306
14307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14309#[cfg_attr(feature = "bindings", derive(TS))]
14310pub struct Uniform {
14311 pub this: Box<Expression>,
14312 pub expression: Box<Expression>,
14313 #[serde(default)]
14314 pub gen: Option<Box<Expression>>,
14315 #[serde(default)]
14316 pub seed: Option<Box<Expression>>,
14317}
14318
14319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14321#[cfg_attr(feature = "bindings", derive(TS))]
14322pub struct UnixToStr {
14323 pub this: Box<Expression>,
14324 #[serde(default)]
14325 pub format: Option<String>,
14326}
14327
14328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14330#[cfg_attr(feature = "bindings", derive(TS))]
14331pub struct UnixToTime {
14332 pub this: Box<Expression>,
14333 #[serde(default)]
14334 pub scale: Option<i64>,
14335 #[serde(default)]
14336 pub zone: Option<Box<Expression>>,
14337 #[serde(default)]
14338 pub hours: Option<Box<Expression>>,
14339 #[serde(default)]
14340 pub minutes: Option<Box<Expression>>,
14341 #[serde(default)]
14342 pub format: Option<String>,
14343 #[serde(default)]
14344 pub target_type: Option<Box<Expression>>,
14345}
14346
14347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14349#[cfg_attr(feature = "bindings", derive(TS))]
14350pub struct Uuid {
14351 #[serde(default)]
14352 pub this: Option<Box<Expression>>,
14353 #[serde(default)]
14354 pub name: Option<String>,
14355 #[serde(default)]
14356 pub is_string: Option<Box<Expression>>,
14357}
14358
14359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14361#[cfg_attr(feature = "bindings", derive(TS))]
14362pub struct TimestampFromParts {
14363 #[serde(default)]
14364 pub zone: Option<Box<Expression>>,
14365 #[serde(default)]
14366 pub milli: Option<Box<Expression>>,
14367 #[serde(default)]
14368 pub this: Option<Box<Expression>>,
14369 #[serde(default)]
14370 pub expression: Option<Box<Expression>>,
14371}
14372
14373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14375#[cfg_attr(feature = "bindings", derive(TS))]
14376pub struct TimestampTzFromParts {
14377 #[serde(default)]
14378 pub zone: Option<Box<Expression>>,
14379}
14380
14381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14383#[cfg_attr(feature = "bindings", derive(TS))]
14384pub struct Corr {
14385 pub this: Box<Expression>,
14386 pub expression: Box<Expression>,
14387 #[serde(default)]
14388 pub null_on_zero_variance: Option<Box<Expression>>,
14389}
14390
14391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14393#[cfg_attr(feature = "bindings", derive(TS))]
14394pub struct WidthBucket {
14395 pub this: Box<Expression>,
14396 #[serde(default)]
14397 pub min_value: Option<Box<Expression>>,
14398 #[serde(default)]
14399 pub max_value: Option<Box<Expression>>,
14400 #[serde(default)]
14401 pub num_buckets: Option<Box<Expression>>,
14402 #[serde(default)]
14403 pub threshold: Option<Box<Expression>>,
14404}
14405
14406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14408#[cfg_attr(feature = "bindings", derive(TS))]
14409pub struct CovarSamp {
14410 pub this: Box<Expression>,
14411 pub expression: Box<Expression>,
14412}
14413
14414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14416#[cfg_attr(feature = "bindings", derive(TS))]
14417pub struct CovarPop {
14418 pub this: Box<Expression>,
14419 pub expression: Box<Expression>,
14420}
14421
14422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14424#[cfg_attr(feature = "bindings", derive(TS))]
14425pub struct Week {
14426 pub this: Box<Expression>,
14427 #[serde(default)]
14428 pub mode: Option<Box<Expression>>,
14429}
14430
14431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14433#[cfg_attr(feature = "bindings", derive(TS))]
14434pub struct XMLElement {
14435 pub this: Box<Expression>,
14436 #[serde(default)]
14437 pub expressions: Vec<Expression>,
14438 #[serde(default)]
14439 pub evalname: Option<Box<Expression>>,
14440}
14441
14442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14444#[cfg_attr(feature = "bindings", derive(TS))]
14445pub struct XMLGet {
14446 pub this: Box<Expression>,
14447 pub expression: Box<Expression>,
14448 #[serde(default)]
14449 pub instance: Option<Box<Expression>>,
14450}
14451
14452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14454#[cfg_attr(feature = "bindings", derive(TS))]
14455pub struct XMLTable {
14456 pub this: Box<Expression>,
14457 #[serde(default)]
14458 pub namespaces: Option<Box<Expression>>,
14459 #[serde(default)]
14460 pub passing: Option<Box<Expression>>,
14461 #[serde(default)]
14462 pub columns: Vec<Expression>,
14463 #[serde(default)]
14464 pub by_ref: Option<Box<Expression>>,
14465}
14466
14467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14469#[cfg_attr(feature = "bindings", derive(TS))]
14470pub struct XMLKeyValueOption {
14471 pub this: Box<Expression>,
14472 #[serde(default)]
14473 pub expression: Option<Box<Expression>>,
14474}
14475
14476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14478#[cfg_attr(feature = "bindings", derive(TS))]
14479pub struct Zipf {
14480 pub this: Box<Expression>,
14481 #[serde(default)]
14482 pub elementcount: Option<Box<Expression>>,
14483 #[serde(default)]
14484 pub gen: Option<Box<Expression>>,
14485}
14486
14487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14489#[cfg_attr(feature = "bindings", derive(TS))]
14490pub struct Merge {
14491 pub this: Box<Expression>,
14492 pub using: Box<Expression>,
14493 #[serde(default)]
14494 pub on: Option<Box<Expression>>,
14495 #[serde(default)]
14496 pub using_cond: Option<Box<Expression>>,
14497 #[serde(default)]
14498 pub whens: Option<Box<Expression>>,
14499 #[serde(default)]
14500 pub with_: Option<Box<Expression>>,
14501 #[serde(default)]
14502 pub returning: Option<Box<Expression>>,
14503}
14504
14505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14507#[cfg_attr(feature = "bindings", derive(TS))]
14508pub struct When {
14509 #[serde(default)]
14510 pub matched: Option<Box<Expression>>,
14511 #[serde(default)]
14512 pub source: Option<Box<Expression>>,
14513 #[serde(default)]
14514 pub condition: Option<Box<Expression>>,
14515 pub then: Box<Expression>,
14516}
14517
14518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14520#[cfg_attr(feature = "bindings", derive(TS))]
14521pub struct Whens {
14522 #[serde(default)]
14523 pub expressions: Vec<Expression>,
14524}
14525
14526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14528#[cfg_attr(feature = "bindings", derive(TS))]
14529pub struct NextValueFor {
14530 pub this: Box<Expression>,
14531 #[serde(default)]
14532 pub order: Option<Box<Expression>>,
14533}
14534
14535#[cfg(test)]
14536mod tests {
14537 use super::*;
14538
14539 #[test]
14540 #[cfg(feature = "bindings")]
14541 fn export_typescript_types() {
14542 Expression::export_all(&ts_rs::Config::default())
14545 .expect("Failed to export Expression types");
14546 }
14547
14548 #[test]
14549 fn test_simple_select_builder() {
14550 let select = Select::new()
14551 .column(Expression::star())
14552 .from(Expression::Table(Box::new(TableRef::new("users"))));
14553
14554 assert_eq!(select.expressions.len(), 1);
14555 assert!(select.from.is_some());
14556 }
14557
14558 #[test]
14559 fn test_expression_alias() {
14560 let expr = Expression::column("id").alias("user_id");
14561
14562 match expr {
14563 Expression::Alias(a) => {
14564 assert_eq!(a.alias.name, "user_id");
14565 }
14566 _ => panic!("Expected Alias"),
14567 }
14568 }
14569
14570 #[test]
14571 fn test_literal_creation() {
14572 let num = Expression::number(42);
14573 let str = Expression::string("hello");
14574
14575 match num {
14576 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => { let Literal::Number(n) = lit.as_ref() else { unreachable!() }; assert_eq!(n, "42") },
14577 _ => panic!("Expected Number"),
14578 }
14579
14580 match str {
14581 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => { let Literal::String(s) = lit.as_ref() else { unreachable!() }; assert_eq!(s, "hello") },
14582 _ => panic!("Expected String"),
14583 }
14584 }
14585
14586 #[test]
14587 fn test_expression_sql() {
14588 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14589 assert_eq!(expr.sql(), "SELECT 1 + 2");
14590 }
14591
14592 #[test]
14593 fn test_expression_sql_for() {
14594 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14595 let sql = expr.sql_for(crate::DialectType::Generic);
14596 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
14598 }
14599}