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 Undrop(Box<Undrop>),
548 AlterTable(Box<AlterTable>),
549 CreateIndex(Box<CreateIndex>),
550 DropIndex(Box<DropIndex>),
551 CreateView(Box<CreateView>),
552 DropView(Box<DropView>),
553 AlterView(Box<AlterView>),
554 AlterIndex(Box<AlterIndex>),
555 Truncate(Box<Truncate>),
556 Use(Box<Use>),
557 Cache(Box<Cache>),
558 Uncache(Box<Uncache>),
559 LoadData(Box<LoadData>),
560 Pragma(Box<Pragma>),
561 Grant(Box<Grant>),
562 Revoke(Box<Revoke>),
563 Comment(Box<Comment>),
564 SetStatement(Box<SetStatement>),
565 CreateSchema(Box<CreateSchema>),
567 DropSchema(Box<DropSchema>),
568 DropNamespace(Box<DropNamespace>),
569 CreateDatabase(Box<CreateDatabase>),
570 DropDatabase(Box<DropDatabase>),
571 CreateFunction(Box<CreateFunction>),
572 DropFunction(Box<DropFunction>),
573 CreateProcedure(Box<CreateProcedure>),
574 DropProcedure(Box<DropProcedure>),
575 CreateSequence(Box<CreateSequence>),
576 CreateSynonym(Box<CreateSynonym>),
577 DropSequence(Box<DropSequence>),
578 AlterSequence(Box<AlterSequence>),
579 CreateTrigger(Box<CreateTrigger>),
580 DropTrigger(Box<DropTrigger>),
581 CreateType(Box<CreateType>),
582 DropType(Box<DropType>),
583 Describe(Box<Describe>),
584 Show(Box<Show>),
585
586 Command(Box<Command>),
588 Kill(Box<Kill>),
589 Execute(Box<ExecuteStatement>),
591
592 CreateTask(Box<CreateTask>),
594
595 Raw(Raw),
597
598 Paren(Box<Paren>),
600
601 Annotated(Box<Annotated>),
603
604 Refresh(Box<Refresh>),
607 LockingStatement(Box<LockingStatement>),
608 SequenceProperties(Box<SequenceProperties>),
609 TruncateTable(Box<TruncateTable>),
610 Clone(Box<Clone>),
611 Attach(Box<Attach>),
612 Detach(Box<Detach>),
613 Install(Box<Install>),
614 Summarize(Box<Summarize>),
615 Declare(Box<Declare>),
616 DeclareItem(Box<DeclareItem>),
617 Set(Box<Set>),
618 Heredoc(Box<Heredoc>),
619 SetItem(Box<SetItem>),
620 QueryBand(Box<QueryBand>),
621 UserDefinedFunction(Box<UserDefinedFunction>),
622 RecursiveWithSearch(Box<RecursiveWithSearch>),
623 ProjectionDef(Box<ProjectionDef>),
624 TableAlias(Box<TableAlias>),
625 ByteString(Box<ByteString>),
626 HexStringExpr(Box<HexStringExpr>),
627 UnicodeString(Box<UnicodeString>),
628 ColumnPosition(Box<ColumnPosition>),
629 ColumnDef(Box<ColumnDef>),
630 AlterColumn(Box<AlterColumn>),
631 AlterSortKey(Box<AlterSortKey>),
632 AlterSet(Box<AlterSet>),
633 RenameColumn(Box<RenameColumn>),
634 Comprehension(Box<Comprehension>),
635 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
636 MergeTreeTTL(Box<MergeTreeTTL>),
637 IndexConstraintOption(Box<IndexConstraintOption>),
638 ColumnConstraint(Box<ColumnConstraint>),
639 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
640 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
641 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
642 CheckColumnConstraint(Box<CheckColumnConstraint>),
643 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
644 CompressColumnConstraint(Box<CompressColumnConstraint>),
645 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
646 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
647 WithOperator(Box<WithOperator>),
648 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
649 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
650 CommentColumnConstraint(CommentColumnConstraint),
651 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
652 IndexColumnConstraint(Box<IndexColumnConstraint>),
653 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
654 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
655 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
656 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
657 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
658 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
659 InOutColumnConstraint(Box<InOutColumnConstraint>),
660 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
661 PathColumnConstraint(Box<PathColumnConstraint>),
662 Constraint(Box<Constraint>),
663 Export(Box<Export>),
664 Filter(Box<Filter>),
665 Changes(Box<Changes>),
666 CopyParameter(Box<CopyParameter>),
667 Credentials(Box<Credentials>),
668 Directory(Box<Directory>),
669 ForeignKey(Box<ForeignKey>),
670 ColumnPrefix(Box<ColumnPrefix>),
671 PrimaryKey(Box<PrimaryKey>),
672 IntoClause(Box<IntoClause>),
673 JoinHint(Box<JoinHint>),
674 Opclass(Box<Opclass>),
675 Index(Box<Index>),
676 IndexParameters(Box<IndexParameters>),
677 ConditionalInsert(Box<ConditionalInsert>),
678 MultitableInserts(Box<MultitableInserts>),
679 OnConflict(Box<OnConflict>),
680 OnCondition(Box<OnCondition>),
681 Returning(Box<Returning>),
682 Introducer(Box<Introducer>),
683 PartitionRange(Box<PartitionRange>),
684 Fetch(Box<Fetch>),
685 Group(Box<Group>),
686 Cube(Box<Cube>),
687 Rollup(Box<Rollup>),
688 GroupingSets(Box<GroupingSets>),
689 LimitOptions(Box<LimitOptions>),
690 Lateral(Box<Lateral>),
691 TableFromRows(Box<TableFromRows>),
692 RowsFrom(Box<RowsFrom>),
693 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
694 WithFill(Box<WithFill>),
695 Property(Box<Property>),
696 GrantPrivilege(Box<GrantPrivilege>),
697 GrantPrincipal(Box<GrantPrincipal>),
698 AllowedValuesProperty(Box<AllowedValuesProperty>),
699 AlgorithmProperty(Box<AlgorithmProperty>),
700 AutoIncrementProperty(Box<AutoIncrementProperty>),
701 AutoRefreshProperty(Box<AutoRefreshProperty>),
702 BackupProperty(Box<BackupProperty>),
703 BuildProperty(Box<BuildProperty>),
704 BlockCompressionProperty(Box<BlockCompressionProperty>),
705 CharacterSetProperty(Box<CharacterSetProperty>),
706 ChecksumProperty(Box<ChecksumProperty>),
707 CollateProperty(Box<CollateProperty>),
708 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
709 DataDeletionProperty(Box<DataDeletionProperty>),
710 DefinerProperty(Box<DefinerProperty>),
711 DistKeyProperty(Box<DistKeyProperty>),
712 DistributedByProperty(Box<DistributedByProperty>),
713 DistStyleProperty(Box<DistStyleProperty>),
714 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
715 EngineProperty(Box<EngineProperty>),
716 ToTableProperty(Box<ToTableProperty>),
717 ExecuteAsProperty(Box<ExecuteAsProperty>),
718 ExternalProperty(Box<ExternalProperty>),
719 FallbackProperty(Box<FallbackProperty>),
720 FileFormatProperty(Box<FileFormatProperty>),
721 CredentialsProperty(Box<CredentialsProperty>),
722 FreespaceProperty(Box<FreespaceProperty>),
723 InheritsProperty(Box<InheritsProperty>),
724 InputModelProperty(Box<InputModelProperty>),
725 OutputModelProperty(Box<OutputModelProperty>),
726 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
727 JournalProperty(Box<JournalProperty>),
728 LanguageProperty(Box<LanguageProperty>),
729 EnviromentProperty(Box<EnviromentProperty>),
730 ClusteredByProperty(Box<ClusteredByProperty>),
731 DictProperty(Box<DictProperty>),
732 DictRange(Box<DictRange>),
733 OnCluster(Box<OnCluster>),
734 LikeProperty(Box<LikeProperty>),
735 LocationProperty(Box<LocationProperty>),
736 LockProperty(Box<LockProperty>),
737 LockingProperty(Box<LockingProperty>),
738 LogProperty(Box<LogProperty>),
739 MaterializedProperty(Box<MaterializedProperty>),
740 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
741 OnProperty(Box<OnProperty>),
742 OnCommitProperty(Box<OnCommitProperty>),
743 PartitionedByProperty(Box<PartitionedByProperty>),
744 PartitionByProperty(Box<PartitionByProperty>),
745 PartitionedByBucket(Box<PartitionedByBucket>),
746 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
747 PartitionByTruncate(Box<PartitionByTruncate>),
748 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
749 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
750 PartitionByListProperty(Box<PartitionByListProperty>),
751 PartitionList(Box<PartitionList>),
752 Partition(Box<Partition>),
753 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
754 UniqueKeyProperty(Box<UniqueKeyProperty>),
755 RollupProperty(Box<RollupProperty>),
756 PartitionBoundSpec(Box<PartitionBoundSpec>),
757 PartitionedOfProperty(Box<PartitionedOfProperty>),
758 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
759 ReturnsProperty(Box<ReturnsProperty>),
760 RowFormatProperty(Box<RowFormatProperty>),
761 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
762 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
763 QueryTransform(Box<QueryTransform>),
764 SampleProperty(Box<SampleProperty>),
765 SecurityProperty(Box<SecurityProperty>),
766 SchemaCommentProperty(Box<SchemaCommentProperty>),
767 SemanticView(Box<SemanticView>),
768 SerdeProperties(Box<SerdeProperties>),
769 SetProperty(Box<SetProperty>),
770 SharingProperty(Box<SharingProperty>),
771 SetConfigProperty(Box<SetConfigProperty>),
772 SettingsProperty(Box<SettingsProperty>),
773 SortKeyProperty(Box<SortKeyProperty>),
774 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
775 SqlSecurityProperty(Box<SqlSecurityProperty>),
776 StabilityProperty(Box<StabilityProperty>),
777 StorageHandlerProperty(Box<StorageHandlerProperty>),
778 TemporaryProperty(Box<TemporaryProperty>),
779 Tags(Box<Tags>),
780 TransformModelProperty(Box<TransformModelProperty>),
781 TransientProperty(Box<TransientProperty>),
782 UsingTemplateProperty(Box<UsingTemplateProperty>),
783 ViewAttributeProperty(Box<ViewAttributeProperty>),
784 VolatileProperty(Box<VolatileProperty>),
785 WithDataProperty(Box<WithDataProperty>),
786 WithJournalTableProperty(Box<WithJournalTableProperty>),
787 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
788 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
789 WithProcedureOptions(Box<WithProcedureOptions>),
790 EncodeProperty(Box<EncodeProperty>),
791 IncludeProperty(Box<IncludeProperty>),
792 Properties(Box<Properties>),
793 OptionsProperty(Box<OptionsProperty>),
794 InputOutputFormat(Box<InputOutputFormat>),
795 Reference(Box<Reference>),
796 QueryOption(Box<QueryOption>),
797 WithTableHint(Box<WithTableHint>),
798 IndexTableHint(Box<IndexTableHint>),
799 HistoricalData(Box<HistoricalData>),
800 Get(Box<Get>),
801 SetOperation(Box<SetOperation>),
802 Var(Box<Var>),
803 Variadic(Box<Variadic>),
804 Version(Box<Version>),
805 Schema(Box<Schema>),
806 Lock(Box<Lock>),
807 TableSample(Box<TableSample>),
808 Tag(Box<Tag>),
809 UnpivotColumns(Box<UnpivotColumns>),
810 WindowSpec(Box<WindowSpec>),
811 SessionParameter(Box<SessionParameter>),
812 PseudoType(Box<PseudoType>),
813 ObjectIdentifier(Box<ObjectIdentifier>),
814 Transaction(Box<Transaction>),
815 Commit(Box<Commit>),
816 Rollback(Box<Rollback>),
817 AlterSession(Box<AlterSession>),
818 Analyze(Box<Analyze>),
819 AnalyzeStatistics(Box<AnalyzeStatistics>),
820 AnalyzeHistogram(Box<AnalyzeHistogram>),
821 AnalyzeSample(Box<AnalyzeSample>),
822 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
823 AnalyzeDelete(Box<AnalyzeDelete>),
824 AnalyzeWith(Box<AnalyzeWith>),
825 AnalyzeValidate(Box<AnalyzeValidate>),
826 AddPartition(Box<AddPartition>),
827 AttachOption(Box<AttachOption>),
828 DropPartition(Box<DropPartition>),
829 ReplacePartition(Box<ReplacePartition>),
830 DPipe(Box<DPipe>),
831 Operator(Box<Operator>),
832 PivotAny(Box<PivotAny>),
833 Aliases(Box<Aliases>),
834 AtIndex(Box<AtIndex>),
835 FromTimeZone(Box<FromTimeZone>),
836 FormatPhrase(Box<FormatPhrase>),
837 ForIn(Box<ForIn>),
838 TimeUnit(Box<TimeUnit>),
839 IntervalOp(Box<IntervalOp>),
840 IntervalSpan(Box<IntervalSpan>),
841 HavingMax(Box<HavingMax>),
842 CosineDistance(Box<CosineDistance>),
843 DotProduct(Box<DotProduct>),
844 EuclideanDistance(Box<EuclideanDistance>),
845 ManhattanDistance(Box<ManhattanDistance>),
846 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
847 Booland(Box<Booland>),
848 Boolor(Box<Boolor>),
849 ParameterizedAgg(Box<ParameterizedAgg>),
850 ArgMax(Box<ArgMax>),
851 ArgMin(Box<ArgMin>),
852 ApproxTopK(Box<ApproxTopK>),
853 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
854 ApproxTopKCombine(Box<ApproxTopKCombine>),
855 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
856 ApproxTopSum(Box<ApproxTopSum>),
857 ApproxQuantiles(Box<ApproxQuantiles>),
858 Minhash(Box<Minhash>),
859 FarmFingerprint(Box<FarmFingerprint>),
860 Float64(Box<Float64>),
861 Transform(Box<Transform>),
862 Translate(Box<Translate>),
863 Grouping(Box<Grouping>),
864 GroupingId(Box<GroupingId>),
865 Anonymous(Box<Anonymous>),
866 AnonymousAggFunc(Box<AnonymousAggFunc>),
867 CombinedAggFunc(Box<CombinedAggFunc>),
868 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
869 HashAgg(Box<HashAgg>),
870 Hll(Box<Hll>),
871 Apply(Box<Apply>),
872 ToBoolean(Box<ToBoolean>),
873 List(Box<List>),
874 ToMap(Box<ToMap>),
875 Pad(Box<Pad>),
876 ToChar(Box<ToChar>),
877 ToNumber(Box<ToNumber>),
878 ToDouble(Box<ToDouble>),
879 Int64(Box<UnaryFunc>),
880 StringFunc(Box<StringFunc>),
881 ToDecfloat(Box<ToDecfloat>),
882 TryToDecfloat(Box<TryToDecfloat>),
883 ToFile(Box<ToFile>),
884 Columns(Box<Columns>),
885 ConvertToCharset(Box<ConvertToCharset>),
886 ConvertTimezone(Box<ConvertTimezone>),
887 GenerateSeries(Box<GenerateSeries>),
888 AIAgg(Box<AIAgg>),
889 AIClassify(Box<AIClassify>),
890 ArrayAll(Box<ArrayAll>),
891 ArrayAny(Box<ArrayAny>),
892 ArrayConstructCompact(Box<ArrayConstructCompact>),
893 StPoint(Box<StPoint>),
894 StDistance(Box<StDistance>),
895 StringToArray(Box<StringToArray>),
896 ArraySum(Box<ArraySum>),
897 ObjectAgg(Box<ObjectAgg>),
898 CastToStrType(Box<CastToStrType>),
899 CheckJson(Box<CheckJson>),
900 CheckXml(Box<CheckXml>),
901 TranslateCharacters(Box<TranslateCharacters>),
902 CurrentSchemas(Box<CurrentSchemas>),
903 CurrentDatetime(Box<CurrentDatetime>),
904 Localtime(Box<Localtime>),
905 Localtimestamp(Box<Localtimestamp>),
906 Systimestamp(Box<Systimestamp>),
907 CurrentSchema(Box<CurrentSchema>),
908 CurrentUser(Box<CurrentUser>),
909 UtcTime(Box<UtcTime>),
910 UtcTimestamp(Box<UtcTimestamp>),
911 Timestamp(Box<TimestampFunc>),
912 DateBin(Box<DateBin>),
913 Datetime(Box<Datetime>),
914 DatetimeAdd(Box<DatetimeAdd>),
915 DatetimeSub(Box<DatetimeSub>),
916 DatetimeDiff(Box<DatetimeDiff>),
917 DatetimeTrunc(Box<DatetimeTrunc>),
918 Dayname(Box<Dayname>),
919 MakeInterval(Box<MakeInterval>),
920 PreviousDay(Box<PreviousDay>),
921 Elt(Box<Elt>),
922 TimestampAdd(Box<TimestampAdd>),
923 TimestampSub(Box<TimestampSub>),
924 TimestampDiff(Box<TimestampDiff>),
925 TimeSlice(Box<TimeSlice>),
926 TimeAdd(Box<TimeAdd>),
927 TimeSub(Box<TimeSub>),
928 TimeDiff(Box<TimeDiff>),
929 TimeTrunc(Box<TimeTrunc>),
930 DateFromParts(Box<DateFromParts>),
931 TimeFromParts(Box<TimeFromParts>),
932 DecodeCase(Box<DecodeCase>),
933 Decrypt(Box<Decrypt>),
934 DecryptRaw(Box<DecryptRaw>),
935 Encode(Box<Encode>),
936 Encrypt(Box<Encrypt>),
937 EncryptRaw(Box<EncryptRaw>),
938 EqualNull(Box<EqualNull>),
939 ToBinary(Box<ToBinary>),
940 Base64DecodeBinary(Box<Base64DecodeBinary>),
941 Base64DecodeString(Box<Base64DecodeString>),
942 Base64Encode(Box<Base64Encode>),
943 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
944 TryBase64DecodeString(Box<TryBase64DecodeString>),
945 GapFill(Box<GapFill>),
946 GenerateDateArray(Box<GenerateDateArray>),
947 GenerateTimestampArray(Box<GenerateTimestampArray>),
948 GetExtract(Box<GetExtract>),
949 Getbit(Box<Getbit>),
950 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
951 HexEncode(Box<HexEncode>),
952 Compress(Box<Compress>),
953 DecompressBinary(Box<DecompressBinary>),
954 DecompressString(Box<DecompressString>),
955 Xor(Box<Xor>),
956 Nullif(Box<Nullif>),
957 JSON(Box<JSON>),
958 JSONPath(Box<JSONPath>),
959 JSONPathFilter(Box<JSONPathFilter>),
960 JSONPathKey(Box<JSONPathKey>),
961 JSONPathRecursive(Box<JSONPathRecursive>),
962 JSONPathScript(Box<JSONPathScript>),
963 JSONPathSlice(Box<JSONPathSlice>),
964 JSONPathSelector(Box<JSONPathSelector>),
965 JSONPathSubscript(Box<JSONPathSubscript>),
966 JSONPathUnion(Box<JSONPathUnion>),
967 Format(Box<Format>),
968 JSONKeys(Box<JSONKeys>),
969 JSONKeyValue(Box<JSONKeyValue>),
970 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
971 JSONObject(Box<JSONObject>),
972 JSONObjectAgg(Box<JSONObjectAgg>),
973 JSONBObjectAgg(Box<JSONBObjectAgg>),
974 JSONArray(Box<JSONArray>),
975 JSONArrayAgg(Box<JSONArrayAgg>),
976 JSONExists(Box<JSONExists>),
977 JSONColumnDef(Box<JSONColumnDef>),
978 JSONSchema(Box<JSONSchema>),
979 JSONSet(Box<JSONSet>),
980 JSONStripNulls(Box<JSONStripNulls>),
981 JSONValue(Box<JSONValue>),
982 JSONValueArray(Box<JSONValueArray>),
983 JSONRemove(Box<JSONRemove>),
984 JSONTable(Box<JSONTable>),
985 JSONType(Box<JSONType>),
986 ObjectInsert(Box<ObjectInsert>),
987 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
988 OpenJSON(Box<OpenJSON>),
989 JSONBExists(Box<JSONBExists>),
990 JSONBContains(Box<BinaryFunc>),
991 JSONBExtract(Box<BinaryFunc>),
992 JSONCast(Box<JSONCast>),
993 JSONExtract(Box<JSONExtract>),
994 JSONExtractQuote(Box<JSONExtractQuote>),
995 JSONExtractArray(Box<JSONExtractArray>),
996 JSONExtractScalar(Box<JSONExtractScalar>),
997 JSONBExtractScalar(Box<JSONBExtractScalar>),
998 JSONFormat(Box<JSONFormat>),
999 JSONBool(Box<UnaryFunc>),
1000 JSONPathRoot(JSONPathRoot),
1001 JSONArrayAppend(Box<JSONArrayAppend>),
1002 JSONArrayContains(Box<JSONArrayContains>),
1003 JSONArrayInsert(Box<JSONArrayInsert>),
1004 ParseJSON(Box<ParseJSON>),
1005 ParseUrl(Box<ParseUrl>),
1006 ParseIp(Box<ParseIp>),
1007 ParseTime(Box<ParseTime>),
1008 ParseDatetime(Box<ParseDatetime>),
1009 Map(Box<Map>),
1010 MapCat(Box<MapCat>),
1011 MapDelete(Box<MapDelete>),
1012 MapInsert(Box<MapInsert>),
1013 MapPick(Box<MapPick>),
1014 ScopeResolution(Box<ScopeResolution>),
1015 Slice(Box<Slice>),
1016 VarMap(Box<VarMap>),
1017 MatchAgainst(Box<MatchAgainst>),
1018 MD5Digest(Box<MD5Digest>),
1019 MD5NumberLower64(Box<UnaryFunc>),
1020 MD5NumberUpper64(Box<UnaryFunc>),
1021 Monthname(Box<Monthname>),
1022 Ntile(Box<Ntile>),
1023 Normalize(Box<Normalize>),
1024 Normal(Box<Normal>),
1025 Predict(Box<Predict>),
1026 MLTranslate(Box<MLTranslate>),
1027 FeaturesAtTime(Box<FeaturesAtTime>),
1028 GenerateEmbedding(Box<GenerateEmbedding>),
1029 MLForecast(Box<MLForecast>),
1030 ModelAttribute(Box<ModelAttribute>),
1031 VectorSearch(Box<VectorSearch>),
1032 Quantile(Box<Quantile>),
1033 ApproxQuantile(Box<ApproxQuantile>),
1034 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1035 Randn(Box<Randn>),
1036 Randstr(Box<Randstr>),
1037 RangeN(Box<RangeN>),
1038 RangeBucket(Box<RangeBucket>),
1039 ReadCSV(Box<ReadCSV>),
1040 ReadParquet(Box<ReadParquet>),
1041 Reduce(Box<Reduce>),
1042 RegexpExtractAll(Box<RegexpExtractAll>),
1043 RegexpILike(Box<RegexpILike>),
1044 RegexpFullMatch(Box<RegexpFullMatch>),
1045 RegexpInstr(Box<RegexpInstr>),
1046 RegexpSplit(Box<RegexpSplit>),
1047 RegexpCount(Box<RegexpCount>),
1048 RegrValx(Box<RegrValx>),
1049 RegrValy(Box<RegrValy>),
1050 RegrAvgy(Box<RegrAvgy>),
1051 RegrAvgx(Box<RegrAvgx>),
1052 RegrCount(Box<RegrCount>),
1053 RegrIntercept(Box<RegrIntercept>),
1054 RegrR2(Box<RegrR2>),
1055 RegrSxx(Box<RegrSxx>),
1056 RegrSxy(Box<RegrSxy>),
1057 RegrSyy(Box<RegrSyy>),
1058 RegrSlope(Box<RegrSlope>),
1059 SafeAdd(Box<SafeAdd>),
1060 SafeDivide(Box<SafeDivide>),
1061 SafeMultiply(Box<SafeMultiply>),
1062 SafeSubtract(Box<SafeSubtract>),
1063 SHA2(Box<SHA2>),
1064 SHA2Digest(Box<SHA2Digest>),
1065 SortArray(Box<SortArray>),
1066 SplitPart(Box<SplitPart>),
1067 SubstringIndex(Box<SubstringIndex>),
1068 StandardHash(Box<StandardHash>),
1069 StrPosition(Box<StrPosition>),
1070 Search(Box<Search>),
1071 SearchIp(Box<SearchIp>),
1072 StrToDate(Box<StrToDate>),
1073 DateStrToDate(Box<UnaryFunc>),
1074 DateToDateStr(Box<UnaryFunc>),
1075 StrToTime(Box<StrToTime>),
1076 StrToUnix(Box<StrToUnix>),
1077 StrToMap(Box<StrToMap>),
1078 NumberToStr(Box<NumberToStr>),
1079 FromBase(Box<FromBase>),
1080 Stuff(Box<Stuff>),
1081 TimeToStr(Box<TimeToStr>),
1082 TimeStrToTime(Box<TimeStrToTime>),
1083 TsOrDsAdd(Box<TsOrDsAdd>),
1084 TsOrDsDiff(Box<TsOrDsDiff>),
1085 TsOrDsToDate(Box<TsOrDsToDate>),
1086 TsOrDsToTime(Box<TsOrDsToTime>),
1087 Unhex(Box<Unhex>),
1088 Uniform(Box<Uniform>),
1089 UnixToStr(Box<UnixToStr>),
1090 UnixToTime(Box<UnixToTime>),
1091 Uuid(Box<Uuid>),
1092 TimestampFromParts(Box<TimestampFromParts>),
1093 TimestampTzFromParts(Box<TimestampTzFromParts>),
1094 Corr(Box<Corr>),
1095 WidthBucket(Box<WidthBucket>),
1096 CovarSamp(Box<CovarSamp>),
1097 CovarPop(Box<CovarPop>),
1098 Week(Box<Week>),
1099 XMLElement(Box<XMLElement>),
1100 XMLGet(Box<XMLGet>),
1101 XMLTable(Box<XMLTable>),
1102 XMLKeyValueOption(Box<XMLKeyValueOption>),
1103 Zipf(Box<Zipf>),
1104 Merge(Box<Merge>),
1105 When(Box<When>),
1106 Whens(Box<Whens>),
1107 NextValueFor(Box<NextValueFor>),
1108 ReturnStmt(Box<Expression>),
1110}
1111
1112impl Expression {
1113 #[inline]
1115 pub fn boxed_column(col: Column) -> Self {
1116 Expression::Column(Box::new(col))
1117 }
1118
1119 #[inline]
1121 pub fn boxed_table(t: TableRef) -> Self {
1122 Expression::Table(Box::new(t))
1123 }
1124
1125 pub fn is_statement(&self) -> bool {
1132 match self {
1133 Expression::Select(_)
1135 | Expression::Union(_)
1136 | Expression::Intersect(_)
1137 | Expression::Except(_)
1138 | Expression::Subquery(_)
1139 | Expression::Values(_)
1140 | Expression::PipeOperator(_)
1141
1142 | Expression::Insert(_)
1144 | Expression::Update(_)
1145 | Expression::Delete(_)
1146 | Expression::Copy(_)
1147 | Expression::Put(_)
1148 | Expression::Merge(_)
1149
1150 | Expression::CreateTable(_)
1152 | Expression::DropTable(_)
1153 | Expression::Undrop(_)
1154 | Expression::AlterTable(_)
1155 | Expression::CreateIndex(_)
1156 | Expression::DropIndex(_)
1157 | Expression::CreateView(_)
1158 | Expression::DropView(_)
1159 | Expression::AlterView(_)
1160 | Expression::AlterIndex(_)
1161 | Expression::Truncate(_)
1162 | Expression::TruncateTable(_)
1163 | Expression::CreateSchema(_)
1164 | Expression::DropSchema(_)
1165 | Expression::DropNamespace(_)
1166 | Expression::CreateDatabase(_)
1167 | Expression::DropDatabase(_)
1168 | Expression::CreateFunction(_)
1169 | Expression::DropFunction(_)
1170 | Expression::CreateProcedure(_)
1171 | Expression::DropProcedure(_)
1172 | Expression::CreateSequence(_)
1173 | Expression::CreateSynonym(_)
1174 | Expression::DropSequence(_)
1175 | Expression::AlterSequence(_)
1176 | Expression::CreateTrigger(_)
1177 | Expression::DropTrigger(_)
1178 | Expression::CreateType(_)
1179 | Expression::DropType(_)
1180 | Expression::Comment(_)
1181
1182 | Expression::Use(_)
1184 | Expression::Set(_)
1185 | Expression::SetStatement(_)
1186 | Expression::Transaction(_)
1187 | Expression::Commit(_)
1188 | Expression::Rollback(_)
1189 | Expression::Grant(_)
1190 | Expression::Revoke(_)
1191 | Expression::Cache(_)
1192 | Expression::Uncache(_)
1193 | Expression::LoadData(_)
1194 | Expression::Pragma(_)
1195 | Expression::Describe(_)
1196 | Expression::Show(_)
1197 | Expression::Kill(_)
1198 | Expression::Execute(_)
1199 | Expression::Declare(_)
1200 | Expression::Refresh(_)
1201 | Expression::AlterSession(_)
1202 | Expression::LockingStatement(_)
1203
1204 | Expression::Analyze(_)
1206 | Expression::AnalyzeStatistics(_)
1207 | Expression::AnalyzeHistogram(_)
1208 | Expression::AnalyzeSample(_)
1209 | Expression::AnalyzeListChainedRows(_)
1210 | Expression::AnalyzeDelete(_)
1211
1212 | Expression::Attach(_)
1214 | Expression::Detach(_)
1215 | Expression::Install(_)
1216 | Expression::Summarize(_)
1217
1218 | Expression::Pivot(_)
1220 | Expression::Unpivot(_)
1221
1222 | Expression::Command(_)
1224 | Expression::Raw(_)
1225 | Expression::CreateTask(_)
1226
1227 | Expression::ReturnStmt(_) => true,
1229
1230 Expression::Annotated(a) => a.this.is_statement(),
1232
1233 Expression::Alias(a) => a.this.is_statement(),
1235
1236 _ => false,
1238 }
1239 }
1240
1241 pub fn number(n: i64) -> Self {
1243 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1244 }
1245
1246 pub fn string(s: impl Into<String>) -> Self {
1248 Expression::Literal(Box::new(Literal::String(s.into())))
1249 }
1250
1251 pub fn float(f: f64) -> Self {
1253 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1254 }
1255
1256 pub fn inferred_type(&self) -> Option<&DataType> {
1262 match self {
1263 Expression::And(op)
1265 | Expression::Or(op)
1266 | Expression::Add(op)
1267 | Expression::Sub(op)
1268 | Expression::Mul(op)
1269 | Expression::Div(op)
1270 | Expression::Mod(op)
1271 | Expression::Eq(op)
1272 | Expression::Neq(op)
1273 | Expression::Lt(op)
1274 | Expression::Lte(op)
1275 | Expression::Gt(op)
1276 | Expression::Gte(op)
1277 | Expression::Concat(op)
1278 | Expression::BitwiseAnd(op)
1279 | Expression::BitwiseOr(op)
1280 | Expression::BitwiseXor(op)
1281 | Expression::Adjacent(op)
1282 | Expression::TsMatch(op)
1283 | Expression::PropertyEQ(op)
1284 | Expression::ArrayContainsAll(op)
1285 | Expression::ArrayContainedBy(op)
1286 | Expression::ArrayOverlaps(op)
1287 | Expression::JSONBContainsAllTopKeys(op)
1288 | Expression::JSONBContainsAnyTopKeys(op)
1289 | Expression::JSONBDeleteAtPath(op)
1290 | Expression::ExtendsLeft(op)
1291 | Expression::ExtendsRight(op)
1292 | Expression::Is(op)
1293 | Expression::MemberOf(op)
1294 | Expression::Match(op)
1295 | Expression::NullSafeEq(op)
1296 | Expression::NullSafeNeq(op)
1297 | Expression::Glob(op)
1298 | Expression::BitwiseLeftShift(op)
1299 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1300
1301 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1302 op.inferred_type.as_ref()
1303 }
1304
1305 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1306
1307 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1308 c.inferred_type.as_ref()
1309 }
1310
1311 Expression::Column(c) => c.inferred_type.as_ref(),
1312 Expression::Function(f) => f.inferred_type.as_ref(),
1313 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1314 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1315 Expression::Case(c) => c.inferred_type.as_ref(),
1316 Expression::Subquery(s) => s.inferred_type.as_ref(),
1317 Expression::Alias(a) => a.inferred_type.as_ref(),
1318 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1319 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1320 Expression::Count(f) => f.inferred_type.as_ref(),
1321 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1322 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1323 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1324 Expression::SumIf(f) => f.inferred_type.as_ref(),
1325
1326 Expression::Upper(f)
1328 | Expression::Lower(f)
1329 | Expression::Length(f)
1330 | Expression::LTrim(f)
1331 | Expression::RTrim(f)
1332 | Expression::Reverse(f)
1333 | Expression::Abs(f)
1334 | Expression::Sqrt(f)
1335 | Expression::Cbrt(f)
1336 | Expression::Ln(f)
1337 | Expression::Exp(f)
1338 | Expression::Sign(f)
1339 | Expression::Date(f)
1340 | Expression::Time(f)
1341 | Expression::Initcap(f)
1342 | Expression::Ascii(f)
1343 | Expression::Chr(f)
1344 | Expression::Soundex(f)
1345 | Expression::ByteLength(f)
1346 | Expression::Hex(f)
1347 | Expression::LowerHex(f)
1348 | Expression::Unicode(f)
1349 | Expression::Typeof(f)
1350 | Expression::Explode(f)
1351 | Expression::ExplodeOuter(f)
1352 | Expression::MapFromEntries(f)
1353 | Expression::MapKeys(f)
1354 | Expression::MapValues(f)
1355 | Expression::ArrayLength(f)
1356 | Expression::ArraySize(f)
1357 | Expression::Cardinality(f)
1358 | Expression::ArrayReverse(f)
1359 | Expression::ArrayDistinct(f)
1360 | Expression::ArrayFlatten(f)
1361 | Expression::ArrayCompact(f)
1362 | Expression::ToArray(f)
1363 | Expression::JsonArrayLength(f)
1364 | Expression::JsonKeys(f)
1365 | Expression::JsonType(f)
1366 | Expression::ParseJson(f)
1367 | Expression::ToJson(f)
1368 | Expression::Radians(f)
1369 | Expression::Degrees(f)
1370 | Expression::Sin(f)
1371 | Expression::Cos(f)
1372 | Expression::Tan(f)
1373 | Expression::Asin(f)
1374 | Expression::Acos(f)
1375 | Expression::Atan(f)
1376 | Expression::IsNan(f)
1377 | Expression::IsInf(f)
1378 | Expression::Year(f)
1379 | Expression::Month(f)
1380 | Expression::Day(f)
1381 | Expression::Hour(f)
1382 | Expression::Minute(f)
1383 | Expression::Second(f)
1384 | Expression::DayOfWeek(f)
1385 | Expression::DayOfWeekIso(f)
1386 | Expression::DayOfMonth(f)
1387 | Expression::DayOfYear(f)
1388 | Expression::WeekOfYear(f)
1389 | Expression::Quarter(f)
1390 | Expression::Epoch(f)
1391 | Expression::EpochMs(f)
1392 | Expression::BitwiseCount(f)
1393 | Expression::DateFromUnixDate(f)
1394 | Expression::UnixDate(f)
1395 | Expression::UnixSeconds(f)
1396 | Expression::UnixMillis(f)
1397 | Expression::UnixMicros(f)
1398 | Expression::TimeStrToDate(f)
1399 | Expression::DateToDi(f)
1400 | Expression::DiToDate(f)
1401 | Expression::TsOrDiToDi(f)
1402 | Expression::TsOrDsToDatetime(f)
1403 | Expression::TsOrDsToTimestamp(f)
1404 | Expression::YearOfWeek(f)
1405 | Expression::YearOfWeekIso(f)
1406 | Expression::SHA(f)
1407 | Expression::SHA1Digest(f)
1408 | Expression::TimeToUnix(f)
1409 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1410
1411 Expression::Power(f)
1413 | Expression::NullIf(f)
1414 | Expression::IfNull(f)
1415 | Expression::Nvl(f)
1416 | Expression::Contains(f)
1417 | Expression::StartsWith(f)
1418 | Expression::EndsWith(f)
1419 | Expression::Levenshtein(f)
1420 | Expression::ModFunc(f)
1421 | Expression::IntDiv(f)
1422 | Expression::Atan2(f)
1423 | Expression::AddMonths(f)
1424 | Expression::MonthsBetween(f)
1425 | Expression::NextDay(f)
1426 | Expression::UnixToTimeStr(f)
1427 | Expression::ArrayContains(f)
1428 | Expression::ArrayPosition(f)
1429 | Expression::ArrayAppend(f)
1430 | Expression::ArrayPrepend(f)
1431 | Expression::ArrayUnion(f)
1432 | Expression::ArrayExcept(f)
1433 | Expression::ArrayRemove(f)
1434 | Expression::StarMap(f)
1435 | Expression::MapFromArrays(f)
1436 | Expression::MapContainsKey(f)
1437 | Expression::ElementAt(f)
1438 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1439
1440 Expression::Coalesce(f)
1442 | Expression::Greatest(f)
1443 | Expression::Least(f)
1444 | Expression::ArrayConcat(f)
1445 | Expression::ArrayIntersect(f)
1446 | Expression::ArrayZip(f)
1447 | Expression::MapConcat(f)
1448 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1449
1450 Expression::Sum(f)
1452 | Expression::Avg(f)
1453 | Expression::Min(f)
1454 | Expression::Max(f)
1455 | Expression::ArrayAgg(f)
1456 | Expression::CountIf(f)
1457 | Expression::Stddev(f)
1458 | Expression::StddevPop(f)
1459 | Expression::StddevSamp(f)
1460 | Expression::Variance(f)
1461 | Expression::VarPop(f)
1462 | Expression::VarSamp(f)
1463 | Expression::Median(f)
1464 | Expression::Mode(f)
1465 | Expression::First(f)
1466 | Expression::Last(f)
1467 | Expression::AnyValue(f)
1468 | Expression::ApproxDistinct(f)
1469 | Expression::ApproxCountDistinct(f)
1470 | Expression::LogicalAnd(f)
1471 | Expression::LogicalOr(f)
1472 | Expression::Skewness(f)
1473 | Expression::ArrayConcatAgg(f)
1474 | Expression::ArrayUniqueAgg(f)
1475 | Expression::BoolXorAgg(f)
1476 | Expression::BitwiseAndAgg(f)
1477 | Expression::BitwiseOrAgg(f)
1478 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1479
1480 _ => None,
1482 }
1483 }
1484
1485 pub fn set_inferred_type(&mut self, dt: DataType) {
1490 match self {
1491 Expression::And(op)
1492 | Expression::Or(op)
1493 | Expression::Add(op)
1494 | Expression::Sub(op)
1495 | Expression::Mul(op)
1496 | Expression::Div(op)
1497 | Expression::Mod(op)
1498 | Expression::Eq(op)
1499 | Expression::Neq(op)
1500 | Expression::Lt(op)
1501 | Expression::Lte(op)
1502 | Expression::Gt(op)
1503 | Expression::Gte(op)
1504 | Expression::Concat(op)
1505 | Expression::BitwiseAnd(op)
1506 | Expression::BitwiseOr(op)
1507 | Expression::BitwiseXor(op)
1508 | Expression::Adjacent(op)
1509 | Expression::TsMatch(op)
1510 | Expression::PropertyEQ(op)
1511 | Expression::ArrayContainsAll(op)
1512 | Expression::ArrayContainedBy(op)
1513 | Expression::ArrayOverlaps(op)
1514 | Expression::JSONBContainsAllTopKeys(op)
1515 | Expression::JSONBContainsAnyTopKeys(op)
1516 | Expression::JSONBDeleteAtPath(op)
1517 | Expression::ExtendsLeft(op)
1518 | Expression::ExtendsRight(op)
1519 | Expression::Is(op)
1520 | Expression::MemberOf(op)
1521 | Expression::Match(op)
1522 | Expression::NullSafeEq(op)
1523 | Expression::NullSafeNeq(op)
1524 | Expression::Glob(op)
1525 | Expression::BitwiseLeftShift(op)
1526 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1527
1528 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1529 op.inferred_type = Some(dt)
1530 }
1531
1532 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1533
1534 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1535 c.inferred_type = Some(dt)
1536 }
1537
1538 Expression::Column(c) => c.inferred_type = Some(dt),
1539 Expression::Function(f) => f.inferred_type = Some(dt),
1540 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1541 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1542 Expression::Case(c) => c.inferred_type = Some(dt),
1543 Expression::Subquery(s) => s.inferred_type = Some(dt),
1544 Expression::Alias(a) => a.inferred_type = Some(dt),
1545 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1546 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1547 Expression::Count(f) => f.inferred_type = Some(dt),
1548 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1549 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1550 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1551 Expression::SumIf(f) => f.inferred_type = Some(dt),
1552
1553 Expression::Upper(f)
1555 | Expression::Lower(f)
1556 | Expression::Length(f)
1557 | Expression::LTrim(f)
1558 | Expression::RTrim(f)
1559 | Expression::Reverse(f)
1560 | Expression::Abs(f)
1561 | Expression::Sqrt(f)
1562 | Expression::Cbrt(f)
1563 | Expression::Ln(f)
1564 | Expression::Exp(f)
1565 | Expression::Sign(f)
1566 | Expression::Date(f)
1567 | Expression::Time(f)
1568 | Expression::Initcap(f)
1569 | Expression::Ascii(f)
1570 | Expression::Chr(f)
1571 | Expression::Soundex(f)
1572 | Expression::ByteLength(f)
1573 | Expression::Hex(f)
1574 | Expression::LowerHex(f)
1575 | Expression::Unicode(f)
1576 | Expression::Typeof(f)
1577 | Expression::Explode(f)
1578 | Expression::ExplodeOuter(f)
1579 | Expression::MapFromEntries(f)
1580 | Expression::MapKeys(f)
1581 | Expression::MapValues(f)
1582 | Expression::ArrayLength(f)
1583 | Expression::ArraySize(f)
1584 | Expression::Cardinality(f)
1585 | Expression::ArrayReverse(f)
1586 | Expression::ArrayDistinct(f)
1587 | Expression::ArrayFlatten(f)
1588 | Expression::ArrayCompact(f)
1589 | Expression::ToArray(f)
1590 | Expression::JsonArrayLength(f)
1591 | Expression::JsonKeys(f)
1592 | Expression::JsonType(f)
1593 | Expression::ParseJson(f)
1594 | Expression::ToJson(f)
1595 | Expression::Radians(f)
1596 | Expression::Degrees(f)
1597 | Expression::Sin(f)
1598 | Expression::Cos(f)
1599 | Expression::Tan(f)
1600 | Expression::Asin(f)
1601 | Expression::Acos(f)
1602 | Expression::Atan(f)
1603 | Expression::IsNan(f)
1604 | Expression::IsInf(f)
1605 | Expression::Year(f)
1606 | Expression::Month(f)
1607 | Expression::Day(f)
1608 | Expression::Hour(f)
1609 | Expression::Minute(f)
1610 | Expression::Second(f)
1611 | Expression::DayOfWeek(f)
1612 | Expression::DayOfWeekIso(f)
1613 | Expression::DayOfMonth(f)
1614 | Expression::DayOfYear(f)
1615 | Expression::WeekOfYear(f)
1616 | Expression::Quarter(f)
1617 | Expression::Epoch(f)
1618 | Expression::EpochMs(f)
1619 | Expression::BitwiseCount(f)
1620 | Expression::DateFromUnixDate(f)
1621 | Expression::UnixDate(f)
1622 | Expression::UnixSeconds(f)
1623 | Expression::UnixMillis(f)
1624 | Expression::UnixMicros(f)
1625 | Expression::TimeStrToDate(f)
1626 | Expression::DateToDi(f)
1627 | Expression::DiToDate(f)
1628 | Expression::TsOrDiToDi(f)
1629 | Expression::TsOrDsToDatetime(f)
1630 | Expression::TsOrDsToTimestamp(f)
1631 | Expression::YearOfWeek(f)
1632 | Expression::YearOfWeekIso(f)
1633 | Expression::SHA(f)
1634 | Expression::SHA1Digest(f)
1635 | Expression::TimeToUnix(f)
1636 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1637
1638 Expression::Power(f)
1640 | Expression::NullIf(f)
1641 | Expression::IfNull(f)
1642 | Expression::Nvl(f)
1643 | Expression::Contains(f)
1644 | Expression::StartsWith(f)
1645 | Expression::EndsWith(f)
1646 | Expression::Levenshtein(f)
1647 | Expression::ModFunc(f)
1648 | Expression::IntDiv(f)
1649 | Expression::Atan2(f)
1650 | Expression::AddMonths(f)
1651 | Expression::MonthsBetween(f)
1652 | Expression::NextDay(f)
1653 | Expression::UnixToTimeStr(f)
1654 | Expression::ArrayContains(f)
1655 | Expression::ArrayPosition(f)
1656 | Expression::ArrayAppend(f)
1657 | Expression::ArrayPrepend(f)
1658 | Expression::ArrayUnion(f)
1659 | Expression::ArrayExcept(f)
1660 | Expression::ArrayRemove(f)
1661 | Expression::StarMap(f)
1662 | Expression::MapFromArrays(f)
1663 | Expression::MapContainsKey(f)
1664 | Expression::ElementAt(f)
1665 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1666
1667 Expression::Coalesce(f)
1669 | Expression::Greatest(f)
1670 | Expression::Least(f)
1671 | Expression::ArrayConcat(f)
1672 | Expression::ArrayIntersect(f)
1673 | Expression::ArrayZip(f)
1674 | Expression::MapConcat(f)
1675 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1676
1677 Expression::Sum(f)
1679 | Expression::Avg(f)
1680 | Expression::Min(f)
1681 | Expression::Max(f)
1682 | Expression::ArrayAgg(f)
1683 | Expression::CountIf(f)
1684 | Expression::Stddev(f)
1685 | Expression::StddevPop(f)
1686 | Expression::StddevSamp(f)
1687 | Expression::Variance(f)
1688 | Expression::VarPop(f)
1689 | Expression::VarSamp(f)
1690 | Expression::Median(f)
1691 | Expression::Mode(f)
1692 | Expression::First(f)
1693 | Expression::Last(f)
1694 | Expression::AnyValue(f)
1695 | Expression::ApproxDistinct(f)
1696 | Expression::ApproxCountDistinct(f)
1697 | Expression::LogicalAnd(f)
1698 | Expression::LogicalOr(f)
1699 | Expression::Skewness(f)
1700 | Expression::ArrayConcatAgg(f)
1701 | Expression::ArrayUniqueAgg(f)
1702 | Expression::BoolXorAgg(f)
1703 | Expression::BitwiseAndAgg(f)
1704 | Expression::BitwiseOrAgg(f)
1705 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1706
1707 _ => {}
1709 }
1710 }
1711
1712 pub fn column(name: impl Into<String>) -> Self {
1714 Expression::Column(Box::new(Column {
1715 name: Identifier::new(name),
1716 table: None,
1717 join_mark: false,
1718 trailing_comments: Vec::new(),
1719 span: None,
1720 inferred_type: None,
1721 }))
1722 }
1723
1724 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1726 Expression::Column(Box::new(Column {
1727 name: Identifier::new(column),
1728 table: Some(Identifier::new(table)),
1729 join_mark: false,
1730 trailing_comments: Vec::new(),
1731 span: None,
1732 inferred_type: None,
1733 }))
1734 }
1735
1736 pub fn identifier(name: impl Into<String>) -> Self {
1738 Expression::Identifier(Identifier::new(name))
1739 }
1740
1741 pub fn null() -> Self {
1743 Expression::Null(Null)
1744 }
1745
1746 pub fn true_() -> Self {
1748 Expression::Boolean(BooleanLiteral { value: true })
1749 }
1750
1751 pub fn false_() -> Self {
1753 Expression::Boolean(BooleanLiteral { value: false })
1754 }
1755
1756 pub fn star() -> Self {
1758 Expression::Star(Star {
1759 table: None,
1760 except: None,
1761 replace: None,
1762 rename: None,
1763 trailing_comments: Vec::new(),
1764 span: None,
1765 })
1766 }
1767
1768 pub fn alias(self, name: impl Into<String>) -> Self {
1770 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1771 }
1772
1773 pub fn is_select(&self) -> bool {
1775 matches!(self, Expression::Select(_))
1776 }
1777
1778 pub fn as_select(&self) -> Option<&Select> {
1780 match self {
1781 Expression::Select(s) => Some(s),
1782 _ => None,
1783 }
1784 }
1785
1786 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1788 match self {
1789 Expression::Select(s) => Some(s),
1790 _ => None,
1791 }
1792 }
1793
1794 pub fn sql(&self) -> String {
1799 crate::generator::Generator::sql(self).unwrap_or_default()
1800 }
1801
1802 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1808 crate::generate(self, dialect).unwrap_or_default()
1809 }
1810}
1811
1812impl Expression {
1815 pub fn variant_name(&self) -> &'static str {
1818 match self {
1819 Expression::Literal(_) => "literal",
1820 Expression::Boolean(_) => "boolean",
1821 Expression::Null(_) => "null",
1822 Expression::Identifier(_) => "identifier",
1823 Expression::Column(_) => "column",
1824 Expression::Table(_) => "table",
1825 Expression::Star(_) => "star",
1826 Expression::BracedWildcard(_) => "braced_wildcard",
1827 Expression::Select(_) => "select",
1828 Expression::Union(_) => "union",
1829 Expression::Intersect(_) => "intersect",
1830 Expression::Except(_) => "except",
1831 Expression::Subquery(_) => "subquery",
1832 Expression::PipeOperator(_) => "pipe_operator",
1833 Expression::Pivot(_) => "pivot",
1834 Expression::PivotAlias(_) => "pivot_alias",
1835 Expression::Unpivot(_) => "unpivot",
1836 Expression::Values(_) => "values",
1837 Expression::PreWhere(_) => "pre_where",
1838 Expression::Stream(_) => "stream",
1839 Expression::UsingData(_) => "using_data",
1840 Expression::XmlNamespace(_) => "xml_namespace",
1841 Expression::Insert(_) => "insert",
1842 Expression::Update(_) => "update",
1843 Expression::Delete(_) => "delete",
1844 Expression::Copy(_) => "copy",
1845 Expression::Put(_) => "put",
1846 Expression::StageReference(_) => "stage_reference",
1847 Expression::Alias(_) => "alias",
1848 Expression::Cast(_) => "cast",
1849 Expression::Collation(_) => "collation",
1850 Expression::Case(_) => "case",
1851 Expression::And(_) => "and",
1852 Expression::Or(_) => "or",
1853 Expression::Add(_) => "add",
1854 Expression::Sub(_) => "sub",
1855 Expression::Mul(_) => "mul",
1856 Expression::Div(_) => "div",
1857 Expression::Mod(_) => "mod",
1858 Expression::Eq(_) => "eq",
1859 Expression::Neq(_) => "neq",
1860 Expression::Lt(_) => "lt",
1861 Expression::Lte(_) => "lte",
1862 Expression::Gt(_) => "gt",
1863 Expression::Gte(_) => "gte",
1864 Expression::Like(_) => "like",
1865 Expression::ILike(_) => "i_like",
1866 Expression::Match(_) => "match",
1867 Expression::BitwiseAnd(_) => "bitwise_and",
1868 Expression::BitwiseOr(_) => "bitwise_or",
1869 Expression::BitwiseXor(_) => "bitwise_xor",
1870 Expression::Concat(_) => "concat",
1871 Expression::Adjacent(_) => "adjacent",
1872 Expression::TsMatch(_) => "ts_match",
1873 Expression::PropertyEQ(_) => "property_e_q",
1874 Expression::ArrayContainsAll(_) => "array_contains_all",
1875 Expression::ArrayContainedBy(_) => "array_contained_by",
1876 Expression::ArrayOverlaps(_) => "array_overlaps",
1877 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1878 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1879 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1880 Expression::ExtendsLeft(_) => "extends_left",
1881 Expression::ExtendsRight(_) => "extends_right",
1882 Expression::Not(_) => "not",
1883 Expression::Neg(_) => "neg",
1884 Expression::BitwiseNot(_) => "bitwise_not",
1885 Expression::In(_) => "in",
1886 Expression::Between(_) => "between",
1887 Expression::IsNull(_) => "is_null",
1888 Expression::IsTrue(_) => "is_true",
1889 Expression::IsFalse(_) => "is_false",
1890 Expression::IsJson(_) => "is_json",
1891 Expression::Is(_) => "is",
1892 Expression::Exists(_) => "exists",
1893 Expression::MemberOf(_) => "member_of",
1894 Expression::Function(_) => "function",
1895 Expression::AggregateFunction(_) => "aggregate_function",
1896 Expression::WindowFunction(_) => "window_function",
1897 Expression::From(_) => "from",
1898 Expression::Join(_) => "join",
1899 Expression::JoinedTable(_) => "joined_table",
1900 Expression::Where(_) => "where",
1901 Expression::GroupBy(_) => "group_by",
1902 Expression::Having(_) => "having",
1903 Expression::OrderBy(_) => "order_by",
1904 Expression::Limit(_) => "limit",
1905 Expression::Offset(_) => "offset",
1906 Expression::Qualify(_) => "qualify",
1907 Expression::With(_) => "with",
1908 Expression::Cte(_) => "cte",
1909 Expression::DistributeBy(_) => "distribute_by",
1910 Expression::ClusterBy(_) => "cluster_by",
1911 Expression::SortBy(_) => "sort_by",
1912 Expression::LateralView(_) => "lateral_view",
1913 Expression::Hint(_) => "hint",
1914 Expression::Pseudocolumn(_) => "pseudocolumn",
1915 Expression::Connect(_) => "connect",
1916 Expression::Prior(_) => "prior",
1917 Expression::ConnectByRoot(_) => "connect_by_root",
1918 Expression::MatchRecognize(_) => "match_recognize",
1919 Expression::Ordered(_) => "ordered",
1920 Expression::Window(_) => "window",
1921 Expression::Over(_) => "over",
1922 Expression::WithinGroup(_) => "within_group",
1923 Expression::DataType(_) => "data_type",
1924 Expression::Array(_) => "array",
1925 Expression::Struct(_) => "struct",
1926 Expression::Tuple(_) => "tuple",
1927 Expression::Interval(_) => "interval",
1928 Expression::ConcatWs(_) => "concat_ws",
1929 Expression::Substring(_) => "substring",
1930 Expression::Upper(_) => "upper",
1931 Expression::Lower(_) => "lower",
1932 Expression::Length(_) => "length",
1933 Expression::Trim(_) => "trim",
1934 Expression::LTrim(_) => "l_trim",
1935 Expression::RTrim(_) => "r_trim",
1936 Expression::Replace(_) => "replace",
1937 Expression::Reverse(_) => "reverse",
1938 Expression::Left(_) => "left",
1939 Expression::Right(_) => "right",
1940 Expression::Repeat(_) => "repeat",
1941 Expression::Lpad(_) => "lpad",
1942 Expression::Rpad(_) => "rpad",
1943 Expression::Split(_) => "split",
1944 Expression::RegexpLike(_) => "regexp_like",
1945 Expression::RegexpReplace(_) => "regexp_replace",
1946 Expression::RegexpExtract(_) => "regexp_extract",
1947 Expression::Overlay(_) => "overlay",
1948 Expression::Abs(_) => "abs",
1949 Expression::Round(_) => "round",
1950 Expression::Floor(_) => "floor",
1951 Expression::Ceil(_) => "ceil",
1952 Expression::Power(_) => "power",
1953 Expression::Sqrt(_) => "sqrt",
1954 Expression::Cbrt(_) => "cbrt",
1955 Expression::Ln(_) => "ln",
1956 Expression::Log(_) => "log",
1957 Expression::Exp(_) => "exp",
1958 Expression::Sign(_) => "sign",
1959 Expression::Greatest(_) => "greatest",
1960 Expression::Least(_) => "least",
1961 Expression::CurrentDate(_) => "current_date",
1962 Expression::CurrentTime(_) => "current_time",
1963 Expression::CurrentTimestamp(_) => "current_timestamp",
1964 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1965 Expression::AtTimeZone(_) => "at_time_zone",
1966 Expression::DateAdd(_) => "date_add",
1967 Expression::DateSub(_) => "date_sub",
1968 Expression::DateDiff(_) => "date_diff",
1969 Expression::DateTrunc(_) => "date_trunc",
1970 Expression::Extract(_) => "extract",
1971 Expression::ToDate(_) => "to_date",
1972 Expression::ToTimestamp(_) => "to_timestamp",
1973 Expression::Date(_) => "date",
1974 Expression::Time(_) => "time",
1975 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1976 Expression::UnixDate(_) => "unix_date",
1977 Expression::UnixSeconds(_) => "unix_seconds",
1978 Expression::UnixMillis(_) => "unix_millis",
1979 Expression::UnixMicros(_) => "unix_micros",
1980 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1981 Expression::TimeStrToDate(_) => "time_str_to_date",
1982 Expression::DateToDi(_) => "date_to_di",
1983 Expression::DiToDate(_) => "di_to_date",
1984 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1985 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1986 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1987 Expression::YearOfWeek(_) => "year_of_week",
1988 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1989 Expression::Coalesce(_) => "coalesce",
1990 Expression::NullIf(_) => "null_if",
1991 Expression::IfFunc(_) => "if_func",
1992 Expression::IfNull(_) => "if_null",
1993 Expression::Nvl(_) => "nvl",
1994 Expression::Nvl2(_) => "nvl2",
1995 Expression::TryCast(_) => "try_cast",
1996 Expression::SafeCast(_) => "safe_cast",
1997 Expression::Count(_) => "count",
1998 Expression::Sum(_) => "sum",
1999 Expression::Avg(_) => "avg",
2000 Expression::Min(_) => "min",
2001 Expression::Max(_) => "max",
2002 Expression::GroupConcat(_) => "group_concat",
2003 Expression::StringAgg(_) => "string_agg",
2004 Expression::ListAgg(_) => "list_agg",
2005 Expression::ArrayAgg(_) => "array_agg",
2006 Expression::CountIf(_) => "count_if",
2007 Expression::SumIf(_) => "sum_if",
2008 Expression::Stddev(_) => "stddev",
2009 Expression::StddevPop(_) => "stddev_pop",
2010 Expression::StddevSamp(_) => "stddev_samp",
2011 Expression::Variance(_) => "variance",
2012 Expression::VarPop(_) => "var_pop",
2013 Expression::VarSamp(_) => "var_samp",
2014 Expression::Median(_) => "median",
2015 Expression::Mode(_) => "mode",
2016 Expression::First(_) => "first",
2017 Expression::Last(_) => "last",
2018 Expression::AnyValue(_) => "any_value",
2019 Expression::ApproxDistinct(_) => "approx_distinct",
2020 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2021 Expression::ApproxPercentile(_) => "approx_percentile",
2022 Expression::Percentile(_) => "percentile",
2023 Expression::LogicalAnd(_) => "logical_and",
2024 Expression::LogicalOr(_) => "logical_or",
2025 Expression::Skewness(_) => "skewness",
2026 Expression::BitwiseCount(_) => "bitwise_count",
2027 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2028 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2029 Expression::BoolXorAgg(_) => "bool_xor_agg",
2030 Expression::RowNumber(_) => "row_number",
2031 Expression::Rank(_) => "rank",
2032 Expression::DenseRank(_) => "dense_rank",
2033 Expression::NTile(_) => "n_tile",
2034 Expression::Lead(_) => "lead",
2035 Expression::Lag(_) => "lag",
2036 Expression::FirstValue(_) => "first_value",
2037 Expression::LastValue(_) => "last_value",
2038 Expression::NthValue(_) => "nth_value",
2039 Expression::PercentRank(_) => "percent_rank",
2040 Expression::CumeDist(_) => "cume_dist",
2041 Expression::PercentileCont(_) => "percentile_cont",
2042 Expression::PercentileDisc(_) => "percentile_disc",
2043 Expression::Contains(_) => "contains",
2044 Expression::StartsWith(_) => "starts_with",
2045 Expression::EndsWith(_) => "ends_with",
2046 Expression::Position(_) => "position",
2047 Expression::Initcap(_) => "initcap",
2048 Expression::Ascii(_) => "ascii",
2049 Expression::Chr(_) => "chr",
2050 Expression::CharFunc(_) => "char_func",
2051 Expression::Soundex(_) => "soundex",
2052 Expression::Levenshtein(_) => "levenshtein",
2053 Expression::ByteLength(_) => "byte_length",
2054 Expression::Hex(_) => "hex",
2055 Expression::LowerHex(_) => "lower_hex",
2056 Expression::Unicode(_) => "unicode",
2057 Expression::ModFunc(_) => "mod_func",
2058 Expression::Random(_) => "random",
2059 Expression::Rand(_) => "rand",
2060 Expression::TruncFunc(_) => "trunc_func",
2061 Expression::Pi(_) => "pi",
2062 Expression::Radians(_) => "radians",
2063 Expression::Degrees(_) => "degrees",
2064 Expression::Sin(_) => "sin",
2065 Expression::Cos(_) => "cos",
2066 Expression::Tan(_) => "tan",
2067 Expression::Asin(_) => "asin",
2068 Expression::Acos(_) => "acos",
2069 Expression::Atan(_) => "atan",
2070 Expression::Atan2(_) => "atan2",
2071 Expression::IsNan(_) => "is_nan",
2072 Expression::IsInf(_) => "is_inf",
2073 Expression::IntDiv(_) => "int_div",
2074 Expression::Decode(_) => "decode",
2075 Expression::DateFormat(_) => "date_format",
2076 Expression::FormatDate(_) => "format_date",
2077 Expression::Year(_) => "year",
2078 Expression::Month(_) => "month",
2079 Expression::Day(_) => "day",
2080 Expression::Hour(_) => "hour",
2081 Expression::Minute(_) => "minute",
2082 Expression::Second(_) => "second",
2083 Expression::DayOfWeek(_) => "day_of_week",
2084 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2085 Expression::DayOfMonth(_) => "day_of_month",
2086 Expression::DayOfYear(_) => "day_of_year",
2087 Expression::WeekOfYear(_) => "week_of_year",
2088 Expression::Quarter(_) => "quarter",
2089 Expression::AddMonths(_) => "add_months",
2090 Expression::MonthsBetween(_) => "months_between",
2091 Expression::LastDay(_) => "last_day",
2092 Expression::NextDay(_) => "next_day",
2093 Expression::Epoch(_) => "epoch",
2094 Expression::EpochMs(_) => "epoch_ms",
2095 Expression::FromUnixtime(_) => "from_unixtime",
2096 Expression::UnixTimestamp(_) => "unix_timestamp",
2097 Expression::MakeDate(_) => "make_date",
2098 Expression::MakeTimestamp(_) => "make_timestamp",
2099 Expression::TimestampTrunc(_) => "timestamp_trunc",
2100 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2101 Expression::SessionUser(_) => "session_user",
2102 Expression::SHA(_) => "s_h_a",
2103 Expression::SHA1Digest(_) => "s_h_a1_digest",
2104 Expression::TimeToUnix(_) => "time_to_unix",
2105 Expression::ArrayFunc(_) => "array_func",
2106 Expression::ArrayLength(_) => "array_length",
2107 Expression::ArraySize(_) => "array_size",
2108 Expression::Cardinality(_) => "cardinality",
2109 Expression::ArrayContains(_) => "array_contains",
2110 Expression::ArrayPosition(_) => "array_position",
2111 Expression::ArrayAppend(_) => "array_append",
2112 Expression::ArrayPrepend(_) => "array_prepend",
2113 Expression::ArrayConcat(_) => "array_concat",
2114 Expression::ArraySort(_) => "array_sort",
2115 Expression::ArrayReverse(_) => "array_reverse",
2116 Expression::ArrayDistinct(_) => "array_distinct",
2117 Expression::ArrayJoin(_) => "array_join",
2118 Expression::ArrayToString(_) => "array_to_string",
2119 Expression::Unnest(_) => "unnest",
2120 Expression::Explode(_) => "explode",
2121 Expression::ExplodeOuter(_) => "explode_outer",
2122 Expression::ArrayFilter(_) => "array_filter",
2123 Expression::ArrayTransform(_) => "array_transform",
2124 Expression::ArrayFlatten(_) => "array_flatten",
2125 Expression::ArrayCompact(_) => "array_compact",
2126 Expression::ArrayIntersect(_) => "array_intersect",
2127 Expression::ArrayUnion(_) => "array_union",
2128 Expression::ArrayExcept(_) => "array_except",
2129 Expression::ArrayRemove(_) => "array_remove",
2130 Expression::ArrayZip(_) => "array_zip",
2131 Expression::Sequence(_) => "sequence",
2132 Expression::Generate(_) => "generate",
2133 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2134 Expression::ToArray(_) => "to_array",
2135 Expression::StarMap(_) => "star_map",
2136 Expression::StructFunc(_) => "struct_func",
2137 Expression::StructExtract(_) => "struct_extract",
2138 Expression::NamedStruct(_) => "named_struct",
2139 Expression::MapFunc(_) => "map_func",
2140 Expression::MapFromEntries(_) => "map_from_entries",
2141 Expression::MapFromArrays(_) => "map_from_arrays",
2142 Expression::MapKeys(_) => "map_keys",
2143 Expression::MapValues(_) => "map_values",
2144 Expression::MapContainsKey(_) => "map_contains_key",
2145 Expression::MapConcat(_) => "map_concat",
2146 Expression::ElementAt(_) => "element_at",
2147 Expression::TransformKeys(_) => "transform_keys",
2148 Expression::TransformValues(_) => "transform_values",
2149 Expression::FunctionEmits(_) => "function_emits",
2150 Expression::JsonExtract(_) => "json_extract",
2151 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2152 Expression::JsonExtractPath(_) => "json_extract_path",
2153 Expression::JsonArray(_) => "json_array",
2154 Expression::JsonObject(_) => "json_object",
2155 Expression::JsonQuery(_) => "json_query",
2156 Expression::JsonValue(_) => "json_value",
2157 Expression::JsonArrayLength(_) => "json_array_length",
2158 Expression::JsonKeys(_) => "json_keys",
2159 Expression::JsonType(_) => "json_type",
2160 Expression::ParseJson(_) => "parse_json",
2161 Expression::ToJson(_) => "to_json",
2162 Expression::JsonSet(_) => "json_set",
2163 Expression::JsonInsert(_) => "json_insert",
2164 Expression::JsonRemove(_) => "json_remove",
2165 Expression::JsonMergePatch(_) => "json_merge_patch",
2166 Expression::JsonArrayAgg(_) => "json_array_agg",
2167 Expression::JsonObjectAgg(_) => "json_object_agg",
2168 Expression::Convert(_) => "convert",
2169 Expression::Typeof(_) => "typeof",
2170 Expression::Lambda(_) => "lambda",
2171 Expression::Parameter(_) => "parameter",
2172 Expression::Placeholder(_) => "placeholder",
2173 Expression::NamedArgument(_) => "named_argument",
2174 Expression::TableArgument(_) => "table_argument",
2175 Expression::SqlComment(_) => "sql_comment",
2176 Expression::NullSafeEq(_) => "null_safe_eq",
2177 Expression::NullSafeNeq(_) => "null_safe_neq",
2178 Expression::Glob(_) => "glob",
2179 Expression::SimilarTo(_) => "similar_to",
2180 Expression::Any(_) => "any",
2181 Expression::All(_) => "all",
2182 Expression::Overlaps(_) => "overlaps",
2183 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2184 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2185 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2186 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2187 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2188 Expression::Subscript(_) => "subscript",
2189 Expression::Dot(_) => "dot",
2190 Expression::MethodCall(_) => "method_call",
2191 Expression::ArraySlice(_) => "array_slice",
2192 Expression::CreateTable(_) => "create_table",
2193 Expression::DropTable(_) => "drop_table",
2194 Expression::Undrop(_) => "undrop",
2195 Expression::AlterTable(_) => "alter_table",
2196 Expression::CreateIndex(_) => "create_index",
2197 Expression::DropIndex(_) => "drop_index",
2198 Expression::CreateView(_) => "create_view",
2199 Expression::DropView(_) => "drop_view",
2200 Expression::AlterView(_) => "alter_view",
2201 Expression::AlterIndex(_) => "alter_index",
2202 Expression::Truncate(_) => "truncate",
2203 Expression::Use(_) => "use",
2204 Expression::Cache(_) => "cache",
2205 Expression::Uncache(_) => "uncache",
2206 Expression::LoadData(_) => "load_data",
2207 Expression::Pragma(_) => "pragma",
2208 Expression::Grant(_) => "grant",
2209 Expression::Revoke(_) => "revoke",
2210 Expression::Comment(_) => "comment",
2211 Expression::SetStatement(_) => "set_statement",
2212 Expression::CreateSchema(_) => "create_schema",
2213 Expression::DropSchema(_) => "drop_schema",
2214 Expression::DropNamespace(_) => "drop_namespace",
2215 Expression::CreateDatabase(_) => "create_database",
2216 Expression::DropDatabase(_) => "drop_database",
2217 Expression::CreateFunction(_) => "create_function",
2218 Expression::DropFunction(_) => "drop_function",
2219 Expression::CreateProcedure(_) => "create_procedure",
2220 Expression::DropProcedure(_) => "drop_procedure",
2221 Expression::CreateSequence(_) => "create_sequence",
2222 Expression::CreateSynonym(_) => "create_synonym",
2223 Expression::DropSequence(_) => "drop_sequence",
2224 Expression::AlterSequence(_) => "alter_sequence",
2225 Expression::CreateTrigger(_) => "create_trigger",
2226 Expression::DropTrigger(_) => "drop_trigger",
2227 Expression::CreateType(_) => "create_type",
2228 Expression::DropType(_) => "drop_type",
2229 Expression::Describe(_) => "describe",
2230 Expression::Show(_) => "show",
2231 Expression::Command(_) => "command",
2232 Expression::Kill(_) => "kill",
2233 Expression::Execute(_) => "execute",
2234 Expression::Raw(_) => "raw",
2235 Expression::CreateTask(_) => "create_task",
2236 Expression::Paren(_) => "paren",
2237 Expression::Annotated(_) => "annotated",
2238 Expression::Refresh(_) => "refresh",
2239 Expression::LockingStatement(_) => "locking_statement",
2240 Expression::SequenceProperties(_) => "sequence_properties",
2241 Expression::TruncateTable(_) => "truncate_table",
2242 Expression::Clone(_) => "clone",
2243 Expression::Attach(_) => "attach",
2244 Expression::Detach(_) => "detach",
2245 Expression::Install(_) => "install",
2246 Expression::Summarize(_) => "summarize",
2247 Expression::Declare(_) => "declare",
2248 Expression::DeclareItem(_) => "declare_item",
2249 Expression::Set(_) => "set",
2250 Expression::Heredoc(_) => "heredoc",
2251 Expression::SetItem(_) => "set_item",
2252 Expression::QueryBand(_) => "query_band",
2253 Expression::UserDefinedFunction(_) => "user_defined_function",
2254 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2255 Expression::ProjectionDef(_) => "projection_def",
2256 Expression::TableAlias(_) => "table_alias",
2257 Expression::ByteString(_) => "byte_string",
2258 Expression::HexStringExpr(_) => "hex_string_expr",
2259 Expression::UnicodeString(_) => "unicode_string",
2260 Expression::ColumnPosition(_) => "column_position",
2261 Expression::ColumnDef(_) => "column_def",
2262 Expression::AlterColumn(_) => "alter_column",
2263 Expression::AlterSortKey(_) => "alter_sort_key",
2264 Expression::AlterSet(_) => "alter_set",
2265 Expression::RenameColumn(_) => "rename_column",
2266 Expression::Comprehension(_) => "comprehension",
2267 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2268 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2269 Expression::IndexConstraintOption(_) => "index_constraint_option",
2270 Expression::ColumnConstraint(_) => "column_constraint",
2271 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2272 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2273 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2274 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2275 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2276 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2277 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2278 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2279 Expression::WithOperator(_) => "with_operator",
2280 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2281 "generated_as_identity_column_constraint"
2282 }
2283 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2284 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2285 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2286 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2287 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2288 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2289 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2290 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2291 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2292 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2293 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2294 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2295 Expression::PathColumnConstraint(_) => "path_column_constraint",
2296 Expression::Constraint(_) => "constraint",
2297 Expression::Export(_) => "export",
2298 Expression::Filter(_) => "filter",
2299 Expression::Changes(_) => "changes",
2300 Expression::CopyParameter(_) => "copy_parameter",
2301 Expression::Credentials(_) => "credentials",
2302 Expression::Directory(_) => "directory",
2303 Expression::ForeignKey(_) => "foreign_key",
2304 Expression::ColumnPrefix(_) => "column_prefix",
2305 Expression::PrimaryKey(_) => "primary_key",
2306 Expression::IntoClause(_) => "into_clause",
2307 Expression::JoinHint(_) => "join_hint",
2308 Expression::Opclass(_) => "opclass",
2309 Expression::Index(_) => "index",
2310 Expression::IndexParameters(_) => "index_parameters",
2311 Expression::ConditionalInsert(_) => "conditional_insert",
2312 Expression::MultitableInserts(_) => "multitable_inserts",
2313 Expression::OnConflict(_) => "on_conflict",
2314 Expression::OnCondition(_) => "on_condition",
2315 Expression::Returning(_) => "returning",
2316 Expression::Introducer(_) => "introducer",
2317 Expression::PartitionRange(_) => "partition_range",
2318 Expression::Fetch(_) => "fetch",
2319 Expression::Group(_) => "group",
2320 Expression::Cube(_) => "cube",
2321 Expression::Rollup(_) => "rollup",
2322 Expression::GroupingSets(_) => "grouping_sets",
2323 Expression::LimitOptions(_) => "limit_options",
2324 Expression::Lateral(_) => "lateral",
2325 Expression::TableFromRows(_) => "table_from_rows",
2326 Expression::RowsFrom(_) => "rows_from",
2327 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2328 Expression::WithFill(_) => "with_fill",
2329 Expression::Property(_) => "property",
2330 Expression::GrantPrivilege(_) => "grant_privilege",
2331 Expression::GrantPrincipal(_) => "grant_principal",
2332 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2333 Expression::AlgorithmProperty(_) => "algorithm_property",
2334 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2335 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2336 Expression::BackupProperty(_) => "backup_property",
2337 Expression::BuildProperty(_) => "build_property",
2338 Expression::BlockCompressionProperty(_) => "block_compression_property",
2339 Expression::CharacterSetProperty(_) => "character_set_property",
2340 Expression::ChecksumProperty(_) => "checksum_property",
2341 Expression::CollateProperty(_) => "collate_property",
2342 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2343 Expression::DataDeletionProperty(_) => "data_deletion_property",
2344 Expression::DefinerProperty(_) => "definer_property",
2345 Expression::DistKeyProperty(_) => "dist_key_property",
2346 Expression::DistributedByProperty(_) => "distributed_by_property",
2347 Expression::DistStyleProperty(_) => "dist_style_property",
2348 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2349 Expression::EngineProperty(_) => "engine_property",
2350 Expression::ToTableProperty(_) => "to_table_property",
2351 Expression::ExecuteAsProperty(_) => "execute_as_property",
2352 Expression::ExternalProperty(_) => "external_property",
2353 Expression::FallbackProperty(_) => "fallback_property",
2354 Expression::FileFormatProperty(_) => "file_format_property",
2355 Expression::CredentialsProperty(_) => "credentials_property",
2356 Expression::FreespaceProperty(_) => "freespace_property",
2357 Expression::InheritsProperty(_) => "inherits_property",
2358 Expression::InputModelProperty(_) => "input_model_property",
2359 Expression::OutputModelProperty(_) => "output_model_property",
2360 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2361 Expression::JournalProperty(_) => "journal_property",
2362 Expression::LanguageProperty(_) => "language_property",
2363 Expression::EnviromentProperty(_) => "enviroment_property",
2364 Expression::ClusteredByProperty(_) => "clustered_by_property",
2365 Expression::DictProperty(_) => "dict_property",
2366 Expression::DictRange(_) => "dict_range",
2367 Expression::OnCluster(_) => "on_cluster",
2368 Expression::LikeProperty(_) => "like_property",
2369 Expression::LocationProperty(_) => "location_property",
2370 Expression::LockProperty(_) => "lock_property",
2371 Expression::LockingProperty(_) => "locking_property",
2372 Expression::LogProperty(_) => "log_property",
2373 Expression::MaterializedProperty(_) => "materialized_property",
2374 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2375 Expression::OnProperty(_) => "on_property",
2376 Expression::OnCommitProperty(_) => "on_commit_property",
2377 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2378 Expression::PartitionByProperty(_) => "partition_by_property",
2379 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2380 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2381 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2382 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2383 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2384 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2385 Expression::PartitionList(_) => "partition_list",
2386 Expression::Partition(_) => "partition",
2387 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2388 Expression::UniqueKeyProperty(_) => "unique_key_property",
2389 Expression::RollupProperty(_) => "rollup_property",
2390 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2391 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2392 Expression::RemoteWithConnectionModelProperty(_) => {
2393 "remote_with_connection_model_property"
2394 }
2395 Expression::ReturnsProperty(_) => "returns_property",
2396 Expression::RowFormatProperty(_) => "row_format_property",
2397 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2398 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2399 Expression::QueryTransform(_) => "query_transform",
2400 Expression::SampleProperty(_) => "sample_property",
2401 Expression::SecurityProperty(_) => "security_property",
2402 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2403 Expression::SemanticView(_) => "semantic_view",
2404 Expression::SerdeProperties(_) => "serde_properties",
2405 Expression::SetProperty(_) => "set_property",
2406 Expression::SharingProperty(_) => "sharing_property",
2407 Expression::SetConfigProperty(_) => "set_config_property",
2408 Expression::SettingsProperty(_) => "settings_property",
2409 Expression::SortKeyProperty(_) => "sort_key_property",
2410 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2411 Expression::SqlSecurityProperty(_) => "sql_security_property",
2412 Expression::StabilityProperty(_) => "stability_property",
2413 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2414 Expression::TemporaryProperty(_) => "temporary_property",
2415 Expression::Tags(_) => "tags",
2416 Expression::TransformModelProperty(_) => "transform_model_property",
2417 Expression::TransientProperty(_) => "transient_property",
2418 Expression::UsingTemplateProperty(_) => "using_template_property",
2419 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2420 Expression::VolatileProperty(_) => "volatile_property",
2421 Expression::WithDataProperty(_) => "with_data_property",
2422 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2423 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2424 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2425 Expression::WithProcedureOptions(_) => "with_procedure_options",
2426 Expression::EncodeProperty(_) => "encode_property",
2427 Expression::IncludeProperty(_) => "include_property",
2428 Expression::Properties(_) => "properties",
2429 Expression::OptionsProperty(_) => "options_property",
2430 Expression::InputOutputFormat(_) => "input_output_format",
2431 Expression::Reference(_) => "reference",
2432 Expression::QueryOption(_) => "query_option",
2433 Expression::WithTableHint(_) => "with_table_hint",
2434 Expression::IndexTableHint(_) => "index_table_hint",
2435 Expression::HistoricalData(_) => "historical_data",
2436 Expression::Get(_) => "get",
2437 Expression::SetOperation(_) => "set_operation",
2438 Expression::Var(_) => "var",
2439 Expression::Variadic(_) => "variadic",
2440 Expression::Version(_) => "version",
2441 Expression::Schema(_) => "schema",
2442 Expression::Lock(_) => "lock",
2443 Expression::TableSample(_) => "table_sample",
2444 Expression::Tag(_) => "tag",
2445 Expression::UnpivotColumns(_) => "unpivot_columns",
2446 Expression::WindowSpec(_) => "window_spec",
2447 Expression::SessionParameter(_) => "session_parameter",
2448 Expression::PseudoType(_) => "pseudo_type",
2449 Expression::ObjectIdentifier(_) => "object_identifier",
2450 Expression::Transaction(_) => "transaction",
2451 Expression::Commit(_) => "commit",
2452 Expression::Rollback(_) => "rollback",
2453 Expression::AlterSession(_) => "alter_session",
2454 Expression::Analyze(_) => "analyze",
2455 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2456 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2457 Expression::AnalyzeSample(_) => "analyze_sample",
2458 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2459 Expression::AnalyzeDelete(_) => "analyze_delete",
2460 Expression::AnalyzeWith(_) => "analyze_with",
2461 Expression::AnalyzeValidate(_) => "analyze_validate",
2462 Expression::AddPartition(_) => "add_partition",
2463 Expression::AttachOption(_) => "attach_option",
2464 Expression::DropPartition(_) => "drop_partition",
2465 Expression::ReplacePartition(_) => "replace_partition",
2466 Expression::DPipe(_) => "d_pipe",
2467 Expression::Operator(_) => "operator",
2468 Expression::PivotAny(_) => "pivot_any",
2469 Expression::Aliases(_) => "aliases",
2470 Expression::AtIndex(_) => "at_index",
2471 Expression::FromTimeZone(_) => "from_time_zone",
2472 Expression::FormatPhrase(_) => "format_phrase",
2473 Expression::ForIn(_) => "for_in",
2474 Expression::TimeUnit(_) => "time_unit",
2475 Expression::IntervalOp(_) => "interval_op",
2476 Expression::IntervalSpan(_) => "interval_span",
2477 Expression::HavingMax(_) => "having_max",
2478 Expression::CosineDistance(_) => "cosine_distance",
2479 Expression::DotProduct(_) => "dot_product",
2480 Expression::EuclideanDistance(_) => "euclidean_distance",
2481 Expression::ManhattanDistance(_) => "manhattan_distance",
2482 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2483 Expression::Booland(_) => "booland",
2484 Expression::Boolor(_) => "boolor",
2485 Expression::ParameterizedAgg(_) => "parameterized_agg",
2486 Expression::ArgMax(_) => "arg_max",
2487 Expression::ArgMin(_) => "arg_min",
2488 Expression::ApproxTopK(_) => "approx_top_k",
2489 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2490 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2491 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2492 Expression::ApproxTopSum(_) => "approx_top_sum",
2493 Expression::ApproxQuantiles(_) => "approx_quantiles",
2494 Expression::Minhash(_) => "minhash",
2495 Expression::FarmFingerprint(_) => "farm_fingerprint",
2496 Expression::Float64(_) => "float64",
2497 Expression::Transform(_) => "transform",
2498 Expression::Translate(_) => "translate",
2499 Expression::Grouping(_) => "grouping",
2500 Expression::GroupingId(_) => "grouping_id",
2501 Expression::Anonymous(_) => "anonymous",
2502 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2503 Expression::CombinedAggFunc(_) => "combined_agg_func",
2504 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2505 Expression::HashAgg(_) => "hash_agg",
2506 Expression::Hll(_) => "hll",
2507 Expression::Apply(_) => "apply",
2508 Expression::ToBoolean(_) => "to_boolean",
2509 Expression::List(_) => "list",
2510 Expression::ToMap(_) => "to_map",
2511 Expression::Pad(_) => "pad",
2512 Expression::ToChar(_) => "to_char",
2513 Expression::ToNumber(_) => "to_number",
2514 Expression::ToDouble(_) => "to_double",
2515 Expression::Int64(_) => "int64",
2516 Expression::StringFunc(_) => "string_func",
2517 Expression::ToDecfloat(_) => "to_decfloat",
2518 Expression::TryToDecfloat(_) => "try_to_decfloat",
2519 Expression::ToFile(_) => "to_file",
2520 Expression::Columns(_) => "columns",
2521 Expression::ConvertToCharset(_) => "convert_to_charset",
2522 Expression::ConvertTimezone(_) => "convert_timezone",
2523 Expression::GenerateSeries(_) => "generate_series",
2524 Expression::AIAgg(_) => "a_i_agg",
2525 Expression::AIClassify(_) => "a_i_classify",
2526 Expression::ArrayAll(_) => "array_all",
2527 Expression::ArrayAny(_) => "array_any",
2528 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2529 Expression::StPoint(_) => "st_point",
2530 Expression::StDistance(_) => "st_distance",
2531 Expression::StringToArray(_) => "string_to_array",
2532 Expression::ArraySum(_) => "array_sum",
2533 Expression::ObjectAgg(_) => "object_agg",
2534 Expression::CastToStrType(_) => "cast_to_str_type",
2535 Expression::CheckJson(_) => "check_json",
2536 Expression::CheckXml(_) => "check_xml",
2537 Expression::TranslateCharacters(_) => "translate_characters",
2538 Expression::CurrentSchemas(_) => "current_schemas",
2539 Expression::CurrentDatetime(_) => "current_datetime",
2540 Expression::Localtime(_) => "localtime",
2541 Expression::Localtimestamp(_) => "localtimestamp",
2542 Expression::Systimestamp(_) => "systimestamp",
2543 Expression::CurrentSchema(_) => "current_schema",
2544 Expression::CurrentUser(_) => "current_user",
2545 Expression::UtcTime(_) => "utc_time",
2546 Expression::UtcTimestamp(_) => "utc_timestamp",
2547 Expression::Timestamp(_) => "timestamp",
2548 Expression::DateBin(_) => "date_bin",
2549 Expression::Datetime(_) => "datetime",
2550 Expression::DatetimeAdd(_) => "datetime_add",
2551 Expression::DatetimeSub(_) => "datetime_sub",
2552 Expression::DatetimeDiff(_) => "datetime_diff",
2553 Expression::DatetimeTrunc(_) => "datetime_trunc",
2554 Expression::Dayname(_) => "dayname",
2555 Expression::MakeInterval(_) => "make_interval",
2556 Expression::PreviousDay(_) => "previous_day",
2557 Expression::Elt(_) => "elt",
2558 Expression::TimestampAdd(_) => "timestamp_add",
2559 Expression::TimestampSub(_) => "timestamp_sub",
2560 Expression::TimestampDiff(_) => "timestamp_diff",
2561 Expression::TimeSlice(_) => "time_slice",
2562 Expression::TimeAdd(_) => "time_add",
2563 Expression::TimeSub(_) => "time_sub",
2564 Expression::TimeDiff(_) => "time_diff",
2565 Expression::TimeTrunc(_) => "time_trunc",
2566 Expression::DateFromParts(_) => "date_from_parts",
2567 Expression::TimeFromParts(_) => "time_from_parts",
2568 Expression::DecodeCase(_) => "decode_case",
2569 Expression::Decrypt(_) => "decrypt",
2570 Expression::DecryptRaw(_) => "decrypt_raw",
2571 Expression::Encode(_) => "encode",
2572 Expression::Encrypt(_) => "encrypt",
2573 Expression::EncryptRaw(_) => "encrypt_raw",
2574 Expression::EqualNull(_) => "equal_null",
2575 Expression::ToBinary(_) => "to_binary",
2576 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2577 Expression::Base64DecodeString(_) => "base64_decode_string",
2578 Expression::Base64Encode(_) => "base64_encode",
2579 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2580 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2581 Expression::GapFill(_) => "gap_fill",
2582 Expression::GenerateDateArray(_) => "generate_date_array",
2583 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2584 Expression::GetExtract(_) => "get_extract",
2585 Expression::Getbit(_) => "getbit",
2586 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2587 Expression::HexEncode(_) => "hex_encode",
2588 Expression::Compress(_) => "compress",
2589 Expression::DecompressBinary(_) => "decompress_binary",
2590 Expression::DecompressString(_) => "decompress_string",
2591 Expression::Xor(_) => "xor",
2592 Expression::Nullif(_) => "nullif",
2593 Expression::JSON(_) => "j_s_o_n",
2594 Expression::JSONPath(_) => "j_s_o_n_path",
2595 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2596 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2597 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2598 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2599 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2600 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2601 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2602 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2603 Expression::Format(_) => "format",
2604 Expression::JSONKeys(_) => "j_s_o_n_keys",
2605 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2606 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2607 Expression::JSONObject(_) => "j_s_o_n_object",
2608 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2609 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2610 Expression::JSONArray(_) => "j_s_o_n_array",
2611 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2612 Expression::JSONExists(_) => "j_s_o_n_exists",
2613 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2614 Expression::JSONSchema(_) => "j_s_o_n_schema",
2615 Expression::JSONSet(_) => "j_s_o_n_set",
2616 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2617 Expression::JSONValue(_) => "j_s_o_n_value",
2618 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2619 Expression::JSONRemove(_) => "j_s_o_n_remove",
2620 Expression::JSONTable(_) => "j_s_o_n_table",
2621 Expression::JSONType(_) => "j_s_o_n_type",
2622 Expression::ObjectInsert(_) => "object_insert",
2623 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2624 Expression::OpenJSON(_) => "open_j_s_o_n",
2625 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2626 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2627 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2628 Expression::JSONCast(_) => "j_s_o_n_cast",
2629 Expression::JSONExtract(_) => "j_s_o_n_extract",
2630 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2631 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2632 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2633 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2634 Expression::JSONFormat(_) => "j_s_o_n_format",
2635 Expression::JSONBool(_) => "j_s_o_n_bool",
2636 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2637 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2638 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2639 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2640 Expression::ParseJSON(_) => "parse_j_s_o_n",
2641 Expression::ParseUrl(_) => "parse_url",
2642 Expression::ParseIp(_) => "parse_ip",
2643 Expression::ParseTime(_) => "parse_time",
2644 Expression::ParseDatetime(_) => "parse_datetime",
2645 Expression::Map(_) => "map",
2646 Expression::MapCat(_) => "map_cat",
2647 Expression::MapDelete(_) => "map_delete",
2648 Expression::MapInsert(_) => "map_insert",
2649 Expression::MapPick(_) => "map_pick",
2650 Expression::ScopeResolution(_) => "scope_resolution",
2651 Expression::Slice(_) => "slice",
2652 Expression::VarMap(_) => "var_map",
2653 Expression::MatchAgainst(_) => "match_against",
2654 Expression::MD5Digest(_) => "m_d5_digest",
2655 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2656 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2657 Expression::Monthname(_) => "monthname",
2658 Expression::Ntile(_) => "ntile",
2659 Expression::Normalize(_) => "normalize",
2660 Expression::Normal(_) => "normal",
2661 Expression::Predict(_) => "predict",
2662 Expression::MLTranslate(_) => "m_l_translate",
2663 Expression::FeaturesAtTime(_) => "features_at_time",
2664 Expression::GenerateEmbedding(_) => "generate_embedding",
2665 Expression::MLForecast(_) => "m_l_forecast",
2666 Expression::ModelAttribute(_) => "model_attribute",
2667 Expression::VectorSearch(_) => "vector_search",
2668 Expression::Quantile(_) => "quantile",
2669 Expression::ApproxQuantile(_) => "approx_quantile",
2670 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2671 Expression::Randn(_) => "randn",
2672 Expression::Randstr(_) => "randstr",
2673 Expression::RangeN(_) => "range_n",
2674 Expression::RangeBucket(_) => "range_bucket",
2675 Expression::ReadCSV(_) => "read_c_s_v",
2676 Expression::ReadParquet(_) => "read_parquet",
2677 Expression::Reduce(_) => "reduce",
2678 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2679 Expression::RegexpILike(_) => "regexp_i_like",
2680 Expression::RegexpFullMatch(_) => "regexp_full_match",
2681 Expression::RegexpInstr(_) => "regexp_instr",
2682 Expression::RegexpSplit(_) => "regexp_split",
2683 Expression::RegexpCount(_) => "regexp_count",
2684 Expression::RegrValx(_) => "regr_valx",
2685 Expression::RegrValy(_) => "regr_valy",
2686 Expression::RegrAvgy(_) => "regr_avgy",
2687 Expression::RegrAvgx(_) => "regr_avgx",
2688 Expression::RegrCount(_) => "regr_count",
2689 Expression::RegrIntercept(_) => "regr_intercept",
2690 Expression::RegrR2(_) => "regr_r2",
2691 Expression::RegrSxx(_) => "regr_sxx",
2692 Expression::RegrSxy(_) => "regr_sxy",
2693 Expression::RegrSyy(_) => "regr_syy",
2694 Expression::RegrSlope(_) => "regr_slope",
2695 Expression::SafeAdd(_) => "safe_add",
2696 Expression::SafeDivide(_) => "safe_divide",
2697 Expression::SafeMultiply(_) => "safe_multiply",
2698 Expression::SafeSubtract(_) => "safe_subtract",
2699 Expression::SHA2(_) => "s_h_a2",
2700 Expression::SHA2Digest(_) => "s_h_a2_digest",
2701 Expression::SortArray(_) => "sort_array",
2702 Expression::SplitPart(_) => "split_part",
2703 Expression::SubstringIndex(_) => "substring_index",
2704 Expression::StandardHash(_) => "standard_hash",
2705 Expression::StrPosition(_) => "str_position",
2706 Expression::Search(_) => "search",
2707 Expression::SearchIp(_) => "search_ip",
2708 Expression::StrToDate(_) => "str_to_date",
2709 Expression::DateStrToDate(_) => "date_str_to_date",
2710 Expression::DateToDateStr(_) => "date_to_date_str",
2711 Expression::StrToTime(_) => "str_to_time",
2712 Expression::StrToUnix(_) => "str_to_unix",
2713 Expression::StrToMap(_) => "str_to_map",
2714 Expression::NumberToStr(_) => "number_to_str",
2715 Expression::FromBase(_) => "from_base",
2716 Expression::Stuff(_) => "stuff",
2717 Expression::TimeToStr(_) => "time_to_str",
2718 Expression::TimeStrToTime(_) => "time_str_to_time",
2719 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2720 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2721 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2722 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2723 Expression::Unhex(_) => "unhex",
2724 Expression::Uniform(_) => "uniform",
2725 Expression::UnixToStr(_) => "unix_to_str",
2726 Expression::UnixToTime(_) => "unix_to_time",
2727 Expression::Uuid(_) => "uuid",
2728 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2729 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2730 Expression::Corr(_) => "corr",
2731 Expression::WidthBucket(_) => "width_bucket",
2732 Expression::CovarSamp(_) => "covar_samp",
2733 Expression::CovarPop(_) => "covar_pop",
2734 Expression::Week(_) => "week",
2735 Expression::XMLElement(_) => "x_m_l_element",
2736 Expression::XMLGet(_) => "x_m_l_get",
2737 Expression::XMLTable(_) => "x_m_l_table",
2738 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2739 Expression::Zipf(_) => "zipf",
2740 Expression::Merge(_) => "merge",
2741 Expression::When(_) => "when",
2742 Expression::Whens(_) => "whens",
2743 Expression::NextValueFor(_) => "next_value_for",
2744 Expression::ReturnStmt(_) => "return_stmt",
2745 }
2746 }
2747
2748 pub fn get_this(&self) -> Option<&Expression> {
2750 match self {
2751 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2753 Expression::Upper(f)
2755 | Expression::Lower(f)
2756 | Expression::Length(f)
2757 | Expression::LTrim(f)
2758 | Expression::RTrim(f)
2759 | Expression::Reverse(f)
2760 | Expression::Abs(f)
2761 | Expression::Sqrt(f)
2762 | Expression::Cbrt(f)
2763 | Expression::Ln(f)
2764 | Expression::Exp(f)
2765 | Expression::Sign(f)
2766 | Expression::Date(f)
2767 | Expression::Time(f)
2768 | Expression::Initcap(f)
2769 | Expression::Ascii(f)
2770 | Expression::Chr(f)
2771 | Expression::Soundex(f)
2772 | Expression::ByteLength(f)
2773 | Expression::Hex(f)
2774 | Expression::LowerHex(f)
2775 | Expression::Unicode(f)
2776 | Expression::Typeof(f)
2777 | Expression::Explode(f)
2778 | Expression::ExplodeOuter(f)
2779 | Expression::MapFromEntries(f)
2780 | Expression::MapKeys(f)
2781 | Expression::MapValues(f)
2782 | Expression::ArrayLength(f)
2783 | Expression::ArraySize(f)
2784 | Expression::Cardinality(f)
2785 | Expression::ArrayReverse(f)
2786 | Expression::ArrayDistinct(f)
2787 | Expression::ArrayFlatten(f)
2788 | Expression::ArrayCompact(f)
2789 | Expression::ToArray(f)
2790 | Expression::JsonArrayLength(f)
2791 | Expression::JsonKeys(f)
2792 | Expression::JsonType(f)
2793 | Expression::ParseJson(f)
2794 | Expression::ToJson(f)
2795 | Expression::Radians(f)
2796 | Expression::Degrees(f)
2797 | Expression::Sin(f)
2798 | Expression::Cos(f)
2799 | Expression::Tan(f)
2800 | Expression::Asin(f)
2801 | Expression::Acos(f)
2802 | Expression::Atan(f)
2803 | Expression::IsNan(f)
2804 | Expression::IsInf(f)
2805 | Expression::Year(f)
2806 | Expression::Month(f)
2807 | Expression::Day(f)
2808 | Expression::Hour(f)
2809 | Expression::Minute(f)
2810 | Expression::Second(f)
2811 | Expression::DayOfWeek(f)
2812 | Expression::DayOfWeekIso(f)
2813 | Expression::DayOfMonth(f)
2814 | Expression::DayOfYear(f)
2815 | Expression::WeekOfYear(f)
2816 | Expression::Quarter(f)
2817 | Expression::Epoch(f)
2818 | Expression::EpochMs(f)
2819 | Expression::BitwiseCount(f)
2820 | Expression::DateFromUnixDate(f)
2821 | Expression::UnixDate(f)
2822 | Expression::UnixSeconds(f)
2823 | Expression::UnixMillis(f)
2824 | Expression::UnixMicros(f)
2825 | Expression::TimeStrToDate(f)
2826 | Expression::DateToDi(f)
2827 | Expression::DiToDate(f)
2828 | Expression::TsOrDiToDi(f)
2829 | Expression::TsOrDsToDatetime(f)
2830 | Expression::TsOrDsToTimestamp(f)
2831 | Expression::YearOfWeek(f)
2832 | Expression::YearOfWeekIso(f)
2833 | Expression::SHA(f)
2834 | Expression::SHA1Digest(f)
2835 | Expression::TimeToUnix(f)
2836 | Expression::TimeStrToUnix(f)
2837 | Expression::Int64(f)
2838 | Expression::JSONBool(f)
2839 | Expression::MD5NumberLower64(f)
2840 | Expression::MD5NumberUpper64(f)
2841 | Expression::DateStrToDate(f)
2842 | Expression::DateToDateStr(f) => Some(&f.this),
2843 Expression::Power(f)
2845 | Expression::NullIf(f)
2846 | Expression::IfNull(f)
2847 | Expression::Nvl(f)
2848 | Expression::Contains(f)
2849 | Expression::StartsWith(f)
2850 | Expression::EndsWith(f)
2851 | Expression::Levenshtein(f)
2852 | Expression::ModFunc(f)
2853 | Expression::IntDiv(f)
2854 | Expression::Atan2(f)
2855 | Expression::AddMonths(f)
2856 | Expression::MonthsBetween(f)
2857 | Expression::NextDay(f)
2858 | Expression::UnixToTimeStr(f)
2859 | Expression::ArrayContains(f)
2860 | Expression::ArrayPosition(f)
2861 | Expression::ArrayAppend(f)
2862 | Expression::ArrayPrepend(f)
2863 | Expression::ArrayUnion(f)
2864 | Expression::ArrayExcept(f)
2865 | Expression::ArrayRemove(f)
2866 | Expression::StarMap(f)
2867 | Expression::MapFromArrays(f)
2868 | Expression::MapContainsKey(f)
2869 | Expression::ElementAt(f)
2870 | Expression::JsonMergePatch(f)
2871 | Expression::JSONBContains(f)
2872 | Expression::JSONBExtract(f) => Some(&f.this),
2873 Expression::Sum(af)
2875 | Expression::Avg(af)
2876 | Expression::Min(af)
2877 | Expression::Max(af)
2878 | Expression::ArrayAgg(af)
2879 | Expression::CountIf(af)
2880 | Expression::Stddev(af)
2881 | Expression::StddevPop(af)
2882 | Expression::StddevSamp(af)
2883 | Expression::Variance(af)
2884 | Expression::VarPop(af)
2885 | Expression::VarSamp(af)
2886 | Expression::Median(af)
2887 | Expression::Mode(af)
2888 | Expression::First(af)
2889 | Expression::Last(af)
2890 | Expression::AnyValue(af)
2891 | Expression::ApproxDistinct(af)
2892 | Expression::ApproxCountDistinct(af)
2893 | Expression::LogicalAnd(af)
2894 | Expression::LogicalOr(af)
2895 | Expression::Skewness(af)
2896 | Expression::ArrayConcatAgg(af)
2897 | Expression::ArrayUniqueAgg(af)
2898 | Expression::BoolXorAgg(af)
2899 | Expression::BitwiseAndAgg(af)
2900 | Expression::BitwiseOrAgg(af)
2901 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2902 Expression::And(op)
2904 | Expression::Or(op)
2905 | Expression::Add(op)
2906 | Expression::Sub(op)
2907 | Expression::Mul(op)
2908 | Expression::Div(op)
2909 | Expression::Mod(op)
2910 | Expression::Eq(op)
2911 | Expression::Neq(op)
2912 | Expression::Lt(op)
2913 | Expression::Lte(op)
2914 | Expression::Gt(op)
2915 | Expression::Gte(op)
2916 | Expression::BitwiseAnd(op)
2917 | Expression::BitwiseOr(op)
2918 | Expression::BitwiseXor(op)
2919 | Expression::Concat(op)
2920 | Expression::Adjacent(op)
2921 | Expression::TsMatch(op)
2922 | Expression::PropertyEQ(op)
2923 | Expression::ArrayContainsAll(op)
2924 | Expression::ArrayContainedBy(op)
2925 | Expression::ArrayOverlaps(op)
2926 | Expression::JSONBContainsAllTopKeys(op)
2927 | Expression::JSONBContainsAnyTopKeys(op)
2928 | Expression::JSONBDeleteAtPath(op)
2929 | Expression::ExtendsLeft(op)
2930 | Expression::ExtendsRight(op)
2931 | Expression::Is(op)
2932 | Expression::MemberOf(op)
2933 | Expression::Match(op)
2934 | Expression::NullSafeEq(op)
2935 | Expression::NullSafeNeq(op)
2936 | Expression::Glob(op)
2937 | Expression::BitwiseLeftShift(op)
2938 | Expression::BitwiseRightShift(op) => Some(&op.left),
2939 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2941 Expression::Alias(a) => Some(&a.this),
2943 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2944 Expression::Paren(p) => Some(&p.this),
2945 Expression::Annotated(a) => Some(&a.this),
2946 Expression::Subquery(s) => Some(&s.this),
2947 Expression::Where(w) => Some(&w.this),
2948 Expression::Having(h) => Some(&h.this),
2949 Expression::Qualify(q) => Some(&q.this),
2950 Expression::IsNull(i) => Some(&i.this),
2951 Expression::Exists(e) => Some(&e.this),
2952 Expression::Ordered(o) => Some(&o.this),
2953 Expression::WindowFunction(wf) => Some(&wf.this),
2954 Expression::Cte(cte) => Some(&cte.this),
2955 Expression::Between(b) => Some(&b.this),
2956 Expression::In(i) => Some(&i.this),
2957 Expression::ReturnStmt(e) => Some(e),
2958 _ => None,
2959 }
2960 }
2961
2962 pub fn get_expression(&self) -> Option<&Expression> {
2964 match self {
2965 Expression::And(op)
2967 | Expression::Or(op)
2968 | Expression::Add(op)
2969 | Expression::Sub(op)
2970 | Expression::Mul(op)
2971 | Expression::Div(op)
2972 | Expression::Mod(op)
2973 | Expression::Eq(op)
2974 | Expression::Neq(op)
2975 | Expression::Lt(op)
2976 | Expression::Lte(op)
2977 | Expression::Gt(op)
2978 | Expression::Gte(op)
2979 | Expression::BitwiseAnd(op)
2980 | Expression::BitwiseOr(op)
2981 | Expression::BitwiseXor(op)
2982 | Expression::Concat(op)
2983 | Expression::Adjacent(op)
2984 | Expression::TsMatch(op)
2985 | Expression::PropertyEQ(op)
2986 | Expression::ArrayContainsAll(op)
2987 | Expression::ArrayContainedBy(op)
2988 | Expression::ArrayOverlaps(op)
2989 | Expression::JSONBContainsAllTopKeys(op)
2990 | Expression::JSONBContainsAnyTopKeys(op)
2991 | Expression::JSONBDeleteAtPath(op)
2992 | Expression::ExtendsLeft(op)
2993 | Expression::ExtendsRight(op)
2994 | Expression::Is(op)
2995 | Expression::MemberOf(op)
2996 | Expression::Match(op)
2997 | Expression::NullSafeEq(op)
2998 | Expression::NullSafeNeq(op)
2999 | Expression::Glob(op)
3000 | Expression::BitwiseLeftShift(op)
3001 | Expression::BitwiseRightShift(op) => Some(&op.right),
3002 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3004 Expression::Power(f)
3006 | Expression::NullIf(f)
3007 | Expression::IfNull(f)
3008 | Expression::Nvl(f)
3009 | Expression::Contains(f)
3010 | Expression::StartsWith(f)
3011 | Expression::EndsWith(f)
3012 | Expression::Levenshtein(f)
3013 | Expression::ModFunc(f)
3014 | Expression::IntDiv(f)
3015 | Expression::Atan2(f)
3016 | Expression::AddMonths(f)
3017 | Expression::MonthsBetween(f)
3018 | Expression::NextDay(f)
3019 | Expression::UnixToTimeStr(f)
3020 | Expression::ArrayContains(f)
3021 | Expression::ArrayPosition(f)
3022 | Expression::ArrayAppend(f)
3023 | Expression::ArrayPrepend(f)
3024 | Expression::ArrayUnion(f)
3025 | Expression::ArrayExcept(f)
3026 | Expression::ArrayRemove(f)
3027 | Expression::StarMap(f)
3028 | Expression::MapFromArrays(f)
3029 | Expression::MapContainsKey(f)
3030 | Expression::ElementAt(f)
3031 | Expression::JsonMergePatch(f)
3032 | Expression::JSONBContains(f)
3033 | Expression::JSONBExtract(f) => Some(&f.expression),
3034 _ => None,
3035 }
3036 }
3037
3038 pub fn get_expressions(&self) -> &[Expression] {
3040 match self {
3041 Expression::Select(s) => &s.expressions,
3042 Expression::Function(f) => &f.args,
3043 Expression::AggregateFunction(f) => &f.args,
3044 Expression::From(f) => &f.expressions,
3045 Expression::GroupBy(g) => &g.expressions,
3046 Expression::In(i) => &i.expressions,
3047 Expression::Array(a) => &a.expressions,
3048 Expression::Tuple(t) => &t.expressions,
3049 Expression::Coalesce(f)
3050 | Expression::Greatest(f)
3051 | Expression::Least(f)
3052 | Expression::ArrayConcat(f)
3053 | Expression::ArrayIntersect(f)
3054 | Expression::ArrayZip(f)
3055 | Expression::MapConcat(f)
3056 | Expression::JsonArray(f) => &f.expressions,
3057 _ => &[],
3058 }
3059 }
3060
3061 pub fn get_name(&self) -> &str {
3063 match self {
3064 Expression::Identifier(id) => &id.name,
3065 Expression::Column(col) => &col.name.name,
3066 Expression::Table(t) => &t.name.name,
3067 Expression::Literal(lit) => lit.value_str(),
3068 Expression::Star(_) => "*",
3069 Expression::Function(f) => &f.name,
3070 Expression::AggregateFunction(f) => &f.name,
3071 Expression::Alias(a) => a.this.get_name(),
3072 Expression::Boolean(b) => {
3073 if b.value {
3074 "TRUE"
3075 } else {
3076 "FALSE"
3077 }
3078 }
3079 Expression::Null(_) => "NULL",
3080 _ => "",
3081 }
3082 }
3083
3084 pub fn get_alias(&self) -> &str {
3086 match self {
3087 Expression::Alias(a) => &a.alias.name,
3088 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3089 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3090 _ => "",
3091 }
3092 }
3093
3094 pub fn get_output_name(&self) -> &str {
3096 match self {
3097 Expression::Alias(a) => &a.alias.name,
3098 Expression::Column(c) => &c.name.name,
3099 Expression::Identifier(id) => &id.name,
3100 Expression::Literal(lit) => lit.value_str(),
3101 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3102 Expression::Star(_) => "*",
3103 _ => "",
3104 }
3105 }
3106
3107 pub fn get_comments(&self) -> Vec<&str> {
3109 match self {
3110 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3111 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3112 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3113 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3114 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3115 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3116 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3117 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3118 }
3119 Expression::And(op)
3120 | Expression::Or(op)
3121 | Expression::Add(op)
3122 | Expression::Sub(op)
3123 | Expression::Mul(op)
3124 | Expression::Div(op)
3125 | Expression::Mod(op)
3126 | Expression::Eq(op)
3127 | Expression::Neq(op)
3128 | Expression::Lt(op)
3129 | Expression::Lte(op)
3130 | Expression::Gt(op)
3131 | Expression::Gte(op)
3132 | Expression::Concat(op)
3133 | Expression::BitwiseAnd(op)
3134 | Expression::BitwiseOr(op)
3135 | Expression::BitwiseXor(op) => {
3136 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3137 }
3138 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3139 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3140 _ => Vec::new(),
3141 }
3142 }
3143}
3144
3145impl fmt::Display for Expression {
3146 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3147 match self {
3149 Expression::Literal(lit) => write!(f, "{}", lit),
3150 Expression::Identifier(id) => write!(f, "{}", id),
3151 Expression::Column(col) => write!(f, "{}", col),
3152 Expression::Star(_) => write!(f, "*"),
3153 Expression::Null(_) => write!(f, "NULL"),
3154 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3155 Expression::Select(_) => write!(f, "SELECT ..."),
3156 _ => write!(f, "{:?}", self),
3157 }
3158 }
3159}
3160
3161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3171#[cfg_attr(feature = "bindings", derive(TS))]
3172#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3173pub enum Literal {
3174 String(String),
3176 Number(String),
3178 HexString(String),
3180 HexNumber(String),
3182 BitString(String),
3183 ByteString(String),
3185 NationalString(String),
3187 Date(String),
3189 Time(String),
3191 Timestamp(String),
3193 Datetime(String),
3195 TripleQuotedString(String, char),
3198 EscapeString(String),
3200 DollarString(String),
3202 RawString(String),
3206}
3207
3208impl Literal {
3209 pub fn value_str(&self) -> &str {
3211 match self {
3212 Literal::String(s)
3213 | Literal::Number(s)
3214 | Literal::HexString(s)
3215 | Literal::HexNumber(s)
3216 | Literal::BitString(s)
3217 | Literal::ByteString(s)
3218 | Literal::NationalString(s)
3219 | Literal::Date(s)
3220 | Literal::Time(s)
3221 | Literal::Timestamp(s)
3222 | Literal::Datetime(s)
3223 | Literal::EscapeString(s)
3224 | Literal::DollarString(s)
3225 | Literal::RawString(s) => s.as_str(),
3226 Literal::TripleQuotedString(s, _) => s.as_str(),
3227 }
3228 }
3229
3230 pub fn is_string(&self) -> bool {
3232 matches!(
3233 self,
3234 Literal::String(_)
3235 | Literal::NationalString(_)
3236 | Literal::EscapeString(_)
3237 | Literal::DollarString(_)
3238 | Literal::RawString(_)
3239 | Literal::TripleQuotedString(_, _)
3240 )
3241 }
3242
3243 pub fn is_number(&self) -> bool {
3245 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3246 }
3247}
3248
3249impl fmt::Display for Literal {
3250 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3251 match self {
3252 Literal::String(s) => write!(f, "'{}'", s),
3253 Literal::Number(n) => write!(f, "{}", n),
3254 Literal::HexString(h) => write!(f, "X'{}'", h),
3255 Literal::HexNumber(h) => write!(f, "0x{}", h),
3256 Literal::BitString(b) => write!(f, "B'{}'", b),
3257 Literal::ByteString(b) => write!(f, "b'{}'", b),
3258 Literal::NationalString(s) => write!(f, "N'{}'", s),
3259 Literal::Date(d) => write!(f, "DATE '{}'", d),
3260 Literal::Time(t) => write!(f, "TIME '{}'", t),
3261 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3262 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3263 Literal::TripleQuotedString(s, q) => {
3264 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3265 }
3266 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3267 Literal::DollarString(s) => write!(f, "$${}$$", s),
3268 Literal::RawString(s) => write!(f, "r'{}'", s),
3269 }
3270 }
3271}
3272
3273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3275#[cfg_attr(feature = "bindings", derive(TS))]
3276pub struct BooleanLiteral {
3277 pub value: bool,
3278}
3279
3280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3282#[cfg_attr(feature = "bindings", derive(TS))]
3283pub struct Null;
3284
3285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3292#[cfg_attr(feature = "bindings", derive(TS))]
3293pub struct Identifier {
3294 pub name: String,
3296 pub quoted: bool,
3298 #[serde(default)]
3299 pub trailing_comments: Vec<String>,
3300 #[serde(default, skip_serializing_if = "Option::is_none")]
3302 pub span: Option<Span>,
3303}
3304
3305impl Identifier {
3306 pub fn new(name: impl Into<String>) -> Self {
3307 Self {
3308 name: name.into(),
3309 quoted: false,
3310 trailing_comments: Vec::new(),
3311 span: None,
3312 }
3313 }
3314
3315 pub fn quoted(name: impl Into<String>) -> Self {
3316 Self {
3317 name: name.into(),
3318 quoted: true,
3319 trailing_comments: Vec::new(),
3320 span: None,
3321 }
3322 }
3323
3324 pub fn empty() -> Self {
3325 Self {
3326 name: String::new(),
3327 quoted: false,
3328 trailing_comments: Vec::new(),
3329 span: None,
3330 }
3331 }
3332
3333 pub fn is_empty(&self) -> bool {
3334 self.name.is_empty()
3335 }
3336
3337 pub fn with_span(mut self, span: Span) -> Self {
3339 self.span = Some(span);
3340 self
3341 }
3342}
3343
3344impl fmt::Display for Identifier {
3345 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3346 if self.quoted {
3347 write!(f, "\"{}\"", self.name)
3348 } else {
3349 write!(f, "{}", self.name)
3350 }
3351 }
3352}
3353
3354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3360#[cfg_attr(feature = "bindings", derive(TS))]
3361pub struct Column {
3362 pub name: Identifier,
3364 pub table: Option<Identifier>,
3366 #[serde(default)]
3368 pub join_mark: bool,
3369 #[serde(default)]
3371 pub trailing_comments: Vec<String>,
3372 #[serde(default, skip_serializing_if = "Option::is_none")]
3374 pub span: Option<Span>,
3375 #[serde(default, skip_serializing_if = "Option::is_none")]
3377 pub inferred_type: Option<DataType>,
3378}
3379
3380impl fmt::Display for Column {
3381 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3382 if let Some(table) = &self.table {
3383 write!(f, "{}.{}", table, self.name)
3384 } else {
3385 write!(f, "{}", self.name)
3386 }
3387 }
3388}
3389
3390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3397#[cfg_attr(feature = "bindings", derive(TS))]
3398pub struct TableRef {
3399 pub name: Identifier,
3401 pub schema: Option<Identifier>,
3403 pub catalog: Option<Identifier>,
3405 pub alias: Option<Identifier>,
3407 #[serde(default)]
3409 pub alias_explicit_as: bool,
3410 #[serde(default)]
3412 pub column_aliases: Vec<Identifier>,
3413 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3415 pub leading_comments: Vec<String>,
3416 #[serde(default)]
3418 pub trailing_comments: Vec<String>,
3419 #[serde(default)]
3421 pub when: Option<Box<HistoricalData>>,
3422 #[serde(default)]
3424 pub only: bool,
3425 #[serde(default)]
3427 pub final_: bool,
3428 #[serde(default, skip_serializing_if = "Option::is_none")]
3430 pub table_sample: Option<Box<Sample>>,
3431 #[serde(default)]
3433 pub hints: Vec<Expression>,
3434 #[serde(default, skip_serializing_if = "Option::is_none")]
3437 pub system_time: Option<String>,
3438 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3440 pub partitions: Vec<Identifier>,
3441 #[serde(default, skip_serializing_if = "Option::is_none")]
3444 pub identifier_func: Option<Box<Expression>>,
3445 #[serde(default, skip_serializing_if = "Option::is_none")]
3447 pub changes: Option<Box<Changes>>,
3448 #[serde(default, skip_serializing_if = "Option::is_none")]
3450 pub version: Option<Box<Version>>,
3451 #[serde(default, skip_serializing_if = "Option::is_none")]
3453 pub span: Option<Span>,
3454}
3455
3456impl TableRef {
3457 pub fn new(name: impl Into<String>) -> Self {
3458 Self {
3459 name: Identifier::new(name),
3460 schema: None,
3461 catalog: None,
3462 alias: None,
3463 alias_explicit_as: false,
3464 column_aliases: Vec::new(),
3465 leading_comments: Vec::new(),
3466 trailing_comments: Vec::new(),
3467 when: None,
3468 only: false,
3469 final_: false,
3470 table_sample: None,
3471 hints: Vec::new(),
3472 system_time: None,
3473 partitions: Vec::new(),
3474 identifier_func: None,
3475 changes: None,
3476 version: None,
3477 span: None,
3478 }
3479 }
3480
3481 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3483 let mut t = Self::new(name);
3484 t.schema = Some(Identifier::new(schema));
3485 t
3486 }
3487
3488 pub fn new_with_catalog(
3490 name: impl Into<String>,
3491 schema: impl Into<String>,
3492 catalog: impl Into<String>,
3493 ) -> Self {
3494 let mut t = Self::new(name);
3495 t.schema = Some(Identifier::new(schema));
3496 t.catalog = Some(Identifier::new(catalog));
3497 t
3498 }
3499
3500 pub fn from_identifier(name: Identifier) -> Self {
3502 Self {
3503 name,
3504 schema: None,
3505 catalog: None,
3506 alias: None,
3507 alias_explicit_as: false,
3508 column_aliases: Vec::new(),
3509 leading_comments: Vec::new(),
3510 trailing_comments: Vec::new(),
3511 when: None,
3512 only: false,
3513 final_: false,
3514 table_sample: None,
3515 hints: Vec::new(),
3516 system_time: None,
3517 partitions: Vec::new(),
3518 identifier_func: None,
3519 changes: None,
3520 version: None,
3521 span: None,
3522 }
3523 }
3524
3525 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3526 self.alias = Some(Identifier::new(alias));
3527 self
3528 }
3529
3530 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3531 self.schema = Some(Identifier::new(schema));
3532 self
3533 }
3534}
3535
3536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3541#[cfg_attr(feature = "bindings", derive(TS))]
3542pub struct Star {
3543 pub table: Option<Identifier>,
3545 pub except: Option<Vec<Identifier>>,
3547 pub replace: Option<Vec<Alias>>,
3549 pub rename: Option<Vec<(Identifier, Identifier)>>,
3551 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3553 pub trailing_comments: Vec<String>,
3554 #[serde(default, skip_serializing_if = "Option::is_none")]
3556 pub span: Option<Span>,
3557}
3558
3559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3583#[cfg_attr(feature = "bindings", derive(TS))]
3584pub struct Select {
3585 pub expressions: Vec<Expression>,
3587 pub from: Option<From>,
3589 pub joins: Vec<Join>,
3591 pub lateral_views: Vec<LateralView>,
3592 #[serde(default, skip_serializing_if = "Option::is_none")]
3594 pub prewhere: Option<Expression>,
3595 pub where_clause: Option<Where>,
3596 pub group_by: Option<GroupBy>,
3597 pub having: Option<Having>,
3598 pub qualify: Option<Qualify>,
3599 pub order_by: Option<OrderBy>,
3600 pub distribute_by: Option<DistributeBy>,
3601 pub cluster_by: Option<ClusterBy>,
3602 pub sort_by: Option<SortBy>,
3603 pub limit: Option<Limit>,
3604 pub offset: Option<Offset>,
3605 #[serde(default, skip_serializing_if = "Option::is_none")]
3607 pub limit_by: Option<Vec<Expression>>,
3608 pub fetch: Option<Fetch>,
3609 pub distinct: bool,
3610 pub distinct_on: Option<Vec<Expression>>,
3611 pub top: Option<Top>,
3612 pub with: Option<With>,
3613 pub sample: Option<Sample>,
3614 #[serde(default, skip_serializing_if = "Option::is_none")]
3616 pub settings: Option<Vec<Expression>>,
3617 #[serde(default, skip_serializing_if = "Option::is_none")]
3619 pub format: Option<Expression>,
3620 pub windows: Option<Vec<NamedWindow>>,
3621 pub hint: Option<Hint>,
3622 pub connect: Option<Connect>,
3624 pub into: Option<SelectInto>,
3626 #[serde(default)]
3628 pub locks: Vec<Lock>,
3629 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3631 pub for_xml: Vec<Expression>,
3632 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub for_json: Vec<Expression>,
3635 #[serde(default)]
3637 pub leading_comments: Vec<String>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3641 pub post_select_comments: Vec<String>,
3642 #[serde(default, skip_serializing_if = "Option::is_none")]
3644 pub kind: Option<String>,
3645 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3647 pub operation_modifiers: Vec<String>,
3648 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3650 pub qualify_after_window: bool,
3651 #[serde(default, skip_serializing_if = "Option::is_none")]
3653 pub option: Option<String>,
3654 #[serde(default, skip_serializing_if = "Option::is_none")]
3657 pub exclude: Option<Vec<Expression>>,
3658}
3659
3660impl Select {
3661 pub fn new() -> Self {
3662 Self {
3663 expressions: Vec::new(),
3664 from: None,
3665 joins: Vec::new(),
3666 lateral_views: Vec::new(),
3667 prewhere: None,
3668 where_clause: None,
3669 group_by: None,
3670 having: None,
3671 qualify: None,
3672 order_by: None,
3673 distribute_by: None,
3674 cluster_by: None,
3675 sort_by: None,
3676 limit: None,
3677 offset: None,
3678 limit_by: None,
3679 fetch: None,
3680 distinct: false,
3681 distinct_on: None,
3682 top: None,
3683 with: None,
3684 sample: None,
3685 settings: None,
3686 format: None,
3687 windows: None,
3688 hint: None,
3689 connect: None,
3690 into: None,
3691 locks: Vec::new(),
3692 for_xml: Vec::new(),
3693 for_json: Vec::new(),
3694 leading_comments: Vec::new(),
3695 post_select_comments: Vec::new(),
3696 kind: None,
3697 operation_modifiers: Vec::new(),
3698 qualify_after_window: false,
3699 option: None,
3700 exclude: None,
3701 }
3702 }
3703
3704 pub fn column(mut self, expr: Expression) -> Self {
3706 self.expressions.push(expr);
3707 self
3708 }
3709
3710 pub fn from(mut self, table: Expression) -> Self {
3712 self.from = Some(From {
3713 expressions: vec![table],
3714 });
3715 self
3716 }
3717
3718 pub fn where_(mut self, condition: Expression) -> Self {
3720 self.where_clause = Some(Where { this: condition });
3721 self
3722 }
3723
3724 pub fn distinct(mut self) -> Self {
3726 self.distinct = true;
3727 self
3728 }
3729
3730 pub fn join(mut self, join: Join) -> Self {
3732 self.joins.push(join);
3733 self
3734 }
3735
3736 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3738 self.order_by = Some(OrderBy {
3739 expressions,
3740 siblings: false,
3741 comments: Vec::new(),
3742 });
3743 self
3744 }
3745
3746 pub fn limit(mut self, n: Expression) -> Self {
3748 self.limit = Some(Limit {
3749 this: n,
3750 percent: false,
3751 comments: Vec::new(),
3752 });
3753 self
3754 }
3755
3756 pub fn offset(mut self, n: Expression) -> Self {
3758 self.offset = Some(Offset {
3759 this: n,
3760 rows: None,
3761 });
3762 self
3763 }
3764}
3765
3766impl Default for Select {
3767 fn default() -> Self {
3768 Self::new()
3769 }
3770}
3771
3772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3778#[cfg_attr(feature = "bindings", derive(TS))]
3779pub struct Union {
3780 pub left: Expression,
3782 pub right: Expression,
3784 pub all: bool,
3786 #[serde(default)]
3788 pub distinct: bool,
3789 pub with: Option<With>,
3791 pub order_by: Option<OrderBy>,
3793 pub limit: Option<Box<Expression>>,
3795 pub offset: Option<Box<Expression>>,
3797 #[serde(default, skip_serializing_if = "Option::is_none")]
3799 pub distribute_by: Option<DistributeBy>,
3800 #[serde(default, skip_serializing_if = "Option::is_none")]
3802 pub sort_by: Option<SortBy>,
3803 #[serde(default, skip_serializing_if = "Option::is_none")]
3805 pub cluster_by: Option<ClusterBy>,
3806 #[serde(default)]
3808 pub by_name: bool,
3809 #[serde(default, skip_serializing_if = "Option::is_none")]
3811 pub side: Option<String>,
3812 #[serde(default, skip_serializing_if = "Option::is_none")]
3814 pub kind: Option<String>,
3815 #[serde(default)]
3817 pub corresponding: bool,
3818 #[serde(default)]
3820 pub strict: bool,
3821 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3823 pub on_columns: Vec<Expression>,
3824}
3825
3826impl Drop for Union {
3829 fn drop(&mut self) {
3830 loop {
3831 if let Expression::Union(ref mut inner) = self.left {
3832 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3833 let old_left = std::mem::replace(&mut self.left, next_left);
3834 drop(old_left);
3835 } else {
3836 break;
3837 }
3838 }
3839 }
3840}
3841
3842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3847#[cfg_attr(feature = "bindings", derive(TS))]
3848pub struct Intersect {
3849 pub left: Expression,
3851 pub right: Expression,
3853 pub all: bool,
3855 #[serde(default)]
3857 pub distinct: bool,
3858 pub with: Option<With>,
3860 pub order_by: Option<OrderBy>,
3862 pub limit: Option<Box<Expression>>,
3864 pub offset: Option<Box<Expression>>,
3866 #[serde(default, skip_serializing_if = "Option::is_none")]
3868 pub distribute_by: Option<DistributeBy>,
3869 #[serde(default, skip_serializing_if = "Option::is_none")]
3871 pub sort_by: Option<SortBy>,
3872 #[serde(default, skip_serializing_if = "Option::is_none")]
3874 pub cluster_by: Option<ClusterBy>,
3875 #[serde(default)]
3877 pub by_name: bool,
3878 #[serde(default, skip_serializing_if = "Option::is_none")]
3880 pub side: Option<String>,
3881 #[serde(default, skip_serializing_if = "Option::is_none")]
3883 pub kind: Option<String>,
3884 #[serde(default)]
3886 pub corresponding: bool,
3887 #[serde(default)]
3889 pub strict: bool,
3890 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3892 pub on_columns: Vec<Expression>,
3893}
3894
3895impl Drop for Intersect {
3896 fn drop(&mut self) {
3897 loop {
3898 if let Expression::Intersect(ref mut inner) = self.left {
3899 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3900 let old_left = std::mem::replace(&mut self.left, next_left);
3901 drop(old_left);
3902 } else {
3903 break;
3904 }
3905 }
3906 }
3907}
3908
3909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3914#[cfg_attr(feature = "bindings", derive(TS))]
3915pub struct Except {
3916 pub left: Expression,
3918 pub right: Expression,
3920 pub all: bool,
3922 #[serde(default)]
3924 pub distinct: bool,
3925 pub with: Option<With>,
3927 pub order_by: Option<OrderBy>,
3929 pub limit: Option<Box<Expression>>,
3931 pub offset: Option<Box<Expression>>,
3933 #[serde(default, skip_serializing_if = "Option::is_none")]
3935 pub distribute_by: Option<DistributeBy>,
3936 #[serde(default, skip_serializing_if = "Option::is_none")]
3938 pub sort_by: Option<SortBy>,
3939 #[serde(default, skip_serializing_if = "Option::is_none")]
3941 pub cluster_by: Option<ClusterBy>,
3942 #[serde(default)]
3944 pub by_name: bool,
3945 #[serde(default, skip_serializing_if = "Option::is_none")]
3947 pub side: Option<String>,
3948 #[serde(default, skip_serializing_if = "Option::is_none")]
3950 pub kind: Option<String>,
3951 #[serde(default)]
3953 pub corresponding: bool,
3954 #[serde(default)]
3956 pub strict: bool,
3957 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3959 pub on_columns: Vec<Expression>,
3960}
3961
3962impl Drop for Except {
3963 fn drop(&mut self) {
3964 loop {
3965 if let Expression::Except(ref mut inner) = self.left {
3966 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3967 let old_left = std::mem::replace(&mut self.left, next_left);
3968 drop(old_left);
3969 } else {
3970 break;
3971 }
3972 }
3973 }
3974}
3975
3976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3978#[cfg_attr(feature = "bindings", derive(TS))]
3979pub struct SelectInto {
3980 pub this: Expression,
3982 #[serde(default)]
3984 pub temporary: bool,
3985 #[serde(default)]
3987 pub unlogged: bool,
3988 #[serde(default)]
3990 pub bulk_collect: bool,
3991 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3993 pub expressions: Vec<Expression>,
3994}
3995
3996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4006#[cfg_attr(feature = "bindings", derive(TS))]
4007pub struct Subquery {
4008 pub this: Expression,
4010 pub alias: Option<Identifier>,
4012 pub column_aliases: Vec<Identifier>,
4014 pub order_by: Option<OrderBy>,
4016 pub limit: Option<Limit>,
4018 pub offset: Option<Offset>,
4020 #[serde(default, skip_serializing_if = "Option::is_none")]
4022 pub distribute_by: Option<DistributeBy>,
4023 #[serde(default, skip_serializing_if = "Option::is_none")]
4025 pub sort_by: Option<SortBy>,
4026 #[serde(default, skip_serializing_if = "Option::is_none")]
4028 pub cluster_by: Option<ClusterBy>,
4029 #[serde(default)]
4031 pub lateral: bool,
4032 #[serde(default)]
4036 pub modifiers_inside: bool,
4037 #[serde(default)]
4039 pub trailing_comments: Vec<String>,
4040 #[serde(default, skip_serializing_if = "Option::is_none")]
4042 pub inferred_type: Option<DataType>,
4043}
4044
4045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4050#[cfg_attr(feature = "bindings", derive(TS))]
4051pub struct PipeOperator {
4052 pub this: Expression,
4054 pub expression: Expression,
4056}
4057
4058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4060#[cfg_attr(feature = "bindings", derive(TS))]
4061pub struct Values {
4062 pub expressions: Vec<Tuple>,
4064 pub alias: Option<Identifier>,
4066 pub column_aliases: Vec<Identifier>,
4068}
4069
4070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4080#[cfg_attr(feature = "bindings", derive(TS))]
4081pub struct Pivot {
4082 pub this: Expression,
4084 #[serde(default)]
4087 pub expressions: Vec<Expression>,
4088 #[serde(default)]
4090 pub fields: Vec<Expression>,
4091 #[serde(default)]
4093 pub using: Vec<Expression>,
4094 #[serde(default)]
4096 pub group: Option<Box<Expression>>,
4097 #[serde(default)]
4099 pub unpivot: bool,
4100 #[serde(default)]
4102 pub into: Option<Box<Expression>>,
4103 #[serde(default)]
4105 pub alias: Option<Identifier>,
4106 #[serde(default)]
4108 pub include_nulls: Option<bool>,
4109 #[serde(default)]
4111 pub default_on_null: Option<Box<Expression>>,
4112 #[serde(default, skip_serializing_if = "Option::is_none")]
4114 pub with: Option<With>,
4115}
4116
4117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4119#[cfg_attr(feature = "bindings", derive(TS))]
4120pub struct Unpivot {
4121 pub this: Expression,
4122 pub value_column: Identifier,
4123 pub name_column: Identifier,
4124 pub columns: Vec<Expression>,
4125 pub alias: Option<Identifier>,
4126 #[serde(default)]
4128 pub value_column_parenthesized: bool,
4129 #[serde(default)]
4131 pub include_nulls: Option<bool>,
4132 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4134 pub extra_value_columns: Vec<Identifier>,
4135}
4136
4137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4140#[cfg_attr(feature = "bindings", derive(TS))]
4141pub struct PivotAlias {
4142 pub this: Expression,
4143 pub alias: Expression,
4144}
4145
4146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4148#[cfg_attr(feature = "bindings", derive(TS))]
4149pub struct PreWhere {
4150 pub this: Expression,
4151}
4152
4153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4155#[cfg_attr(feature = "bindings", derive(TS))]
4156pub struct Stream {
4157 pub this: Expression,
4158 #[serde(skip_serializing_if = "Option::is_none")]
4159 pub on: Option<Expression>,
4160 #[serde(skip_serializing_if = "Option::is_none")]
4161 pub show_initial_rows: Option<bool>,
4162}
4163
4164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4166#[cfg_attr(feature = "bindings", derive(TS))]
4167pub struct UsingData {
4168 pub this: Expression,
4169}
4170
4171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4173#[cfg_attr(feature = "bindings", derive(TS))]
4174pub struct XmlNamespace {
4175 pub this: Expression,
4176 #[serde(skip_serializing_if = "Option::is_none")]
4177 pub alias: Option<Identifier>,
4178}
4179
4180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4182#[cfg_attr(feature = "bindings", derive(TS))]
4183pub struct RowFormat {
4184 pub delimited: bool,
4185 pub fields_terminated_by: Option<String>,
4186 pub collection_items_terminated_by: Option<String>,
4187 pub map_keys_terminated_by: Option<String>,
4188 pub lines_terminated_by: Option<String>,
4189 pub null_defined_as: Option<String>,
4190}
4191
4192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4194#[cfg_attr(feature = "bindings", derive(TS))]
4195pub struct DirectoryInsert {
4196 pub local: bool,
4197 pub path: String,
4198 pub row_format: Option<RowFormat>,
4199 #[serde(default)]
4201 pub stored_as: Option<String>,
4202}
4203
4204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4206#[cfg_attr(feature = "bindings", derive(TS))]
4207pub struct Insert {
4208 pub table: TableRef,
4209 pub columns: Vec<Identifier>,
4210 pub values: Vec<Vec<Expression>>,
4211 pub query: Option<Expression>,
4212 pub overwrite: bool,
4214 pub partition: Vec<(Identifier, Option<Expression>)>,
4216 #[serde(default)]
4218 pub directory: Option<DirectoryInsert>,
4219 #[serde(default)]
4221 pub returning: Vec<Expression>,
4222 #[serde(default)]
4224 pub output: Option<OutputClause>,
4225 #[serde(default)]
4227 pub on_conflict: Option<Box<Expression>>,
4228 #[serde(default)]
4230 pub leading_comments: Vec<String>,
4231 #[serde(default)]
4233 pub if_exists: bool,
4234 #[serde(default)]
4236 pub with: Option<With>,
4237 #[serde(default)]
4239 pub ignore: bool,
4240 #[serde(default)]
4242 pub source_alias: Option<Identifier>,
4243 #[serde(default)]
4245 pub alias: Option<Identifier>,
4246 #[serde(default)]
4248 pub alias_explicit_as: bool,
4249 #[serde(default)]
4251 pub default_values: bool,
4252 #[serde(default)]
4254 pub by_name: bool,
4255 #[serde(default, skip_serializing_if = "Option::is_none")]
4257 pub conflict_action: Option<String>,
4258 #[serde(default)]
4260 pub is_replace: bool,
4261 #[serde(default, skip_serializing_if = "Option::is_none")]
4263 pub hint: Option<Hint>,
4264 #[serde(default)]
4266 pub replace_where: Option<Box<Expression>>,
4267 #[serde(default)]
4269 pub source: Option<Box<Expression>>,
4270 #[serde(default, skip_serializing_if = "Option::is_none")]
4272 pub function_target: Option<Box<Expression>>,
4273 #[serde(default, skip_serializing_if = "Option::is_none")]
4275 pub partition_by: Option<Box<Expression>>,
4276 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4278 pub settings: Vec<Expression>,
4279}
4280
4281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4283#[cfg_attr(feature = "bindings", derive(TS))]
4284pub struct OutputClause {
4285 pub columns: Vec<Expression>,
4287 #[serde(default)]
4289 pub into_table: Option<Expression>,
4290}
4291
4292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4294#[cfg_attr(feature = "bindings", derive(TS))]
4295pub struct Update {
4296 pub table: TableRef,
4297 #[serde(default)]
4298 pub hint: Option<Hint>,
4299 #[serde(default)]
4301 pub extra_tables: Vec<TableRef>,
4302 #[serde(default)]
4304 pub table_joins: Vec<Join>,
4305 pub set: Vec<(Identifier, Expression)>,
4306 pub from_clause: Option<From>,
4307 #[serde(default)]
4309 pub from_joins: Vec<Join>,
4310 pub where_clause: Option<Where>,
4311 #[serde(default)]
4313 pub returning: Vec<Expression>,
4314 #[serde(default)]
4316 pub output: Option<OutputClause>,
4317 #[serde(default)]
4319 pub with: Option<With>,
4320 #[serde(default)]
4322 pub leading_comments: Vec<String>,
4323 #[serde(default)]
4325 pub limit: Option<Expression>,
4326 #[serde(default)]
4328 pub order_by: Option<OrderBy>,
4329 #[serde(default)]
4331 pub from_before_set: bool,
4332}
4333
4334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4336#[cfg_attr(feature = "bindings", derive(TS))]
4337pub struct Delete {
4338 pub table: TableRef,
4339 #[serde(default)]
4340 pub hint: Option<Hint>,
4341 #[serde(default, skip_serializing_if = "Option::is_none")]
4343 pub on_cluster: Option<OnCluster>,
4344 pub alias: Option<Identifier>,
4346 #[serde(default)]
4348 pub alias_explicit_as: bool,
4349 pub using: Vec<TableRef>,
4351 pub where_clause: Option<Where>,
4352 #[serde(default)]
4354 pub output: Option<OutputClause>,
4355 #[serde(default)]
4357 pub leading_comments: Vec<String>,
4358 #[serde(default)]
4360 pub with: Option<With>,
4361 #[serde(default)]
4363 pub limit: Option<Expression>,
4364 #[serde(default)]
4366 pub order_by: Option<OrderBy>,
4367 #[serde(default)]
4369 pub returning: Vec<Expression>,
4370 #[serde(default)]
4373 pub tables: Vec<TableRef>,
4374 #[serde(default)]
4377 pub tables_from_using: bool,
4378 #[serde(default)]
4380 pub joins: Vec<Join>,
4381 #[serde(default)]
4383 pub force_index: Option<String>,
4384 #[serde(default)]
4386 pub no_from: bool,
4387}
4388
4389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4391#[cfg_attr(feature = "bindings", derive(TS))]
4392pub struct CopyStmt {
4393 pub this: Expression,
4395 pub kind: bool,
4397 pub files: Vec<Expression>,
4399 #[serde(default)]
4401 pub params: Vec<CopyParameter>,
4402 #[serde(default)]
4404 pub credentials: Option<Box<Credentials>>,
4405 #[serde(default)]
4407 pub is_into: bool,
4408 #[serde(default)]
4410 pub with_wrapped: bool,
4411}
4412
4413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4415#[cfg_attr(feature = "bindings", derive(TS))]
4416pub struct CopyParameter {
4417 pub name: String,
4418 pub value: Option<Expression>,
4419 pub values: Vec<Expression>,
4420 #[serde(default)]
4422 pub eq: bool,
4423}
4424
4425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4427#[cfg_attr(feature = "bindings", derive(TS))]
4428pub struct Credentials {
4429 pub credentials: Vec<(String, String)>,
4430 pub encryption: Option<String>,
4431 pub storage: Option<String>,
4432}
4433
4434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4436#[cfg_attr(feature = "bindings", derive(TS))]
4437pub struct PutStmt {
4438 pub source: String,
4440 #[serde(default)]
4442 pub source_quoted: bool,
4443 pub target: Expression,
4445 #[serde(default)]
4447 pub params: Vec<CopyParameter>,
4448}
4449
4450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4452#[cfg_attr(feature = "bindings", derive(TS))]
4453pub struct StageReference {
4454 pub name: String,
4456 #[serde(default)]
4458 pub path: Option<String>,
4459 #[serde(default)]
4461 pub file_format: Option<Expression>,
4462 #[serde(default)]
4464 pub pattern: Option<String>,
4465 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4467 pub quoted: bool,
4468}
4469
4470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4472#[cfg_attr(feature = "bindings", derive(TS))]
4473pub struct HistoricalData {
4474 pub this: Box<Expression>,
4476 pub kind: String,
4478 pub expression: Box<Expression>,
4480}
4481
4482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4487#[cfg_attr(feature = "bindings", derive(TS))]
4488pub struct Alias {
4489 pub this: Expression,
4491 pub alias: Identifier,
4493 #[serde(default)]
4495 pub column_aliases: Vec<Identifier>,
4496 #[serde(default)]
4498 pub pre_alias_comments: Vec<String>,
4499 #[serde(default)]
4501 pub trailing_comments: Vec<String>,
4502 #[serde(default, skip_serializing_if = "Option::is_none")]
4504 pub inferred_type: Option<DataType>,
4505}
4506
4507impl Alias {
4508 pub fn new(this: Expression, alias: Identifier) -> Self {
4510 Self {
4511 this,
4512 alias,
4513 column_aliases: Vec::new(),
4514 pre_alias_comments: Vec::new(),
4515 trailing_comments: Vec::new(),
4516 inferred_type: None,
4517 }
4518 }
4519
4520 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4522 Self {
4523 this,
4524 alias: Identifier::empty(),
4525 column_aliases,
4526 pre_alias_comments: Vec::new(),
4527 trailing_comments: Vec::new(),
4528 inferred_type: None,
4529 }
4530 }
4531}
4532
4533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4540#[cfg_attr(feature = "bindings", derive(TS))]
4541pub struct Cast {
4542 pub this: Expression,
4544 pub to: DataType,
4546 #[serde(default)]
4547 pub trailing_comments: Vec<String>,
4548 #[serde(default)]
4550 pub double_colon_syntax: bool,
4551 #[serde(skip_serializing_if = "Option::is_none", default)]
4553 pub format: Option<Box<Expression>>,
4554 #[serde(skip_serializing_if = "Option::is_none", default)]
4556 pub default: Option<Box<Expression>>,
4557 #[serde(default, skip_serializing_if = "Option::is_none")]
4559 pub inferred_type: Option<DataType>,
4560}
4561
4562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4564#[cfg_attr(feature = "bindings", derive(TS))]
4565pub struct CollationExpr {
4566 pub this: Expression,
4567 pub collation: String,
4568 #[serde(default)]
4570 pub quoted: bool,
4571 #[serde(default)]
4573 pub double_quoted: bool,
4574}
4575
4576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4582#[cfg_attr(feature = "bindings", derive(TS))]
4583pub struct Case {
4584 pub operand: Option<Expression>,
4586 pub whens: Vec<(Expression, Expression)>,
4588 pub else_: Option<Expression>,
4590 #[serde(default)]
4592 #[serde(skip_serializing_if = "Vec::is_empty")]
4593 pub comments: Vec<String>,
4594 #[serde(default, skip_serializing_if = "Option::is_none")]
4596 pub inferred_type: Option<DataType>,
4597}
4598
4599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4607#[cfg_attr(feature = "bindings", derive(TS))]
4608pub struct BinaryOp {
4609 pub left: Expression,
4610 pub right: Expression,
4611 #[serde(default)]
4613 pub left_comments: Vec<String>,
4614 #[serde(default)]
4616 pub operator_comments: Vec<String>,
4617 #[serde(default)]
4619 pub trailing_comments: Vec<String>,
4620 #[serde(default, skip_serializing_if = "Option::is_none")]
4622 pub inferred_type: Option<DataType>,
4623}
4624
4625impl BinaryOp {
4626 pub fn new(left: Expression, right: Expression) -> Self {
4627 Self {
4628 left,
4629 right,
4630 left_comments: Vec::new(),
4631 operator_comments: Vec::new(),
4632 trailing_comments: Vec::new(),
4633 inferred_type: None,
4634 }
4635 }
4636}
4637
4638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4640#[cfg_attr(feature = "bindings", derive(TS))]
4641pub struct LikeOp {
4642 pub left: Expression,
4643 pub right: Expression,
4644 #[serde(default)]
4646 pub escape: Option<Expression>,
4647 #[serde(default)]
4649 pub quantifier: Option<String>,
4650 #[serde(default, skip_serializing_if = "Option::is_none")]
4652 pub inferred_type: Option<DataType>,
4653}
4654
4655impl LikeOp {
4656 pub fn new(left: Expression, right: Expression) -> Self {
4657 Self {
4658 left,
4659 right,
4660 escape: None,
4661 quantifier: None,
4662 inferred_type: None,
4663 }
4664 }
4665
4666 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4667 Self {
4668 left,
4669 right,
4670 escape: Some(escape),
4671 quantifier: None,
4672 inferred_type: None,
4673 }
4674 }
4675}
4676
4677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4681#[cfg_attr(feature = "bindings", derive(TS))]
4682pub struct UnaryOp {
4683 pub this: Expression,
4685 #[serde(default, skip_serializing_if = "Option::is_none")]
4687 pub inferred_type: Option<DataType>,
4688}
4689
4690impl UnaryOp {
4691 pub fn new(this: Expression) -> Self {
4692 Self {
4693 this,
4694 inferred_type: None,
4695 }
4696 }
4697}
4698
4699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4704#[cfg_attr(feature = "bindings", derive(TS))]
4705pub struct In {
4706 pub this: Expression,
4708 pub expressions: Vec<Expression>,
4710 pub query: Option<Expression>,
4712 pub not: bool,
4714 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4715 pub global: bool,
4716 #[serde(default, skip_serializing_if = "Option::is_none")]
4718 pub unnest: Option<Box<Expression>>,
4719 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4723 pub is_field: bool,
4724}
4725
4726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4728#[cfg_attr(feature = "bindings", derive(TS))]
4729pub struct Between {
4730 pub this: Expression,
4732 pub low: Expression,
4734 pub high: Expression,
4736 pub not: bool,
4738 #[serde(default)]
4740 pub symmetric: Option<bool>,
4741}
4742
4743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4745#[cfg_attr(feature = "bindings", derive(TS))]
4746pub struct IsNull {
4747 pub this: Expression,
4748 pub not: bool,
4749 #[serde(default)]
4751 pub postfix_form: bool,
4752}
4753
4754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4756#[cfg_attr(feature = "bindings", derive(TS))]
4757pub struct IsTrueFalse {
4758 pub this: Expression,
4759 pub not: bool,
4760}
4761
4762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4765#[cfg_attr(feature = "bindings", derive(TS))]
4766pub struct IsJson {
4767 pub this: Expression,
4768 pub json_type: Option<String>,
4770 pub unique_keys: Option<JsonUniqueKeys>,
4772 pub negated: bool,
4774}
4775
4776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4778#[cfg_attr(feature = "bindings", derive(TS))]
4779pub enum JsonUniqueKeys {
4780 With,
4782 Without,
4784 Shorthand,
4786}
4787
4788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4790#[cfg_attr(feature = "bindings", derive(TS))]
4791pub struct Exists {
4792 pub this: Expression,
4794 pub not: bool,
4796}
4797
4798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4805#[cfg_attr(feature = "bindings", derive(TS))]
4806pub struct Function {
4807 pub name: String,
4809 pub args: Vec<Expression>,
4811 pub distinct: bool,
4813 #[serde(default)]
4814 pub trailing_comments: Vec<String>,
4815 #[serde(default)]
4817 pub use_bracket_syntax: bool,
4818 #[serde(default)]
4820 pub no_parens: bool,
4821 #[serde(default)]
4823 pub quoted: bool,
4824 #[serde(default, skip_serializing_if = "Option::is_none")]
4826 pub span: Option<Span>,
4827 #[serde(default, skip_serializing_if = "Option::is_none")]
4829 pub inferred_type: Option<DataType>,
4830}
4831
4832impl Default for Function {
4833 fn default() -> Self {
4834 Self {
4835 name: String::new(),
4836 args: Vec::new(),
4837 distinct: false,
4838 trailing_comments: Vec::new(),
4839 use_bracket_syntax: false,
4840 no_parens: false,
4841 quoted: false,
4842 span: None,
4843 inferred_type: None,
4844 }
4845 }
4846}
4847
4848impl Function {
4849 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4850 Self {
4851 name: name.into(),
4852 args,
4853 distinct: false,
4854 trailing_comments: Vec::new(),
4855 use_bracket_syntax: false,
4856 no_parens: false,
4857 quoted: false,
4858 span: None,
4859 inferred_type: None,
4860 }
4861 }
4862}
4863
4864#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4871#[cfg_attr(feature = "bindings", derive(TS))]
4872pub struct AggregateFunction {
4873 pub name: String,
4875 pub args: Vec<Expression>,
4877 pub distinct: bool,
4879 pub filter: Option<Expression>,
4881 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4883 pub order_by: Vec<Ordered>,
4884 #[serde(default, skip_serializing_if = "Option::is_none")]
4886 pub limit: Option<Box<Expression>>,
4887 #[serde(default, skip_serializing_if = "Option::is_none")]
4889 pub ignore_nulls: Option<bool>,
4890 #[serde(default, skip_serializing_if = "Option::is_none")]
4892 pub inferred_type: Option<DataType>,
4893}
4894
4895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4902#[cfg_attr(feature = "bindings", derive(TS))]
4903pub struct WindowFunction {
4904 pub this: Expression,
4906 pub over: Over,
4908 #[serde(default, skip_serializing_if = "Option::is_none")]
4910 pub keep: Option<Keep>,
4911 #[serde(default, skip_serializing_if = "Option::is_none")]
4913 pub inferred_type: Option<DataType>,
4914}
4915
4916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4919#[cfg_attr(feature = "bindings", derive(TS))]
4920pub struct Keep {
4921 pub first: bool,
4923 pub order_by: Vec<Ordered>,
4925}
4926
4927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4929#[cfg_attr(feature = "bindings", derive(TS))]
4930pub struct WithinGroup {
4931 pub this: Expression,
4933 pub order_by: Vec<Ordered>,
4935}
4936
4937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4942#[cfg_attr(feature = "bindings", derive(TS))]
4943pub struct From {
4944 pub expressions: Vec<Expression>,
4946}
4947
4948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4954#[cfg_attr(feature = "bindings", derive(TS))]
4955pub struct Join {
4956 pub this: Expression,
4958 pub on: Option<Expression>,
4960 pub using: Vec<Identifier>,
4962 pub kind: JoinKind,
4964 pub use_inner_keyword: bool,
4966 pub use_outer_keyword: bool,
4968 pub deferred_condition: bool,
4970 #[serde(default, skip_serializing_if = "Option::is_none")]
4972 pub join_hint: Option<String>,
4973 #[serde(default, skip_serializing_if = "Option::is_none")]
4975 pub match_condition: Option<Expression>,
4976 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4978 pub pivots: Vec<Expression>,
4979 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4981 pub comments: Vec<String>,
4982 #[serde(default)]
4986 pub nesting_group: usize,
4987 #[serde(default)]
4989 pub directed: bool,
4990}
4991
4992#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4999#[cfg_attr(feature = "bindings", derive(TS))]
5000pub enum JoinKind {
5001 Inner,
5002 Left,
5003 Right,
5004 Full,
5005 Outer, Cross,
5007 Natural,
5008 NaturalLeft,
5009 NaturalRight,
5010 NaturalFull,
5011 Semi,
5012 Anti,
5013 LeftSemi,
5015 LeftAnti,
5016 RightSemi,
5017 RightAnti,
5018 CrossApply,
5020 OuterApply,
5021 AsOf,
5023 AsOfLeft,
5024 AsOfRight,
5025 Lateral,
5027 LeftLateral,
5028 Straight,
5030 Implicit,
5032 Array,
5034 LeftArray,
5035 Paste,
5037 Positional,
5039}
5040
5041impl Default for JoinKind {
5042 fn default() -> Self {
5043 JoinKind::Inner
5044 }
5045}
5046
5047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5050#[cfg_attr(feature = "bindings", derive(TS))]
5051pub struct JoinedTable {
5052 pub left: Expression,
5054 pub joins: Vec<Join>,
5056 pub lateral_views: Vec<LateralView>,
5058 pub alias: Option<Identifier>,
5060}
5061
5062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5064#[cfg_attr(feature = "bindings", derive(TS))]
5065pub struct Where {
5066 pub this: Expression,
5068}
5069
5070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5075#[cfg_attr(feature = "bindings", derive(TS))]
5076pub struct GroupBy {
5077 pub expressions: Vec<Expression>,
5079 #[serde(default)]
5081 pub all: Option<bool>,
5082 #[serde(default)]
5084 pub totals: bool,
5085 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5087 pub comments: Vec<String>,
5088}
5089
5090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5092#[cfg_attr(feature = "bindings", derive(TS))]
5093pub struct Having {
5094 pub this: Expression,
5096 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5098 pub comments: Vec<String>,
5099}
5100
5101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5103#[cfg_attr(feature = "bindings", derive(TS))]
5104pub struct OrderBy {
5105 pub expressions: Vec<Ordered>,
5107 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5109 pub siblings: bool,
5110 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5112 pub comments: Vec<String>,
5113}
5114
5115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5122#[cfg_attr(feature = "bindings", derive(TS))]
5123pub struct Ordered {
5124 pub this: Expression,
5126 pub desc: bool,
5128 pub nulls_first: Option<bool>,
5130 #[serde(default)]
5132 pub explicit_asc: bool,
5133 #[serde(default, skip_serializing_if = "Option::is_none")]
5135 pub with_fill: Option<Box<WithFill>>,
5136}
5137
5138impl Ordered {
5139 pub fn asc(expr: Expression) -> Self {
5140 Self {
5141 this: expr,
5142 desc: false,
5143 nulls_first: None,
5144 explicit_asc: false,
5145 with_fill: None,
5146 }
5147 }
5148
5149 pub fn desc(expr: Expression) -> Self {
5150 Self {
5151 this: expr,
5152 desc: true,
5153 nulls_first: None,
5154 explicit_asc: false,
5155 with_fill: None,
5156 }
5157 }
5158}
5159
5160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5163#[cfg_attr(feature = "bindings", derive(TS))]
5164#[cfg_attr(feature = "bindings", ts(export))]
5165pub struct DistributeBy {
5166 pub expressions: Vec<Expression>,
5167}
5168
5169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5172#[cfg_attr(feature = "bindings", derive(TS))]
5173#[cfg_attr(feature = "bindings", ts(export))]
5174pub struct ClusterBy {
5175 pub expressions: Vec<Ordered>,
5176}
5177
5178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5181#[cfg_attr(feature = "bindings", derive(TS))]
5182#[cfg_attr(feature = "bindings", ts(export))]
5183pub struct SortBy {
5184 pub expressions: Vec<Ordered>,
5185}
5186
5187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5190#[cfg_attr(feature = "bindings", derive(TS))]
5191#[cfg_attr(feature = "bindings", ts(export))]
5192pub struct LateralView {
5193 pub this: Expression,
5195 pub table_alias: Option<Identifier>,
5197 pub column_aliases: Vec<Identifier>,
5199 pub outer: bool,
5201}
5202
5203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5205#[cfg_attr(feature = "bindings", derive(TS))]
5206#[cfg_attr(feature = "bindings", ts(export))]
5207pub struct Hint {
5208 pub expressions: Vec<HintExpression>,
5209}
5210
5211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5213#[cfg_attr(feature = "bindings", derive(TS))]
5214#[cfg_attr(feature = "bindings", ts(export))]
5215pub enum HintExpression {
5216 Function { name: String, args: Vec<Expression> },
5218 Identifier(String),
5220 Raw(String),
5222}
5223
5224#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5226#[cfg_attr(feature = "bindings", derive(TS))]
5227#[cfg_attr(feature = "bindings", ts(export))]
5228pub enum PseudocolumnType {
5229 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5236
5237impl PseudocolumnType {
5238 pub fn as_str(&self) -> &'static str {
5239 match self {
5240 PseudocolumnType::Rownum => "ROWNUM",
5241 PseudocolumnType::Rowid => "ROWID",
5242 PseudocolumnType::Level => "LEVEL",
5243 PseudocolumnType::Sysdate => "SYSDATE",
5244 PseudocolumnType::ObjectId => "OBJECT_ID",
5245 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5246 }
5247 }
5248
5249 pub fn from_str(s: &str) -> Option<Self> {
5250 match s.to_uppercase().as_str() {
5251 "ROWNUM" => Some(PseudocolumnType::Rownum),
5252 "ROWID" => Some(PseudocolumnType::Rowid),
5253 "LEVEL" => Some(PseudocolumnType::Level),
5254 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5255 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5256 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5257 _ => None,
5258 }
5259 }
5260}
5261
5262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5265#[cfg_attr(feature = "bindings", derive(TS))]
5266#[cfg_attr(feature = "bindings", ts(export))]
5267pub struct Pseudocolumn {
5268 pub kind: PseudocolumnType,
5269}
5270
5271impl Pseudocolumn {
5272 pub fn rownum() -> Self {
5273 Self {
5274 kind: PseudocolumnType::Rownum,
5275 }
5276 }
5277
5278 pub fn rowid() -> Self {
5279 Self {
5280 kind: PseudocolumnType::Rowid,
5281 }
5282 }
5283
5284 pub fn level() -> Self {
5285 Self {
5286 kind: PseudocolumnType::Level,
5287 }
5288 }
5289}
5290
5291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5293#[cfg_attr(feature = "bindings", derive(TS))]
5294#[cfg_attr(feature = "bindings", ts(export))]
5295pub struct Connect {
5296 pub start: Option<Expression>,
5298 pub connect: Expression,
5300 pub nocycle: bool,
5302}
5303
5304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5306#[cfg_attr(feature = "bindings", derive(TS))]
5307#[cfg_attr(feature = "bindings", ts(export))]
5308pub struct Prior {
5309 pub this: Expression,
5310}
5311
5312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5314#[cfg_attr(feature = "bindings", derive(TS))]
5315#[cfg_attr(feature = "bindings", ts(export))]
5316pub struct ConnectByRoot {
5317 pub this: Expression,
5318}
5319
5320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5322#[cfg_attr(feature = "bindings", derive(TS))]
5323#[cfg_attr(feature = "bindings", ts(export))]
5324pub struct MatchRecognize {
5325 pub this: Option<Box<Expression>>,
5327 pub partition_by: Option<Vec<Expression>>,
5329 pub order_by: Option<Vec<Ordered>>,
5331 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5333 pub rows: Option<MatchRecognizeRows>,
5335 pub after: Option<MatchRecognizeAfter>,
5337 pub pattern: Option<String>,
5339 pub define: Option<Vec<(Identifier, Expression)>>,
5341 pub alias: Option<Identifier>,
5343 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5345 pub alias_explicit_as: bool,
5346}
5347
5348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5350#[cfg_attr(feature = "bindings", derive(TS))]
5351#[cfg_attr(feature = "bindings", ts(export))]
5352pub struct MatchRecognizeMeasure {
5353 pub this: Expression,
5355 pub window_frame: Option<MatchRecognizeSemantics>,
5357}
5358
5359#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5361#[cfg_attr(feature = "bindings", derive(TS))]
5362#[cfg_attr(feature = "bindings", ts(export))]
5363pub enum MatchRecognizeSemantics {
5364 Running,
5365 Final,
5366}
5367
5368#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5370#[cfg_attr(feature = "bindings", derive(TS))]
5371#[cfg_attr(feature = "bindings", ts(export))]
5372pub enum MatchRecognizeRows {
5373 OneRowPerMatch,
5374 AllRowsPerMatch,
5375 AllRowsPerMatchShowEmptyMatches,
5376 AllRowsPerMatchOmitEmptyMatches,
5377 AllRowsPerMatchWithUnmatchedRows,
5378}
5379
5380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5382#[cfg_attr(feature = "bindings", derive(TS))]
5383#[cfg_attr(feature = "bindings", ts(export))]
5384pub enum MatchRecognizeAfter {
5385 PastLastRow,
5386 ToNextRow,
5387 ToFirst(Identifier),
5388 ToLast(Identifier),
5389}
5390
5391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5393#[cfg_attr(feature = "bindings", derive(TS))]
5394pub struct Limit {
5395 pub this: Expression,
5397 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5399 pub percent: bool,
5400 #[serde(default)]
5402 #[serde(skip_serializing_if = "Vec::is_empty")]
5403 pub comments: Vec<String>,
5404}
5405
5406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5408#[cfg_attr(feature = "bindings", derive(TS))]
5409pub struct Offset {
5410 pub this: Expression,
5411 #[serde(skip_serializing_if = "Option::is_none", default)]
5413 pub rows: Option<bool>,
5414}
5415
5416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5418#[cfg_attr(feature = "bindings", derive(TS))]
5419pub struct Top {
5420 pub this: Expression,
5421 pub percent: bool,
5422 pub with_ties: bool,
5423 #[serde(default)]
5425 pub parenthesized: bool,
5426}
5427
5428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5430#[cfg_attr(feature = "bindings", derive(TS))]
5431pub struct Fetch {
5432 pub direction: String,
5434 pub count: Option<Expression>,
5436 pub percent: bool,
5438 pub rows: bool,
5440 pub with_ties: bool,
5442}
5443
5444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5450#[cfg_attr(feature = "bindings", derive(TS))]
5451pub struct Qualify {
5452 pub this: Expression,
5454}
5455
5456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5458#[cfg_attr(feature = "bindings", derive(TS))]
5459pub struct Sample {
5460 pub method: SampleMethod,
5461 pub size: Expression,
5462 pub seed: Option<Expression>,
5463 #[serde(default)]
5465 pub offset: Option<Expression>,
5466 pub unit_after_size: bool,
5468 #[serde(default)]
5470 pub use_sample_keyword: bool,
5471 #[serde(default)]
5473 pub explicit_method: bool,
5474 #[serde(default)]
5476 pub method_before_size: bool,
5477 #[serde(default)]
5479 pub use_seed_keyword: bool,
5480 pub bucket_numerator: Option<Box<Expression>>,
5482 pub bucket_denominator: Option<Box<Expression>>,
5484 pub bucket_field: Option<Box<Expression>>,
5486 #[serde(default)]
5488 pub is_using_sample: bool,
5489 #[serde(default)]
5491 pub is_percent: bool,
5492 #[serde(default)]
5494 pub suppress_method_output: bool,
5495}
5496
5497#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5499#[cfg_attr(feature = "bindings", derive(TS))]
5500pub enum SampleMethod {
5501 Bernoulli,
5502 System,
5503 Block,
5504 Row,
5505 Percent,
5506 Bucket,
5508 Reservoir,
5510}
5511
5512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5514#[cfg_attr(feature = "bindings", derive(TS))]
5515pub struct NamedWindow {
5516 pub name: Identifier,
5517 pub spec: Over,
5518}
5519
5520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5526#[cfg_attr(feature = "bindings", derive(TS))]
5527pub struct With {
5528 pub ctes: Vec<Cte>,
5530 pub recursive: bool,
5532 #[serde(default)]
5534 pub leading_comments: Vec<String>,
5535 #[serde(default, skip_serializing_if = "Option::is_none")]
5537 pub search: Option<Box<Expression>>,
5538}
5539
5540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5547#[cfg_attr(feature = "bindings", derive(TS))]
5548pub struct Cte {
5549 pub alias: Identifier,
5551 pub this: Expression,
5553 pub columns: Vec<Identifier>,
5555 pub materialized: Option<bool>,
5557 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5559 pub key_expressions: Vec<Identifier>,
5560 #[serde(default)]
5562 pub alias_first: bool,
5563 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5565 pub comments: Vec<String>,
5566}
5567
5568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5570#[cfg_attr(feature = "bindings", derive(TS))]
5571pub struct WindowSpec {
5572 pub partition_by: Vec<Expression>,
5573 pub order_by: Vec<Ordered>,
5574 pub frame: Option<WindowFrame>,
5575}
5576
5577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5579#[cfg_attr(feature = "bindings", derive(TS))]
5580pub struct Over {
5581 pub window_name: Option<Identifier>,
5583 pub partition_by: Vec<Expression>,
5584 pub order_by: Vec<Ordered>,
5585 pub frame: Option<WindowFrame>,
5586 pub alias: Option<Identifier>,
5587}
5588
5589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5591#[cfg_attr(feature = "bindings", derive(TS))]
5592pub struct WindowFrame {
5593 pub kind: WindowFrameKind,
5594 pub start: WindowFrameBound,
5595 pub end: Option<WindowFrameBound>,
5596 pub exclude: Option<WindowFrameExclude>,
5597 #[serde(default, skip_serializing_if = "Option::is_none")]
5599 pub kind_text: Option<String>,
5600 #[serde(default, skip_serializing_if = "Option::is_none")]
5602 pub start_side_text: Option<String>,
5603 #[serde(default, skip_serializing_if = "Option::is_none")]
5605 pub end_side_text: Option<String>,
5606}
5607
5608#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5609#[cfg_attr(feature = "bindings", derive(TS))]
5610pub enum WindowFrameKind {
5611 Rows,
5612 Range,
5613 Groups,
5614}
5615
5616#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5618#[cfg_attr(feature = "bindings", derive(TS))]
5619pub enum WindowFrameExclude {
5620 CurrentRow,
5621 Group,
5622 Ties,
5623 NoOthers,
5624}
5625
5626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5627#[cfg_attr(feature = "bindings", derive(TS))]
5628pub enum WindowFrameBound {
5629 CurrentRow,
5630 UnboundedPreceding,
5631 UnboundedFollowing,
5632 Preceding(Box<Expression>),
5633 Following(Box<Expression>),
5634 BarePreceding,
5636 BareFollowing,
5638 Value(Box<Expression>),
5640}
5641
5642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5644#[cfg_attr(feature = "bindings", derive(TS))]
5645pub struct StructField {
5646 pub name: String,
5647 pub data_type: DataType,
5648 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5649 pub options: Vec<Expression>,
5650 #[serde(default, skip_serializing_if = "Option::is_none")]
5651 pub comment: Option<String>,
5652}
5653
5654impl StructField {
5655 pub fn new(name: String, data_type: DataType) -> Self {
5657 Self {
5658 name,
5659 data_type,
5660 options: Vec::new(),
5661 comment: None,
5662 }
5663 }
5664
5665 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5667 Self {
5668 name,
5669 data_type,
5670 options,
5671 comment: None,
5672 }
5673 }
5674
5675 pub fn with_options_and_comment(
5677 name: String,
5678 data_type: DataType,
5679 options: Vec<Expression>,
5680 comment: Option<String>,
5681 ) -> Self {
5682 Self {
5683 name,
5684 data_type,
5685 options,
5686 comment,
5687 }
5688 }
5689}
5690
5691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5703#[cfg_attr(feature = "bindings", derive(TS))]
5704#[serde(tag = "data_type", rename_all = "snake_case")]
5705pub enum DataType {
5706 Boolean,
5708 TinyInt {
5709 length: Option<u32>,
5710 },
5711 SmallInt {
5712 length: Option<u32>,
5713 },
5714 Int {
5718 length: Option<u32>,
5719 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5720 integer_spelling: bool,
5721 },
5722 BigInt {
5723 length: Option<u32>,
5724 },
5725 Float {
5729 precision: Option<u32>,
5730 scale: Option<u32>,
5731 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5732 real_spelling: bool,
5733 },
5734 Double {
5735 precision: Option<u32>,
5736 scale: Option<u32>,
5737 },
5738 Decimal {
5739 precision: Option<u32>,
5740 scale: Option<u32>,
5741 },
5742
5743 Char {
5745 length: Option<u32>,
5746 },
5747 VarChar {
5750 length: Option<u32>,
5751 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5752 parenthesized_length: bool,
5753 },
5754 String {
5756 length: Option<u32>,
5757 },
5758 Text,
5759 TextWithLength {
5761 length: u32,
5762 },
5763
5764 Binary {
5766 length: Option<u32>,
5767 },
5768 VarBinary {
5769 length: Option<u32>,
5770 },
5771 Blob,
5772
5773 Bit {
5775 length: Option<u32>,
5776 },
5777 VarBit {
5778 length: Option<u32>,
5779 },
5780
5781 Date,
5783 Time {
5784 precision: Option<u32>,
5785 #[serde(default)]
5786 timezone: bool,
5787 },
5788 Timestamp {
5789 precision: Option<u32>,
5790 timezone: bool,
5791 },
5792 Interval {
5793 unit: Option<String>,
5794 #[serde(default, skip_serializing_if = "Option::is_none")]
5796 to: Option<String>,
5797 },
5798
5799 Json,
5801 JsonB,
5802
5803 Uuid,
5805
5806 Array {
5808 element_type: Box<DataType>,
5809 #[serde(default, skip_serializing_if = "Option::is_none")]
5811 dimension: Option<u32>,
5812 },
5813
5814 List {
5817 element_type: Box<DataType>,
5818 },
5819
5820 Struct {
5824 fields: Vec<StructField>,
5825 nested: bool,
5826 },
5827 Map {
5828 key_type: Box<DataType>,
5829 value_type: Box<DataType>,
5830 },
5831
5832 Enum {
5834 values: Vec<String>,
5835 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5836 assignments: Vec<Option<String>>,
5837 },
5838
5839 Set {
5841 values: Vec<String>,
5842 },
5843
5844 Union {
5846 fields: Vec<(String, DataType)>,
5847 },
5848
5849 Vector {
5851 #[serde(default)]
5852 element_type: Option<Box<DataType>>,
5853 dimension: Option<u32>,
5854 },
5855
5856 Object {
5859 fields: Vec<(String, DataType, bool)>,
5860 modifier: Option<String>,
5861 },
5862
5863 Nullable {
5865 inner: Box<DataType>,
5866 },
5867
5868 Custom {
5870 name: String,
5871 },
5872
5873 Geometry {
5875 subtype: Option<String>,
5876 srid: Option<u32>,
5877 },
5878 Geography {
5879 subtype: Option<String>,
5880 srid: Option<u32>,
5881 },
5882
5883 CharacterSet {
5886 name: String,
5887 },
5888
5889 Unknown,
5891}
5892
5893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5895#[cfg_attr(feature = "bindings", derive(TS))]
5896#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5897pub struct Array {
5898 pub expressions: Vec<Expression>,
5899}
5900
5901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5903#[cfg_attr(feature = "bindings", derive(TS))]
5904pub struct Struct {
5905 pub fields: Vec<(Option<String>, Expression)>,
5906}
5907
5908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5910#[cfg_attr(feature = "bindings", derive(TS))]
5911pub struct Tuple {
5912 pub expressions: Vec<Expression>,
5913}
5914
5915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5917#[cfg_attr(feature = "bindings", derive(TS))]
5918pub struct Interval {
5919 pub this: Option<Expression>,
5921 pub unit: Option<IntervalUnitSpec>,
5923}
5924
5925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5927#[cfg_attr(feature = "bindings", derive(TS))]
5928#[serde(tag = "type", rename_all = "snake_case")]
5929pub enum IntervalUnitSpec {
5930 Simple {
5932 unit: IntervalUnit,
5933 use_plural: bool,
5935 },
5936 Span(IntervalSpan),
5938 ExprSpan(IntervalSpanExpr),
5941 Expr(Box<Expression>),
5943}
5944
5945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5947#[cfg_attr(feature = "bindings", derive(TS))]
5948pub struct IntervalSpan {
5949 pub this: IntervalUnit,
5951 pub expression: IntervalUnit,
5953}
5954
5955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5958#[cfg_attr(feature = "bindings", derive(TS))]
5959pub struct IntervalSpanExpr {
5960 pub this: Box<Expression>,
5962 pub expression: Box<Expression>,
5964}
5965
5966#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5967#[cfg_attr(feature = "bindings", derive(TS))]
5968pub enum IntervalUnit {
5969 Year,
5970 Quarter,
5971 Month,
5972 Week,
5973 Day,
5974 Hour,
5975 Minute,
5976 Second,
5977 Millisecond,
5978 Microsecond,
5979 Nanosecond,
5980}
5981
5982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5984#[cfg_attr(feature = "bindings", derive(TS))]
5985pub struct Command {
5986 pub this: String,
5988}
5989
5990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5993#[cfg_attr(feature = "bindings", derive(TS))]
5994pub struct ExecuteStatement {
5995 pub this: Expression,
5997 #[serde(default)]
5999 pub parameters: Vec<ExecuteParameter>,
6000 #[serde(default, skip_serializing_if = "Option::is_none")]
6002 pub suffix: Option<String>,
6003}
6004
6005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6007#[cfg_attr(feature = "bindings", derive(TS))]
6008pub struct ExecuteParameter {
6009 pub name: String,
6011 pub value: Expression,
6013 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6015 pub positional: bool,
6016 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6018 pub output: bool,
6019}
6020
6021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6024#[cfg_attr(feature = "bindings", derive(TS))]
6025pub struct Kill {
6026 pub this: Expression,
6028 pub kind: Option<String>,
6030}
6031
6032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6034#[cfg_attr(feature = "bindings", derive(TS))]
6035pub struct CreateTask {
6036 pub or_replace: bool,
6037 pub if_not_exists: bool,
6038 pub name: String,
6040 pub properties: String,
6042 pub body: Expression,
6044}
6045
6046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6048#[cfg_attr(feature = "bindings", derive(TS))]
6049pub struct Raw {
6050 pub sql: String,
6051}
6052
6053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6059#[cfg_attr(feature = "bindings", derive(TS))]
6060pub struct UnaryFunc {
6061 pub this: Expression,
6062 #[serde(skip_serializing_if = "Option::is_none", default)]
6064 pub original_name: Option<String>,
6065 #[serde(default, skip_serializing_if = "Option::is_none")]
6067 pub inferred_type: Option<DataType>,
6068}
6069
6070impl UnaryFunc {
6071 pub fn new(this: Expression) -> Self {
6073 Self {
6074 this,
6075 original_name: None,
6076 inferred_type: None,
6077 }
6078 }
6079
6080 pub fn with_name(this: Expression, name: String) -> Self {
6082 Self {
6083 this,
6084 original_name: Some(name),
6085 inferred_type: None,
6086 }
6087 }
6088}
6089
6090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6094#[cfg_attr(feature = "bindings", derive(TS))]
6095pub struct CharFunc {
6096 pub args: Vec<Expression>,
6097 #[serde(skip_serializing_if = "Option::is_none", default)]
6098 pub charset: Option<String>,
6099 #[serde(skip_serializing_if = "Option::is_none", default)]
6101 pub name: Option<String>,
6102}
6103
6104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6106#[cfg_attr(feature = "bindings", derive(TS))]
6107pub struct BinaryFunc {
6108 pub this: Expression,
6109 pub expression: Expression,
6110 #[serde(skip_serializing_if = "Option::is_none", default)]
6112 pub original_name: Option<String>,
6113 #[serde(default, skip_serializing_if = "Option::is_none")]
6115 pub inferred_type: Option<DataType>,
6116}
6117
6118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6120#[cfg_attr(feature = "bindings", derive(TS))]
6121pub struct VarArgFunc {
6122 pub expressions: Vec<Expression>,
6123 #[serde(skip_serializing_if = "Option::is_none", default)]
6125 pub original_name: Option<String>,
6126 #[serde(default, skip_serializing_if = "Option::is_none")]
6128 pub inferred_type: Option<DataType>,
6129}
6130
6131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6133#[cfg_attr(feature = "bindings", derive(TS))]
6134pub struct ConcatWs {
6135 pub separator: Expression,
6136 pub expressions: Vec<Expression>,
6137}
6138
6139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6141#[cfg_attr(feature = "bindings", derive(TS))]
6142pub struct SubstringFunc {
6143 pub this: Expression,
6144 pub start: Expression,
6145 pub length: Option<Expression>,
6146 #[serde(default)]
6148 pub from_for_syntax: bool,
6149}
6150
6151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6153#[cfg_attr(feature = "bindings", derive(TS))]
6154pub struct OverlayFunc {
6155 pub this: Expression,
6156 pub replacement: Expression,
6157 pub from: Expression,
6158 pub length: Option<Expression>,
6159}
6160
6161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6163#[cfg_attr(feature = "bindings", derive(TS))]
6164pub struct TrimFunc {
6165 pub this: Expression,
6166 pub characters: Option<Expression>,
6167 pub position: TrimPosition,
6168 #[serde(default)]
6170 pub sql_standard_syntax: bool,
6171 #[serde(default)]
6173 pub position_explicit: bool,
6174}
6175
6176#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6177#[cfg_attr(feature = "bindings", derive(TS))]
6178pub enum TrimPosition {
6179 Both,
6180 Leading,
6181 Trailing,
6182}
6183
6184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6186#[cfg_attr(feature = "bindings", derive(TS))]
6187pub struct ReplaceFunc {
6188 pub this: Expression,
6189 pub old: Expression,
6190 pub new: Expression,
6191}
6192
6193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6195#[cfg_attr(feature = "bindings", derive(TS))]
6196pub struct LeftRightFunc {
6197 pub this: Expression,
6198 pub length: Expression,
6199}
6200
6201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6203#[cfg_attr(feature = "bindings", derive(TS))]
6204pub struct RepeatFunc {
6205 pub this: Expression,
6206 pub times: Expression,
6207}
6208
6209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6211#[cfg_attr(feature = "bindings", derive(TS))]
6212pub struct PadFunc {
6213 pub this: Expression,
6214 pub length: Expression,
6215 pub fill: Option<Expression>,
6216}
6217
6218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6220#[cfg_attr(feature = "bindings", derive(TS))]
6221pub struct SplitFunc {
6222 pub this: Expression,
6223 pub delimiter: Expression,
6224}
6225
6226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6228#[cfg_attr(feature = "bindings", derive(TS))]
6229pub struct RegexpFunc {
6230 pub this: Expression,
6231 pub pattern: Expression,
6232 pub flags: Option<Expression>,
6233}
6234
6235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6237#[cfg_attr(feature = "bindings", derive(TS))]
6238pub struct RegexpReplaceFunc {
6239 pub this: Expression,
6240 pub pattern: Expression,
6241 pub replacement: Expression,
6242 pub flags: Option<Expression>,
6243}
6244
6245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6247#[cfg_attr(feature = "bindings", derive(TS))]
6248pub struct RegexpExtractFunc {
6249 pub this: Expression,
6250 pub pattern: Expression,
6251 pub group: Option<Expression>,
6252}
6253
6254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6256#[cfg_attr(feature = "bindings", derive(TS))]
6257pub struct RoundFunc {
6258 pub this: Expression,
6259 pub decimals: Option<Expression>,
6260}
6261
6262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6264#[cfg_attr(feature = "bindings", derive(TS))]
6265pub struct FloorFunc {
6266 pub this: Expression,
6267 pub scale: Option<Expression>,
6268 #[serde(skip_serializing_if = "Option::is_none", default)]
6270 pub to: Option<Expression>,
6271}
6272
6273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6275#[cfg_attr(feature = "bindings", derive(TS))]
6276pub struct CeilFunc {
6277 pub this: Expression,
6278 #[serde(skip_serializing_if = "Option::is_none", default)]
6279 pub decimals: Option<Expression>,
6280 #[serde(skip_serializing_if = "Option::is_none", default)]
6282 pub to: Option<Expression>,
6283}
6284
6285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6287#[cfg_attr(feature = "bindings", derive(TS))]
6288pub struct LogFunc {
6289 pub this: Expression,
6290 pub base: Option<Expression>,
6291}
6292
6293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6295#[cfg_attr(feature = "bindings", derive(TS))]
6296pub struct CurrentDate;
6297
6298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6300#[cfg_attr(feature = "bindings", derive(TS))]
6301pub struct CurrentTime {
6302 pub precision: Option<u32>,
6303}
6304
6305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6307#[cfg_attr(feature = "bindings", derive(TS))]
6308pub struct CurrentTimestamp {
6309 pub precision: Option<u32>,
6310 #[serde(default)]
6312 pub sysdate: bool,
6313}
6314
6315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6317#[cfg_attr(feature = "bindings", derive(TS))]
6318pub struct CurrentTimestampLTZ {
6319 pub precision: Option<u32>,
6320}
6321
6322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6324#[cfg_attr(feature = "bindings", derive(TS))]
6325pub struct AtTimeZone {
6326 pub this: Expression,
6328 pub zone: Expression,
6330}
6331
6332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6334#[cfg_attr(feature = "bindings", derive(TS))]
6335pub struct DateAddFunc {
6336 pub this: Expression,
6337 pub interval: Expression,
6338 pub unit: IntervalUnit,
6339}
6340
6341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6343#[cfg_attr(feature = "bindings", derive(TS))]
6344pub struct DateDiffFunc {
6345 pub this: Expression,
6346 pub expression: Expression,
6347 pub unit: Option<IntervalUnit>,
6348}
6349
6350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6352#[cfg_attr(feature = "bindings", derive(TS))]
6353pub struct DateTruncFunc {
6354 pub this: Expression,
6355 pub unit: DateTimeField,
6356}
6357
6358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6360#[cfg_attr(feature = "bindings", derive(TS))]
6361pub struct ExtractFunc {
6362 pub this: Expression,
6363 pub field: DateTimeField,
6364}
6365
6366#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6367#[cfg_attr(feature = "bindings", derive(TS))]
6368pub enum DateTimeField {
6369 Year,
6370 Month,
6371 Day,
6372 Hour,
6373 Minute,
6374 Second,
6375 Millisecond,
6376 Microsecond,
6377 DayOfWeek,
6378 DayOfYear,
6379 Week,
6380 WeekWithModifier(String),
6382 Quarter,
6383 Epoch,
6384 Timezone,
6385 TimezoneHour,
6386 TimezoneMinute,
6387 Date,
6388 Time,
6389 Custom(String),
6391}
6392
6393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6395#[cfg_attr(feature = "bindings", derive(TS))]
6396pub struct ToDateFunc {
6397 pub this: Expression,
6398 pub format: Option<Expression>,
6399}
6400
6401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6403#[cfg_attr(feature = "bindings", derive(TS))]
6404pub struct ToTimestampFunc {
6405 pub this: Expression,
6406 pub format: Option<Expression>,
6407}
6408
6409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6411#[cfg_attr(feature = "bindings", derive(TS))]
6412pub struct IfFunc {
6413 pub condition: Expression,
6414 pub true_value: Expression,
6415 pub false_value: Option<Expression>,
6416 #[serde(skip_serializing_if = "Option::is_none", default)]
6418 pub original_name: Option<String>,
6419 #[serde(default, skip_serializing_if = "Option::is_none")]
6421 pub inferred_type: Option<DataType>,
6422}
6423
6424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6426#[cfg_attr(feature = "bindings", derive(TS))]
6427pub struct Nvl2Func {
6428 pub this: Expression,
6429 pub true_value: Expression,
6430 pub false_value: Expression,
6431 #[serde(default, skip_serializing_if = "Option::is_none")]
6433 pub inferred_type: Option<DataType>,
6434}
6435
6436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6442#[cfg_attr(feature = "bindings", derive(TS))]
6443pub struct AggFunc {
6444 pub this: Expression,
6445 pub distinct: bool,
6446 pub filter: Option<Expression>,
6447 pub order_by: Vec<Ordered>,
6448 #[serde(skip_serializing_if = "Option::is_none", default)]
6450 pub name: Option<String>,
6451 #[serde(skip_serializing_if = "Option::is_none", default)]
6453 pub ignore_nulls: Option<bool>,
6454 #[serde(skip_serializing_if = "Option::is_none", default)]
6457 pub having_max: Option<(Box<Expression>, bool)>,
6458 #[serde(skip_serializing_if = "Option::is_none", default)]
6460 pub limit: Option<Box<Expression>>,
6461 #[serde(default, skip_serializing_if = "Option::is_none")]
6463 pub inferred_type: Option<DataType>,
6464}
6465
6466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6468#[cfg_attr(feature = "bindings", derive(TS))]
6469pub struct CountFunc {
6470 pub this: Option<Expression>,
6471 pub star: bool,
6472 pub distinct: bool,
6473 pub filter: Option<Expression>,
6474 #[serde(default, skip_serializing_if = "Option::is_none")]
6476 pub ignore_nulls: Option<bool>,
6477 #[serde(default, skip_serializing_if = "Option::is_none")]
6479 pub original_name: Option<String>,
6480 #[serde(default, skip_serializing_if = "Option::is_none")]
6482 pub inferred_type: Option<DataType>,
6483}
6484
6485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6487#[cfg_attr(feature = "bindings", derive(TS))]
6488pub struct GroupConcatFunc {
6489 pub this: Expression,
6490 pub separator: Option<Expression>,
6491 pub order_by: Option<Vec<Ordered>>,
6492 pub distinct: bool,
6493 pub filter: Option<Expression>,
6494 #[serde(default, skip_serializing_if = "Option::is_none")]
6496 pub limit: Option<Box<Expression>>,
6497 #[serde(default, skip_serializing_if = "Option::is_none")]
6499 pub inferred_type: Option<DataType>,
6500}
6501
6502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6504#[cfg_attr(feature = "bindings", derive(TS))]
6505pub struct StringAggFunc {
6506 pub this: Expression,
6507 #[serde(default)]
6508 pub separator: Option<Expression>,
6509 #[serde(default)]
6510 pub order_by: Option<Vec<Ordered>>,
6511 #[serde(default)]
6512 pub distinct: bool,
6513 #[serde(default)]
6514 pub filter: Option<Expression>,
6515 #[serde(default, skip_serializing_if = "Option::is_none")]
6517 pub limit: Option<Box<Expression>>,
6518 #[serde(default, skip_serializing_if = "Option::is_none")]
6520 pub inferred_type: Option<DataType>,
6521}
6522
6523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6525#[cfg_attr(feature = "bindings", derive(TS))]
6526pub struct ListAggFunc {
6527 pub this: Expression,
6528 pub separator: Option<Expression>,
6529 pub on_overflow: Option<ListAggOverflow>,
6530 pub order_by: Option<Vec<Ordered>>,
6531 pub distinct: bool,
6532 pub filter: Option<Expression>,
6533 #[serde(default, skip_serializing_if = "Option::is_none")]
6535 pub inferred_type: Option<DataType>,
6536}
6537
6538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6540#[cfg_attr(feature = "bindings", derive(TS))]
6541pub enum ListAggOverflow {
6542 Error,
6543 Truncate {
6544 filler: Option<Expression>,
6545 with_count: bool,
6546 },
6547}
6548
6549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6551#[cfg_attr(feature = "bindings", derive(TS))]
6552pub struct SumIfFunc {
6553 pub this: Expression,
6554 pub condition: Expression,
6555 pub filter: Option<Expression>,
6556 #[serde(default, skip_serializing_if = "Option::is_none")]
6558 pub inferred_type: Option<DataType>,
6559}
6560
6561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6563#[cfg_attr(feature = "bindings", derive(TS))]
6564pub struct ApproxPercentileFunc {
6565 pub this: Expression,
6566 pub percentile: Expression,
6567 pub accuracy: Option<Expression>,
6568 pub filter: Option<Expression>,
6569}
6570
6571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6573#[cfg_attr(feature = "bindings", derive(TS))]
6574pub struct PercentileFunc {
6575 pub this: Expression,
6576 pub percentile: Expression,
6577 pub order_by: Option<Vec<Ordered>>,
6578 pub filter: Option<Expression>,
6579}
6580
6581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6587#[cfg_attr(feature = "bindings", derive(TS))]
6588pub struct RowNumber;
6589
6590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6592#[cfg_attr(feature = "bindings", derive(TS))]
6593pub struct Rank {
6594 #[serde(default, skip_serializing_if = "Option::is_none")]
6596 pub order_by: Option<Vec<Ordered>>,
6597 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6599 pub args: Vec<Expression>,
6600}
6601
6602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6604#[cfg_attr(feature = "bindings", derive(TS))]
6605pub struct DenseRank {
6606 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6608 pub args: Vec<Expression>,
6609}
6610
6611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6613#[cfg_attr(feature = "bindings", derive(TS))]
6614pub struct NTileFunc {
6615 #[serde(default, skip_serializing_if = "Option::is_none")]
6617 pub num_buckets: Option<Expression>,
6618 #[serde(default, skip_serializing_if = "Option::is_none")]
6620 pub order_by: Option<Vec<Ordered>>,
6621}
6622
6623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6625#[cfg_attr(feature = "bindings", derive(TS))]
6626pub struct LeadLagFunc {
6627 pub this: Expression,
6628 pub offset: Option<Expression>,
6629 pub default: Option<Expression>,
6630 #[serde(default, skip_serializing_if = "Option::is_none")]
6632 pub ignore_nulls: Option<bool>,
6633}
6634
6635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6637#[cfg_attr(feature = "bindings", derive(TS))]
6638pub struct ValueFunc {
6639 pub this: Expression,
6640 #[serde(default, skip_serializing_if = "Option::is_none")]
6642 pub ignore_nulls: Option<bool>,
6643 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6645 pub order_by: Vec<Ordered>,
6646}
6647
6648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6650#[cfg_attr(feature = "bindings", derive(TS))]
6651pub struct NthValueFunc {
6652 pub this: Expression,
6653 pub offset: Expression,
6654 #[serde(default, skip_serializing_if = "Option::is_none")]
6656 pub ignore_nulls: Option<bool>,
6657 #[serde(default, skip_serializing_if = "Option::is_none")]
6660 pub from_first: Option<bool>,
6661}
6662
6663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6665#[cfg_attr(feature = "bindings", derive(TS))]
6666pub struct PercentRank {
6667 #[serde(default, skip_serializing_if = "Option::is_none")]
6669 pub order_by: Option<Vec<Ordered>>,
6670 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6672 pub args: Vec<Expression>,
6673}
6674
6675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6677#[cfg_attr(feature = "bindings", derive(TS))]
6678pub struct CumeDist {
6679 #[serde(default, skip_serializing_if = "Option::is_none")]
6681 pub order_by: Option<Vec<Ordered>>,
6682 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6684 pub args: Vec<Expression>,
6685}
6686
6687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6693#[cfg_attr(feature = "bindings", derive(TS))]
6694pub struct PositionFunc {
6695 pub substring: Expression,
6696 pub string: Expression,
6697 pub start: Option<Expression>,
6698}
6699
6700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6706#[cfg_attr(feature = "bindings", derive(TS))]
6707pub struct Random;
6708
6709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6711#[cfg_attr(feature = "bindings", derive(TS))]
6712pub struct Rand {
6713 pub seed: Option<Box<Expression>>,
6714 #[serde(default)]
6716 pub lower: Option<Box<Expression>>,
6717 #[serde(default)]
6719 pub upper: Option<Box<Expression>>,
6720}
6721
6722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6724#[cfg_attr(feature = "bindings", derive(TS))]
6725pub struct TruncateFunc {
6726 pub this: Expression,
6727 pub decimals: Option<Expression>,
6728}
6729
6730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6732#[cfg_attr(feature = "bindings", derive(TS))]
6733pub struct Pi;
6734
6735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6741#[cfg_attr(feature = "bindings", derive(TS))]
6742pub struct DecodeFunc {
6743 pub this: Expression,
6744 pub search_results: Vec<(Expression, Expression)>,
6745 pub default: Option<Expression>,
6746}
6747
6748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6754#[cfg_attr(feature = "bindings", derive(TS))]
6755pub struct DateFormatFunc {
6756 pub this: Expression,
6757 pub format: Expression,
6758}
6759
6760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6762#[cfg_attr(feature = "bindings", derive(TS))]
6763pub struct FromUnixtimeFunc {
6764 pub this: Expression,
6765 pub format: Option<Expression>,
6766}
6767
6768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6770#[cfg_attr(feature = "bindings", derive(TS))]
6771pub struct UnixTimestampFunc {
6772 pub this: Option<Expression>,
6773 pub format: Option<Expression>,
6774}
6775
6776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6778#[cfg_attr(feature = "bindings", derive(TS))]
6779pub struct MakeDateFunc {
6780 pub year: Expression,
6781 pub month: Expression,
6782 pub day: Expression,
6783}
6784
6785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6787#[cfg_attr(feature = "bindings", derive(TS))]
6788pub struct MakeTimestampFunc {
6789 pub year: Expression,
6790 pub month: Expression,
6791 pub day: Expression,
6792 pub hour: Expression,
6793 pub minute: Expression,
6794 pub second: Expression,
6795 pub timezone: Option<Expression>,
6796}
6797
6798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6800#[cfg_attr(feature = "bindings", derive(TS))]
6801pub struct LastDayFunc {
6802 pub this: Expression,
6803 #[serde(skip_serializing_if = "Option::is_none", default)]
6805 pub unit: Option<DateTimeField>,
6806}
6807
6808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6814#[cfg_attr(feature = "bindings", derive(TS))]
6815pub struct ArrayConstructor {
6816 pub expressions: Vec<Expression>,
6817 pub bracket_notation: bool,
6818 pub use_list_keyword: bool,
6820}
6821
6822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6824#[cfg_attr(feature = "bindings", derive(TS))]
6825pub struct ArraySortFunc {
6826 pub this: Expression,
6827 pub comparator: Option<Expression>,
6828 pub desc: bool,
6829 pub nulls_first: Option<bool>,
6830}
6831
6832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6834#[cfg_attr(feature = "bindings", derive(TS))]
6835pub struct ArrayJoinFunc {
6836 pub this: Expression,
6837 pub separator: Expression,
6838 pub null_replacement: Option<Expression>,
6839}
6840
6841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6843#[cfg_attr(feature = "bindings", derive(TS))]
6844pub struct UnnestFunc {
6845 pub this: Expression,
6846 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6848 pub expressions: Vec<Expression>,
6849 pub with_ordinality: bool,
6850 pub alias: Option<Identifier>,
6851 #[serde(default, skip_serializing_if = "Option::is_none")]
6853 pub offset_alias: Option<Identifier>,
6854}
6855
6856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6858#[cfg_attr(feature = "bindings", derive(TS))]
6859pub struct ArrayFilterFunc {
6860 pub this: Expression,
6861 pub filter: Expression,
6862}
6863
6864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6866#[cfg_attr(feature = "bindings", derive(TS))]
6867pub struct ArrayTransformFunc {
6868 pub this: Expression,
6869 pub transform: Expression,
6870}
6871
6872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6874#[cfg_attr(feature = "bindings", derive(TS))]
6875pub struct SequenceFunc {
6876 pub start: Expression,
6877 pub stop: Expression,
6878 pub step: Option<Expression>,
6879}
6880
6881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6887#[cfg_attr(feature = "bindings", derive(TS))]
6888pub struct StructConstructor {
6889 pub fields: Vec<(Option<Identifier>, Expression)>,
6890}
6891
6892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6894#[cfg_attr(feature = "bindings", derive(TS))]
6895pub struct StructExtractFunc {
6896 pub this: Expression,
6897 pub field: Identifier,
6898}
6899
6900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6902#[cfg_attr(feature = "bindings", derive(TS))]
6903pub struct NamedStructFunc {
6904 pub pairs: Vec<(Expression, Expression)>,
6905}
6906
6907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6913#[cfg_attr(feature = "bindings", derive(TS))]
6914pub struct MapConstructor {
6915 pub keys: Vec<Expression>,
6916 pub values: Vec<Expression>,
6917 #[serde(default)]
6919 pub curly_brace_syntax: bool,
6920 #[serde(default)]
6922 pub with_map_keyword: bool,
6923}
6924
6925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6927#[cfg_attr(feature = "bindings", derive(TS))]
6928pub struct TransformFunc {
6929 pub this: Expression,
6930 pub transform: Expression,
6931}
6932
6933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6936#[cfg_attr(feature = "bindings", derive(TS))]
6937pub struct FunctionEmits {
6938 pub this: Expression,
6940 pub emits: Expression,
6942}
6943
6944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6950#[cfg_attr(feature = "bindings", derive(TS))]
6951pub struct JsonExtractFunc {
6952 pub this: Expression,
6953 pub path: Expression,
6954 pub returning: Option<DataType>,
6955 #[serde(default)]
6957 pub arrow_syntax: bool,
6958 #[serde(default)]
6960 pub hash_arrow_syntax: bool,
6961 #[serde(default)]
6963 pub wrapper_option: Option<String>,
6964 #[serde(default)]
6966 pub quotes_option: Option<String>,
6967 #[serde(default)]
6969 pub on_scalar_string: bool,
6970 #[serde(default)]
6972 pub on_error: Option<String>,
6973}
6974
6975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6977#[cfg_attr(feature = "bindings", derive(TS))]
6978pub struct JsonPathFunc {
6979 pub this: Expression,
6980 pub paths: Vec<Expression>,
6981}
6982
6983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6985#[cfg_attr(feature = "bindings", derive(TS))]
6986pub struct JsonObjectFunc {
6987 pub pairs: Vec<(Expression, Expression)>,
6988 pub null_handling: Option<JsonNullHandling>,
6989 #[serde(default)]
6990 pub with_unique_keys: bool,
6991 #[serde(default)]
6992 pub returning_type: Option<DataType>,
6993 #[serde(default)]
6994 pub format_json: bool,
6995 #[serde(default)]
6996 pub encoding: Option<String>,
6997 #[serde(default)]
6999 pub star: bool,
7000}
7001
7002#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7004#[cfg_attr(feature = "bindings", derive(TS))]
7005pub enum JsonNullHandling {
7006 NullOnNull,
7007 AbsentOnNull,
7008}
7009
7010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7012#[cfg_attr(feature = "bindings", derive(TS))]
7013pub struct JsonModifyFunc {
7014 pub this: Expression,
7015 pub path_values: Vec<(Expression, Expression)>,
7016}
7017
7018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7020#[cfg_attr(feature = "bindings", derive(TS))]
7021pub struct JsonArrayAggFunc {
7022 pub this: Expression,
7023 pub order_by: Option<Vec<Ordered>>,
7024 pub null_handling: Option<JsonNullHandling>,
7025 pub filter: Option<Expression>,
7026}
7027
7028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7030#[cfg_attr(feature = "bindings", derive(TS))]
7031pub struct JsonObjectAggFunc {
7032 pub key: Expression,
7033 pub value: Expression,
7034 pub null_handling: Option<JsonNullHandling>,
7035 pub filter: Option<Expression>,
7036}
7037
7038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7044#[cfg_attr(feature = "bindings", derive(TS))]
7045pub struct ConvertFunc {
7046 pub this: Expression,
7047 pub to: DataType,
7048 pub style: Option<Expression>,
7049}
7050
7051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7057#[cfg_attr(feature = "bindings", derive(TS))]
7058pub struct LambdaExpr {
7059 pub parameters: Vec<Identifier>,
7060 pub body: Expression,
7061 #[serde(default)]
7063 pub colon: bool,
7064 #[serde(default)]
7067 pub parameter_types: Vec<Option<DataType>>,
7068}
7069
7070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7072#[cfg_attr(feature = "bindings", derive(TS))]
7073pub struct Parameter {
7074 pub name: Option<String>,
7075 pub index: Option<u32>,
7076 pub style: ParameterStyle,
7077 #[serde(default)]
7079 pub quoted: bool,
7080 #[serde(default)]
7082 pub string_quoted: bool,
7083 #[serde(default)]
7085 pub expression: Option<String>,
7086}
7087
7088#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7090#[cfg_attr(feature = "bindings", derive(TS))]
7091pub enum ParameterStyle {
7092 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7102
7103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7105#[cfg_attr(feature = "bindings", derive(TS))]
7106pub struct Placeholder {
7107 pub index: Option<u32>,
7108}
7109
7110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7112#[cfg_attr(feature = "bindings", derive(TS))]
7113pub struct NamedArgument {
7114 pub name: Identifier,
7115 pub value: Expression,
7116 pub separator: NamedArgSeparator,
7118}
7119
7120#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7122#[cfg_attr(feature = "bindings", derive(TS))]
7123pub enum NamedArgSeparator {
7124 DArrow,
7126 ColonEq,
7128 Eq,
7130}
7131
7132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7135#[cfg_attr(feature = "bindings", derive(TS))]
7136pub struct TableArgument {
7137 pub prefix: String,
7139 pub this: Expression,
7141}
7142
7143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7145#[cfg_attr(feature = "bindings", derive(TS))]
7146pub struct SqlComment {
7147 pub text: String,
7148 pub is_block: bool,
7149}
7150
7151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7157#[cfg_attr(feature = "bindings", derive(TS))]
7158pub struct SimilarToExpr {
7159 pub this: Expression,
7160 pub pattern: Expression,
7161 pub escape: Option<Expression>,
7162 pub not: bool,
7163}
7164
7165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7167#[cfg_attr(feature = "bindings", derive(TS))]
7168pub struct QuantifiedExpr {
7169 pub this: Expression,
7170 pub subquery: Expression,
7171 pub op: Option<QuantifiedOp>,
7172}
7173
7174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7176#[cfg_attr(feature = "bindings", derive(TS))]
7177pub enum QuantifiedOp {
7178 Eq,
7179 Neq,
7180 Lt,
7181 Lte,
7182 Gt,
7183 Gte,
7184}
7185
7186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7191#[cfg_attr(feature = "bindings", derive(TS))]
7192pub struct OverlapsExpr {
7193 #[serde(skip_serializing_if = "Option::is_none")]
7195 pub this: Option<Expression>,
7196 #[serde(skip_serializing_if = "Option::is_none")]
7198 pub expression: Option<Expression>,
7199 #[serde(skip_serializing_if = "Option::is_none")]
7201 pub left_start: Option<Expression>,
7202 #[serde(skip_serializing_if = "Option::is_none")]
7204 pub left_end: Option<Expression>,
7205 #[serde(skip_serializing_if = "Option::is_none")]
7207 pub right_start: Option<Expression>,
7208 #[serde(skip_serializing_if = "Option::is_none")]
7210 pub right_end: Option<Expression>,
7211}
7212
7213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7219#[cfg_attr(feature = "bindings", derive(TS))]
7220pub struct Subscript {
7221 pub this: Expression,
7222 pub index: Expression,
7223}
7224
7225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7227#[cfg_attr(feature = "bindings", derive(TS))]
7228pub struct DotAccess {
7229 pub this: Expression,
7230 pub field: Identifier,
7231}
7232
7233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7235#[cfg_attr(feature = "bindings", derive(TS))]
7236pub struct MethodCall {
7237 pub this: Expression,
7238 pub method: Identifier,
7239 pub args: Vec<Expression>,
7240}
7241
7242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7244#[cfg_attr(feature = "bindings", derive(TS))]
7245pub struct ArraySlice {
7246 pub this: Expression,
7247 pub start: Option<Expression>,
7248 pub end: Option<Expression>,
7249}
7250
7251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7257#[cfg_attr(feature = "bindings", derive(TS))]
7258pub enum OnCommit {
7259 PreserveRows,
7261 DeleteRows,
7263}
7264
7265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7267#[cfg_attr(feature = "bindings", derive(TS))]
7268pub struct CreateTable {
7269 pub name: TableRef,
7270 #[serde(default, skip_serializing_if = "Option::is_none")]
7272 pub on_cluster: Option<OnCluster>,
7273 pub columns: Vec<ColumnDef>,
7274 pub constraints: Vec<TableConstraint>,
7275 pub if_not_exists: bool,
7276 pub temporary: bool,
7277 pub or_replace: bool,
7278 #[serde(default, skip_serializing_if = "Option::is_none")]
7280 pub table_modifier: Option<String>,
7281 pub as_select: Option<Expression>,
7282 #[serde(default)]
7284 pub as_select_parenthesized: bool,
7285 #[serde(default)]
7287 pub on_commit: Option<OnCommit>,
7288 #[serde(default)]
7290 pub clone_source: Option<TableRef>,
7291 #[serde(default, skip_serializing_if = "Option::is_none")]
7293 pub clone_at_clause: Option<Expression>,
7294 #[serde(default)]
7296 pub is_copy: bool,
7297 #[serde(default)]
7299 pub shallow_clone: bool,
7300 #[serde(default)]
7302 pub leading_comments: Vec<String>,
7303 #[serde(default)]
7305 pub with_properties: Vec<(String, String)>,
7306 #[serde(default)]
7308 pub teradata_post_name_options: Vec<String>,
7309 #[serde(default)]
7311 pub with_data: Option<bool>,
7312 #[serde(default)]
7314 pub with_statistics: Option<bool>,
7315 #[serde(default)]
7317 pub teradata_indexes: Vec<TeradataIndex>,
7318 #[serde(default)]
7320 pub with_cte: Option<With>,
7321 #[serde(default)]
7323 pub properties: Vec<Expression>,
7324 #[serde(default, skip_serializing_if = "Option::is_none")]
7326 pub partition_of: Option<Expression>,
7327 #[serde(default)]
7329 pub post_table_properties: Vec<Expression>,
7330 #[serde(default)]
7332 pub mysql_table_options: Vec<(String, String)>,
7333 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7335 pub inherits: Vec<TableRef>,
7336 #[serde(default, skip_serializing_if = "Option::is_none")]
7338 pub on_property: Option<OnProperty>,
7339 #[serde(default)]
7341 pub copy_grants: bool,
7342 #[serde(default, skip_serializing_if = "Option::is_none")]
7344 pub using_template: Option<Box<Expression>>,
7345 #[serde(default, skip_serializing_if = "Option::is_none")]
7347 pub rollup: Option<RollupProperty>,
7348 #[serde(default, skip_serializing_if = "Option::is_none")]
7350 pub uuid: Option<String>,
7351 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7355 pub with_partition_columns: Vec<ColumnDef>,
7356 #[serde(default, skip_serializing_if = "Option::is_none")]
7359 pub with_connection: Option<TableRef>,
7360}
7361
7362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7364#[cfg_attr(feature = "bindings", derive(TS))]
7365pub struct TeradataIndex {
7366 pub kind: TeradataIndexKind,
7368 pub name: Option<String>,
7370 pub columns: Vec<String>,
7372}
7373
7374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7376#[cfg_attr(feature = "bindings", derive(TS))]
7377pub enum TeradataIndexKind {
7378 NoPrimary,
7380 Primary,
7382 PrimaryAmp,
7384 Unique,
7386 UniquePrimary,
7388 Secondary,
7390}
7391
7392impl CreateTable {
7393 pub fn new(name: impl Into<String>) -> Self {
7394 Self {
7395 name: TableRef::new(name),
7396 on_cluster: None,
7397 columns: Vec::new(),
7398 constraints: Vec::new(),
7399 if_not_exists: false,
7400 temporary: false,
7401 or_replace: false,
7402 table_modifier: None,
7403 as_select: None,
7404 as_select_parenthesized: false,
7405 on_commit: None,
7406 clone_source: None,
7407 clone_at_clause: None,
7408 shallow_clone: false,
7409 is_copy: false,
7410 leading_comments: Vec::new(),
7411 with_properties: Vec::new(),
7412 teradata_post_name_options: Vec::new(),
7413 with_data: None,
7414 with_statistics: None,
7415 teradata_indexes: Vec::new(),
7416 with_cte: None,
7417 properties: Vec::new(),
7418 partition_of: None,
7419 post_table_properties: Vec::new(),
7420 mysql_table_options: Vec::new(),
7421 inherits: Vec::new(),
7422 on_property: None,
7423 copy_grants: false,
7424 using_template: None,
7425 rollup: None,
7426 uuid: None,
7427 with_partition_columns: Vec::new(),
7428 with_connection: None,
7429 }
7430 }
7431}
7432
7433#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7435#[cfg_attr(feature = "bindings", derive(TS))]
7436pub enum SortOrder {
7437 Asc,
7438 Desc,
7439}
7440
7441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7443#[cfg_attr(feature = "bindings", derive(TS))]
7444pub enum ConstraintType {
7445 NotNull,
7446 Null,
7447 PrimaryKey,
7448 Unique,
7449 Default,
7450 AutoIncrement,
7451 Collate,
7452 Comment,
7453 References,
7454 Check,
7455 GeneratedAsIdentity,
7456 Tags,
7458 ComputedColumn,
7460 GeneratedAsRow,
7462 OnUpdate,
7464 Path,
7466 Encode,
7468}
7469
7470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7472#[cfg_attr(feature = "bindings", derive(TS))]
7473pub struct ColumnDef {
7474 pub name: Identifier,
7475 pub data_type: DataType,
7476 pub nullable: Option<bool>,
7477 pub default: Option<Expression>,
7478 pub primary_key: bool,
7479 #[serde(default)]
7481 pub primary_key_order: Option<SortOrder>,
7482 pub unique: bool,
7483 #[serde(default)]
7485 pub unique_nulls_not_distinct: bool,
7486 pub auto_increment: bool,
7487 pub comment: Option<String>,
7488 pub constraints: Vec<ColumnConstraint>,
7489 #[serde(default)]
7491 pub constraint_order: Vec<ConstraintType>,
7492 #[serde(default)]
7494 pub format: Option<String>,
7495 #[serde(default)]
7497 pub title: Option<String>,
7498 #[serde(default)]
7500 pub inline_length: Option<u64>,
7501 #[serde(default)]
7503 pub compress: Option<Vec<Expression>>,
7504 #[serde(default)]
7506 pub character_set: Option<String>,
7507 #[serde(default)]
7509 pub uppercase: bool,
7510 #[serde(default)]
7512 pub casespecific: Option<bool>,
7513 #[serde(default)]
7515 pub auto_increment_start: Option<Box<Expression>>,
7516 #[serde(default)]
7518 pub auto_increment_increment: Option<Box<Expression>>,
7519 #[serde(default)]
7521 pub auto_increment_order: Option<bool>,
7522 #[serde(default)]
7524 pub unsigned: bool,
7525 #[serde(default)]
7527 pub zerofill: bool,
7528 #[serde(default, skip_serializing_if = "Option::is_none")]
7530 pub on_update: Option<Expression>,
7531 #[serde(default, skip_serializing_if = "Option::is_none")]
7533 pub visible: Option<bool>,
7534 #[serde(default, skip_serializing_if = "Option::is_none")]
7536 pub unique_constraint_name: Option<String>,
7537 #[serde(default, skip_serializing_if = "Option::is_none")]
7539 pub not_null_constraint_name: Option<String>,
7540 #[serde(default, skip_serializing_if = "Option::is_none")]
7542 pub primary_key_constraint_name: Option<String>,
7543 #[serde(default, skip_serializing_if = "Option::is_none")]
7545 pub check_constraint_name: Option<String>,
7546 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7548 pub options: Vec<Expression>,
7549 #[serde(default)]
7551 pub no_type: bool,
7552 #[serde(default, skip_serializing_if = "Option::is_none")]
7554 pub encoding: Option<String>,
7555 #[serde(default, skip_serializing_if = "Option::is_none")]
7557 pub codec: Option<String>,
7558 #[serde(default, skip_serializing_if = "Option::is_none")]
7560 pub ephemeral: Option<Option<Box<Expression>>>,
7561 #[serde(default, skip_serializing_if = "Option::is_none")]
7563 pub materialized_expr: Option<Box<Expression>>,
7564 #[serde(default, skip_serializing_if = "Option::is_none")]
7566 pub alias_expr: Option<Box<Expression>>,
7567 #[serde(default, skip_serializing_if = "Option::is_none")]
7569 pub ttl_expr: Option<Box<Expression>>,
7570 #[serde(default)]
7572 pub not_for_replication: bool,
7573}
7574
7575impl ColumnDef {
7576 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7577 Self {
7578 name: Identifier::new(name),
7579 data_type,
7580 nullable: None,
7581 default: None,
7582 primary_key: false,
7583 primary_key_order: None,
7584 unique: false,
7585 unique_nulls_not_distinct: false,
7586 auto_increment: false,
7587 comment: None,
7588 constraints: Vec::new(),
7589 constraint_order: Vec::new(),
7590 format: None,
7591 title: None,
7592 inline_length: None,
7593 compress: None,
7594 character_set: None,
7595 uppercase: false,
7596 casespecific: None,
7597 auto_increment_start: None,
7598 auto_increment_increment: None,
7599 auto_increment_order: None,
7600 unsigned: false,
7601 zerofill: false,
7602 on_update: None,
7603 visible: None,
7604 unique_constraint_name: None,
7605 not_null_constraint_name: None,
7606 primary_key_constraint_name: None,
7607 check_constraint_name: None,
7608 options: Vec::new(),
7609 no_type: false,
7610 encoding: None,
7611 codec: None,
7612 ephemeral: None,
7613 materialized_expr: None,
7614 alias_expr: None,
7615 ttl_expr: None,
7616 not_for_replication: false,
7617 }
7618 }
7619}
7620
7621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7623#[cfg_attr(feature = "bindings", derive(TS))]
7624pub enum ColumnConstraint {
7625 NotNull,
7626 Null,
7627 Unique,
7628 PrimaryKey,
7629 Default(Expression),
7630 Check(Expression),
7631 References(ForeignKeyRef),
7632 GeneratedAsIdentity(GeneratedAsIdentity),
7633 Collate(Identifier),
7634 Comment(String),
7635 Tags(Tags),
7637 ComputedColumn(ComputedColumn),
7640 GeneratedAsRow(GeneratedAsRow),
7642 Path(Expression),
7644}
7645
7646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7648#[cfg_attr(feature = "bindings", derive(TS))]
7649pub struct ComputedColumn {
7650 pub expression: Box<Expression>,
7652 #[serde(default)]
7654 pub persisted: bool,
7655 #[serde(default)]
7657 pub not_null: bool,
7658 #[serde(default)]
7661 pub persistence_kind: Option<String>,
7662 #[serde(default, skip_serializing_if = "Option::is_none")]
7664 pub data_type: Option<DataType>,
7665}
7666
7667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7669#[cfg_attr(feature = "bindings", derive(TS))]
7670pub struct GeneratedAsRow {
7671 pub start: bool,
7673 #[serde(default)]
7675 pub hidden: bool,
7676}
7677
7678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7680#[cfg_attr(feature = "bindings", derive(TS))]
7681pub struct GeneratedAsIdentity {
7682 pub always: bool,
7684 pub on_null: bool,
7686 pub start: Option<Box<Expression>>,
7688 pub increment: Option<Box<Expression>>,
7690 pub minvalue: Option<Box<Expression>>,
7692 pub maxvalue: Option<Box<Expression>>,
7694 pub cycle: Option<bool>,
7696}
7697
7698#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7700#[cfg_attr(feature = "bindings", derive(TS))]
7701pub struct ConstraintModifiers {
7702 pub enforced: Option<bool>,
7704 pub deferrable: Option<bool>,
7706 pub initially_deferred: Option<bool>,
7708 pub norely: bool,
7710 pub rely: bool,
7712 #[serde(default)]
7714 pub using: Option<String>,
7715 #[serde(default)]
7717 pub using_before_columns: bool,
7718 #[serde(default, skip_serializing_if = "Option::is_none")]
7720 pub comment: Option<String>,
7721 #[serde(default, skip_serializing_if = "Option::is_none")]
7723 pub visible: Option<bool>,
7724 #[serde(default, skip_serializing_if = "Option::is_none")]
7726 pub engine_attribute: Option<String>,
7727 #[serde(default, skip_serializing_if = "Option::is_none")]
7729 pub with_parser: Option<String>,
7730 #[serde(default)]
7732 pub not_valid: bool,
7733 #[serde(default, skip_serializing_if = "Option::is_none")]
7735 pub clustered: Option<String>,
7736 #[serde(default, skip_serializing_if = "Option::is_none")]
7738 pub on_conflict: Option<String>,
7739 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7741 pub with_options: Vec<(String, String)>,
7742 #[serde(default, skip_serializing_if = "Option::is_none")]
7744 pub on_filegroup: Option<Identifier>,
7745}
7746
7747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7749#[cfg_attr(feature = "bindings", derive(TS))]
7750pub enum TableConstraint {
7751 PrimaryKey {
7752 name: Option<Identifier>,
7753 columns: Vec<Identifier>,
7754 #[serde(default)]
7756 include_columns: Vec<Identifier>,
7757 #[serde(default)]
7758 modifiers: ConstraintModifiers,
7759 #[serde(default)]
7761 has_constraint_keyword: bool,
7762 },
7763 Unique {
7764 name: Option<Identifier>,
7765 columns: Vec<Identifier>,
7766 #[serde(default)]
7768 columns_parenthesized: bool,
7769 #[serde(default)]
7770 modifiers: ConstraintModifiers,
7771 #[serde(default)]
7773 has_constraint_keyword: bool,
7774 #[serde(default)]
7776 nulls_not_distinct: bool,
7777 },
7778 ForeignKey {
7779 name: Option<Identifier>,
7780 columns: Vec<Identifier>,
7781 #[serde(default)]
7782 references: Option<ForeignKeyRef>,
7783 #[serde(default)]
7785 on_delete: Option<ReferentialAction>,
7786 #[serde(default)]
7788 on_update: Option<ReferentialAction>,
7789 #[serde(default)]
7790 modifiers: ConstraintModifiers,
7791 },
7792 Check {
7793 name: Option<Identifier>,
7794 expression: Expression,
7795 #[serde(default)]
7796 modifiers: ConstraintModifiers,
7797 },
7798 Assume {
7800 name: Option<Identifier>,
7801 expression: Expression,
7802 },
7803 Default {
7805 name: Option<Identifier>,
7806 expression: Expression,
7807 column: Identifier,
7808 },
7809 Index {
7811 name: Option<Identifier>,
7812 columns: Vec<Identifier>,
7813 #[serde(default)]
7815 kind: Option<String>,
7816 #[serde(default)]
7817 modifiers: ConstraintModifiers,
7818 #[serde(default)]
7820 use_key_keyword: bool,
7821 #[serde(default, skip_serializing_if = "Option::is_none")]
7823 expression: Option<Box<Expression>>,
7824 #[serde(default, skip_serializing_if = "Option::is_none")]
7826 index_type: Option<Box<Expression>>,
7827 #[serde(default, skip_serializing_if = "Option::is_none")]
7829 granularity: Option<Box<Expression>>,
7830 },
7831 Projection {
7833 name: Identifier,
7834 expression: Expression,
7835 },
7836 Like {
7838 source: TableRef,
7839 options: Vec<(LikeOptionAction, String)>,
7841 },
7842 PeriodForSystemTime {
7844 start_col: Identifier,
7845 end_col: Identifier,
7846 },
7847 Exclude {
7850 name: Option<Identifier>,
7851 #[serde(default)]
7853 using: Option<String>,
7854 elements: Vec<ExcludeElement>,
7856 #[serde(default)]
7858 include_columns: Vec<Identifier>,
7859 #[serde(default)]
7861 where_clause: Option<Box<Expression>>,
7862 #[serde(default)]
7864 with_params: Vec<(String, String)>,
7865 #[serde(default)]
7867 using_index_tablespace: Option<String>,
7868 #[serde(default)]
7869 modifiers: ConstraintModifiers,
7870 },
7871 Tags(Tags),
7873 InitiallyDeferred {
7877 deferred: bool,
7879 },
7880}
7881
7882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7884#[cfg_attr(feature = "bindings", derive(TS))]
7885pub struct ExcludeElement {
7886 pub expression: String,
7888 pub operator: String,
7890}
7891
7892#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7894#[cfg_attr(feature = "bindings", derive(TS))]
7895pub enum LikeOptionAction {
7896 Including,
7897 Excluding,
7898}
7899
7900#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7902#[cfg_attr(feature = "bindings", derive(TS))]
7903pub enum MatchType {
7904 Full,
7905 Partial,
7906 Simple,
7907}
7908
7909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7911#[cfg_attr(feature = "bindings", derive(TS))]
7912pub struct ForeignKeyRef {
7913 pub table: TableRef,
7914 pub columns: Vec<Identifier>,
7915 pub on_delete: Option<ReferentialAction>,
7916 pub on_update: Option<ReferentialAction>,
7917 #[serde(default)]
7919 pub on_update_first: bool,
7920 #[serde(default)]
7922 pub match_type: Option<MatchType>,
7923 #[serde(default)]
7925 pub match_after_actions: bool,
7926 #[serde(default)]
7928 pub constraint_name: Option<String>,
7929 #[serde(default)]
7931 pub deferrable: Option<bool>,
7932 #[serde(default)]
7934 pub has_foreign_key_keywords: bool,
7935}
7936
7937#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7939#[cfg_attr(feature = "bindings", derive(TS))]
7940pub enum ReferentialAction {
7941 Cascade,
7942 SetNull,
7943 SetDefault,
7944 Restrict,
7945 NoAction,
7946}
7947
7948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7950#[cfg_attr(feature = "bindings", derive(TS))]
7951pub struct DropTable {
7952 pub names: Vec<TableRef>,
7953 pub if_exists: bool,
7954 pub cascade: bool,
7955 #[serde(default)]
7957 pub cascade_constraints: bool,
7958 #[serde(default)]
7960 pub purge: bool,
7961 #[serde(default)]
7963 pub leading_comments: Vec<String>,
7964 #[serde(default, skip_serializing_if = "Option::is_none")]
7967 pub object_id_args: Option<String>,
7968 #[serde(default)]
7970 pub sync: bool,
7971 #[serde(default)]
7973 pub iceberg: bool,
7974 #[serde(default)]
7976 pub restrict: bool,
7977}
7978
7979impl DropTable {
7980 pub fn new(name: impl Into<String>) -> Self {
7981 Self {
7982 names: vec![TableRef::new(name)],
7983 if_exists: false,
7984 cascade: false,
7985 cascade_constraints: false,
7986 purge: false,
7987 leading_comments: Vec::new(),
7988 object_id_args: None,
7989 sync: false,
7990 iceberg: false,
7991 restrict: false,
7992 }
7993 }
7994}
7995
7996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7998#[cfg_attr(feature = "bindings", derive(TS))]
7999pub struct Undrop {
8000 pub kind: String,
8002 pub name: TableRef,
8004 #[serde(default)]
8006 pub if_exists: bool,
8007}
8008
8009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8011#[cfg_attr(feature = "bindings", derive(TS))]
8012pub struct AlterTable {
8013 pub name: TableRef,
8014 pub actions: Vec<AlterTableAction>,
8015 #[serde(default)]
8017 pub if_exists: bool,
8018 #[serde(default, skip_serializing_if = "Option::is_none")]
8020 pub algorithm: Option<String>,
8021 #[serde(default, skip_serializing_if = "Option::is_none")]
8023 pub lock: Option<String>,
8024 #[serde(default, skip_serializing_if = "Option::is_none")]
8026 pub with_check: Option<String>,
8027 #[serde(default, skip_serializing_if = "Option::is_none")]
8029 pub partition: Option<Vec<(Identifier, Expression)>>,
8030 #[serde(default, skip_serializing_if = "Option::is_none")]
8032 pub on_cluster: Option<OnCluster>,
8033 #[serde(default, skip_serializing_if = "Option::is_none")]
8035 pub table_modifier: Option<String>,
8036}
8037
8038impl AlterTable {
8039 pub fn new(name: impl Into<String>) -> Self {
8040 Self {
8041 name: TableRef::new(name),
8042 actions: Vec::new(),
8043 if_exists: false,
8044 algorithm: None,
8045 lock: None,
8046 with_check: None,
8047 partition: None,
8048 on_cluster: None,
8049 table_modifier: None,
8050 }
8051 }
8052}
8053
8054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8056#[cfg_attr(feature = "bindings", derive(TS))]
8057pub enum ColumnPosition {
8058 First,
8059 After(Identifier),
8060}
8061
8062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8064#[cfg_attr(feature = "bindings", derive(TS))]
8065pub enum AlterTableAction {
8066 AddColumn {
8067 column: ColumnDef,
8068 if_not_exists: bool,
8069 position: Option<ColumnPosition>,
8070 },
8071 DropColumn {
8072 name: Identifier,
8073 if_exists: bool,
8074 cascade: bool,
8075 },
8076 RenameColumn {
8077 old_name: Identifier,
8078 new_name: Identifier,
8079 if_exists: bool,
8080 },
8081 AlterColumn {
8082 name: Identifier,
8083 action: AlterColumnAction,
8084 #[serde(default)]
8086 use_modify_keyword: bool,
8087 },
8088 RenameTable(TableRef),
8089 AddConstraint(TableConstraint),
8090 DropConstraint {
8091 name: Identifier,
8092 if_exists: bool,
8093 },
8094 DropForeignKey {
8096 name: Identifier,
8097 },
8098 DropPartition {
8100 partitions: Vec<Vec<(Identifier, Expression)>>,
8102 if_exists: bool,
8103 },
8104 AddPartition {
8106 partition: Expression,
8108 if_not_exists: bool,
8109 location: Option<Expression>,
8110 },
8111 Delete {
8113 where_clause: Expression,
8114 },
8115 SwapWith(TableRef),
8117 SetProperty {
8119 properties: Vec<(String, Expression)>,
8120 },
8121 UnsetProperty {
8123 properties: Vec<String>,
8124 },
8125 ClusterBy {
8127 expressions: Vec<Expression>,
8128 },
8129 SetTag {
8131 expressions: Vec<(String, Expression)>,
8132 },
8133 UnsetTag {
8135 names: Vec<String>,
8136 },
8137 SetOptions {
8139 expressions: Vec<Expression>,
8140 },
8141 AlterIndex {
8143 name: Identifier,
8144 visible: bool,
8145 },
8146 SetAttribute {
8148 attribute: String,
8149 },
8150 SetStageFileFormat {
8152 options: Option<Expression>,
8153 },
8154 SetStageCopyOptions {
8156 options: Option<Expression>,
8157 },
8158 AddColumns {
8160 columns: Vec<ColumnDef>,
8161 cascade: bool,
8162 },
8163 DropColumns {
8165 names: Vec<Identifier>,
8166 },
8167 ChangeColumn {
8170 old_name: Identifier,
8171 new_name: Identifier,
8172 #[serde(default, skip_serializing_if = "Option::is_none")]
8173 data_type: Option<DataType>,
8174 comment: Option<String>,
8175 #[serde(default)]
8176 cascade: bool,
8177 },
8178 AlterSortKey {
8181 this: Option<String>,
8183 expressions: Vec<Expression>,
8185 compound: bool,
8187 },
8188 AlterDistStyle {
8192 style: String,
8194 distkey: Option<Identifier>,
8196 },
8197 SetTableProperties {
8199 properties: Vec<(Expression, Expression)>,
8200 },
8201 SetLocation {
8203 location: String,
8204 },
8205 SetFileFormat {
8207 format: String,
8208 },
8209 ReplacePartition {
8211 partition: Expression,
8212 source: Option<Box<Expression>>,
8213 },
8214 Raw {
8216 sql: String,
8217 },
8218}
8219
8220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8222#[cfg_attr(feature = "bindings", derive(TS))]
8223pub enum AlterColumnAction {
8224 SetDataType {
8225 data_type: DataType,
8226 using: Option<Expression>,
8228 #[serde(default, skip_serializing_if = "Option::is_none")]
8230 collate: Option<String>,
8231 },
8232 SetDefault(Expression),
8233 DropDefault,
8234 SetNotNull,
8235 DropNotNull,
8236 Comment(String),
8238 SetVisible,
8240 SetInvisible,
8242}
8243
8244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8246#[cfg_attr(feature = "bindings", derive(TS))]
8247pub struct CreateIndex {
8248 pub name: Identifier,
8249 pub table: TableRef,
8250 pub columns: Vec<IndexColumn>,
8251 pub unique: bool,
8252 pub if_not_exists: bool,
8253 pub using: Option<String>,
8254 #[serde(default)]
8256 pub clustered: Option<String>,
8257 #[serde(default)]
8259 pub concurrently: bool,
8260 #[serde(default)]
8262 pub where_clause: Option<Box<Expression>>,
8263 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8265 pub include_columns: Vec<Identifier>,
8266 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8268 pub with_options: Vec<(String, String)>,
8269 #[serde(default)]
8271 pub on_filegroup: Option<String>,
8272}
8273
8274impl CreateIndex {
8275 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8276 Self {
8277 name: Identifier::new(name),
8278 table: TableRef::new(table),
8279 columns: Vec::new(),
8280 unique: false,
8281 if_not_exists: false,
8282 using: None,
8283 clustered: None,
8284 concurrently: false,
8285 where_clause: None,
8286 include_columns: Vec::new(),
8287 with_options: Vec::new(),
8288 on_filegroup: None,
8289 }
8290 }
8291}
8292
8293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8295#[cfg_attr(feature = "bindings", derive(TS))]
8296pub struct IndexColumn {
8297 pub column: Identifier,
8298 pub desc: bool,
8299 #[serde(default)]
8301 pub asc: bool,
8302 pub nulls_first: Option<bool>,
8303 #[serde(default, skip_serializing_if = "Option::is_none")]
8305 pub opclass: Option<String>,
8306}
8307
8308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8310#[cfg_attr(feature = "bindings", derive(TS))]
8311pub struct DropIndex {
8312 pub name: Identifier,
8313 pub table: Option<TableRef>,
8314 pub if_exists: bool,
8315 #[serde(default)]
8317 pub concurrently: bool,
8318}
8319
8320impl DropIndex {
8321 pub fn new(name: impl Into<String>) -> Self {
8322 Self {
8323 name: Identifier::new(name),
8324 table: None,
8325 if_exists: false,
8326 concurrently: false,
8327 }
8328 }
8329}
8330
8331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8333#[cfg_attr(feature = "bindings", derive(TS))]
8334pub struct ViewColumn {
8335 pub name: Identifier,
8336 pub comment: Option<String>,
8337 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8339 pub options: Vec<Expression>,
8340}
8341
8342impl ViewColumn {
8343 pub fn new(name: impl Into<String>) -> Self {
8344 Self {
8345 name: Identifier::new(name),
8346 comment: None,
8347 options: Vec::new(),
8348 }
8349 }
8350
8351 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8352 Self {
8353 name: Identifier::new(name),
8354 comment: Some(comment.into()),
8355 options: Vec::new(),
8356 }
8357 }
8358}
8359
8360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8362#[cfg_attr(feature = "bindings", derive(TS))]
8363pub struct CreateView {
8364 pub name: TableRef,
8365 pub columns: Vec<ViewColumn>,
8366 pub query: Expression,
8367 pub or_replace: bool,
8368 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8370 pub or_alter: bool,
8371 pub if_not_exists: bool,
8372 pub materialized: bool,
8373 pub temporary: bool,
8374 #[serde(default)]
8376 pub secure: bool,
8377 #[serde(skip_serializing_if = "Option::is_none")]
8379 pub algorithm: Option<String>,
8380 #[serde(skip_serializing_if = "Option::is_none")]
8382 pub definer: Option<String>,
8383 #[serde(skip_serializing_if = "Option::is_none")]
8385 pub security: Option<FunctionSecurity>,
8386 #[serde(default = "default_true")]
8388 pub security_sql_style: bool,
8389 #[serde(default)]
8391 pub security_after_name: bool,
8392 #[serde(default)]
8394 pub query_parenthesized: bool,
8395 #[serde(skip_serializing_if = "Option::is_none")]
8397 pub locking_mode: Option<String>,
8398 #[serde(skip_serializing_if = "Option::is_none")]
8400 pub locking_access: Option<String>,
8401 #[serde(default)]
8403 pub copy_grants: bool,
8404 #[serde(skip_serializing_if = "Option::is_none", default)]
8406 pub comment: Option<String>,
8407 #[serde(skip_serializing_if = "Option::is_none", default)]
8409 pub row_access_policy: Option<String>,
8410 #[serde(default)]
8412 pub tags: Vec<(String, String)>,
8413 #[serde(default)]
8415 pub options: Vec<Expression>,
8416 #[serde(skip_serializing_if = "Option::is_none", default)]
8418 pub build: Option<String>,
8419 #[serde(skip_serializing_if = "Option::is_none", default)]
8421 pub refresh: Option<Box<RefreshTriggerProperty>>,
8422 #[serde(skip_serializing_if = "Option::is_none", default)]
8425 pub schema: Option<Box<Schema>>,
8426 #[serde(skip_serializing_if = "Option::is_none", default)]
8428 pub unique_key: Option<Box<UniqueKeyProperty>>,
8429 #[serde(default)]
8431 pub no_schema_binding: bool,
8432 #[serde(skip_serializing_if = "Option::is_none", default)]
8434 pub auto_refresh: Option<bool>,
8435 #[serde(default, skip_serializing_if = "Option::is_none")]
8437 pub on_cluster: Option<OnCluster>,
8438 #[serde(default, skip_serializing_if = "Option::is_none")]
8440 pub to_table: Option<TableRef>,
8441 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8443 pub table_properties: Vec<Expression>,
8444}
8445
8446impl CreateView {
8447 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8448 Self {
8449 name: TableRef::new(name),
8450 columns: Vec::new(),
8451 query,
8452 or_replace: false,
8453 or_alter: false,
8454 if_not_exists: false,
8455 materialized: false,
8456 temporary: false,
8457 secure: false,
8458 algorithm: None,
8459 definer: None,
8460 security: None,
8461 security_sql_style: true,
8462 security_after_name: false,
8463 query_parenthesized: false,
8464 locking_mode: None,
8465 locking_access: None,
8466 copy_grants: false,
8467 comment: None,
8468 row_access_policy: None,
8469 tags: Vec::new(),
8470 options: Vec::new(),
8471 build: None,
8472 refresh: None,
8473 schema: None,
8474 unique_key: None,
8475 no_schema_binding: false,
8476 auto_refresh: None,
8477 on_cluster: None,
8478 to_table: None,
8479 table_properties: Vec::new(),
8480 }
8481 }
8482}
8483
8484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8486#[cfg_attr(feature = "bindings", derive(TS))]
8487pub struct DropView {
8488 pub name: TableRef,
8489 pub if_exists: bool,
8490 pub materialized: bool,
8491}
8492
8493impl DropView {
8494 pub fn new(name: impl Into<String>) -> Self {
8495 Self {
8496 name: TableRef::new(name),
8497 if_exists: false,
8498 materialized: false,
8499 }
8500 }
8501}
8502
8503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8505#[cfg_attr(feature = "bindings", derive(TS))]
8506pub struct Truncate {
8507 #[serde(default)]
8509 pub target: TruncateTarget,
8510 #[serde(default)]
8512 pub if_exists: bool,
8513 pub table: TableRef,
8514 #[serde(default, skip_serializing_if = "Option::is_none")]
8516 pub on_cluster: Option<OnCluster>,
8517 pub cascade: bool,
8518 #[serde(default)]
8520 pub extra_tables: Vec<TruncateTableEntry>,
8521 #[serde(default)]
8523 pub identity: Option<TruncateIdentity>,
8524 #[serde(default)]
8526 pub restrict: bool,
8527 #[serde(default, skip_serializing_if = "Option::is_none")]
8529 pub partition: Option<Box<Expression>>,
8530}
8531
8532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8534#[cfg_attr(feature = "bindings", derive(TS))]
8535pub struct TruncateTableEntry {
8536 pub table: TableRef,
8537 #[serde(default)]
8539 pub star: bool,
8540}
8541
8542#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8544#[cfg_attr(feature = "bindings", derive(TS))]
8545pub enum TruncateTarget {
8546 Table,
8547 Database,
8548}
8549
8550impl Default for TruncateTarget {
8551 fn default() -> Self {
8552 TruncateTarget::Table
8553 }
8554}
8555
8556#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8558#[cfg_attr(feature = "bindings", derive(TS))]
8559pub enum TruncateIdentity {
8560 Restart,
8561 Continue,
8562}
8563
8564impl Truncate {
8565 pub fn new(table: impl Into<String>) -> Self {
8566 Self {
8567 target: TruncateTarget::Table,
8568 if_exists: false,
8569 table: TableRef::new(table),
8570 on_cluster: None,
8571 cascade: false,
8572 extra_tables: Vec::new(),
8573 identity: None,
8574 restrict: false,
8575 partition: None,
8576 }
8577 }
8578}
8579
8580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8582#[cfg_attr(feature = "bindings", derive(TS))]
8583pub struct Use {
8584 pub kind: Option<UseKind>,
8586 pub this: Identifier,
8588}
8589
8590#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8592#[cfg_attr(feature = "bindings", derive(TS))]
8593pub enum UseKind {
8594 Database,
8595 Schema,
8596 Role,
8597 Warehouse,
8598 Catalog,
8599 SecondaryRoles,
8601}
8602
8603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8605#[cfg_attr(feature = "bindings", derive(TS))]
8606pub struct SetStatement {
8607 pub items: Vec<SetItem>,
8609}
8610
8611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8613#[cfg_attr(feature = "bindings", derive(TS))]
8614pub struct SetItem {
8615 pub name: Expression,
8617 pub value: Expression,
8619 pub kind: Option<String>,
8621 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8623 pub no_equals: bool,
8624}
8625
8626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8628#[cfg_attr(feature = "bindings", derive(TS))]
8629pub struct Cache {
8630 pub table: Identifier,
8632 pub lazy: bool,
8634 pub options: Vec<(Expression, Expression)>,
8636 pub query: Option<Expression>,
8638}
8639
8640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8642#[cfg_attr(feature = "bindings", derive(TS))]
8643pub struct Uncache {
8644 pub table: Identifier,
8646 pub if_exists: bool,
8648}
8649
8650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8652#[cfg_attr(feature = "bindings", derive(TS))]
8653pub struct LoadData {
8654 pub local: bool,
8656 pub inpath: String,
8658 pub overwrite: bool,
8660 pub table: Expression,
8662 pub partition: Vec<(Identifier, Expression)>,
8664 pub input_format: Option<String>,
8666 pub serde: Option<String>,
8668}
8669
8670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8672#[cfg_attr(feature = "bindings", derive(TS))]
8673pub struct Pragma {
8674 pub schema: Option<Identifier>,
8676 pub name: Identifier,
8678 pub value: Option<Expression>,
8680 pub args: Vec<Expression>,
8682 #[serde(default)]
8684 pub use_assignment_syntax: bool,
8685}
8686
8687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8690#[cfg_attr(feature = "bindings", derive(TS))]
8691pub struct Privilege {
8692 pub name: String,
8694 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8696 pub columns: Vec<String>,
8697}
8698
8699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8701#[cfg_attr(feature = "bindings", derive(TS))]
8702pub struct GrantPrincipal {
8703 pub name: Identifier,
8705 pub is_role: bool,
8707 #[serde(default)]
8709 pub is_group: bool,
8710 #[serde(default)]
8712 pub is_share: bool,
8713}
8714
8715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8717#[cfg_attr(feature = "bindings", derive(TS))]
8718pub struct Grant {
8719 pub privileges: Vec<Privilege>,
8721 pub kind: Option<String>,
8723 pub securable: Identifier,
8725 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8727 pub function_params: Vec<String>,
8728 pub principals: Vec<GrantPrincipal>,
8730 pub grant_option: bool,
8732 #[serde(default, skip_serializing_if = "Option::is_none")]
8734 pub as_principal: Option<Identifier>,
8735}
8736
8737#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8739#[cfg_attr(feature = "bindings", derive(TS))]
8740pub struct Revoke {
8741 pub privileges: Vec<Privilege>,
8743 pub kind: Option<String>,
8745 pub securable: Identifier,
8747 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8749 pub function_params: Vec<String>,
8750 pub principals: Vec<GrantPrincipal>,
8752 pub grant_option: bool,
8754 pub cascade: bool,
8756 #[serde(default)]
8758 pub restrict: bool,
8759}
8760
8761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8763#[cfg_attr(feature = "bindings", derive(TS))]
8764pub struct Comment {
8765 pub this: Expression,
8767 pub kind: String,
8769 pub expression: Expression,
8771 pub exists: bool,
8773 pub materialized: bool,
8775}
8776
8777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8783#[cfg_attr(feature = "bindings", derive(TS))]
8784pub struct AlterView {
8785 pub name: TableRef,
8786 pub actions: Vec<AlterViewAction>,
8787 #[serde(default, skip_serializing_if = "Option::is_none")]
8789 pub algorithm: Option<String>,
8790 #[serde(default, skip_serializing_if = "Option::is_none")]
8792 pub definer: Option<String>,
8793 #[serde(default, skip_serializing_if = "Option::is_none")]
8795 pub sql_security: Option<String>,
8796 #[serde(default, skip_serializing_if = "Option::is_none")]
8798 pub with_option: Option<String>,
8799 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8801 pub columns: Vec<ViewColumn>,
8802}
8803
8804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8806#[cfg_attr(feature = "bindings", derive(TS))]
8807pub enum AlterViewAction {
8808 Rename(TableRef),
8810 OwnerTo(Identifier),
8812 SetSchema(Identifier),
8814 SetAuthorization(String),
8816 AlterColumn {
8818 name: Identifier,
8819 action: AlterColumnAction,
8820 },
8821 AsSelect(Box<Expression>),
8823 SetTblproperties(Vec<(String, String)>),
8825 UnsetTblproperties(Vec<String>),
8827}
8828
8829impl AlterView {
8830 pub fn new(name: impl Into<String>) -> Self {
8831 Self {
8832 name: TableRef::new(name),
8833 actions: Vec::new(),
8834 algorithm: None,
8835 definer: None,
8836 sql_security: None,
8837 with_option: None,
8838 columns: Vec::new(),
8839 }
8840 }
8841}
8842
8843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8845#[cfg_attr(feature = "bindings", derive(TS))]
8846pub struct AlterIndex {
8847 pub name: Identifier,
8848 pub table: Option<TableRef>,
8849 pub actions: Vec<AlterIndexAction>,
8850}
8851
8852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8854#[cfg_attr(feature = "bindings", derive(TS))]
8855pub enum AlterIndexAction {
8856 Rename(Identifier),
8858 SetTablespace(Identifier),
8860 Visible(bool),
8862}
8863
8864impl AlterIndex {
8865 pub fn new(name: impl Into<String>) -> Self {
8866 Self {
8867 name: Identifier::new(name),
8868 table: None,
8869 actions: Vec::new(),
8870 }
8871 }
8872}
8873
8874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8876#[cfg_attr(feature = "bindings", derive(TS))]
8877pub struct CreateSchema {
8878 pub name: Vec<Identifier>,
8880 pub if_not_exists: bool,
8881 pub authorization: Option<Identifier>,
8882 #[serde(default)]
8884 pub clone_from: Option<Vec<Identifier>>,
8885 #[serde(default)]
8887 pub at_clause: Option<Expression>,
8888 #[serde(default)]
8890 pub properties: Vec<Expression>,
8891 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8893 pub leading_comments: Vec<String>,
8894}
8895
8896impl CreateSchema {
8897 pub fn new(name: impl Into<String>) -> Self {
8898 Self {
8899 name: vec![Identifier::new(name)],
8900 if_not_exists: false,
8901 authorization: None,
8902 clone_from: None,
8903 at_clause: None,
8904 properties: Vec::new(),
8905 leading_comments: Vec::new(),
8906 }
8907 }
8908}
8909
8910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8912#[cfg_attr(feature = "bindings", derive(TS))]
8913pub struct DropSchema {
8914 pub name: Identifier,
8915 pub if_exists: bool,
8916 pub cascade: bool,
8917}
8918
8919impl DropSchema {
8920 pub fn new(name: impl Into<String>) -> Self {
8921 Self {
8922 name: Identifier::new(name),
8923 if_exists: false,
8924 cascade: false,
8925 }
8926 }
8927}
8928
8929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8931#[cfg_attr(feature = "bindings", derive(TS))]
8932pub struct DropNamespace {
8933 pub name: Identifier,
8934 pub if_exists: bool,
8935 pub cascade: bool,
8936}
8937
8938impl DropNamespace {
8939 pub fn new(name: impl Into<String>) -> Self {
8940 Self {
8941 name: Identifier::new(name),
8942 if_exists: false,
8943 cascade: false,
8944 }
8945 }
8946}
8947
8948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8950#[cfg_attr(feature = "bindings", derive(TS))]
8951pub struct CreateDatabase {
8952 pub name: Identifier,
8953 pub if_not_exists: bool,
8954 pub options: Vec<DatabaseOption>,
8955 #[serde(default)]
8957 pub clone_from: Option<Identifier>,
8958 #[serde(default)]
8960 pub at_clause: Option<Expression>,
8961}
8962
8963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8965#[cfg_attr(feature = "bindings", derive(TS))]
8966pub enum DatabaseOption {
8967 CharacterSet(String),
8968 Collate(String),
8969 Owner(Identifier),
8970 Template(Identifier),
8971 Encoding(String),
8972 Location(String),
8973}
8974
8975impl CreateDatabase {
8976 pub fn new(name: impl Into<String>) -> Self {
8977 Self {
8978 name: Identifier::new(name),
8979 if_not_exists: false,
8980 options: Vec::new(),
8981 clone_from: None,
8982 at_clause: None,
8983 }
8984 }
8985}
8986
8987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8989#[cfg_attr(feature = "bindings", derive(TS))]
8990pub struct DropDatabase {
8991 pub name: Identifier,
8992 pub if_exists: bool,
8993 #[serde(default)]
8995 pub sync: bool,
8996}
8997
8998impl DropDatabase {
8999 pub fn new(name: impl Into<String>) -> Self {
9000 Self {
9001 name: Identifier::new(name),
9002 if_exists: false,
9003 sync: false,
9004 }
9005 }
9006}
9007
9008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9010#[cfg_attr(feature = "bindings", derive(TS))]
9011pub struct CreateFunction {
9012 pub name: TableRef,
9013 pub parameters: Vec<FunctionParameter>,
9014 pub return_type: Option<DataType>,
9015 pub body: Option<FunctionBody>,
9016 pub or_replace: bool,
9017 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9019 pub or_alter: bool,
9020 pub if_not_exists: bool,
9021 pub temporary: bool,
9022 pub language: Option<String>,
9023 pub deterministic: Option<bool>,
9024 pub returns_null_on_null_input: Option<bool>,
9025 pub security: Option<FunctionSecurity>,
9026 #[serde(default = "default_true")]
9028 pub has_parens: bool,
9029 #[serde(default)]
9031 pub sql_data_access: Option<SqlDataAccess>,
9032 #[serde(default, skip_serializing_if = "Option::is_none")]
9034 pub returns_table_body: Option<String>,
9035 #[serde(default)]
9037 pub language_first: bool,
9038 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9040 pub set_options: Vec<FunctionSetOption>,
9041 #[serde(default)]
9043 pub strict: bool,
9044 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9046 pub options: Vec<Expression>,
9047 #[serde(default)]
9049 pub is_table_function: bool,
9050 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9052 pub property_order: Vec<FunctionPropertyKind>,
9053 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9055 pub using_resources: Vec<FunctionUsingResource>,
9056 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9058 pub environment: Vec<Expression>,
9059 #[serde(default, skip_serializing_if = "Option::is_none")]
9061 pub handler: Option<String>,
9062 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9064 pub handler_uses_eq: bool,
9065 #[serde(default, skip_serializing_if = "Option::is_none")]
9067 pub runtime_version: Option<String>,
9068 #[serde(default, skip_serializing_if = "Option::is_none")]
9070 pub packages: Option<Vec<String>>,
9071 #[serde(default, skip_serializing_if = "Option::is_none")]
9073 pub parameter_style: Option<String>,
9074}
9075
9076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9078#[cfg_attr(feature = "bindings", derive(TS))]
9079pub struct FunctionSetOption {
9080 pub name: String,
9081 pub value: FunctionSetValue,
9082}
9083
9084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9086#[cfg_attr(feature = "bindings", derive(TS))]
9087pub enum FunctionSetValue {
9088 Value { value: String, use_to: bool },
9090 FromCurrent,
9092}
9093
9094#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9096#[cfg_attr(feature = "bindings", derive(TS))]
9097pub enum SqlDataAccess {
9098 NoSql,
9100 ContainsSql,
9102 ReadsSqlData,
9104 ModifiesSqlData,
9106}
9107
9108#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9110#[cfg_attr(feature = "bindings", derive(TS))]
9111pub enum FunctionPropertyKind {
9112 Set,
9114 As,
9116 Using,
9118 Language,
9120 Determinism,
9122 NullInput,
9124 Security,
9126 SqlDataAccess,
9128 Options,
9130 Environment,
9132 Handler,
9134 RuntimeVersion,
9136 Packages,
9138 ParameterStyle,
9140}
9141
9142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9144#[cfg_attr(feature = "bindings", derive(TS))]
9145pub struct FunctionUsingResource {
9146 pub kind: String,
9147 pub uri: String,
9148}
9149
9150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9152#[cfg_attr(feature = "bindings", derive(TS))]
9153pub struct FunctionParameter {
9154 pub name: Option<Identifier>,
9155 pub data_type: DataType,
9156 pub mode: Option<ParameterMode>,
9157 pub default: Option<Expression>,
9158 #[serde(default, skip_serializing_if = "Option::is_none")]
9160 pub mode_text: Option<String>,
9161}
9162
9163#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9165#[cfg_attr(feature = "bindings", derive(TS))]
9166pub enum ParameterMode {
9167 In,
9168 Out,
9169 InOut,
9170 Variadic,
9171}
9172
9173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9175#[cfg_attr(feature = "bindings", derive(TS))]
9176pub enum FunctionBody {
9177 Block(String),
9179 StringLiteral(String),
9181 Expression(Expression),
9183 External(String),
9185 Return(Expression),
9187 Statements(Vec<Expression>),
9189 DollarQuoted {
9192 content: String,
9193 tag: Option<String>,
9194 },
9195 RawBlock(String),
9197}
9198
9199#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9201#[cfg_attr(feature = "bindings", derive(TS))]
9202pub enum FunctionSecurity {
9203 Definer,
9204 Invoker,
9205 None,
9207}
9208
9209impl CreateFunction {
9210 pub fn new(name: impl Into<String>) -> Self {
9211 Self {
9212 name: TableRef::new(name),
9213 parameters: Vec::new(),
9214 return_type: None,
9215 body: None,
9216 or_replace: false,
9217 or_alter: false,
9218 if_not_exists: false,
9219 temporary: false,
9220 language: None,
9221 deterministic: None,
9222 returns_null_on_null_input: None,
9223 security: None,
9224 has_parens: true,
9225 sql_data_access: None,
9226 returns_table_body: None,
9227 language_first: false,
9228 set_options: Vec::new(),
9229 strict: false,
9230 options: Vec::new(),
9231 is_table_function: false,
9232 property_order: Vec::new(),
9233 using_resources: Vec::new(),
9234 environment: Vec::new(),
9235 handler: None,
9236 handler_uses_eq: false,
9237 runtime_version: None,
9238 packages: None,
9239 parameter_style: None,
9240 }
9241 }
9242}
9243
9244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9246#[cfg_attr(feature = "bindings", derive(TS))]
9247pub struct DropFunction {
9248 pub name: TableRef,
9249 pub parameters: Option<Vec<DataType>>,
9250 pub if_exists: bool,
9251 pub cascade: bool,
9252}
9253
9254impl DropFunction {
9255 pub fn new(name: impl Into<String>) -> Self {
9256 Self {
9257 name: TableRef::new(name),
9258 parameters: None,
9259 if_exists: false,
9260 cascade: false,
9261 }
9262 }
9263}
9264
9265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9267#[cfg_attr(feature = "bindings", derive(TS))]
9268pub struct CreateProcedure {
9269 pub name: TableRef,
9270 pub parameters: Vec<FunctionParameter>,
9271 pub body: Option<FunctionBody>,
9272 pub or_replace: bool,
9273 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9275 pub or_alter: bool,
9276 pub if_not_exists: bool,
9277 pub language: Option<String>,
9278 pub security: Option<FunctionSecurity>,
9279 #[serde(default)]
9281 pub return_type: Option<DataType>,
9282 #[serde(default)]
9284 pub execute_as: Option<String>,
9285 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9287 pub with_options: Vec<String>,
9288 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9290 pub has_parens: bool,
9291 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9293 pub use_proc_keyword: bool,
9294}
9295
9296impl CreateProcedure {
9297 pub fn new(name: impl Into<String>) -> Self {
9298 Self {
9299 name: TableRef::new(name),
9300 parameters: Vec::new(),
9301 body: None,
9302 or_replace: false,
9303 or_alter: false,
9304 if_not_exists: false,
9305 language: None,
9306 security: None,
9307 return_type: None,
9308 execute_as: None,
9309 with_options: Vec::new(),
9310 has_parens: true,
9311 use_proc_keyword: false,
9312 }
9313 }
9314}
9315
9316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9318#[cfg_attr(feature = "bindings", derive(TS))]
9319pub struct DropProcedure {
9320 pub name: TableRef,
9321 pub parameters: Option<Vec<DataType>>,
9322 pub if_exists: bool,
9323 pub cascade: bool,
9324}
9325
9326impl DropProcedure {
9327 pub fn new(name: impl Into<String>) -> Self {
9328 Self {
9329 name: TableRef::new(name),
9330 parameters: None,
9331 if_exists: false,
9332 cascade: false,
9333 }
9334 }
9335}
9336
9337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9339#[cfg_attr(feature = "bindings", derive(TS))]
9340pub enum SeqPropKind {
9341 Start,
9342 Increment,
9343 Minvalue,
9344 Maxvalue,
9345 Cache,
9346 NoCache,
9347 Cycle,
9348 NoCycle,
9349 OwnedBy,
9350 Order,
9351 NoOrder,
9352 Comment,
9353 Sharing,
9355 Keep,
9357 NoKeep,
9359 Scale,
9361 NoScale,
9363 Shard,
9365 NoShard,
9367 Session,
9369 Global,
9371 NoCacheWord,
9373 NoCycleWord,
9375 NoMinvalueWord,
9377 NoMaxvalueWord,
9379}
9380
9381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9383#[cfg_attr(feature = "bindings", derive(TS))]
9384pub struct CreateSynonym {
9385 pub name: TableRef,
9387 pub target: TableRef,
9389}
9390
9391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9393#[cfg_attr(feature = "bindings", derive(TS))]
9394pub struct CreateSequence {
9395 pub name: TableRef,
9396 pub if_not_exists: bool,
9397 pub temporary: bool,
9398 #[serde(default)]
9399 pub or_replace: bool,
9400 #[serde(default, skip_serializing_if = "Option::is_none")]
9402 pub as_type: Option<DataType>,
9403 pub increment: Option<i64>,
9404 pub minvalue: Option<SequenceBound>,
9405 pub maxvalue: Option<SequenceBound>,
9406 pub start: Option<i64>,
9407 pub cache: Option<i64>,
9408 pub cycle: bool,
9409 pub owned_by: Option<TableRef>,
9410 #[serde(default)]
9412 pub owned_by_none: bool,
9413 #[serde(default)]
9415 pub order: Option<bool>,
9416 #[serde(default)]
9418 pub comment: Option<String>,
9419 #[serde(default, skip_serializing_if = "Option::is_none")]
9421 pub sharing: Option<String>,
9422 #[serde(default, skip_serializing_if = "Option::is_none")]
9424 pub scale_modifier: Option<String>,
9425 #[serde(default, skip_serializing_if = "Option::is_none")]
9427 pub shard_modifier: Option<String>,
9428 #[serde(default)]
9430 pub property_order: Vec<SeqPropKind>,
9431}
9432
9433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9435#[cfg_attr(feature = "bindings", derive(TS))]
9436pub enum SequenceBound {
9437 Value(i64),
9438 None,
9439}
9440
9441impl CreateSequence {
9442 pub fn new(name: impl Into<String>) -> Self {
9443 Self {
9444 name: TableRef::new(name),
9445 if_not_exists: false,
9446 temporary: false,
9447 or_replace: false,
9448 as_type: None,
9449 increment: None,
9450 minvalue: None,
9451 maxvalue: None,
9452 start: None,
9453 cache: None,
9454 cycle: false,
9455 owned_by: None,
9456 owned_by_none: false,
9457 order: None,
9458 comment: None,
9459 sharing: None,
9460 scale_modifier: None,
9461 shard_modifier: None,
9462 property_order: Vec::new(),
9463 }
9464 }
9465}
9466
9467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9469#[cfg_attr(feature = "bindings", derive(TS))]
9470pub struct DropSequence {
9471 pub name: TableRef,
9472 pub if_exists: bool,
9473 pub cascade: bool,
9474}
9475
9476impl DropSequence {
9477 pub fn new(name: impl Into<String>) -> Self {
9478 Self {
9479 name: TableRef::new(name),
9480 if_exists: false,
9481 cascade: false,
9482 }
9483 }
9484}
9485
9486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9488#[cfg_attr(feature = "bindings", derive(TS))]
9489pub struct AlterSequence {
9490 pub name: TableRef,
9491 pub if_exists: bool,
9492 pub increment: Option<i64>,
9493 pub minvalue: Option<SequenceBound>,
9494 pub maxvalue: Option<SequenceBound>,
9495 pub start: Option<i64>,
9496 pub restart: Option<Option<i64>>,
9497 pub cache: Option<i64>,
9498 pub cycle: Option<bool>,
9499 pub owned_by: Option<Option<TableRef>>,
9500}
9501
9502impl AlterSequence {
9503 pub fn new(name: impl Into<String>) -> Self {
9504 Self {
9505 name: TableRef::new(name),
9506 if_exists: false,
9507 increment: None,
9508 minvalue: None,
9509 maxvalue: None,
9510 start: None,
9511 restart: None,
9512 cache: None,
9513 cycle: None,
9514 owned_by: None,
9515 }
9516 }
9517}
9518
9519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9521#[cfg_attr(feature = "bindings", derive(TS))]
9522pub struct CreateTrigger {
9523 pub name: Identifier,
9524 pub table: TableRef,
9525 pub timing: TriggerTiming,
9526 pub events: Vec<TriggerEvent>,
9527 #[serde(default, skip_serializing_if = "Option::is_none")]
9528 pub for_each: Option<TriggerForEach>,
9529 pub when: Option<Expression>,
9530 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9532 pub when_paren: bool,
9533 pub body: TriggerBody,
9534 pub or_replace: bool,
9535 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9537 pub or_alter: bool,
9538 pub constraint: bool,
9539 pub deferrable: Option<bool>,
9540 pub initially_deferred: Option<bool>,
9541 pub referencing: Option<TriggerReferencing>,
9542}
9543
9544#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9546#[cfg_attr(feature = "bindings", derive(TS))]
9547pub enum TriggerTiming {
9548 Before,
9549 After,
9550 InsteadOf,
9551}
9552
9553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9555#[cfg_attr(feature = "bindings", derive(TS))]
9556pub enum TriggerEvent {
9557 Insert,
9558 Update(Option<Vec<Identifier>>),
9559 Delete,
9560 Truncate,
9561}
9562
9563#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9565#[cfg_attr(feature = "bindings", derive(TS))]
9566pub enum TriggerForEach {
9567 Row,
9568 Statement,
9569}
9570
9571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9573#[cfg_attr(feature = "bindings", derive(TS))]
9574pub enum TriggerBody {
9575 Execute {
9577 function: TableRef,
9578 args: Vec<Expression>,
9579 },
9580 Block(String),
9582}
9583
9584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9586#[cfg_attr(feature = "bindings", derive(TS))]
9587pub struct TriggerReferencing {
9588 pub old_table: Option<Identifier>,
9589 pub new_table: Option<Identifier>,
9590 pub old_row: Option<Identifier>,
9591 pub new_row: Option<Identifier>,
9592}
9593
9594impl CreateTrigger {
9595 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9596 Self {
9597 name: Identifier::new(name),
9598 table: TableRef::new(table),
9599 timing: TriggerTiming::Before,
9600 events: Vec::new(),
9601 for_each: Some(TriggerForEach::Row),
9602 when: None,
9603 when_paren: false,
9604 body: TriggerBody::Execute {
9605 function: TableRef::new(""),
9606 args: Vec::new(),
9607 },
9608 or_replace: false,
9609 or_alter: false,
9610 constraint: false,
9611 deferrable: None,
9612 initially_deferred: None,
9613 referencing: None,
9614 }
9615 }
9616}
9617
9618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9620#[cfg_attr(feature = "bindings", derive(TS))]
9621pub struct DropTrigger {
9622 pub name: Identifier,
9623 pub table: Option<TableRef>,
9624 pub if_exists: bool,
9625 pub cascade: bool,
9626}
9627
9628impl DropTrigger {
9629 pub fn new(name: impl Into<String>) -> Self {
9630 Self {
9631 name: Identifier::new(name),
9632 table: None,
9633 if_exists: false,
9634 cascade: false,
9635 }
9636 }
9637}
9638
9639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9641#[cfg_attr(feature = "bindings", derive(TS))]
9642pub struct CreateType {
9643 pub name: TableRef,
9644 pub definition: TypeDefinition,
9645 pub if_not_exists: bool,
9646}
9647
9648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9650#[cfg_attr(feature = "bindings", derive(TS))]
9651pub enum TypeDefinition {
9652 Enum(Vec<String>),
9654 Composite(Vec<TypeAttribute>),
9656 Range {
9658 subtype: DataType,
9659 subtype_diff: Option<String>,
9660 canonical: Option<String>,
9661 },
9662 Base {
9664 input: String,
9665 output: String,
9666 internallength: Option<i32>,
9667 },
9668 Domain {
9670 base_type: DataType,
9671 default: Option<Expression>,
9672 constraints: Vec<DomainConstraint>,
9673 },
9674}
9675
9676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9678#[cfg_attr(feature = "bindings", derive(TS))]
9679pub struct TypeAttribute {
9680 pub name: Identifier,
9681 pub data_type: DataType,
9682 pub collate: Option<Identifier>,
9683}
9684
9685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9687#[cfg_attr(feature = "bindings", derive(TS))]
9688pub struct DomainConstraint {
9689 pub name: Option<Identifier>,
9690 pub check: Expression,
9691}
9692
9693impl CreateType {
9694 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9695 Self {
9696 name: TableRef::new(name),
9697 definition: TypeDefinition::Enum(values),
9698 if_not_exists: false,
9699 }
9700 }
9701
9702 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9703 Self {
9704 name: TableRef::new(name),
9705 definition: TypeDefinition::Composite(attributes),
9706 if_not_exists: false,
9707 }
9708 }
9709}
9710
9711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9713#[cfg_attr(feature = "bindings", derive(TS))]
9714pub struct DropType {
9715 pub name: TableRef,
9716 pub if_exists: bool,
9717 pub cascade: bool,
9718}
9719
9720impl DropType {
9721 pub fn new(name: impl Into<String>) -> Self {
9722 Self {
9723 name: TableRef::new(name),
9724 if_exists: false,
9725 cascade: false,
9726 }
9727 }
9728}
9729
9730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9732#[cfg_attr(feature = "bindings", derive(TS))]
9733pub struct Describe {
9734 pub target: Expression,
9736 pub extended: bool,
9738 pub formatted: bool,
9740 #[serde(default)]
9742 pub kind: Option<String>,
9743 #[serde(default)]
9745 pub properties: Vec<(String, String)>,
9746 #[serde(default, skip_serializing_if = "Option::is_none")]
9748 pub style: Option<String>,
9749 #[serde(default)]
9751 pub partition: Option<Box<Expression>>,
9752 #[serde(default)]
9754 pub leading_comments: Vec<String>,
9755 #[serde(default)]
9757 pub as_json: bool,
9758 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9760 pub params: Vec<String>,
9761}
9762
9763impl Describe {
9764 pub fn new(target: Expression) -> Self {
9765 Self {
9766 target,
9767 extended: false,
9768 formatted: false,
9769 kind: None,
9770 properties: Vec::new(),
9771 style: None,
9772 partition: None,
9773 leading_comments: Vec::new(),
9774 as_json: false,
9775 params: Vec::new(),
9776 }
9777 }
9778}
9779
9780#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9782#[cfg_attr(feature = "bindings", derive(TS))]
9783pub struct Show {
9784 pub this: String,
9786 #[serde(default)]
9788 pub terse: bool,
9789 #[serde(default)]
9791 pub history: bool,
9792 pub like: Option<Expression>,
9794 pub scope_kind: Option<String>,
9796 pub scope: Option<Expression>,
9798 pub starts_with: Option<Expression>,
9800 pub limit: Option<Box<Limit>>,
9802 pub from: Option<Expression>,
9804 #[serde(default, skip_serializing_if = "Option::is_none")]
9806 pub where_clause: Option<Expression>,
9807 #[serde(default, skip_serializing_if = "Option::is_none")]
9809 pub for_target: Option<Expression>,
9810 #[serde(default, skip_serializing_if = "Option::is_none")]
9812 pub db: Option<Expression>,
9813 #[serde(default, skip_serializing_if = "Option::is_none")]
9815 pub target: Option<Expression>,
9816 #[serde(default, skip_serializing_if = "Option::is_none")]
9818 pub mutex: Option<bool>,
9819 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9821 pub privileges: Vec<String>,
9822}
9823
9824impl Show {
9825 pub fn new(this: impl Into<String>) -> Self {
9826 Self {
9827 this: this.into(),
9828 terse: false,
9829 history: false,
9830 like: None,
9831 scope_kind: None,
9832 scope: None,
9833 starts_with: None,
9834 limit: None,
9835 from: None,
9836 where_clause: None,
9837 for_target: None,
9838 db: None,
9839 target: None,
9840 mutex: None,
9841 privileges: Vec::new(),
9842 }
9843 }
9844}
9845
9846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9851#[cfg_attr(feature = "bindings", derive(TS))]
9852pub struct Paren {
9853 pub this: Expression,
9855 #[serde(default)]
9856 pub trailing_comments: Vec<String>,
9857}
9858
9859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9861#[cfg_attr(feature = "bindings", derive(TS))]
9862pub struct Annotated {
9863 pub this: Expression,
9864 pub trailing_comments: Vec<String>,
9865}
9866
9867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9872#[cfg_attr(feature = "bindings", derive(TS))]
9873pub struct Refresh {
9874 pub this: Box<Expression>,
9875 pub kind: String,
9876}
9877
9878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9880#[cfg_attr(feature = "bindings", derive(TS))]
9881pub struct LockingStatement {
9882 pub this: Box<Expression>,
9883 pub expression: Box<Expression>,
9884}
9885
9886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9888#[cfg_attr(feature = "bindings", derive(TS))]
9889pub struct SequenceProperties {
9890 #[serde(default)]
9891 pub increment: Option<Box<Expression>>,
9892 #[serde(default)]
9893 pub minvalue: Option<Box<Expression>>,
9894 #[serde(default)]
9895 pub maxvalue: Option<Box<Expression>>,
9896 #[serde(default)]
9897 pub cache: Option<Box<Expression>>,
9898 #[serde(default)]
9899 pub start: Option<Box<Expression>>,
9900 #[serde(default)]
9901 pub owned: Option<Box<Expression>>,
9902 #[serde(default)]
9903 pub options: Vec<Expression>,
9904}
9905
9906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9908#[cfg_attr(feature = "bindings", derive(TS))]
9909pub struct TruncateTable {
9910 #[serde(default)]
9911 pub expressions: Vec<Expression>,
9912 #[serde(default)]
9913 pub is_database: Option<Box<Expression>>,
9914 #[serde(default)]
9915 pub exists: bool,
9916 #[serde(default)]
9917 pub only: Option<Box<Expression>>,
9918 #[serde(default)]
9919 pub cluster: Option<Box<Expression>>,
9920 #[serde(default)]
9921 pub identity: Option<Box<Expression>>,
9922 #[serde(default)]
9923 pub option: Option<Box<Expression>>,
9924 #[serde(default)]
9925 pub partition: Option<Box<Expression>>,
9926}
9927
9928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9930#[cfg_attr(feature = "bindings", derive(TS))]
9931pub struct Clone {
9932 pub this: Box<Expression>,
9933 #[serde(default)]
9934 pub shallow: Option<Box<Expression>>,
9935 #[serde(default)]
9936 pub copy: Option<Box<Expression>>,
9937}
9938
9939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9941#[cfg_attr(feature = "bindings", derive(TS))]
9942pub struct Attach {
9943 pub this: Box<Expression>,
9944 #[serde(default)]
9945 pub exists: bool,
9946 #[serde(default)]
9947 pub expressions: Vec<Expression>,
9948}
9949
9950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9952#[cfg_attr(feature = "bindings", derive(TS))]
9953pub struct Detach {
9954 pub this: Box<Expression>,
9955 #[serde(default)]
9956 pub exists: bool,
9957}
9958
9959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9961#[cfg_attr(feature = "bindings", derive(TS))]
9962pub struct Install {
9963 pub this: Box<Expression>,
9964 #[serde(default)]
9965 pub from_: Option<Box<Expression>>,
9966 #[serde(default)]
9967 pub force: Option<Box<Expression>>,
9968}
9969
9970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9972#[cfg_attr(feature = "bindings", derive(TS))]
9973pub struct Summarize {
9974 pub this: Box<Expression>,
9975 #[serde(default)]
9976 pub table: Option<Box<Expression>>,
9977}
9978
9979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9981#[cfg_attr(feature = "bindings", derive(TS))]
9982pub struct Declare {
9983 #[serde(default)]
9984 pub expressions: Vec<Expression>,
9985 #[serde(default)]
9986 pub replace: bool,
9987}
9988
9989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9991#[cfg_attr(feature = "bindings", derive(TS))]
9992pub struct DeclareItem {
9993 pub this: Box<Expression>,
9994 #[serde(default)]
9995 pub kind: Option<String>,
9996 #[serde(default)]
9997 pub default: Option<Box<Expression>>,
9998 #[serde(default)]
9999 pub has_as: bool,
10000 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10002 pub additional_names: Vec<Expression>,
10003}
10004
10005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10007#[cfg_attr(feature = "bindings", derive(TS))]
10008pub struct Set {
10009 #[serde(default)]
10010 pub expressions: Vec<Expression>,
10011 #[serde(default)]
10012 pub unset: Option<Box<Expression>>,
10013 #[serde(default)]
10014 pub tag: Option<Box<Expression>>,
10015}
10016
10017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10019#[cfg_attr(feature = "bindings", derive(TS))]
10020pub struct Heredoc {
10021 pub this: Box<Expression>,
10022 #[serde(default)]
10023 pub tag: Option<Box<Expression>>,
10024}
10025
10026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10028#[cfg_attr(feature = "bindings", derive(TS))]
10029pub struct QueryBand {
10030 pub this: Box<Expression>,
10031 #[serde(default)]
10032 pub scope: Option<Box<Expression>>,
10033 #[serde(default)]
10034 pub update: Option<Box<Expression>>,
10035}
10036
10037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10039#[cfg_attr(feature = "bindings", derive(TS))]
10040pub struct UserDefinedFunction {
10041 pub this: Box<Expression>,
10042 #[serde(default)]
10043 pub expressions: Vec<Expression>,
10044 #[serde(default)]
10045 pub wrapped: Option<Box<Expression>>,
10046}
10047
10048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10050#[cfg_attr(feature = "bindings", derive(TS))]
10051pub struct RecursiveWithSearch {
10052 pub kind: String,
10053 pub this: Box<Expression>,
10054 pub expression: Box<Expression>,
10055 #[serde(default)]
10056 pub using: Option<Box<Expression>>,
10057}
10058
10059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10061#[cfg_attr(feature = "bindings", derive(TS))]
10062pub struct ProjectionDef {
10063 pub this: Box<Expression>,
10064 pub expression: Box<Expression>,
10065}
10066
10067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10069#[cfg_attr(feature = "bindings", derive(TS))]
10070pub struct TableAlias {
10071 #[serde(default)]
10072 pub this: Option<Box<Expression>>,
10073 #[serde(default)]
10074 pub columns: Vec<Expression>,
10075}
10076
10077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10079#[cfg_attr(feature = "bindings", derive(TS))]
10080pub struct ByteString {
10081 pub this: Box<Expression>,
10082 #[serde(default)]
10083 pub is_bytes: Option<Box<Expression>>,
10084}
10085
10086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10089#[cfg_attr(feature = "bindings", derive(TS))]
10090pub struct HexStringExpr {
10091 pub this: Box<Expression>,
10092 #[serde(default)]
10093 pub is_integer: Option<bool>,
10094}
10095
10096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10098#[cfg_attr(feature = "bindings", derive(TS))]
10099pub struct UnicodeString {
10100 pub this: Box<Expression>,
10101 #[serde(default)]
10102 pub escape: Option<Box<Expression>>,
10103}
10104
10105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10107#[cfg_attr(feature = "bindings", derive(TS))]
10108pub struct AlterColumn {
10109 pub this: Box<Expression>,
10110 #[serde(default)]
10111 pub dtype: Option<Box<Expression>>,
10112 #[serde(default)]
10113 pub collate: Option<Box<Expression>>,
10114 #[serde(default)]
10115 pub using: Option<Box<Expression>>,
10116 #[serde(default)]
10117 pub default: Option<Box<Expression>>,
10118 #[serde(default)]
10119 pub drop: Option<Box<Expression>>,
10120 #[serde(default)]
10121 pub comment: Option<Box<Expression>>,
10122 #[serde(default)]
10123 pub allow_null: Option<Box<Expression>>,
10124 #[serde(default)]
10125 pub visible: Option<Box<Expression>>,
10126 #[serde(default)]
10127 pub rename_to: Option<Box<Expression>>,
10128}
10129
10130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10132#[cfg_attr(feature = "bindings", derive(TS))]
10133pub struct AlterSortKey {
10134 #[serde(default)]
10135 pub this: Option<Box<Expression>>,
10136 #[serde(default)]
10137 pub expressions: Vec<Expression>,
10138 #[serde(default)]
10139 pub compound: Option<Box<Expression>>,
10140}
10141
10142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10144#[cfg_attr(feature = "bindings", derive(TS))]
10145pub struct AlterSet {
10146 #[serde(default)]
10147 pub expressions: Vec<Expression>,
10148 #[serde(default)]
10149 pub option: Option<Box<Expression>>,
10150 #[serde(default)]
10151 pub tablespace: Option<Box<Expression>>,
10152 #[serde(default)]
10153 pub access_method: Option<Box<Expression>>,
10154 #[serde(default)]
10155 pub file_format: Option<Box<Expression>>,
10156 #[serde(default)]
10157 pub copy_options: Option<Box<Expression>>,
10158 #[serde(default)]
10159 pub tag: Option<Box<Expression>>,
10160 #[serde(default)]
10161 pub location: Option<Box<Expression>>,
10162 #[serde(default)]
10163 pub serde: Option<Box<Expression>>,
10164}
10165
10166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10168#[cfg_attr(feature = "bindings", derive(TS))]
10169pub struct RenameColumn {
10170 pub this: Box<Expression>,
10171 #[serde(default)]
10172 pub to: Option<Box<Expression>>,
10173 #[serde(default)]
10174 pub exists: bool,
10175}
10176
10177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10179#[cfg_attr(feature = "bindings", derive(TS))]
10180pub struct Comprehension {
10181 pub this: Box<Expression>,
10182 pub expression: Box<Expression>,
10183 #[serde(default)]
10184 pub position: Option<Box<Expression>>,
10185 #[serde(default)]
10186 pub iterator: Option<Box<Expression>>,
10187 #[serde(default)]
10188 pub condition: Option<Box<Expression>>,
10189}
10190
10191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10193#[cfg_attr(feature = "bindings", derive(TS))]
10194pub struct MergeTreeTTLAction {
10195 pub this: Box<Expression>,
10196 #[serde(default)]
10197 pub delete: Option<Box<Expression>>,
10198 #[serde(default)]
10199 pub recompress: Option<Box<Expression>>,
10200 #[serde(default)]
10201 pub to_disk: Option<Box<Expression>>,
10202 #[serde(default)]
10203 pub to_volume: Option<Box<Expression>>,
10204}
10205
10206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10208#[cfg_attr(feature = "bindings", derive(TS))]
10209pub struct MergeTreeTTL {
10210 #[serde(default)]
10211 pub expressions: Vec<Expression>,
10212 #[serde(default)]
10213 pub where_: Option<Box<Expression>>,
10214 #[serde(default)]
10215 pub group: Option<Box<Expression>>,
10216 #[serde(default)]
10217 pub aggregates: Option<Box<Expression>>,
10218}
10219
10220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10222#[cfg_attr(feature = "bindings", derive(TS))]
10223pub struct IndexConstraintOption {
10224 #[serde(default)]
10225 pub key_block_size: Option<Box<Expression>>,
10226 #[serde(default)]
10227 pub using: Option<Box<Expression>>,
10228 #[serde(default)]
10229 pub parser: Option<Box<Expression>>,
10230 #[serde(default)]
10231 pub comment: Option<Box<Expression>>,
10232 #[serde(default)]
10233 pub visible: Option<Box<Expression>>,
10234 #[serde(default)]
10235 pub engine_attr: Option<Box<Expression>>,
10236 #[serde(default)]
10237 pub secondary_engine_attr: Option<Box<Expression>>,
10238}
10239
10240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10242#[cfg_attr(feature = "bindings", derive(TS))]
10243pub struct PeriodForSystemTimeConstraint {
10244 pub this: Box<Expression>,
10245 pub expression: Box<Expression>,
10246}
10247
10248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10250#[cfg_attr(feature = "bindings", derive(TS))]
10251pub struct CaseSpecificColumnConstraint {
10252 #[serde(default)]
10253 pub not_: Option<Box<Expression>>,
10254}
10255
10256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10258#[cfg_attr(feature = "bindings", derive(TS))]
10259pub struct CharacterSetColumnConstraint {
10260 pub this: Box<Expression>,
10261}
10262
10263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10265#[cfg_attr(feature = "bindings", derive(TS))]
10266pub struct CheckColumnConstraint {
10267 pub this: Box<Expression>,
10268 #[serde(default)]
10269 pub enforced: Option<Box<Expression>>,
10270}
10271
10272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10274#[cfg_attr(feature = "bindings", derive(TS))]
10275pub struct AssumeColumnConstraint {
10276 pub this: Box<Expression>,
10277}
10278
10279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10281#[cfg_attr(feature = "bindings", derive(TS))]
10282pub struct CompressColumnConstraint {
10283 #[serde(default)]
10284 pub this: Option<Box<Expression>>,
10285}
10286
10287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10289#[cfg_attr(feature = "bindings", derive(TS))]
10290pub struct DateFormatColumnConstraint {
10291 pub this: Box<Expression>,
10292}
10293
10294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10296#[cfg_attr(feature = "bindings", derive(TS))]
10297pub struct EphemeralColumnConstraint {
10298 #[serde(default)]
10299 pub this: Option<Box<Expression>>,
10300}
10301
10302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10304#[cfg_attr(feature = "bindings", derive(TS))]
10305pub struct WithOperator {
10306 pub this: Box<Expression>,
10307 pub op: String,
10308}
10309
10310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10312#[cfg_attr(feature = "bindings", derive(TS))]
10313pub struct GeneratedAsIdentityColumnConstraint {
10314 #[serde(default)]
10315 pub this: Option<Box<Expression>>,
10316 #[serde(default)]
10317 pub expression: Option<Box<Expression>>,
10318 #[serde(default)]
10319 pub on_null: Option<Box<Expression>>,
10320 #[serde(default)]
10321 pub start: Option<Box<Expression>>,
10322 #[serde(default)]
10323 pub increment: Option<Box<Expression>>,
10324 #[serde(default)]
10325 pub minvalue: Option<Box<Expression>>,
10326 #[serde(default)]
10327 pub maxvalue: Option<Box<Expression>>,
10328 #[serde(default)]
10329 pub cycle: Option<Box<Expression>>,
10330 #[serde(default)]
10331 pub order: Option<Box<Expression>>,
10332}
10333
10334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10337#[cfg_attr(feature = "bindings", derive(TS))]
10338pub struct AutoIncrementColumnConstraint;
10339
10340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10342#[cfg_attr(feature = "bindings", derive(TS))]
10343pub struct CommentColumnConstraint;
10344
10345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10347#[cfg_attr(feature = "bindings", derive(TS))]
10348pub struct GeneratedAsRowColumnConstraint {
10349 #[serde(default)]
10350 pub start: Option<Box<Expression>>,
10351 #[serde(default)]
10352 pub hidden: Option<Box<Expression>>,
10353}
10354
10355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10357#[cfg_attr(feature = "bindings", derive(TS))]
10358pub struct IndexColumnConstraint {
10359 #[serde(default)]
10360 pub this: Option<Box<Expression>>,
10361 #[serde(default)]
10362 pub expressions: Vec<Expression>,
10363 #[serde(default)]
10364 pub kind: Option<String>,
10365 #[serde(default)]
10366 pub index_type: Option<Box<Expression>>,
10367 #[serde(default)]
10368 pub options: Vec<Expression>,
10369 #[serde(default)]
10370 pub expression: Option<Box<Expression>>,
10371 #[serde(default)]
10372 pub granularity: Option<Box<Expression>>,
10373}
10374
10375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10377#[cfg_attr(feature = "bindings", derive(TS))]
10378pub struct MaskingPolicyColumnConstraint {
10379 pub this: Box<Expression>,
10380 #[serde(default)]
10381 pub expressions: Vec<Expression>,
10382}
10383
10384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10386#[cfg_attr(feature = "bindings", derive(TS))]
10387pub struct NotNullColumnConstraint {
10388 #[serde(default)]
10389 pub allow_null: Option<Box<Expression>>,
10390}
10391
10392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10394#[cfg_attr(feature = "bindings", derive(TS))]
10395pub struct DefaultColumnConstraint {
10396 pub this: Box<Expression>,
10397 #[serde(default, skip_serializing_if = "Option::is_none")]
10399 pub for_column: Option<Identifier>,
10400}
10401
10402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10404#[cfg_attr(feature = "bindings", derive(TS))]
10405pub struct PrimaryKeyColumnConstraint {
10406 #[serde(default)]
10407 pub desc: Option<Box<Expression>>,
10408 #[serde(default)]
10409 pub options: Vec<Expression>,
10410}
10411
10412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10414#[cfg_attr(feature = "bindings", derive(TS))]
10415pub struct UniqueColumnConstraint {
10416 #[serde(default)]
10417 pub this: Option<Box<Expression>>,
10418 #[serde(default)]
10419 pub index_type: Option<Box<Expression>>,
10420 #[serde(default)]
10421 pub on_conflict: Option<Box<Expression>>,
10422 #[serde(default)]
10423 pub nulls: Option<Box<Expression>>,
10424 #[serde(default)]
10425 pub options: Vec<Expression>,
10426}
10427
10428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10430#[cfg_attr(feature = "bindings", derive(TS))]
10431pub struct WatermarkColumnConstraint {
10432 pub this: Box<Expression>,
10433 pub expression: Box<Expression>,
10434}
10435
10436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10438#[cfg_attr(feature = "bindings", derive(TS))]
10439pub struct ComputedColumnConstraint {
10440 pub this: Box<Expression>,
10441 #[serde(default)]
10442 pub persisted: Option<Box<Expression>>,
10443 #[serde(default)]
10444 pub not_null: Option<Box<Expression>>,
10445 #[serde(default)]
10446 pub data_type: Option<Box<Expression>>,
10447}
10448
10449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10451#[cfg_attr(feature = "bindings", derive(TS))]
10452pub struct InOutColumnConstraint {
10453 #[serde(default)]
10454 pub input_: Option<Box<Expression>>,
10455 #[serde(default)]
10456 pub output: Option<Box<Expression>>,
10457}
10458
10459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10461#[cfg_attr(feature = "bindings", derive(TS))]
10462pub struct PathColumnConstraint {
10463 pub this: Box<Expression>,
10464}
10465
10466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10468#[cfg_attr(feature = "bindings", derive(TS))]
10469pub struct Constraint {
10470 pub this: Box<Expression>,
10471 #[serde(default)]
10472 pub expressions: Vec<Expression>,
10473}
10474
10475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10477#[cfg_attr(feature = "bindings", derive(TS))]
10478pub struct Export {
10479 pub this: Box<Expression>,
10480 #[serde(default)]
10481 pub connection: Option<Box<Expression>>,
10482 #[serde(default)]
10483 pub options: Vec<Expression>,
10484}
10485
10486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10488#[cfg_attr(feature = "bindings", derive(TS))]
10489pub struct Filter {
10490 pub this: Box<Expression>,
10491 pub expression: Box<Expression>,
10492}
10493
10494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10496#[cfg_attr(feature = "bindings", derive(TS))]
10497pub struct Changes {
10498 #[serde(default)]
10499 pub information: Option<Box<Expression>>,
10500 #[serde(default)]
10501 pub at_before: Option<Box<Expression>>,
10502 #[serde(default)]
10503 pub end: Option<Box<Expression>>,
10504}
10505
10506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10508#[cfg_attr(feature = "bindings", derive(TS))]
10509pub struct Directory {
10510 pub this: Box<Expression>,
10511 #[serde(default)]
10512 pub local: Option<Box<Expression>>,
10513 #[serde(default)]
10514 pub row_format: Option<Box<Expression>>,
10515}
10516
10517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10519#[cfg_attr(feature = "bindings", derive(TS))]
10520pub struct ForeignKey {
10521 #[serde(default)]
10522 pub expressions: Vec<Expression>,
10523 #[serde(default)]
10524 pub reference: Option<Box<Expression>>,
10525 #[serde(default)]
10526 pub delete: Option<Box<Expression>>,
10527 #[serde(default)]
10528 pub update: Option<Box<Expression>>,
10529 #[serde(default)]
10530 pub options: Vec<Expression>,
10531}
10532
10533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10535#[cfg_attr(feature = "bindings", derive(TS))]
10536pub struct ColumnPrefix {
10537 pub this: Box<Expression>,
10538 pub expression: Box<Expression>,
10539}
10540
10541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10543#[cfg_attr(feature = "bindings", derive(TS))]
10544pub struct PrimaryKey {
10545 #[serde(default)]
10546 pub this: Option<Box<Expression>>,
10547 #[serde(default)]
10548 pub expressions: Vec<Expression>,
10549 #[serde(default)]
10550 pub options: Vec<Expression>,
10551 #[serde(default)]
10552 pub include: Option<Box<Expression>>,
10553}
10554
10555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10557#[cfg_attr(feature = "bindings", derive(TS))]
10558pub struct IntoClause {
10559 #[serde(default)]
10560 pub this: Option<Box<Expression>>,
10561 #[serde(default)]
10562 pub temporary: bool,
10563 #[serde(default)]
10564 pub unlogged: Option<Box<Expression>>,
10565 #[serde(default)]
10566 pub bulk_collect: Option<Box<Expression>>,
10567 #[serde(default)]
10568 pub expressions: Vec<Expression>,
10569}
10570
10571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10573#[cfg_attr(feature = "bindings", derive(TS))]
10574pub struct JoinHint {
10575 pub this: Box<Expression>,
10576 #[serde(default)]
10577 pub expressions: Vec<Expression>,
10578}
10579
10580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10582#[cfg_attr(feature = "bindings", derive(TS))]
10583pub struct Opclass {
10584 pub this: Box<Expression>,
10585 pub expression: Box<Expression>,
10586}
10587
10588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10590#[cfg_attr(feature = "bindings", derive(TS))]
10591pub struct Index {
10592 #[serde(default)]
10593 pub this: Option<Box<Expression>>,
10594 #[serde(default)]
10595 pub table: Option<Box<Expression>>,
10596 #[serde(default)]
10597 pub unique: bool,
10598 #[serde(default)]
10599 pub primary: Option<Box<Expression>>,
10600 #[serde(default)]
10601 pub amp: Option<Box<Expression>>,
10602 #[serde(default)]
10603 pub params: Vec<Expression>,
10604}
10605
10606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10608#[cfg_attr(feature = "bindings", derive(TS))]
10609pub struct IndexParameters {
10610 #[serde(default)]
10611 pub using: Option<Box<Expression>>,
10612 #[serde(default)]
10613 pub include: Option<Box<Expression>>,
10614 #[serde(default)]
10615 pub columns: Vec<Expression>,
10616 #[serde(default)]
10617 pub with_storage: Option<Box<Expression>>,
10618 #[serde(default)]
10619 pub partition_by: Option<Box<Expression>>,
10620 #[serde(default)]
10621 pub tablespace: Option<Box<Expression>>,
10622 #[serde(default)]
10623 pub where_: Option<Box<Expression>>,
10624 #[serde(default)]
10625 pub on: Option<Box<Expression>>,
10626}
10627
10628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10630#[cfg_attr(feature = "bindings", derive(TS))]
10631pub struct ConditionalInsert {
10632 pub this: Box<Expression>,
10633 #[serde(default)]
10634 pub expression: Option<Box<Expression>>,
10635 #[serde(default)]
10636 pub else_: Option<Box<Expression>>,
10637}
10638
10639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10641#[cfg_attr(feature = "bindings", derive(TS))]
10642pub struct MultitableInserts {
10643 #[serde(default)]
10644 pub expressions: Vec<Expression>,
10645 pub kind: String,
10646 #[serde(default)]
10647 pub source: Option<Box<Expression>>,
10648 #[serde(default)]
10650 pub leading_comments: Vec<String>,
10651 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10653 pub overwrite: bool,
10654}
10655
10656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10658#[cfg_attr(feature = "bindings", derive(TS))]
10659pub struct OnConflict {
10660 #[serde(default)]
10661 pub duplicate: Option<Box<Expression>>,
10662 #[serde(default)]
10663 pub expressions: Vec<Expression>,
10664 #[serde(default)]
10665 pub action: Option<Box<Expression>>,
10666 #[serde(default)]
10667 pub conflict_keys: Option<Box<Expression>>,
10668 #[serde(default)]
10669 pub index_predicate: Option<Box<Expression>>,
10670 #[serde(default)]
10671 pub constraint: Option<Box<Expression>>,
10672 #[serde(default)]
10673 pub where_: Option<Box<Expression>>,
10674}
10675
10676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10678#[cfg_attr(feature = "bindings", derive(TS))]
10679pub struct OnCondition {
10680 #[serde(default)]
10681 pub error: Option<Box<Expression>>,
10682 #[serde(default)]
10683 pub empty: Option<Box<Expression>>,
10684 #[serde(default)]
10685 pub null: Option<Box<Expression>>,
10686}
10687
10688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10690#[cfg_attr(feature = "bindings", derive(TS))]
10691pub struct Returning {
10692 #[serde(default)]
10693 pub expressions: Vec<Expression>,
10694 #[serde(default)]
10695 pub into: Option<Box<Expression>>,
10696}
10697
10698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10700#[cfg_attr(feature = "bindings", derive(TS))]
10701pub struct Introducer {
10702 pub this: Box<Expression>,
10703 pub expression: Box<Expression>,
10704}
10705
10706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10708#[cfg_attr(feature = "bindings", derive(TS))]
10709pub struct PartitionRange {
10710 pub this: Box<Expression>,
10711 #[serde(default)]
10712 pub expression: Option<Box<Expression>>,
10713 #[serde(default)]
10714 pub expressions: Vec<Expression>,
10715}
10716
10717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10719#[cfg_attr(feature = "bindings", derive(TS))]
10720pub struct Group {
10721 #[serde(default)]
10722 pub expressions: Vec<Expression>,
10723 #[serde(default)]
10724 pub grouping_sets: Option<Box<Expression>>,
10725 #[serde(default)]
10726 pub cube: Option<Box<Expression>>,
10727 #[serde(default)]
10728 pub rollup: Option<Box<Expression>>,
10729 #[serde(default)]
10730 pub totals: Option<Box<Expression>>,
10731 #[serde(default)]
10733 pub all: Option<bool>,
10734}
10735
10736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10738#[cfg_attr(feature = "bindings", derive(TS))]
10739pub struct Cube {
10740 #[serde(default)]
10741 pub expressions: Vec<Expression>,
10742}
10743
10744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10746#[cfg_attr(feature = "bindings", derive(TS))]
10747pub struct Rollup {
10748 #[serde(default)]
10749 pub expressions: Vec<Expression>,
10750}
10751
10752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10754#[cfg_attr(feature = "bindings", derive(TS))]
10755pub struct GroupingSets {
10756 #[serde(default)]
10757 pub expressions: Vec<Expression>,
10758}
10759
10760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10762#[cfg_attr(feature = "bindings", derive(TS))]
10763pub struct LimitOptions {
10764 #[serde(default)]
10765 pub percent: Option<Box<Expression>>,
10766 #[serde(default)]
10767 pub rows: Option<Box<Expression>>,
10768 #[serde(default)]
10769 pub with_ties: Option<Box<Expression>>,
10770}
10771
10772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10774#[cfg_attr(feature = "bindings", derive(TS))]
10775pub struct Lateral {
10776 pub this: Box<Expression>,
10777 #[serde(default)]
10778 pub view: Option<Box<Expression>>,
10779 #[serde(default)]
10780 pub outer: Option<Box<Expression>>,
10781 #[serde(default)]
10782 pub alias: Option<String>,
10783 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10785 pub alias_quoted: bool,
10786 #[serde(default)]
10787 pub cross_apply: Option<Box<Expression>>,
10788 #[serde(default)]
10789 pub ordinality: Option<Box<Expression>>,
10790 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10792 pub column_aliases: Vec<String>,
10793}
10794
10795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10797#[cfg_attr(feature = "bindings", derive(TS))]
10798pub struct TableFromRows {
10799 pub this: Box<Expression>,
10800 #[serde(default)]
10801 pub alias: Option<String>,
10802 #[serde(default)]
10803 pub joins: Vec<Expression>,
10804 #[serde(default)]
10805 pub pivots: Option<Box<Expression>>,
10806 #[serde(default)]
10807 pub sample: Option<Box<Expression>>,
10808}
10809
10810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10813#[cfg_attr(feature = "bindings", derive(TS))]
10814pub struct RowsFrom {
10815 pub expressions: Vec<Expression>,
10817 #[serde(default)]
10819 pub ordinality: bool,
10820 #[serde(default)]
10822 pub alias: Option<Box<Expression>>,
10823}
10824
10825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10827#[cfg_attr(feature = "bindings", derive(TS))]
10828pub struct WithFill {
10829 #[serde(default)]
10830 pub from_: Option<Box<Expression>>,
10831 #[serde(default)]
10832 pub to: Option<Box<Expression>>,
10833 #[serde(default)]
10834 pub step: Option<Box<Expression>>,
10835 #[serde(default)]
10836 pub staleness: Option<Box<Expression>>,
10837 #[serde(default)]
10838 pub interpolate: Option<Box<Expression>>,
10839}
10840
10841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10843#[cfg_attr(feature = "bindings", derive(TS))]
10844pub struct Property {
10845 pub this: Box<Expression>,
10846 #[serde(default)]
10847 pub value: Option<Box<Expression>>,
10848}
10849
10850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10852#[cfg_attr(feature = "bindings", derive(TS))]
10853pub struct GrantPrivilege {
10854 pub this: Box<Expression>,
10855 #[serde(default)]
10856 pub expressions: Vec<Expression>,
10857}
10858
10859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10861#[cfg_attr(feature = "bindings", derive(TS))]
10862pub struct AllowedValuesProperty {
10863 #[serde(default)]
10864 pub expressions: Vec<Expression>,
10865}
10866
10867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10869#[cfg_attr(feature = "bindings", derive(TS))]
10870pub struct AlgorithmProperty {
10871 pub this: Box<Expression>,
10872}
10873
10874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10876#[cfg_attr(feature = "bindings", derive(TS))]
10877pub struct AutoIncrementProperty {
10878 pub this: Box<Expression>,
10879}
10880
10881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10883#[cfg_attr(feature = "bindings", derive(TS))]
10884pub struct AutoRefreshProperty {
10885 pub this: Box<Expression>,
10886}
10887
10888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10890#[cfg_attr(feature = "bindings", derive(TS))]
10891pub struct BackupProperty {
10892 pub this: Box<Expression>,
10893}
10894
10895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10897#[cfg_attr(feature = "bindings", derive(TS))]
10898pub struct BuildProperty {
10899 pub this: Box<Expression>,
10900}
10901
10902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10904#[cfg_attr(feature = "bindings", derive(TS))]
10905pub struct BlockCompressionProperty {
10906 #[serde(default)]
10907 pub autotemp: Option<Box<Expression>>,
10908 #[serde(default)]
10909 pub always: Option<Box<Expression>>,
10910 #[serde(default)]
10911 pub default: Option<Box<Expression>>,
10912 #[serde(default)]
10913 pub manual: Option<Box<Expression>>,
10914 #[serde(default)]
10915 pub never: Option<Box<Expression>>,
10916}
10917
10918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10920#[cfg_attr(feature = "bindings", derive(TS))]
10921pub struct CharacterSetProperty {
10922 pub this: Box<Expression>,
10923 #[serde(default)]
10924 pub default: Option<Box<Expression>>,
10925}
10926
10927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10929#[cfg_attr(feature = "bindings", derive(TS))]
10930pub struct ChecksumProperty {
10931 #[serde(default)]
10932 pub on: Option<Box<Expression>>,
10933 #[serde(default)]
10934 pub default: Option<Box<Expression>>,
10935}
10936
10937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10939#[cfg_attr(feature = "bindings", derive(TS))]
10940pub struct CollateProperty {
10941 pub this: Box<Expression>,
10942 #[serde(default)]
10943 pub default: Option<Box<Expression>>,
10944}
10945
10946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10948#[cfg_attr(feature = "bindings", derive(TS))]
10949pub struct DataBlocksizeProperty {
10950 #[serde(default)]
10951 pub size: Option<i64>,
10952 #[serde(default)]
10953 pub units: Option<Box<Expression>>,
10954 #[serde(default)]
10955 pub minimum: Option<Box<Expression>>,
10956 #[serde(default)]
10957 pub maximum: Option<Box<Expression>>,
10958 #[serde(default)]
10959 pub default: Option<Box<Expression>>,
10960}
10961
10962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10964#[cfg_attr(feature = "bindings", derive(TS))]
10965pub struct DataDeletionProperty {
10966 pub on: Box<Expression>,
10967 #[serde(default)]
10968 pub filter_column: Option<Box<Expression>>,
10969 #[serde(default)]
10970 pub retention_period: Option<Box<Expression>>,
10971}
10972
10973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10975#[cfg_attr(feature = "bindings", derive(TS))]
10976pub struct DefinerProperty {
10977 pub this: Box<Expression>,
10978}
10979
10980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10982#[cfg_attr(feature = "bindings", derive(TS))]
10983pub struct DistKeyProperty {
10984 pub this: Box<Expression>,
10985}
10986
10987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10989#[cfg_attr(feature = "bindings", derive(TS))]
10990pub struct DistributedByProperty {
10991 #[serde(default)]
10992 pub expressions: Vec<Expression>,
10993 pub kind: String,
10994 #[serde(default)]
10995 pub buckets: Option<Box<Expression>>,
10996 #[serde(default)]
10997 pub order: Option<Box<Expression>>,
10998}
10999
11000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11002#[cfg_attr(feature = "bindings", derive(TS))]
11003pub struct DistStyleProperty {
11004 pub this: Box<Expression>,
11005}
11006
11007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11009#[cfg_attr(feature = "bindings", derive(TS))]
11010pub struct DuplicateKeyProperty {
11011 #[serde(default)]
11012 pub expressions: Vec<Expression>,
11013}
11014
11015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11017#[cfg_attr(feature = "bindings", derive(TS))]
11018pub struct EngineProperty {
11019 pub this: Box<Expression>,
11020}
11021
11022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11024#[cfg_attr(feature = "bindings", derive(TS))]
11025pub struct ToTableProperty {
11026 pub this: Box<Expression>,
11027}
11028
11029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11031#[cfg_attr(feature = "bindings", derive(TS))]
11032pub struct ExecuteAsProperty {
11033 pub this: Box<Expression>,
11034}
11035
11036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11038#[cfg_attr(feature = "bindings", derive(TS))]
11039pub struct ExternalProperty {
11040 #[serde(default)]
11041 pub this: Option<Box<Expression>>,
11042}
11043
11044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11046#[cfg_attr(feature = "bindings", derive(TS))]
11047pub struct FallbackProperty {
11048 #[serde(default)]
11049 pub no: Option<Box<Expression>>,
11050 #[serde(default)]
11051 pub protection: Option<Box<Expression>>,
11052}
11053
11054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11056#[cfg_attr(feature = "bindings", derive(TS))]
11057pub struct FileFormatProperty {
11058 #[serde(default)]
11059 pub this: Option<Box<Expression>>,
11060 #[serde(default)]
11061 pub expressions: Vec<Expression>,
11062 #[serde(default)]
11063 pub hive_format: Option<Box<Expression>>,
11064}
11065
11066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11068#[cfg_attr(feature = "bindings", derive(TS))]
11069pub struct CredentialsProperty {
11070 #[serde(default)]
11071 pub expressions: Vec<Expression>,
11072}
11073
11074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11076#[cfg_attr(feature = "bindings", derive(TS))]
11077pub struct FreespaceProperty {
11078 pub this: Box<Expression>,
11079 #[serde(default)]
11080 pub percent: Option<Box<Expression>>,
11081}
11082
11083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11085#[cfg_attr(feature = "bindings", derive(TS))]
11086pub struct InheritsProperty {
11087 #[serde(default)]
11088 pub expressions: Vec<Expression>,
11089}
11090
11091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11093#[cfg_attr(feature = "bindings", derive(TS))]
11094pub struct InputModelProperty {
11095 pub this: Box<Expression>,
11096}
11097
11098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11100#[cfg_attr(feature = "bindings", derive(TS))]
11101pub struct OutputModelProperty {
11102 pub this: Box<Expression>,
11103}
11104
11105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11107#[cfg_attr(feature = "bindings", derive(TS))]
11108pub struct IsolatedLoadingProperty {
11109 #[serde(default)]
11110 pub no: Option<Box<Expression>>,
11111 #[serde(default)]
11112 pub concurrent: Option<Box<Expression>>,
11113 #[serde(default)]
11114 pub target: Option<Box<Expression>>,
11115}
11116
11117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11119#[cfg_attr(feature = "bindings", derive(TS))]
11120pub struct JournalProperty {
11121 #[serde(default)]
11122 pub no: Option<Box<Expression>>,
11123 #[serde(default)]
11124 pub dual: Option<Box<Expression>>,
11125 #[serde(default)]
11126 pub before: Option<Box<Expression>>,
11127 #[serde(default)]
11128 pub local: Option<Box<Expression>>,
11129 #[serde(default)]
11130 pub after: Option<Box<Expression>>,
11131}
11132
11133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11135#[cfg_attr(feature = "bindings", derive(TS))]
11136pub struct LanguageProperty {
11137 pub this: Box<Expression>,
11138}
11139
11140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11142#[cfg_attr(feature = "bindings", derive(TS))]
11143pub struct EnviromentProperty {
11144 #[serde(default)]
11145 pub expressions: Vec<Expression>,
11146}
11147
11148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11150#[cfg_attr(feature = "bindings", derive(TS))]
11151pub struct ClusteredByProperty {
11152 #[serde(default)]
11153 pub expressions: Vec<Expression>,
11154 #[serde(default)]
11155 pub sorted_by: Option<Box<Expression>>,
11156 #[serde(default)]
11157 pub buckets: Option<Box<Expression>>,
11158}
11159
11160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11162#[cfg_attr(feature = "bindings", derive(TS))]
11163pub struct DictProperty {
11164 pub this: Box<Expression>,
11165 pub kind: String,
11166 #[serde(default)]
11167 pub settings: Option<Box<Expression>>,
11168}
11169
11170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11172#[cfg_attr(feature = "bindings", derive(TS))]
11173pub struct DictRange {
11174 pub this: Box<Expression>,
11175 #[serde(default)]
11176 pub min: Option<Box<Expression>>,
11177 #[serde(default)]
11178 pub max: Option<Box<Expression>>,
11179}
11180
11181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11183#[cfg_attr(feature = "bindings", derive(TS))]
11184pub struct OnCluster {
11185 pub this: Box<Expression>,
11186}
11187
11188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11190#[cfg_attr(feature = "bindings", derive(TS))]
11191pub struct LikeProperty {
11192 pub this: Box<Expression>,
11193 #[serde(default)]
11194 pub expressions: Vec<Expression>,
11195}
11196
11197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11199#[cfg_attr(feature = "bindings", derive(TS))]
11200pub struct LocationProperty {
11201 pub this: Box<Expression>,
11202}
11203
11204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11206#[cfg_attr(feature = "bindings", derive(TS))]
11207pub struct LockProperty {
11208 pub this: Box<Expression>,
11209}
11210
11211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11213#[cfg_attr(feature = "bindings", derive(TS))]
11214pub struct LockingProperty {
11215 #[serde(default)]
11216 pub this: Option<Box<Expression>>,
11217 pub kind: String,
11218 #[serde(default)]
11219 pub for_or_in: Option<Box<Expression>>,
11220 #[serde(default)]
11221 pub lock_type: Option<Box<Expression>>,
11222 #[serde(default)]
11223 pub override_: Option<Box<Expression>>,
11224}
11225
11226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11228#[cfg_attr(feature = "bindings", derive(TS))]
11229pub struct LogProperty {
11230 #[serde(default)]
11231 pub no: Option<Box<Expression>>,
11232}
11233
11234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11236#[cfg_attr(feature = "bindings", derive(TS))]
11237pub struct MaterializedProperty {
11238 #[serde(default)]
11239 pub this: Option<Box<Expression>>,
11240}
11241
11242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11244#[cfg_attr(feature = "bindings", derive(TS))]
11245pub struct MergeBlockRatioProperty {
11246 #[serde(default)]
11247 pub this: Option<Box<Expression>>,
11248 #[serde(default)]
11249 pub no: Option<Box<Expression>>,
11250 #[serde(default)]
11251 pub default: Option<Box<Expression>>,
11252 #[serde(default)]
11253 pub percent: Option<Box<Expression>>,
11254}
11255
11256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11258#[cfg_attr(feature = "bindings", derive(TS))]
11259pub struct OnProperty {
11260 pub this: Box<Expression>,
11261}
11262
11263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11265#[cfg_attr(feature = "bindings", derive(TS))]
11266pub struct OnCommitProperty {
11267 #[serde(default)]
11268 pub delete: Option<Box<Expression>>,
11269}
11270
11271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11273#[cfg_attr(feature = "bindings", derive(TS))]
11274pub struct PartitionedByProperty {
11275 pub this: Box<Expression>,
11276}
11277
11278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11280#[cfg_attr(feature = "bindings", derive(TS))]
11281pub struct PartitionByProperty {
11282 #[serde(default)]
11283 pub expressions: Vec<Expression>,
11284}
11285
11286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11288#[cfg_attr(feature = "bindings", derive(TS))]
11289pub struct PartitionedByBucket {
11290 pub this: Box<Expression>,
11291 pub expression: Box<Expression>,
11292}
11293
11294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11296#[cfg_attr(feature = "bindings", derive(TS))]
11297pub struct ClusterByColumnsProperty {
11298 #[serde(default)]
11299 pub columns: Vec<Identifier>,
11300}
11301
11302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11304#[cfg_attr(feature = "bindings", derive(TS))]
11305pub struct PartitionByTruncate {
11306 pub this: Box<Expression>,
11307 pub expression: Box<Expression>,
11308}
11309
11310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11312#[cfg_attr(feature = "bindings", derive(TS))]
11313pub struct PartitionByRangeProperty {
11314 #[serde(default)]
11315 pub partition_expressions: Option<Box<Expression>>,
11316 #[serde(default)]
11317 pub create_expressions: Option<Box<Expression>>,
11318}
11319
11320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11322#[cfg_attr(feature = "bindings", derive(TS))]
11323pub struct PartitionByRangePropertyDynamic {
11324 #[serde(default)]
11325 pub this: Option<Box<Expression>>,
11326 #[serde(default)]
11327 pub start: Option<Box<Expression>>,
11328 #[serde(default)]
11330 pub use_start_end: bool,
11331 #[serde(default)]
11332 pub end: Option<Box<Expression>>,
11333 #[serde(default)]
11334 pub every: Option<Box<Expression>>,
11335}
11336
11337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11339#[cfg_attr(feature = "bindings", derive(TS))]
11340pub struct PartitionByListProperty {
11341 #[serde(default)]
11342 pub partition_expressions: Option<Box<Expression>>,
11343 #[serde(default)]
11344 pub create_expressions: Option<Box<Expression>>,
11345}
11346
11347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11349#[cfg_attr(feature = "bindings", derive(TS))]
11350pub struct PartitionList {
11351 pub this: Box<Expression>,
11352 #[serde(default)]
11353 pub expressions: Vec<Expression>,
11354}
11355
11356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11358#[cfg_attr(feature = "bindings", derive(TS))]
11359pub struct Partition {
11360 pub expressions: Vec<Expression>,
11361 #[serde(default)]
11362 pub subpartition: bool,
11363}
11364
11365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11368#[cfg_attr(feature = "bindings", derive(TS))]
11369pub struct RefreshTriggerProperty {
11370 pub method: String,
11372 #[serde(default)]
11374 pub kind: Option<String>,
11375 #[serde(default)]
11377 pub every: Option<Box<Expression>>,
11378 #[serde(default)]
11380 pub unit: Option<String>,
11381 #[serde(default)]
11383 pub starts: Option<Box<Expression>>,
11384}
11385
11386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11388#[cfg_attr(feature = "bindings", derive(TS))]
11389pub struct UniqueKeyProperty {
11390 #[serde(default)]
11391 pub expressions: Vec<Expression>,
11392}
11393
11394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11396#[cfg_attr(feature = "bindings", derive(TS))]
11397pub struct RollupProperty {
11398 pub expressions: Vec<RollupIndex>,
11399}
11400
11401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11403#[cfg_attr(feature = "bindings", derive(TS))]
11404pub struct RollupIndex {
11405 pub name: Identifier,
11406 pub expressions: Vec<Identifier>,
11407}
11408
11409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11411#[cfg_attr(feature = "bindings", derive(TS))]
11412pub struct PartitionBoundSpec {
11413 #[serde(default)]
11414 pub this: Option<Box<Expression>>,
11415 #[serde(default)]
11416 pub expression: Option<Box<Expression>>,
11417 #[serde(default)]
11418 pub from_expressions: Option<Box<Expression>>,
11419 #[serde(default)]
11420 pub to_expressions: Option<Box<Expression>>,
11421}
11422
11423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11425#[cfg_attr(feature = "bindings", derive(TS))]
11426pub struct PartitionedOfProperty {
11427 pub this: Box<Expression>,
11428 pub expression: Box<Expression>,
11429}
11430
11431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11433#[cfg_attr(feature = "bindings", derive(TS))]
11434pub struct RemoteWithConnectionModelProperty {
11435 pub this: Box<Expression>,
11436}
11437
11438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11440#[cfg_attr(feature = "bindings", derive(TS))]
11441pub struct ReturnsProperty {
11442 #[serde(default)]
11443 pub this: Option<Box<Expression>>,
11444 #[serde(default)]
11445 pub is_table: Option<Box<Expression>>,
11446 #[serde(default)]
11447 pub table: Option<Box<Expression>>,
11448 #[serde(default)]
11449 pub null: Option<Box<Expression>>,
11450}
11451
11452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11454#[cfg_attr(feature = "bindings", derive(TS))]
11455pub struct RowFormatProperty {
11456 pub this: Box<Expression>,
11457}
11458
11459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11461#[cfg_attr(feature = "bindings", derive(TS))]
11462pub struct RowFormatDelimitedProperty {
11463 #[serde(default)]
11464 pub fields: Option<Box<Expression>>,
11465 #[serde(default)]
11466 pub escaped: Option<Box<Expression>>,
11467 #[serde(default)]
11468 pub collection_items: Option<Box<Expression>>,
11469 #[serde(default)]
11470 pub map_keys: Option<Box<Expression>>,
11471 #[serde(default)]
11472 pub lines: Option<Box<Expression>>,
11473 #[serde(default)]
11474 pub null: Option<Box<Expression>>,
11475 #[serde(default)]
11476 pub serde: Option<Box<Expression>>,
11477}
11478
11479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11481#[cfg_attr(feature = "bindings", derive(TS))]
11482pub struct RowFormatSerdeProperty {
11483 pub this: Box<Expression>,
11484 #[serde(default)]
11485 pub serde_properties: Option<Box<Expression>>,
11486}
11487
11488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11490#[cfg_attr(feature = "bindings", derive(TS))]
11491pub struct QueryTransform {
11492 #[serde(default)]
11493 pub expressions: Vec<Expression>,
11494 #[serde(default)]
11495 pub command_script: Option<Box<Expression>>,
11496 #[serde(default)]
11497 pub schema: Option<Box<Expression>>,
11498 #[serde(default)]
11499 pub row_format_before: Option<Box<Expression>>,
11500 #[serde(default)]
11501 pub record_writer: Option<Box<Expression>>,
11502 #[serde(default)]
11503 pub row_format_after: Option<Box<Expression>>,
11504 #[serde(default)]
11505 pub record_reader: Option<Box<Expression>>,
11506}
11507
11508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11510#[cfg_attr(feature = "bindings", derive(TS))]
11511pub struct SampleProperty {
11512 pub this: Box<Expression>,
11513}
11514
11515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11517#[cfg_attr(feature = "bindings", derive(TS))]
11518pub struct SecurityProperty {
11519 pub this: Box<Expression>,
11520}
11521
11522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11524#[cfg_attr(feature = "bindings", derive(TS))]
11525pub struct SchemaCommentProperty {
11526 pub this: Box<Expression>,
11527}
11528
11529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11531#[cfg_attr(feature = "bindings", derive(TS))]
11532pub struct SemanticView {
11533 pub this: Box<Expression>,
11534 #[serde(default)]
11535 pub metrics: Option<Box<Expression>>,
11536 #[serde(default)]
11537 pub dimensions: Option<Box<Expression>>,
11538 #[serde(default)]
11539 pub facts: Option<Box<Expression>>,
11540 #[serde(default)]
11541 pub where_: Option<Box<Expression>>,
11542}
11543
11544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11546#[cfg_attr(feature = "bindings", derive(TS))]
11547pub struct SerdeProperties {
11548 #[serde(default)]
11549 pub expressions: Vec<Expression>,
11550 #[serde(default)]
11551 pub with_: Option<Box<Expression>>,
11552}
11553
11554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11556#[cfg_attr(feature = "bindings", derive(TS))]
11557pub struct SetProperty {
11558 #[serde(default)]
11559 pub multi: Option<Box<Expression>>,
11560}
11561
11562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11564#[cfg_attr(feature = "bindings", derive(TS))]
11565pub struct SharingProperty {
11566 #[serde(default)]
11567 pub this: Option<Box<Expression>>,
11568}
11569
11570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11572#[cfg_attr(feature = "bindings", derive(TS))]
11573pub struct SetConfigProperty {
11574 pub this: Box<Expression>,
11575}
11576
11577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11579#[cfg_attr(feature = "bindings", derive(TS))]
11580pub struct SettingsProperty {
11581 #[serde(default)]
11582 pub expressions: Vec<Expression>,
11583}
11584
11585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11587#[cfg_attr(feature = "bindings", derive(TS))]
11588pub struct SortKeyProperty {
11589 pub this: Box<Expression>,
11590 #[serde(default)]
11591 pub compound: Option<Box<Expression>>,
11592}
11593
11594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11596#[cfg_attr(feature = "bindings", derive(TS))]
11597pub struct SqlReadWriteProperty {
11598 pub this: Box<Expression>,
11599}
11600
11601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11603#[cfg_attr(feature = "bindings", derive(TS))]
11604pub struct SqlSecurityProperty {
11605 pub this: Box<Expression>,
11606}
11607
11608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11610#[cfg_attr(feature = "bindings", derive(TS))]
11611pub struct StabilityProperty {
11612 pub this: Box<Expression>,
11613}
11614
11615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11617#[cfg_attr(feature = "bindings", derive(TS))]
11618pub struct StorageHandlerProperty {
11619 pub this: Box<Expression>,
11620}
11621
11622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11624#[cfg_attr(feature = "bindings", derive(TS))]
11625pub struct TemporaryProperty {
11626 #[serde(default)]
11627 pub this: Option<Box<Expression>>,
11628}
11629
11630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11632#[cfg_attr(feature = "bindings", derive(TS))]
11633pub struct Tags {
11634 #[serde(default)]
11635 pub expressions: Vec<Expression>,
11636}
11637
11638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11640#[cfg_attr(feature = "bindings", derive(TS))]
11641pub struct TransformModelProperty {
11642 #[serde(default)]
11643 pub expressions: Vec<Expression>,
11644}
11645
11646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11648#[cfg_attr(feature = "bindings", derive(TS))]
11649pub struct TransientProperty {
11650 #[serde(default)]
11651 pub this: Option<Box<Expression>>,
11652}
11653
11654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11656#[cfg_attr(feature = "bindings", derive(TS))]
11657pub struct UsingTemplateProperty {
11658 pub this: Box<Expression>,
11659}
11660
11661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11663#[cfg_attr(feature = "bindings", derive(TS))]
11664pub struct ViewAttributeProperty {
11665 pub this: Box<Expression>,
11666}
11667
11668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11670#[cfg_attr(feature = "bindings", derive(TS))]
11671pub struct VolatileProperty {
11672 #[serde(default)]
11673 pub this: Option<Box<Expression>>,
11674}
11675
11676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11678#[cfg_attr(feature = "bindings", derive(TS))]
11679pub struct WithDataProperty {
11680 #[serde(default)]
11681 pub no: Option<Box<Expression>>,
11682 #[serde(default)]
11683 pub statistics: Option<Box<Expression>>,
11684}
11685
11686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11688#[cfg_attr(feature = "bindings", derive(TS))]
11689pub struct WithJournalTableProperty {
11690 pub this: Box<Expression>,
11691}
11692
11693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11695#[cfg_attr(feature = "bindings", derive(TS))]
11696pub struct WithSchemaBindingProperty {
11697 pub this: Box<Expression>,
11698}
11699
11700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11702#[cfg_attr(feature = "bindings", derive(TS))]
11703pub struct WithSystemVersioningProperty {
11704 #[serde(default)]
11705 pub on: Option<Box<Expression>>,
11706 #[serde(default)]
11707 pub this: Option<Box<Expression>>,
11708 #[serde(default)]
11709 pub data_consistency: Option<Box<Expression>>,
11710 #[serde(default)]
11711 pub retention_period: Option<Box<Expression>>,
11712 #[serde(default)]
11713 pub with_: Option<Box<Expression>>,
11714}
11715
11716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11718#[cfg_attr(feature = "bindings", derive(TS))]
11719pub struct WithProcedureOptions {
11720 #[serde(default)]
11721 pub expressions: Vec<Expression>,
11722}
11723
11724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11726#[cfg_attr(feature = "bindings", derive(TS))]
11727pub struct EncodeProperty {
11728 pub this: Box<Expression>,
11729 #[serde(default)]
11730 pub properties: Vec<Expression>,
11731 #[serde(default)]
11732 pub key: Option<Box<Expression>>,
11733}
11734
11735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11737#[cfg_attr(feature = "bindings", derive(TS))]
11738pub struct IncludeProperty {
11739 pub this: Box<Expression>,
11740 #[serde(default)]
11741 pub alias: Option<String>,
11742 #[serde(default)]
11743 pub column_def: Option<Box<Expression>>,
11744}
11745
11746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11748#[cfg_attr(feature = "bindings", derive(TS))]
11749pub struct Properties {
11750 #[serde(default)]
11751 pub expressions: Vec<Expression>,
11752}
11753
11754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11756#[cfg_attr(feature = "bindings", derive(TS))]
11757pub struct OptionEntry {
11758 pub key: Identifier,
11759 pub value: Expression,
11760}
11761
11762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11764#[cfg_attr(feature = "bindings", derive(TS))]
11765pub struct OptionsProperty {
11766 #[serde(default)]
11767 pub entries: Vec<OptionEntry>,
11768}
11769
11770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11772#[cfg_attr(feature = "bindings", derive(TS))]
11773pub struct InputOutputFormat {
11774 #[serde(default)]
11775 pub input_format: Option<Box<Expression>>,
11776 #[serde(default)]
11777 pub output_format: Option<Box<Expression>>,
11778}
11779
11780#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11782#[cfg_attr(feature = "bindings", derive(TS))]
11783pub struct Reference {
11784 pub this: Box<Expression>,
11785 #[serde(default)]
11786 pub expressions: Vec<Expression>,
11787 #[serde(default)]
11788 pub options: Vec<Expression>,
11789}
11790
11791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11793#[cfg_attr(feature = "bindings", derive(TS))]
11794pub struct QueryOption {
11795 pub this: Box<Expression>,
11796 #[serde(default)]
11797 pub expression: Option<Box<Expression>>,
11798}
11799
11800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11802#[cfg_attr(feature = "bindings", derive(TS))]
11803pub struct WithTableHint {
11804 #[serde(default)]
11805 pub expressions: Vec<Expression>,
11806}
11807
11808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11810#[cfg_attr(feature = "bindings", derive(TS))]
11811pub struct IndexTableHint {
11812 pub this: Box<Expression>,
11813 #[serde(default)]
11814 pub expressions: Vec<Expression>,
11815 #[serde(default)]
11816 pub target: Option<Box<Expression>>,
11817}
11818
11819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11821#[cfg_attr(feature = "bindings", derive(TS))]
11822pub struct Get {
11823 pub this: Box<Expression>,
11824 #[serde(default)]
11825 pub target: Option<Box<Expression>>,
11826 #[serde(default)]
11827 pub properties: Vec<Expression>,
11828}
11829
11830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11832#[cfg_attr(feature = "bindings", derive(TS))]
11833pub struct SetOperation {
11834 #[serde(default)]
11835 pub with_: Option<Box<Expression>>,
11836 pub this: Box<Expression>,
11837 pub expression: Box<Expression>,
11838 #[serde(default)]
11839 pub distinct: bool,
11840 #[serde(default)]
11841 pub by_name: Option<Box<Expression>>,
11842 #[serde(default)]
11843 pub side: Option<Box<Expression>>,
11844 #[serde(default)]
11845 pub kind: Option<String>,
11846 #[serde(default)]
11847 pub on: Option<Box<Expression>>,
11848}
11849
11850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11852#[cfg_attr(feature = "bindings", derive(TS))]
11853pub struct Var {
11854 pub this: String,
11855}
11856
11857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11859#[cfg_attr(feature = "bindings", derive(TS))]
11860pub struct Variadic {
11861 pub this: Box<Expression>,
11862}
11863
11864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11866#[cfg_attr(feature = "bindings", derive(TS))]
11867pub struct Version {
11868 pub this: Box<Expression>,
11869 pub kind: String,
11870 #[serde(default)]
11871 pub expression: Option<Box<Expression>>,
11872}
11873
11874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11876#[cfg_attr(feature = "bindings", derive(TS))]
11877pub struct Schema {
11878 #[serde(default)]
11879 pub this: Option<Box<Expression>>,
11880 #[serde(default)]
11881 pub expressions: Vec<Expression>,
11882}
11883
11884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11886#[cfg_attr(feature = "bindings", derive(TS))]
11887pub struct Lock {
11888 #[serde(default)]
11889 pub update: Option<Box<Expression>>,
11890 #[serde(default)]
11891 pub expressions: Vec<Expression>,
11892 #[serde(default)]
11893 pub wait: Option<Box<Expression>>,
11894 #[serde(default)]
11895 pub key: Option<Box<Expression>>,
11896}
11897
11898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11901#[cfg_attr(feature = "bindings", derive(TS))]
11902pub struct TableSample {
11903 #[serde(default, skip_serializing_if = "Option::is_none")]
11905 pub this: Option<Box<Expression>>,
11906 #[serde(default, skip_serializing_if = "Option::is_none")]
11908 pub sample: Option<Box<Sample>>,
11909 #[serde(default)]
11910 pub expressions: Vec<Expression>,
11911 #[serde(default)]
11912 pub method: Option<String>,
11913 #[serde(default)]
11914 pub bucket_numerator: Option<Box<Expression>>,
11915 #[serde(default)]
11916 pub bucket_denominator: Option<Box<Expression>>,
11917 #[serde(default)]
11918 pub bucket_field: Option<Box<Expression>>,
11919 #[serde(default)]
11920 pub percent: Option<Box<Expression>>,
11921 #[serde(default)]
11922 pub rows: Option<Box<Expression>>,
11923 #[serde(default)]
11924 pub size: Option<i64>,
11925 #[serde(default)]
11926 pub seed: Option<Box<Expression>>,
11927}
11928
11929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11931#[cfg_attr(feature = "bindings", derive(TS))]
11932pub struct Tag {
11933 #[serde(default)]
11934 pub this: Option<Box<Expression>>,
11935 #[serde(default)]
11936 pub prefix: Option<Box<Expression>>,
11937 #[serde(default)]
11938 pub postfix: Option<Box<Expression>>,
11939}
11940
11941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11943#[cfg_attr(feature = "bindings", derive(TS))]
11944pub struct UnpivotColumns {
11945 pub this: Box<Expression>,
11946 #[serde(default)]
11947 pub expressions: Vec<Expression>,
11948}
11949
11950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11952#[cfg_attr(feature = "bindings", derive(TS))]
11953pub struct SessionParameter {
11954 pub this: Box<Expression>,
11955 #[serde(default)]
11956 pub kind: Option<String>,
11957}
11958
11959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11961#[cfg_attr(feature = "bindings", derive(TS))]
11962pub struct PseudoType {
11963 pub this: Box<Expression>,
11964}
11965
11966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11968#[cfg_attr(feature = "bindings", derive(TS))]
11969pub struct ObjectIdentifier {
11970 pub this: Box<Expression>,
11971}
11972
11973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11975#[cfg_attr(feature = "bindings", derive(TS))]
11976pub struct Transaction {
11977 #[serde(default)]
11978 pub this: Option<Box<Expression>>,
11979 #[serde(default)]
11980 pub modes: Option<Box<Expression>>,
11981 #[serde(default)]
11982 pub mark: Option<Box<Expression>>,
11983}
11984
11985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11987#[cfg_attr(feature = "bindings", derive(TS))]
11988pub struct Commit {
11989 #[serde(default)]
11990 pub chain: Option<Box<Expression>>,
11991 #[serde(default)]
11992 pub this: Option<Box<Expression>>,
11993 #[serde(default)]
11994 pub durability: Option<Box<Expression>>,
11995}
11996
11997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11999#[cfg_attr(feature = "bindings", derive(TS))]
12000pub struct Rollback {
12001 #[serde(default)]
12002 pub savepoint: Option<Box<Expression>>,
12003 #[serde(default)]
12004 pub this: Option<Box<Expression>>,
12005}
12006
12007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12009#[cfg_attr(feature = "bindings", derive(TS))]
12010pub struct AlterSession {
12011 #[serde(default)]
12012 pub expressions: Vec<Expression>,
12013 #[serde(default)]
12014 pub unset: Option<Box<Expression>>,
12015}
12016
12017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12019#[cfg_attr(feature = "bindings", derive(TS))]
12020pub struct Analyze {
12021 #[serde(default)]
12022 pub kind: Option<String>,
12023 #[serde(default)]
12024 pub this: Option<Box<Expression>>,
12025 #[serde(default)]
12026 pub options: Vec<Expression>,
12027 #[serde(default)]
12028 pub mode: Option<Box<Expression>>,
12029 #[serde(default)]
12030 pub partition: Option<Box<Expression>>,
12031 #[serde(default)]
12032 pub expression: Option<Box<Expression>>,
12033 #[serde(default)]
12034 pub properties: Vec<Expression>,
12035 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12037 pub columns: Vec<String>,
12038}
12039
12040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12042#[cfg_attr(feature = "bindings", derive(TS))]
12043pub struct AnalyzeStatistics {
12044 pub kind: String,
12045 #[serde(default)]
12046 pub option: Option<Box<Expression>>,
12047 #[serde(default)]
12048 pub this: Option<Box<Expression>>,
12049 #[serde(default)]
12050 pub expressions: Vec<Expression>,
12051}
12052
12053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12055#[cfg_attr(feature = "bindings", derive(TS))]
12056pub struct AnalyzeHistogram {
12057 pub this: Box<Expression>,
12058 #[serde(default)]
12059 pub expressions: Vec<Expression>,
12060 #[serde(default)]
12061 pub expression: Option<Box<Expression>>,
12062 #[serde(default)]
12063 pub update_options: Option<Box<Expression>>,
12064}
12065
12066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12068#[cfg_attr(feature = "bindings", derive(TS))]
12069pub struct AnalyzeSample {
12070 pub kind: String,
12071 #[serde(default)]
12072 pub sample: Option<Box<Expression>>,
12073}
12074
12075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12077#[cfg_attr(feature = "bindings", derive(TS))]
12078pub struct AnalyzeListChainedRows {
12079 #[serde(default)]
12080 pub expression: Option<Box<Expression>>,
12081}
12082
12083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12085#[cfg_attr(feature = "bindings", derive(TS))]
12086pub struct AnalyzeDelete {
12087 #[serde(default)]
12088 pub kind: Option<String>,
12089}
12090
12091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12093#[cfg_attr(feature = "bindings", derive(TS))]
12094pub struct AnalyzeWith {
12095 #[serde(default)]
12096 pub expressions: Vec<Expression>,
12097}
12098
12099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12101#[cfg_attr(feature = "bindings", derive(TS))]
12102pub struct AnalyzeValidate {
12103 pub kind: String,
12104 #[serde(default)]
12105 pub this: Option<Box<Expression>>,
12106 #[serde(default)]
12107 pub expression: Option<Box<Expression>>,
12108}
12109
12110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12112#[cfg_attr(feature = "bindings", derive(TS))]
12113pub struct AddPartition {
12114 pub this: Box<Expression>,
12115 #[serde(default)]
12116 pub exists: bool,
12117 #[serde(default)]
12118 pub location: Option<Box<Expression>>,
12119}
12120
12121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12123#[cfg_attr(feature = "bindings", derive(TS))]
12124pub struct AttachOption {
12125 pub this: Box<Expression>,
12126 #[serde(default)]
12127 pub expression: Option<Box<Expression>>,
12128}
12129
12130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12132#[cfg_attr(feature = "bindings", derive(TS))]
12133pub struct DropPartition {
12134 #[serde(default)]
12135 pub expressions: Vec<Expression>,
12136 #[serde(default)]
12137 pub exists: bool,
12138}
12139
12140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12142#[cfg_attr(feature = "bindings", derive(TS))]
12143pub struct ReplacePartition {
12144 pub expression: Box<Expression>,
12145 #[serde(default)]
12146 pub source: Option<Box<Expression>>,
12147}
12148
12149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12151#[cfg_attr(feature = "bindings", derive(TS))]
12152pub struct DPipe {
12153 pub this: Box<Expression>,
12154 pub expression: Box<Expression>,
12155 #[serde(default)]
12156 pub safe: Option<Box<Expression>>,
12157}
12158
12159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12161#[cfg_attr(feature = "bindings", derive(TS))]
12162pub struct Operator {
12163 pub this: Box<Expression>,
12164 #[serde(default)]
12165 pub operator: Option<Box<Expression>>,
12166 pub expression: Box<Expression>,
12167 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12169 pub comments: Vec<String>,
12170}
12171
12172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12174#[cfg_attr(feature = "bindings", derive(TS))]
12175pub struct PivotAny {
12176 #[serde(default)]
12177 pub this: Option<Box<Expression>>,
12178}
12179
12180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12182#[cfg_attr(feature = "bindings", derive(TS))]
12183pub struct Aliases {
12184 pub this: Box<Expression>,
12185 #[serde(default)]
12186 pub expressions: Vec<Expression>,
12187}
12188
12189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12191#[cfg_attr(feature = "bindings", derive(TS))]
12192pub struct AtIndex {
12193 pub this: Box<Expression>,
12194 pub expression: Box<Expression>,
12195}
12196
12197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12199#[cfg_attr(feature = "bindings", derive(TS))]
12200pub struct FromTimeZone {
12201 pub this: Box<Expression>,
12202 #[serde(default)]
12203 pub zone: Option<Box<Expression>>,
12204}
12205
12206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12208#[cfg_attr(feature = "bindings", derive(TS))]
12209pub struct FormatPhrase {
12210 pub this: Box<Expression>,
12211 pub format: String,
12212}
12213
12214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12216#[cfg_attr(feature = "bindings", derive(TS))]
12217pub struct ForIn {
12218 pub this: Box<Expression>,
12219 pub expression: Box<Expression>,
12220}
12221
12222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12224#[cfg_attr(feature = "bindings", derive(TS))]
12225pub struct TimeUnit {
12226 #[serde(default)]
12227 pub unit: Option<String>,
12228}
12229
12230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12232#[cfg_attr(feature = "bindings", derive(TS))]
12233pub struct IntervalOp {
12234 #[serde(default)]
12235 pub unit: Option<String>,
12236 pub expression: Box<Expression>,
12237}
12238
12239#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12241#[cfg_attr(feature = "bindings", derive(TS))]
12242pub struct HavingMax {
12243 pub this: Box<Expression>,
12244 pub expression: Box<Expression>,
12245 #[serde(default)]
12246 pub max: Option<Box<Expression>>,
12247}
12248
12249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12251#[cfg_attr(feature = "bindings", derive(TS))]
12252pub struct CosineDistance {
12253 pub this: Box<Expression>,
12254 pub expression: Box<Expression>,
12255}
12256
12257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12259#[cfg_attr(feature = "bindings", derive(TS))]
12260pub struct DotProduct {
12261 pub this: Box<Expression>,
12262 pub expression: Box<Expression>,
12263}
12264
12265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12267#[cfg_attr(feature = "bindings", derive(TS))]
12268pub struct EuclideanDistance {
12269 pub this: Box<Expression>,
12270 pub expression: Box<Expression>,
12271}
12272
12273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12275#[cfg_attr(feature = "bindings", derive(TS))]
12276pub struct ManhattanDistance {
12277 pub this: Box<Expression>,
12278 pub expression: Box<Expression>,
12279}
12280
12281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12283#[cfg_attr(feature = "bindings", derive(TS))]
12284pub struct JarowinklerSimilarity {
12285 pub this: Box<Expression>,
12286 pub expression: Box<Expression>,
12287}
12288
12289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12291#[cfg_attr(feature = "bindings", derive(TS))]
12292pub struct Booland {
12293 pub this: Box<Expression>,
12294 pub expression: Box<Expression>,
12295}
12296
12297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12299#[cfg_attr(feature = "bindings", derive(TS))]
12300pub struct Boolor {
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 ParameterizedAgg {
12309 pub this: Box<Expression>,
12310 #[serde(default)]
12311 pub expressions: Vec<Expression>,
12312 #[serde(default)]
12313 pub params: Vec<Expression>,
12314}
12315
12316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12318#[cfg_attr(feature = "bindings", derive(TS))]
12319pub struct ArgMax {
12320 pub this: Box<Expression>,
12321 pub expression: Box<Expression>,
12322 #[serde(default)]
12323 pub count: Option<Box<Expression>>,
12324}
12325
12326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12328#[cfg_attr(feature = "bindings", derive(TS))]
12329pub struct ArgMin {
12330 pub this: Box<Expression>,
12331 pub expression: Box<Expression>,
12332 #[serde(default)]
12333 pub count: Option<Box<Expression>>,
12334}
12335
12336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12338#[cfg_attr(feature = "bindings", derive(TS))]
12339pub struct ApproxTopK {
12340 pub this: Box<Expression>,
12341 #[serde(default)]
12342 pub expression: Option<Box<Expression>>,
12343 #[serde(default)]
12344 pub counters: Option<Box<Expression>>,
12345}
12346
12347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12349#[cfg_attr(feature = "bindings", derive(TS))]
12350pub struct ApproxTopKAccumulate {
12351 pub this: Box<Expression>,
12352 #[serde(default)]
12353 pub expression: Option<Box<Expression>>,
12354}
12355
12356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12358#[cfg_attr(feature = "bindings", derive(TS))]
12359pub struct ApproxTopKCombine {
12360 pub this: Box<Expression>,
12361 #[serde(default)]
12362 pub expression: Option<Box<Expression>>,
12363}
12364
12365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12367#[cfg_attr(feature = "bindings", derive(TS))]
12368pub struct ApproxTopKEstimate {
12369 pub this: Box<Expression>,
12370 #[serde(default)]
12371 pub expression: Option<Box<Expression>>,
12372}
12373
12374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12376#[cfg_attr(feature = "bindings", derive(TS))]
12377pub struct ApproxTopSum {
12378 pub this: Box<Expression>,
12379 pub expression: Box<Expression>,
12380 #[serde(default)]
12381 pub count: Option<Box<Expression>>,
12382}
12383
12384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12386#[cfg_attr(feature = "bindings", derive(TS))]
12387pub struct ApproxQuantiles {
12388 pub this: Box<Expression>,
12389 #[serde(default)]
12390 pub expression: Option<Box<Expression>>,
12391}
12392
12393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12395#[cfg_attr(feature = "bindings", derive(TS))]
12396pub struct Minhash {
12397 pub this: Box<Expression>,
12398 #[serde(default)]
12399 pub expressions: Vec<Expression>,
12400}
12401
12402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12404#[cfg_attr(feature = "bindings", derive(TS))]
12405pub struct FarmFingerprint {
12406 #[serde(default)]
12407 pub expressions: Vec<Expression>,
12408}
12409
12410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12412#[cfg_attr(feature = "bindings", derive(TS))]
12413pub struct Float64 {
12414 pub this: Box<Expression>,
12415 #[serde(default)]
12416 pub expression: Option<Box<Expression>>,
12417}
12418
12419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12421#[cfg_attr(feature = "bindings", derive(TS))]
12422pub struct Transform {
12423 pub this: Box<Expression>,
12424 pub expression: Box<Expression>,
12425}
12426
12427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12429#[cfg_attr(feature = "bindings", derive(TS))]
12430pub struct Translate {
12431 pub this: Box<Expression>,
12432 #[serde(default)]
12433 pub from_: Option<Box<Expression>>,
12434 #[serde(default)]
12435 pub to: Option<Box<Expression>>,
12436}
12437
12438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12440#[cfg_attr(feature = "bindings", derive(TS))]
12441pub struct Grouping {
12442 #[serde(default)]
12443 pub expressions: Vec<Expression>,
12444}
12445
12446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12448#[cfg_attr(feature = "bindings", derive(TS))]
12449pub struct GroupingId {
12450 #[serde(default)]
12451 pub expressions: Vec<Expression>,
12452}
12453
12454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12456#[cfg_attr(feature = "bindings", derive(TS))]
12457pub struct Anonymous {
12458 pub this: Box<Expression>,
12459 #[serde(default)]
12460 pub expressions: Vec<Expression>,
12461}
12462
12463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12465#[cfg_attr(feature = "bindings", derive(TS))]
12466pub struct AnonymousAggFunc {
12467 pub this: Box<Expression>,
12468 #[serde(default)]
12469 pub expressions: Vec<Expression>,
12470}
12471
12472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12474#[cfg_attr(feature = "bindings", derive(TS))]
12475pub struct CombinedAggFunc {
12476 pub this: Box<Expression>,
12477 #[serde(default)]
12478 pub expressions: Vec<Expression>,
12479}
12480
12481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12483#[cfg_attr(feature = "bindings", derive(TS))]
12484pub struct CombinedParameterizedAgg {
12485 pub this: Box<Expression>,
12486 #[serde(default)]
12487 pub expressions: Vec<Expression>,
12488 #[serde(default)]
12489 pub params: Vec<Expression>,
12490}
12491
12492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12494#[cfg_attr(feature = "bindings", derive(TS))]
12495pub struct HashAgg {
12496 pub this: Box<Expression>,
12497 #[serde(default)]
12498 pub expressions: Vec<Expression>,
12499}
12500
12501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12503#[cfg_attr(feature = "bindings", derive(TS))]
12504pub struct Hll {
12505 pub this: Box<Expression>,
12506 #[serde(default)]
12507 pub expressions: Vec<Expression>,
12508}
12509
12510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12512#[cfg_attr(feature = "bindings", derive(TS))]
12513pub struct Apply {
12514 pub this: Box<Expression>,
12515 pub expression: Box<Expression>,
12516}
12517
12518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12520#[cfg_attr(feature = "bindings", derive(TS))]
12521pub struct ToBoolean {
12522 pub this: Box<Expression>,
12523 #[serde(default)]
12524 pub safe: Option<Box<Expression>>,
12525}
12526
12527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12529#[cfg_attr(feature = "bindings", derive(TS))]
12530pub struct List {
12531 #[serde(default)]
12532 pub expressions: Vec<Expression>,
12533}
12534
12535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12540#[cfg_attr(feature = "bindings", derive(TS))]
12541pub struct ToMap {
12542 pub this: Box<Expression>,
12544}
12545
12546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12548#[cfg_attr(feature = "bindings", derive(TS))]
12549pub struct Pad {
12550 pub this: Box<Expression>,
12551 pub expression: Box<Expression>,
12552 #[serde(default)]
12553 pub fill_pattern: Option<Box<Expression>>,
12554 #[serde(default)]
12555 pub is_left: Option<Box<Expression>>,
12556}
12557
12558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12560#[cfg_attr(feature = "bindings", derive(TS))]
12561pub struct ToChar {
12562 pub this: Box<Expression>,
12563 #[serde(default)]
12564 pub format: Option<String>,
12565 #[serde(default)]
12566 pub nlsparam: Option<Box<Expression>>,
12567 #[serde(default)]
12568 pub is_numeric: Option<Box<Expression>>,
12569}
12570
12571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12573#[cfg_attr(feature = "bindings", derive(TS))]
12574pub struct StringFunc {
12575 pub this: Box<Expression>,
12576 #[serde(default)]
12577 pub zone: Option<Box<Expression>>,
12578}
12579
12580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12582#[cfg_attr(feature = "bindings", derive(TS))]
12583pub struct ToNumber {
12584 pub this: Box<Expression>,
12585 #[serde(default)]
12586 pub format: Option<Box<Expression>>,
12587 #[serde(default)]
12588 pub nlsparam: Option<Box<Expression>>,
12589 #[serde(default)]
12590 pub precision: Option<Box<Expression>>,
12591 #[serde(default)]
12592 pub scale: Option<Box<Expression>>,
12593 #[serde(default)]
12594 pub safe: Option<Box<Expression>>,
12595 #[serde(default)]
12596 pub safe_name: Option<Box<Expression>>,
12597}
12598
12599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12601#[cfg_attr(feature = "bindings", derive(TS))]
12602pub struct ToDouble {
12603 pub this: Box<Expression>,
12604 #[serde(default)]
12605 pub format: Option<String>,
12606 #[serde(default)]
12607 pub safe: Option<Box<Expression>>,
12608}
12609
12610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12612#[cfg_attr(feature = "bindings", derive(TS))]
12613pub struct ToDecfloat {
12614 pub this: Box<Expression>,
12615 #[serde(default)]
12616 pub format: Option<String>,
12617}
12618
12619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12621#[cfg_attr(feature = "bindings", derive(TS))]
12622pub struct TryToDecfloat {
12623 pub this: Box<Expression>,
12624 #[serde(default)]
12625 pub format: Option<String>,
12626}
12627
12628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12630#[cfg_attr(feature = "bindings", derive(TS))]
12631pub struct ToFile {
12632 pub this: Box<Expression>,
12633 #[serde(default)]
12634 pub path: Option<Box<Expression>>,
12635 #[serde(default)]
12636 pub safe: Option<Box<Expression>>,
12637}
12638
12639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12641#[cfg_attr(feature = "bindings", derive(TS))]
12642pub struct Columns {
12643 pub this: Box<Expression>,
12644 #[serde(default)]
12645 pub unpack: Option<Box<Expression>>,
12646}
12647
12648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12650#[cfg_attr(feature = "bindings", derive(TS))]
12651pub struct ConvertToCharset {
12652 pub this: Box<Expression>,
12653 #[serde(default)]
12654 pub dest: Option<Box<Expression>>,
12655 #[serde(default)]
12656 pub source: Option<Box<Expression>>,
12657}
12658
12659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12661#[cfg_attr(feature = "bindings", derive(TS))]
12662pub struct ConvertTimezone {
12663 #[serde(default)]
12664 pub source_tz: Option<Box<Expression>>,
12665 #[serde(default)]
12666 pub target_tz: Option<Box<Expression>>,
12667 #[serde(default)]
12668 pub timestamp: Option<Box<Expression>>,
12669 #[serde(default)]
12670 pub options: Vec<Expression>,
12671}
12672
12673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12675#[cfg_attr(feature = "bindings", derive(TS))]
12676pub struct GenerateSeries {
12677 #[serde(default)]
12678 pub start: Option<Box<Expression>>,
12679 #[serde(default)]
12680 pub end: Option<Box<Expression>>,
12681 #[serde(default)]
12682 pub step: Option<Box<Expression>>,
12683 #[serde(default)]
12684 pub is_end_exclusive: Option<Box<Expression>>,
12685}
12686
12687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12689#[cfg_attr(feature = "bindings", derive(TS))]
12690pub struct AIAgg {
12691 pub this: Box<Expression>,
12692 pub expression: Box<Expression>,
12693}
12694
12695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12697#[cfg_attr(feature = "bindings", derive(TS))]
12698pub struct AIClassify {
12699 pub this: Box<Expression>,
12700 #[serde(default)]
12701 pub categories: Option<Box<Expression>>,
12702 #[serde(default)]
12703 pub config: Option<Box<Expression>>,
12704}
12705
12706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12708#[cfg_attr(feature = "bindings", derive(TS))]
12709pub struct ArrayAll {
12710 pub this: Box<Expression>,
12711 pub expression: Box<Expression>,
12712}
12713
12714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12716#[cfg_attr(feature = "bindings", derive(TS))]
12717pub struct ArrayAny {
12718 pub this: Box<Expression>,
12719 pub expression: Box<Expression>,
12720}
12721
12722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12724#[cfg_attr(feature = "bindings", derive(TS))]
12725pub struct ArrayConstructCompact {
12726 #[serde(default)]
12727 pub expressions: Vec<Expression>,
12728}
12729
12730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12732#[cfg_attr(feature = "bindings", derive(TS))]
12733pub struct StPoint {
12734 pub this: Box<Expression>,
12735 pub expression: Box<Expression>,
12736 #[serde(default)]
12737 pub null: Option<Box<Expression>>,
12738}
12739
12740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12742#[cfg_attr(feature = "bindings", derive(TS))]
12743pub struct StDistance {
12744 pub this: Box<Expression>,
12745 pub expression: Box<Expression>,
12746 #[serde(default)]
12747 pub use_spheroid: Option<Box<Expression>>,
12748}
12749
12750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12752#[cfg_attr(feature = "bindings", derive(TS))]
12753pub struct StringToArray {
12754 pub this: Box<Expression>,
12755 #[serde(default)]
12756 pub expression: Option<Box<Expression>>,
12757 #[serde(default)]
12758 pub null: Option<Box<Expression>>,
12759}
12760
12761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12763#[cfg_attr(feature = "bindings", derive(TS))]
12764pub struct ArraySum {
12765 pub this: Box<Expression>,
12766 #[serde(default)]
12767 pub expression: Option<Box<Expression>>,
12768}
12769
12770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12772#[cfg_attr(feature = "bindings", derive(TS))]
12773pub struct ObjectAgg {
12774 pub this: Box<Expression>,
12775 pub expression: Box<Expression>,
12776}
12777
12778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12780#[cfg_attr(feature = "bindings", derive(TS))]
12781pub struct CastToStrType {
12782 pub this: Box<Expression>,
12783 #[serde(default)]
12784 pub to: Option<Box<Expression>>,
12785}
12786
12787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12789#[cfg_attr(feature = "bindings", derive(TS))]
12790pub struct CheckJson {
12791 pub this: Box<Expression>,
12792}
12793
12794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12796#[cfg_attr(feature = "bindings", derive(TS))]
12797pub struct CheckXml {
12798 pub this: Box<Expression>,
12799 #[serde(default)]
12800 pub disable_auto_convert: Option<Box<Expression>>,
12801}
12802
12803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12805#[cfg_attr(feature = "bindings", derive(TS))]
12806pub struct TranslateCharacters {
12807 pub this: Box<Expression>,
12808 pub expression: Box<Expression>,
12809 #[serde(default)]
12810 pub with_error: Option<Box<Expression>>,
12811}
12812
12813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12815#[cfg_attr(feature = "bindings", derive(TS))]
12816pub struct CurrentSchemas {
12817 #[serde(default)]
12818 pub this: Option<Box<Expression>>,
12819}
12820
12821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12823#[cfg_attr(feature = "bindings", derive(TS))]
12824pub struct CurrentDatetime {
12825 #[serde(default)]
12826 pub this: Option<Box<Expression>>,
12827}
12828
12829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12831#[cfg_attr(feature = "bindings", derive(TS))]
12832pub struct Localtime {
12833 #[serde(default)]
12834 pub this: Option<Box<Expression>>,
12835}
12836
12837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12839#[cfg_attr(feature = "bindings", derive(TS))]
12840pub struct Localtimestamp {
12841 #[serde(default)]
12842 pub this: Option<Box<Expression>>,
12843}
12844
12845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12847#[cfg_attr(feature = "bindings", derive(TS))]
12848pub struct Systimestamp {
12849 #[serde(default)]
12850 pub this: Option<Box<Expression>>,
12851}
12852
12853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12855#[cfg_attr(feature = "bindings", derive(TS))]
12856pub struct CurrentSchema {
12857 #[serde(default)]
12858 pub this: Option<Box<Expression>>,
12859}
12860
12861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12863#[cfg_attr(feature = "bindings", derive(TS))]
12864pub struct CurrentUser {
12865 #[serde(default)]
12866 pub this: Option<Box<Expression>>,
12867}
12868
12869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12871#[cfg_attr(feature = "bindings", derive(TS))]
12872pub struct SessionUser;
12873
12874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12876#[cfg_attr(feature = "bindings", derive(TS))]
12877pub struct JSONPathRoot;
12878
12879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12881#[cfg_attr(feature = "bindings", derive(TS))]
12882pub struct UtcTime {
12883 #[serde(default)]
12884 pub this: Option<Box<Expression>>,
12885}
12886
12887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12889#[cfg_attr(feature = "bindings", derive(TS))]
12890pub struct UtcTimestamp {
12891 #[serde(default)]
12892 pub this: Option<Box<Expression>>,
12893}
12894
12895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12897#[cfg_attr(feature = "bindings", derive(TS))]
12898pub struct TimestampFunc {
12899 #[serde(default)]
12900 pub this: Option<Box<Expression>>,
12901 #[serde(default)]
12902 pub zone: Option<Box<Expression>>,
12903 #[serde(default)]
12904 pub with_tz: Option<bool>,
12905 #[serde(default)]
12906 pub safe: Option<bool>,
12907}
12908
12909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12911#[cfg_attr(feature = "bindings", derive(TS))]
12912pub struct DateBin {
12913 pub this: Box<Expression>,
12914 pub expression: Box<Expression>,
12915 #[serde(default)]
12916 pub unit: Option<String>,
12917 #[serde(default)]
12918 pub zone: Option<Box<Expression>>,
12919 #[serde(default)]
12920 pub origin: Option<Box<Expression>>,
12921}
12922
12923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12925#[cfg_attr(feature = "bindings", derive(TS))]
12926pub struct Datetime {
12927 pub this: Box<Expression>,
12928 #[serde(default)]
12929 pub expression: Option<Box<Expression>>,
12930}
12931
12932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12934#[cfg_attr(feature = "bindings", derive(TS))]
12935pub struct DatetimeAdd {
12936 pub this: Box<Expression>,
12937 pub expression: Box<Expression>,
12938 #[serde(default)]
12939 pub unit: Option<String>,
12940}
12941
12942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12944#[cfg_attr(feature = "bindings", derive(TS))]
12945pub struct DatetimeSub {
12946 pub this: Box<Expression>,
12947 pub expression: Box<Expression>,
12948 #[serde(default)]
12949 pub unit: Option<String>,
12950}
12951
12952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12954#[cfg_attr(feature = "bindings", derive(TS))]
12955pub struct DatetimeDiff {
12956 pub this: Box<Expression>,
12957 pub expression: Box<Expression>,
12958 #[serde(default)]
12959 pub unit: Option<String>,
12960}
12961
12962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12964#[cfg_attr(feature = "bindings", derive(TS))]
12965pub struct DatetimeTrunc {
12966 pub this: Box<Expression>,
12967 pub unit: String,
12968 #[serde(default)]
12969 pub zone: Option<Box<Expression>>,
12970}
12971
12972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12974#[cfg_attr(feature = "bindings", derive(TS))]
12975pub struct Dayname {
12976 pub this: Box<Expression>,
12977 #[serde(default)]
12978 pub abbreviated: Option<Box<Expression>>,
12979}
12980
12981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12983#[cfg_attr(feature = "bindings", derive(TS))]
12984pub struct MakeInterval {
12985 #[serde(default)]
12986 pub year: Option<Box<Expression>>,
12987 #[serde(default)]
12988 pub month: Option<Box<Expression>>,
12989 #[serde(default)]
12990 pub week: Option<Box<Expression>>,
12991 #[serde(default)]
12992 pub day: Option<Box<Expression>>,
12993 #[serde(default)]
12994 pub hour: Option<Box<Expression>>,
12995 #[serde(default)]
12996 pub minute: Option<Box<Expression>>,
12997 #[serde(default)]
12998 pub second: Option<Box<Expression>>,
12999}
13000
13001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13003#[cfg_attr(feature = "bindings", derive(TS))]
13004pub struct PreviousDay {
13005 pub this: Box<Expression>,
13006 pub expression: Box<Expression>,
13007}
13008
13009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13011#[cfg_attr(feature = "bindings", derive(TS))]
13012pub struct Elt {
13013 pub this: Box<Expression>,
13014 #[serde(default)]
13015 pub expressions: Vec<Expression>,
13016}
13017
13018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13020#[cfg_attr(feature = "bindings", derive(TS))]
13021pub struct TimestampAdd {
13022 pub this: Box<Expression>,
13023 pub expression: Box<Expression>,
13024 #[serde(default)]
13025 pub unit: Option<String>,
13026}
13027
13028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13030#[cfg_attr(feature = "bindings", derive(TS))]
13031pub struct TimestampSub {
13032 pub this: Box<Expression>,
13033 pub expression: Box<Expression>,
13034 #[serde(default)]
13035 pub unit: Option<String>,
13036}
13037
13038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13040#[cfg_attr(feature = "bindings", derive(TS))]
13041pub struct TimestampDiff {
13042 pub this: Box<Expression>,
13043 pub expression: Box<Expression>,
13044 #[serde(default)]
13045 pub unit: Option<String>,
13046}
13047
13048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13050#[cfg_attr(feature = "bindings", derive(TS))]
13051pub struct TimeSlice {
13052 pub this: Box<Expression>,
13053 pub expression: Box<Expression>,
13054 pub unit: String,
13055 #[serde(default)]
13056 pub kind: Option<String>,
13057}
13058
13059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13061#[cfg_attr(feature = "bindings", derive(TS))]
13062pub struct TimeAdd {
13063 pub this: Box<Expression>,
13064 pub expression: Box<Expression>,
13065 #[serde(default)]
13066 pub unit: Option<String>,
13067}
13068
13069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13071#[cfg_attr(feature = "bindings", derive(TS))]
13072pub struct TimeSub {
13073 pub this: Box<Expression>,
13074 pub expression: Box<Expression>,
13075 #[serde(default)]
13076 pub unit: Option<String>,
13077}
13078
13079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13081#[cfg_attr(feature = "bindings", derive(TS))]
13082pub struct TimeDiff {
13083 pub this: Box<Expression>,
13084 pub expression: Box<Expression>,
13085 #[serde(default)]
13086 pub unit: Option<String>,
13087}
13088
13089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13091#[cfg_attr(feature = "bindings", derive(TS))]
13092pub struct TimeTrunc {
13093 pub this: Box<Expression>,
13094 pub unit: String,
13095 #[serde(default)]
13096 pub zone: Option<Box<Expression>>,
13097}
13098
13099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13101#[cfg_attr(feature = "bindings", derive(TS))]
13102pub struct DateFromParts {
13103 #[serde(default)]
13104 pub year: Option<Box<Expression>>,
13105 #[serde(default)]
13106 pub month: Option<Box<Expression>>,
13107 #[serde(default)]
13108 pub day: Option<Box<Expression>>,
13109 #[serde(default)]
13110 pub allow_overflow: Option<Box<Expression>>,
13111}
13112
13113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13115#[cfg_attr(feature = "bindings", derive(TS))]
13116pub struct TimeFromParts {
13117 #[serde(default)]
13118 pub hour: Option<Box<Expression>>,
13119 #[serde(default)]
13120 pub min: Option<Box<Expression>>,
13121 #[serde(default)]
13122 pub sec: Option<Box<Expression>>,
13123 #[serde(default)]
13124 pub nano: Option<Box<Expression>>,
13125 #[serde(default)]
13126 pub fractions: Option<Box<Expression>>,
13127 #[serde(default)]
13128 pub precision: Option<i64>,
13129}
13130
13131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13133#[cfg_attr(feature = "bindings", derive(TS))]
13134pub struct DecodeCase {
13135 #[serde(default)]
13136 pub expressions: Vec<Expression>,
13137}
13138
13139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13141#[cfg_attr(feature = "bindings", derive(TS))]
13142pub struct Decrypt {
13143 pub this: Box<Expression>,
13144 #[serde(default)]
13145 pub passphrase: Option<Box<Expression>>,
13146 #[serde(default)]
13147 pub aad: Option<Box<Expression>>,
13148 #[serde(default)]
13149 pub encryption_method: Option<Box<Expression>>,
13150 #[serde(default)]
13151 pub safe: Option<Box<Expression>>,
13152}
13153
13154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13156#[cfg_attr(feature = "bindings", derive(TS))]
13157pub struct DecryptRaw {
13158 pub this: Box<Expression>,
13159 #[serde(default)]
13160 pub key: Option<Box<Expression>>,
13161 #[serde(default)]
13162 pub iv: Option<Box<Expression>>,
13163 #[serde(default)]
13164 pub aad: Option<Box<Expression>>,
13165 #[serde(default)]
13166 pub encryption_method: Option<Box<Expression>>,
13167 #[serde(default)]
13168 pub aead: Option<Box<Expression>>,
13169 #[serde(default)]
13170 pub safe: Option<Box<Expression>>,
13171}
13172
13173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13175#[cfg_attr(feature = "bindings", derive(TS))]
13176pub struct Encode {
13177 pub this: Box<Expression>,
13178 #[serde(default)]
13179 pub charset: Option<Box<Expression>>,
13180}
13181
13182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13184#[cfg_attr(feature = "bindings", derive(TS))]
13185pub struct Encrypt {
13186 pub this: Box<Expression>,
13187 #[serde(default)]
13188 pub passphrase: Option<Box<Expression>>,
13189 #[serde(default)]
13190 pub aad: Option<Box<Expression>>,
13191 #[serde(default)]
13192 pub encryption_method: Option<Box<Expression>>,
13193}
13194
13195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13197#[cfg_attr(feature = "bindings", derive(TS))]
13198pub struct EncryptRaw {
13199 pub this: Box<Expression>,
13200 #[serde(default)]
13201 pub key: Option<Box<Expression>>,
13202 #[serde(default)]
13203 pub iv: Option<Box<Expression>>,
13204 #[serde(default)]
13205 pub aad: Option<Box<Expression>>,
13206 #[serde(default)]
13207 pub encryption_method: Option<Box<Expression>>,
13208}
13209
13210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13212#[cfg_attr(feature = "bindings", derive(TS))]
13213pub struct EqualNull {
13214 pub this: Box<Expression>,
13215 pub expression: Box<Expression>,
13216}
13217
13218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13220#[cfg_attr(feature = "bindings", derive(TS))]
13221pub struct ToBinary {
13222 pub this: Box<Expression>,
13223 #[serde(default)]
13224 pub format: Option<String>,
13225 #[serde(default)]
13226 pub safe: Option<Box<Expression>>,
13227}
13228
13229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13231#[cfg_attr(feature = "bindings", derive(TS))]
13232pub struct Base64DecodeBinary {
13233 pub this: Box<Expression>,
13234 #[serde(default)]
13235 pub alphabet: Option<Box<Expression>>,
13236}
13237
13238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13240#[cfg_attr(feature = "bindings", derive(TS))]
13241pub struct Base64DecodeString {
13242 pub this: Box<Expression>,
13243 #[serde(default)]
13244 pub alphabet: Option<Box<Expression>>,
13245}
13246
13247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13249#[cfg_attr(feature = "bindings", derive(TS))]
13250pub struct Base64Encode {
13251 pub this: Box<Expression>,
13252 #[serde(default)]
13253 pub max_line_length: Option<Box<Expression>>,
13254 #[serde(default)]
13255 pub alphabet: Option<Box<Expression>>,
13256}
13257
13258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13260#[cfg_attr(feature = "bindings", derive(TS))]
13261pub struct TryBase64DecodeBinary {
13262 pub this: Box<Expression>,
13263 #[serde(default)]
13264 pub alphabet: Option<Box<Expression>>,
13265}
13266
13267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13269#[cfg_attr(feature = "bindings", derive(TS))]
13270pub struct TryBase64DecodeString {
13271 pub this: Box<Expression>,
13272 #[serde(default)]
13273 pub alphabet: Option<Box<Expression>>,
13274}
13275
13276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13278#[cfg_attr(feature = "bindings", derive(TS))]
13279pub struct GapFill {
13280 pub this: Box<Expression>,
13281 #[serde(default)]
13282 pub ts_column: Option<Box<Expression>>,
13283 #[serde(default)]
13284 pub bucket_width: Option<Box<Expression>>,
13285 #[serde(default)]
13286 pub partitioning_columns: Option<Box<Expression>>,
13287 #[serde(default)]
13288 pub value_columns: Option<Box<Expression>>,
13289 #[serde(default)]
13290 pub origin: Option<Box<Expression>>,
13291 #[serde(default)]
13292 pub ignore_nulls: Option<Box<Expression>>,
13293}
13294
13295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13297#[cfg_attr(feature = "bindings", derive(TS))]
13298pub struct GenerateDateArray {
13299 #[serde(default)]
13300 pub start: Option<Box<Expression>>,
13301 #[serde(default)]
13302 pub end: Option<Box<Expression>>,
13303 #[serde(default)]
13304 pub step: Option<Box<Expression>>,
13305}
13306
13307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13309#[cfg_attr(feature = "bindings", derive(TS))]
13310pub struct GenerateTimestampArray {
13311 #[serde(default)]
13312 pub start: Option<Box<Expression>>,
13313 #[serde(default)]
13314 pub end: Option<Box<Expression>>,
13315 #[serde(default)]
13316 pub step: Option<Box<Expression>>,
13317}
13318
13319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13321#[cfg_attr(feature = "bindings", derive(TS))]
13322pub struct GetExtract {
13323 pub this: Box<Expression>,
13324 pub expression: Box<Expression>,
13325}
13326
13327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13329#[cfg_attr(feature = "bindings", derive(TS))]
13330pub struct Getbit {
13331 pub this: Box<Expression>,
13332 pub expression: Box<Expression>,
13333 #[serde(default)]
13334 pub zero_is_msb: Option<Box<Expression>>,
13335}
13336
13337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13339#[cfg_attr(feature = "bindings", derive(TS))]
13340pub struct OverflowTruncateBehavior {
13341 #[serde(default)]
13342 pub this: Option<Box<Expression>>,
13343 #[serde(default)]
13344 pub with_count: Option<Box<Expression>>,
13345}
13346
13347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13349#[cfg_attr(feature = "bindings", derive(TS))]
13350pub struct HexEncode {
13351 pub this: Box<Expression>,
13352 #[serde(default)]
13353 pub case: Option<Box<Expression>>,
13354}
13355
13356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13358#[cfg_attr(feature = "bindings", derive(TS))]
13359pub struct Compress {
13360 pub this: Box<Expression>,
13361 #[serde(default)]
13362 pub method: Option<String>,
13363}
13364
13365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13367#[cfg_attr(feature = "bindings", derive(TS))]
13368pub struct DecompressBinary {
13369 pub this: Box<Expression>,
13370 pub method: String,
13371}
13372
13373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13375#[cfg_attr(feature = "bindings", derive(TS))]
13376pub struct DecompressString {
13377 pub this: Box<Expression>,
13378 pub method: String,
13379}
13380
13381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13383#[cfg_attr(feature = "bindings", derive(TS))]
13384pub struct Xor {
13385 #[serde(default)]
13386 pub this: Option<Box<Expression>>,
13387 #[serde(default)]
13388 pub expression: Option<Box<Expression>>,
13389 #[serde(default)]
13390 pub expressions: Vec<Expression>,
13391}
13392
13393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13395#[cfg_attr(feature = "bindings", derive(TS))]
13396pub struct Nullif {
13397 pub this: Box<Expression>,
13398 pub expression: Box<Expression>,
13399}
13400
13401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13403#[cfg_attr(feature = "bindings", derive(TS))]
13404pub struct JSON {
13405 #[serde(default)]
13406 pub this: Option<Box<Expression>>,
13407 #[serde(default)]
13408 pub with_: Option<Box<Expression>>,
13409 #[serde(default)]
13410 pub unique: bool,
13411}
13412
13413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13415#[cfg_attr(feature = "bindings", derive(TS))]
13416pub struct JSONPath {
13417 #[serde(default)]
13418 pub expressions: Vec<Expression>,
13419 #[serde(default)]
13420 pub escape: Option<Box<Expression>>,
13421}
13422
13423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13425#[cfg_attr(feature = "bindings", derive(TS))]
13426pub struct JSONPathFilter {
13427 pub this: Box<Expression>,
13428}
13429
13430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13432#[cfg_attr(feature = "bindings", derive(TS))]
13433pub struct JSONPathKey {
13434 pub this: Box<Expression>,
13435}
13436
13437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13439#[cfg_attr(feature = "bindings", derive(TS))]
13440pub struct JSONPathRecursive {
13441 #[serde(default)]
13442 pub this: Option<Box<Expression>>,
13443}
13444
13445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13447#[cfg_attr(feature = "bindings", derive(TS))]
13448pub struct JSONPathScript {
13449 pub this: Box<Expression>,
13450}
13451
13452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13454#[cfg_attr(feature = "bindings", derive(TS))]
13455pub struct JSONPathSlice {
13456 #[serde(default)]
13457 pub start: Option<Box<Expression>>,
13458 #[serde(default)]
13459 pub end: Option<Box<Expression>>,
13460 #[serde(default)]
13461 pub step: Option<Box<Expression>>,
13462}
13463
13464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13466#[cfg_attr(feature = "bindings", derive(TS))]
13467pub struct JSONPathSelector {
13468 pub this: Box<Expression>,
13469}
13470
13471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13473#[cfg_attr(feature = "bindings", derive(TS))]
13474pub struct JSONPathSubscript {
13475 pub this: Box<Expression>,
13476}
13477
13478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13480#[cfg_attr(feature = "bindings", derive(TS))]
13481pub struct JSONPathUnion {
13482 #[serde(default)]
13483 pub expressions: Vec<Expression>,
13484}
13485
13486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13488#[cfg_attr(feature = "bindings", derive(TS))]
13489pub struct Format {
13490 pub this: Box<Expression>,
13491 #[serde(default)]
13492 pub expressions: Vec<Expression>,
13493}
13494
13495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13497#[cfg_attr(feature = "bindings", derive(TS))]
13498pub struct JSONKeys {
13499 pub this: Box<Expression>,
13500 #[serde(default)]
13501 pub expression: Option<Box<Expression>>,
13502 #[serde(default)]
13503 pub expressions: Vec<Expression>,
13504}
13505
13506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13508#[cfg_attr(feature = "bindings", derive(TS))]
13509pub struct JSONKeyValue {
13510 pub this: Box<Expression>,
13511 pub expression: Box<Expression>,
13512}
13513
13514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13516#[cfg_attr(feature = "bindings", derive(TS))]
13517pub struct JSONKeysAtDepth {
13518 pub this: Box<Expression>,
13519 #[serde(default)]
13520 pub expression: Option<Box<Expression>>,
13521 #[serde(default)]
13522 pub mode: Option<Box<Expression>>,
13523}
13524
13525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13527#[cfg_attr(feature = "bindings", derive(TS))]
13528pub struct JSONObject {
13529 #[serde(default)]
13530 pub expressions: Vec<Expression>,
13531 #[serde(default)]
13532 pub null_handling: Option<Box<Expression>>,
13533 #[serde(default)]
13534 pub unique_keys: Option<Box<Expression>>,
13535 #[serde(default)]
13536 pub return_type: Option<Box<Expression>>,
13537 #[serde(default)]
13538 pub encoding: Option<Box<Expression>>,
13539}
13540
13541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13543#[cfg_attr(feature = "bindings", derive(TS))]
13544pub struct JSONObjectAgg {
13545 #[serde(default)]
13546 pub expressions: Vec<Expression>,
13547 #[serde(default)]
13548 pub null_handling: Option<Box<Expression>>,
13549 #[serde(default)]
13550 pub unique_keys: Option<Box<Expression>>,
13551 #[serde(default)]
13552 pub return_type: Option<Box<Expression>>,
13553 #[serde(default)]
13554 pub encoding: Option<Box<Expression>>,
13555}
13556
13557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13559#[cfg_attr(feature = "bindings", derive(TS))]
13560pub struct JSONBObjectAgg {
13561 pub this: Box<Expression>,
13562 pub expression: Box<Expression>,
13563}
13564
13565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13567#[cfg_attr(feature = "bindings", derive(TS))]
13568pub struct JSONArray {
13569 #[serde(default)]
13570 pub expressions: Vec<Expression>,
13571 #[serde(default)]
13572 pub null_handling: Option<Box<Expression>>,
13573 #[serde(default)]
13574 pub return_type: Option<Box<Expression>>,
13575 #[serde(default)]
13576 pub strict: Option<Box<Expression>>,
13577}
13578
13579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13581#[cfg_attr(feature = "bindings", derive(TS))]
13582pub struct JSONArrayAgg {
13583 pub this: Box<Expression>,
13584 #[serde(default)]
13585 pub order: Option<Box<Expression>>,
13586 #[serde(default)]
13587 pub null_handling: Option<Box<Expression>>,
13588 #[serde(default)]
13589 pub return_type: Option<Box<Expression>>,
13590 #[serde(default)]
13591 pub strict: Option<Box<Expression>>,
13592}
13593
13594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13596#[cfg_attr(feature = "bindings", derive(TS))]
13597pub struct JSONExists {
13598 pub this: Box<Expression>,
13599 #[serde(default)]
13600 pub path: Option<Box<Expression>>,
13601 #[serde(default)]
13602 pub passing: Option<Box<Expression>>,
13603 #[serde(default)]
13604 pub on_condition: Option<Box<Expression>>,
13605 #[serde(default)]
13606 pub from_dcolonqmark: Option<Box<Expression>>,
13607}
13608
13609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13611#[cfg_attr(feature = "bindings", derive(TS))]
13612pub struct JSONColumnDef {
13613 #[serde(default)]
13614 pub this: Option<Box<Expression>>,
13615 #[serde(default)]
13616 pub kind: Option<String>,
13617 #[serde(default)]
13618 pub path: Option<Box<Expression>>,
13619 #[serde(default)]
13620 pub nested_schema: Option<Box<Expression>>,
13621 #[serde(default)]
13622 pub ordinality: Option<Box<Expression>>,
13623}
13624
13625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13627#[cfg_attr(feature = "bindings", derive(TS))]
13628pub struct JSONSchema {
13629 #[serde(default)]
13630 pub expressions: Vec<Expression>,
13631}
13632
13633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13635#[cfg_attr(feature = "bindings", derive(TS))]
13636pub struct JSONSet {
13637 pub this: Box<Expression>,
13638 #[serde(default)]
13639 pub expressions: Vec<Expression>,
13640}
13641
13642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13644#[cfg_attr(feature = "bindings", derive(TS))]
13645pub struct JSONStripNulls {
13646 pub this: Box<Expression>,
13647 #[serde(default)]
13648 pub expression: Option<Box<Expression>>,
13649 #[serde(default)]
13650 pub include_arrays: Option<Box<Expression>>,
13651 #[serde(default)]
13652 pub remove_empty: Option<Box<Expression>>,
13653}
13654
13655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13657#[cfg_attr(feature = "bindings", derive(TS))]
13658pub struct JSONValue {
13659 pub this: Box<Expression>,
13660 #[serde(default)]
13661 pub path: Option<Box<Expression>>,
13662 #[serde(default)]
13663 pub returning: Option<Box<Expression>>,
13664 #[serde(default)]
13665 pub on_condition: Option<Box<Expression>>,
13666}
13667
13668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13670#[cfg_attr(feature = "bindings", derive(TS))]
13671pub struct JSONValueArray {
13672 pub this: Box<Expression>,
13673 #[serde(default)]
13674 pub expression: Option<Box<Expression>>,
13675}
13676
13677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13679#[cfg_attr(feature = "bindings", derive(TS))]
13680pub struct JSONRemove {
13681 pub this: Box<Expression>,
13682 #[serde(default)]
13683 pub expressions: Vec<Expression>,
13684}
13685
13686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13688#[cfg_attr(feature = "bindings", derive(TS))]
13689pub struct JSONTable {
13690 pub this: Box<Expression>,
13691 #[serde(default)]
13692 pub schema: Option<Box<Expression>>,
13693 #[serde(default)]
13694 pub path: Option<Box<Expression>>,
13695 #[serde(default)]
13696 pub error_handling: Option<Box<Expression>>,
13697 #[serde(default)]
13698 pub empty_handling: Option<Box<Expression>>,
13699}
13700
13701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13703#[cfg_attr(feature = "bindings", derive(TS))]
13704pub struct JSONType {
13705 pub this: Box<Expression>,
13706 #[serde(default)]
13707 pub expression: Option<Box<Expression>>,
13708}
13709
13710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13712#[cfg_attr(feature = "bindings", derive(TS))]
13713pub struct ObjectInsert {
13714 pub this: Box<Expression>,
13715 #[serde(default)]
13716 pub key: Option<Box<Expression>>,
13717 #[serde(default)]
13718 pub value: Option<Box<Expression>>,
13719 #[serde(default)]
13720 pub update_flag: Option<Box<Expression>>,
13721}
13722
13723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13725#[cfg_attr(feature = "bindings", derive(TS))]
13726pub struct OpenJSONColumnDef {
13727 pub this: Box<Expression>,
13728 pub kind: String,
13729 #[serde(default)]
13730 pub path: Option<Box<Expression>>,
13731 #[serde(default)]
13732 pub as_json: Option<Box<Expression>>,
13733 #[serde(default, skip_serializing_if = "Option::is_none")]
13735 pub data_type: Option<DataType>,
13736}
13737
13738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13740#[cfg_attr(feature = "bindings", derive(TS))]
13741pub struct OpenJSON {
13742 pub this: Box<Expression>,
13743 #[serde(default)]
13744 pub path: Option<Box<Expression>>,
13745 #[serde(default)]
13746 pub expressions: Vec<Expression>,
13747}
13748
13749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13751#[cfg_attr(feature = "bindings", derive(TS))]
13752pub struct JSONBExists {
13753 pub this: Box<Expression>,
13754 #[serde(default)]
13755 pub path: Option<Box<Expression>>,
13756}
13757
13758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13760#[cfg_attr(feature = "bindings", derive(TS))]
13761pub struct JSONCast {
13762 pub this: Box<Expression>,
13763 pub to: DataType,
13764}
13765
13766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13768#[cfg_attr(feature = "bindings", derive(TS))]
13769pub struct JSONExtract {
13770 pub this: Box<Expression>,
13771 pub expression: Box<Expression>,
13772 #[serde(default)]
13773 pub only_json_types: Option<Box<Expression>>,
13774 #[serde(default)]
13775 pub expressions: Vec<Expression>,
13776 #[serde(default)]
13777 pub variant_extract: Option<Box<Expression>>,
13778 #[serde(default)]
13779 pub json_query: Option<Box<Expression>>,
13780 #[serde(default)]
13781 pub option: Option<Box<Expression>>,
13782 #[serde(default)]
13783 pub quote: Option<Box<Expression>>,
13784 #[serde(default)]
13785 pub on_condition: Option<Box<Expression>>,
13786 #[serde(default)]
13787 pub requires_json: Option<Box<Expression>>,
13788}
13789
13790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13792#[cfg_attr(feature = "bindings", derive(TS))]
13793pub struct JSONExtractQuote {
13794 #[serde(default)]
13795 pub option: Option<Box<Expression>>,
13796 #[serde(default)]
13797 pub scalar: Option<Box<Expression>>,
13798}
13799
13800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13802#[cfg_attr(feature = "bindings", derive(TS))]
13803pub struct JSONExtractArray {
13804 pub this: Box<Expression>,
13805 #[serde(default)]
13806 pub expression: Option<Box<Expression>>,
13807}
13808
13809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13811#[cfg_attr(feature = "bindings", derive(TS))]
13812pub struct JSONExtractScalar {
13813 pub this: Box<Expression>,
13814 pub expression: Box<Expression>,
13815 #[serde(default)]
13816 pub only_json_types: Option<Box<Expression>>,
13817 #[serde(default)]
13818 pub expressions: Vec<Expression>,
13819 #[serde(default)]
13820 pub json_type: Option<Box<Expression>>,
13821 #[serde(default)]
13822 pub scalar_only: Option<Box<Expression>>,
13823}
13824
13825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13827#[cfg_attr(feature = "bindings", derive(TS))]
13828pub struct JSONBExtractScalar {
13829 pub this: Box<Expression>,
13830 pub expression: Box<Expression>,
13831 #[serde(default)]
13832 pub json_type: Option<Box<Expression>>,
13833}
13834
13835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13837#[cfg_attr(feature = "bindings", derive(TS))]
13838pub struct JSONFormat {
13839 #[serde(default)]
13840 pub this: Option<Box<Expression>>,
13841 #[serde(default)]
13842 pub options: Vec<Expression>,
13843 #[serde(default)]
13844 pub is_json: Option<Box<Expression>>,
13845 #[serde(default)]
13846 pub to_json: Option<Box<Expression>>,
13847}
13848
13849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13851#[cfg_attr(feature = "bindings", derive(TS))]
13852pub struct JSONArrayAppend {
13853 pub this: Box<Expression>,
13854 #[serde(default)]
13855 pub expressions: Vec<Expression>,
13856}
13857
13858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13860#[cfg_attr(feature = "bindings", derive(TS))]
13861pub struct JSONArrayContains {
13862 pub this: Box<Expression>,
13863 pub expression: Box<Expression>,
13864 #[serde(default)]
13865 pub json_type: Option<Box<Expression>>,
13866}
13867
13868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13870#[cfg_attr(feature = "bindings", derive(TS))]
13871pub struct JSONArrayInsert {
13872 pub this: Box<Expression>,
13873 #[serde(default)]
13874 pub expressions: Vec<Expression>,
13875}
13876
13877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13879#[cfg_attr(feature = "bindings", derive(TS))]
13880pub struct ParseJSON {
13881 pub this: Box<Expression>,
13882 #[serde(default)]
13883 pub expression: Option<Box<Expression>>,
13884 #[serde(default)]
13885 pub safe: Option<Box<Expression>>,
13886}
13887
13888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13890#[cfg_attr(feature = "bindings", derive(TS))]
13891pub struct ParseUrl {
13892 pub this: Box<Expression>,
13893 #[serde(default)]
13894 pub part_to_extract: Option<Box<Expression>>,
13895 #[serde(default)]
13896 pub key: Option<Box<Expression>>,
13897 #[serde(default)]
13898 pub permissive: Option<Box<Expression>>,
13899}
13900
13901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13903#[cfg_attr(feature = "bindings", derive(TS))]
13904pub struct ParseIp {
13905 pub this: Box<Expression>,
13906 #[serde(default)]
13907 pub type_: Option<Box<Expression>>,
13908 #[serde(default)]
13909 pub permissive: Option<Box<Expression>>,
13910}
13911
13912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13914#[cfg_attr(feature = "bindings", derive(TS))]
13915pub struct ParseTime {
13916 pub this: Box<Expression>,
13917 pub format: String,
13918}
13919
13920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13922#[cfg_attr(feature = "bindings", derive(TS))]
13923pub struct ParseDatetime {
13924 pub this: Box<Expression>,
13925 #[serde(default)]
13926 pub format: Option<String>,
13927 #[serde(default)]
13928 pub zone: Option<Box<Expression>>,
13929}
13930
13931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13933#[cfg_attr(feature = "bindings", derive(TS))]
13934pub struct Map {
13935 #[serde(default)]
13936 pub keys: Vec<Expression>,
13937 #[serde(default)]
13938 pub values: Vec<Expression>,
13939}
13940
13941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13943#[cfg_attr(feature = "bindings", derive(TS))]
13944pub struct MapCat {
13945 pub this: Box<Expression>,
13946 pub expression: Box<Expression>,
13947}
13948
13949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13951#[cfg_attr(feature = "bindings", derive(TS))]
13952pub struct MapDelete {
13953 pub this: Box<Expression>,
13954 #[serde(default)]
13955 pub expressions: Vec<Expression>,
13956}
13957
13958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13960#[cfg_attr(feature = "bindings", derive(TS))]
13961pub struct MapInsert {
13962 pub this: Box<Expression>,
13963 #[serde(default)]
13964 pub key: Option<Box<Expression>>,
13965 #[serde(default)]
13966 pub value: Option<Box<Expression>>,
13967 #[serde(default)]
13968 pub update_flag: Option<Box<Expression>>,
13969}
13970
13971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13973#[cfg_attr(feature = "bindings", derive(TS))]
13974pub struct MapPick {
13975 pub this: Box<Expression>,
13976 #[serde(default)]
13977 pub expressions: Vec<Expression>,
13978}
13979
13980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13982#[cfg_attr(feature = "bindings", derive(TS))]
13983pub struct ScopeResolution {
13984 #[serde(default)]
13985 pub this: Option<Box<Expression>>,
13986 pub expression: Box<Expression>,
13987}
13988
13989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13991#[cfg_attr(feature = "bindings", derive(TS))]
13992pub struct Slice {
13993 #[serde(default)]
13994 pub this: Option<Box<Expression>>,
13995 #[serde(default)]
13996 pub expression: Option<Box<Expression>>,
13997 #[serde(default)]
13998 pub step: Option<Box<Expression>>,
13999}
14000
14001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14003#[cfg_attr(feature = "bindings", derive(TS))]
14004pub struct VarMap {
14005 #[serde(default)]
14006 pub keys: Vec<Expression>,
14007 #[serde(default)]
14008 pub values: Vec<Expression>,
14009}
14010
14011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14013#[cfg_attr(feature = "bindings", derive(TS))]
14014pub struct MatchAgainst {
14015 pub this: Box<Expression>,
14016 #[serde(default)]
14017 pub expressions: Vec<Expression>,
14018 #[serde(default)]
14019 pub modifier: Option<Box<Expression>>,
14020}
14021
14022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14024#[cfg_attr(feature = "bindings", derive(TS))]
14025pub struct MD5Digest {
14026 pub this: Box<Expression>,
14027 #[serde(default)]
14028 pub expressions: Vec<Expression>,
14029}
14030
14031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14033#[cfg_attr(feature = "bindings", derive(TS))]
14034pub struct Monthname {
14035 pub this: Box<Expression>,
14036 #[serde(default)]
14037 pub abbreviated: Option<Box<Expression>>,
14038}
14039
14040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14042#[cfg_attr(feature = "bindings", derive(TS))]
14043pub struct Ntile {
14044 #[serde(default)]
14045 pub this: Option<Box<Expression>>,
14046}
14047
14048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14050#[cfg_attr(feature = "bindings", derive(TS))]
14051pub struct Normalize {
14052 pub this: Box<Expression>,
14053 #[serde(default)]
14054 pub form: Option<Box<Expression>>,
14055 #[serde(default)]
14056 pub is_casefold: Option<Box<Expression>>,
14057}
14058
14059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14061#[cfg_attr(feature = "bindings", derive(TS))]
14062pub struct Normal {
14063 pub this: Box<Expression>,
14064 #[serde(default)]
14065 pub stddev: Option<Box<Expression>>,
14066 #[serde(default)]
14067 pub gen: Option<Box<Expression>>,
14068}
14069
14070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14072#[cfg_attr(feature = "bindings", derive(TS))]
14073pub struct Predict {
14074 pub this: Box<Expression>,
14075 pub expression: Box<Expression>,
14076 #[serde(default)]
14077 pub params_struct: Option<Box<Expression>>,
14078}
14079
14080#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14082#[cfg_attr(feature = "bindings", derive(TS))]
14083pub struct MLTranslate {
14084 pub this: Box<Expression>,
14085 pub expression: Box<Expression>,
14086 #[serde(default)]
14087 pub params_struct: Option<Box<Expression>>,
14088}
14089
14090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14092#[cfg_attr(feature = "bindings", derive(TS))]
14093pub struct FeaturesAtTime {
14094 pub this: Box<Expression>,
14095 #[serde(default)]
14096 pub time: Option<Box<Expression>>,
14097 #[serde(default)]
14098 pub num_rows: Option<Box<Expression>>,
14099 #[serde(default)]
14100 pub ignore_feature_nulls: Option<Box<Expression>>,
14101}
14102
14103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14105#[cfg_attr(feature = "bindings", derive(TS))]
14106pub struct GenerateEmbedding {
14107 pub this: Box<Expression>,
14108 pub expression: Box<Expression>,
14109 #[serde(default)]
14110 pub params_struct: Option<Box<Expression>>,
14111 #[serde(default)]
14112 pub is_text: Option<Box<Expression>>,
14113}
14114
14115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14117#[cfg_attr(feature = "bindings", derive(TS))]
14118pub struct MLForecast {
14119 pub this: Box<Expression>,
14120 #[serde(default)]
14121 pub expression: Option<Box<Expression>>,
14122 #[serde(default)]
14123 pub params_struct: Option<Box<Expression>>,
14124}
14125
14126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14128#[cfg_attr(feature = "bindings", derive(TS))]
14129pub struct ModelAttribute {
14130 pub this: Box<Expression>,
14131 pub expression: Box<Expression>,
14132}
14133
14134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14136#[cfg_attr(feature = "bindings", derive(TS))]
14137pub struct VectorSearch {
14138 pub this: Box<Expression>,
14139 #[serde(default)]
14140 pub column_to_search: Option<Box<Expression>>,
14141 #[serde(default)]
14142 pub query_table: Option<Box<Expression>>,
14143 #[serde(default)]
14144 pub query_column_to_search: Option<Box<Expression>>,
14145 #[serde(default)]
14146 pub top_k: Option<Box<Expression>>,
14147 #[serde(default)]
14148 pub distance_type: Option<Box<Expression>>,
14149 #[serde(default)]
14150 pub options: Vec<Expression>,
14151}
14152
14153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14155#[cfg_attr(feature = "bindings", derive(TS))]
14156pub struct Quantile {
14157 pub this: Box<Expression>,
14158 #[serde(default)]
14159 pub quantile: Option<Box<Expression>>,
14160}
14161
14162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14164#[cfg_attr(feature = "bindings", derive(TS))]
14165pub struct ApproxQuantile {
14166 pub this: Box<Expression>,
14167 #[serde(default)]
14168 pub quantile: Option<Box<Expression>>,
14169 #[serde(default)]
14170 pub accuracy: Option<Box<Expression>>,
14171 #[serde(default)]
14172 pub weight: Option<Box<Expression>>,
14173 #[serde(default)]
14174 pub error_tolerance: Option<Box<Expression>>,
14175}
14176
14177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14179#[cfg_attr(feature = "bindings", derive(TS))]
14180pub struct ApproxPercentileEstimate {
14181 pub this: Box<Expression>,
14182 #[serde(default)]
14183 pub percentile: Option<Box<Expression>>,
14184}
14185
14186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14188#[cfg_attr(feature = "bindings", derive(TS))]
14189pub struct Randn {
14190 #[serde(default)]
14191 pub this: Option<Box<Expression>>,
14192}
14193
14194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14196#[cfg_attr(feature = "bindings", derive(TS))]
14197pub struct Randstr {
14198 pub this: Box<Expression>,
14199 #[serde(default)]
14200 pub generator: Option<Box<Expression>>,
14201}
14202
14203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14205#[cfg_attr(feature = "bindings", derive(TS))]
14206pub struct RangeN {
14207 pub this: Box<Expression>,
14208 #[serde(default)]
14209 pub expressions: Vec<Expression>,
14210 #[serde(default)]
14211 pub each: Option<Box<Expression>>,
14212}
14213
14214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14216#[cfg_attr(feature = "bindings", derive(TS))]
14217pub struct RangeBucket {
14218 pub this: Box<Expression>,
14219 pub expression: Box<Expression>,
14220}
14221
14222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14224#[cfg_attr(feature = "bindings", derive(TS))]
14225pub struct ReadCSV {
14226 pub this: Box<Expression>,
14227 #[serde(default)]
14228 pub expressions: Vec<Expression>,
14229}
14230
14231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14233#[cfg_attr(feature = "bindings", derive(TS))]
14234pub struct ReadParquet {
14235 #[serde(default)]
14236 pub expressions: Vec<Expression>,
14237}
14238
14239#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14241#[cfg_attr(feature = "bindings", derive(TS))]
14242pub struct Reduce {
14243 pub this: Box<Expression>,
14244 #[serde(default)]
14245 pub initial: Option<Box<Expression>>,
14246 #[serde(default)]
14247 pub merge: Option<Box<Expression>>,
14248 #[serde(default)]
14249 pub finish: Option<Box<Expression>>,
14250}
14251
14252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14254#[cfg_attr(feature = "bindings", derive(TS))]
14255pub struct RegexpExtractAll {
14256 pub this: Box<Expression>,
14257 pub expression: Box<Expression>,
14258 #[serde(default)]
14259 pub group: Option<Box<Expression>>,
14260 #[serde(default)]
14261 pub parameters: Option<Box<Expression>>,
14262 #[serde(default)]
14263 pub position: Option<Box<Expression>>,
14264 #[serde(default)]
14265 pub occurrence: Option<Box<Expression>>,
14266}
14267
14268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14270#[cfg_attr(feature = "bindings", derive(TS))]
14271pub struct RegexpILike {
14272 pub this: Box<Expression>,
14273 pub expression: Box<Expression>,
14274 #[serde(default)]
14275 pub flag: Option<Box<Expression>>,
14276}
14277
14278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14280#[cfg_attr(feature = "bindings", derive(TS))]
14281pub struct RegexpFullMatch {
14282 pub this: Box<Expression>,
14283 pub expression: Box<Expression>,
14284 #[serde(default)]
14285 pub options: Vec<Expression>,
14286}
14287
14288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14290#[cfg_attr(feature = "bindings", derive(TS))]
14291pub struct RegexpInstr {
14292 pub this: Box<Expression>,
14293 pub expression: Box<Expression>,
14294 #[serde(default)]
14295 pub position: Option<Box<Expression>>,
14296 #[serde(default)]
14297 pub occurrence: Option<Box<Expression>>,
14298 #[serde(default)]
14299 pub option: Option<Box<Expression>>,
14300 #[serde(default)]
14301 pub parameters: Option<Box<Expression>>,
14302 #[serde(default)]
14303 pub group: Option<Box<Expression>>,
14304}
14305
14306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14308#[cfg_attr(feature = "bindings", derive(TS))]
14309pub struct RegexpSplit {
14310 pub this: Box<Expression>,
14311 pub expression: Box<Expression>,
14312 #[serde(default)]
14313 pub limit: Option<Box<Expression>>,
14314}
14315
14316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14318#[cfg_attr(feature = "bindings", derive(TS))]
14319pub struct RegexpCount {
14320 pub this: Box<Expression>,
14321 pub expression: Box<Expression>,
14322 #[serde(default)]
14323 pub position: Option<Box<Expression>>,
14324 #[serde(default)]
14325 pub parameters: Option<Box<Expression>>,
14326}
14327
14328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14330#[cfg_attr(feature = "bindings", derive(TS))]
14331pub struct RegrValx {
14332 pub this: Box<Expression>,
14333 pub expression: Box<Expression>,
14334}
14335
14336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14338#[cfg_attr(feature = "bindings", derive(TS))]
14339pub struct RegrValy {
14340 pub this: Box<Expression>,
14341 pub expression: Box<Expression>,
14342}
14343
14344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14346#[cfg_attr(feature = "bindings", derive(TS))]
14347pub struct RegrAvgy {
14348 pub this: Box<Expression>,
14349 pub expression: Box<Expression>,
14350}
14351
14352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14354#[cfg_attr(feature = "bindings", derive(TS))]
14355pub struct RegrAvgx {
14356 pub this: Box<Expression>,
14357 pub expression: Box<Expression>,
14358}
14359
14360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14362#[cfg_attr(feature = "bindings", derive(TS))]
14363pub struct RegrCount {
14364 pub this: Box<Expression>,
14365 pub expression: Box<Expression>,
14366}
14367
14368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14370#[cfg_attr(feature = "bindings", derive(TS))]
14371pub struct RegrIntercept {
14372 pub this: Box<Expression>,
14373 pub expression: Box<Expression>,
14374}
14375
14376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14378#[cfg_attr(feature = "bindings", derive(TS))]
14379pub struct RegrR2 {
14380 pub this: Box<Expression>,
14381 pub expression: Box<Expression>,
14382}
14383
14384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14386#[cfg_attr(feature = "bindings", derive(TS))]
14387pub struct RegrSxx {
14388 pub this: Box<Expression>,
14389 pub expression: Box<Expression>,
14390}
14391
14392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14394#[cfg_attr(feature = "bindings", derive(TS))]
14395pub struct RegrSxy {
14396 pub this: Box<Expression>,
14397 pub expression: Box<Expression>,
14398}
14399
14400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14402#[cfg_attr(feature = "bindings", derive(TS))]
14403pub struct RegrSyy {
14404 pub this: Box<Expression>,
14405 pub expression: Box<Expression>,
14406}
14407
14408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14410#[cfg_attr(feature = "bindings", derive(TS))]
14411pub struct RegrSlope {
14412 pub this: Box<Expression>,
14413 pub expression: Box<Expression>,
14414}
14415
14416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14418#[cfg_attr(feature = "bindings", derive(TS))]
14419pub struct SafeAdd {
14420 pub this: Box<Expression>,
14421 pub expression: Box<Expression>,
14422}
14423
14424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14426#[cfg_attr(feature = "bindings", derive(TS))]
14427pub struct SafeDivide {
14428 pub this: Box<Expression>,
14429 pub expression: Box<Expression>,
14430}
14431
14432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14434#[cfg_attr(feature = "bindings", derive(TS))]
14435pub struct SafeMultiply {
14436 pub this: Box<Expression>,
14437 pub expression: Box<Expression>,
14438}
14439
14440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14442#[cfg_attr(feature = "bindings", derive(TS))]
14443pub struct SafeSubtract {
14444 pub this: Box<Expression>,
14445 pub expression: Box<Expression>,
14446}
14447
14448#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14450#[cfg_attr(feature = "bindings", derive(TS))]
14451pub struct SHA2 {
14452 pub this: Box<Expression>,
14453 #[serde(default)]
14454 pub length: Option<i64>,
14455}
14456
14457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14459#[cfg_attr(feature = "bindings", derive(TS))]
14460pub struct SHA2Digest {
14461 pub this: Box<Expression>,
14462 #[serde(default)]
14463 pub length: Option<i64>,
14464}
14465
14466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14468#[cfg_attr(feature = "bindings", derive(TS))]
14469pub struct SortArray {
14470 pub this: Box<Expression>,
14471 #[serde(default)]
14472 pub asc: Option<Box<Expression>>,
14473 #[serde(default)]
14474 pub nulls_first: Option<Box<Expression>>,
14475}
14476
14477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14479#[cfg_attr(feature = "bindings", derive(TS))]
14480pub struct SplitPart {
14481 pub this: Box<Expression>,
14482 #[serde(default)]
14483 pub delimiter: Option<Box<Expression>>,
14484 #[serde(default)]
14485 pub part_index: Option<Box<Expression>>,
14486}
14487
14488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14490#[cfg_attr(feature = "bindings", derive(TS))]
14491pub struct SubstringIndex {
14492 pub this: Box<Expression>,
14493 #[serde(default)]
14494 pub delimiter: Option<Box<Expression>>,
14495 #[serde(default)]
14496 pub count: Option<Box<Expression>>,
14497}
14498
14499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14501#[cfg_attr(feature = "bindings", derive(TS))]
14502pub struct StandardHash {
14503 pub this: Box<Expression>,
14504 #[serde(default)]
14505 pub expression: Option<Box<Expression>>,
14506}
14507
14508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14510#[cfg_attr(feature = "bindings", derive(TS))]
14511pub struct StrPosition {
14512 pub this: Box<Expression>,
14513 #[serde(default)]
14514 pub substr: Option<Box<Expression>>,
14515 #[serde(default)]
14516 pub position: Option<Box<Expression>>,
14517 #[serde(default)]
14518 pub occurrence: Option<Box<Expression>>,
14519}
14520
14521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14523#[cfg_attr(feature = "bindings", derive(TS))]
14524pub struct Search {
14525 pub this: Box<Expression>,
14526 pub expression: Box<Expression>,
14527 #[serde(default)]
14528 pub json_scope: Option<Box<Expression>>,
14529 #[serde(default)]
14530 pub analyzer: Option<Box<Expression>>,
14531 #[serde(default)]
14532 pub analyzer_options: Option<Box<Expression>>,
14533 #[serde(default)]
14534 pub search_mode: Option<Box<Expression>>,
14535}
14536
14537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14539#[cfg_attr(feature = "bindings", derive(TS))]
14540pub struct SearchIp {
14541 pub this: Box<Expression>,
14542 pub expression: Box<Expression>,
14543}
14544
14545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14547#[cfg_attr(feature = "bindings", derive(TS))]
14548pub struct StrToDate {
14549 pub this: Box<Expression>,
14550 #[serde(default)]
14551 pub format: Option<String>,
14552 #[serde(default)]
14553 pub safe: Option<Box<Expression>>,
14554}
14555
14556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14558#[cfg_attr(feature = "bindings", derive(TS))]
14559pub struct StrToTime {
14560 pub this: Box<Expression>,
14561 pub format: String,
14562 #[serde(default)]
14563 pub zone: Option<Box<Expression>>,
14564 #[serde(default)]
14565 pub safe: Option<Box<Expression>>,
14566 #[serde(default)]
14567 pub target_type: Option<Box<Expression>>,
14568}
14569
14570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14572#[cfg_attr(feature = "bindings", derive(TS))]
14573pub struct StrToUnix {
14574 #[serde(default)]
14575 pub this: Option<Box<Expression>>,
14576 #[serde(default)]
14577 pub format: Option<String>,
14578}
14579
14580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14582#[cfg_attr(feature = "bindings", derive(TS))]
14583pub struct StrToMap {
14584 pub this: Box<Expression>,
14585 #[serde(default)]
14586 pub pair_delim: Option<Box<Expression>>,
14587 #[serde(default)]
14588 pub key_value_delim: Option<Box<Expression>>,
14589 #[serde(default)]
14590 pub duplicate_resolution_callback: Option<Box<Expression>>,
14591}
14592
14593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14595#[cfg_attr(feature = "bindings", derive(TS))]
14596pub struct NumberToStr {
14597 pub this: Box<Expression>,
14598 pub format: String,
14599 #[serde(default)]
14600 pub culture: Option<Box<Expression>>,
14601}
14602
14603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14605#[cfg_attr(feature = "bindings", derive(TS))]
14606pub struct FromBase {
14607 pub this: Box<Expression>,
14608 pub expression: Box<Expression>,
14609}
14610
14611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14613#[cfg_attr(feature = "bindings", derive(TS))]
14614pub struct Stuff {
14615 pub this: Box<Expression>,
14616 #[serde(default)]
14617 pub start: Option<Box<Expression>>,
14618 #[serde(default)]
14619 pub length: Option<i64>,
14620 pub expression: Box<Expression>,
14621}
14622
14623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14625#[cfg_attr(feature = "bindings", derive(TS))]
14626pub struct TimeToStr {
14627 pub this: Box<Expression>,
14628 pub format: String,
14629 #[serde(default)]
14630 pub culture: Option<Box<Expression>>,
14631 #[serde(default)]
14632 pub zone: Option<Box<Expression>>,
14633}
14634
14635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14637#[cfg_attr(feature = "bindings", derive(TS))]
14638pub struct TimeStrToTime {
14639 pub this: Box<Expression>,
14640 #[serde(default)]
14641 pub zone: Option<Box<Expression>>,
14642}
14643
14644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14646#[cfg_attr(feature = "bindings", derive(TS))]
14647pub struct TsOrDsAdd {
14648 pub this: Box<Expression>,
14649 pub expression: Box<Expression>,
14650 #[serde(default)]
14651 pub unit: Option<String>,
14652 #[serde(default)]
14653 pub return_type: Option<Box<Expression>>,
14654}
14655
14656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14658#[cfg_attr(feature = "bindings", derive(TS))]
14659pub struct TsOrDsDiff {
14660 pub this: Box<Expression>,
14661 pub expression: Box<Expression>,
14662 #[serde(default)]
14663 pub unit: Option<String>,
14664}
14665
14666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14668#[cfg_attr(feature = "bindings", derive(TS))]
14669pub struct TsOrDsToDate {
14670 pub this: Box<Expression>,
14671 #[serde(default)]
14672 pub format: Option<String>,
14673 #[serde(default)]
14674 pub safe: Option<Box<Expression>>,
14675}
14676
14677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14679#[cfg_attr(feature = "bindings", derive(TS))]
14680pub struct TsOrDsToTime {
14681 pub this: Box<Expression>,
14682 #[serde(default)]
14683 pub format: Option<String>,
14684 #[serde(default)]
14685 pub safe: Option<Box<Expression>>,
14686}
14687
14688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14690#[cfg_attr(feature = "bindings", derive(TS))]
14691pub struct Unhex {
14692 pub this: Box<Expression>,
14693 #[serde(default)]
14694 pub expression: Option<Box<Expression>>,
14695}
14696
14697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14699#[cfg_attr(feature = "bindings", derive(TS))]
14700pub struct Uniform {
14701 pub this: Box<Expression>,
14702 pub expression: Box<Expression>,
14703 #[serde(default)]
14704 pub gen: Option<Box<Expression>>,
14705 #[serde(default)]
14706 pub seed: Option<Box<Expression>>,
14707}
14708
14709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14711#[cfg_attr(feature = "bindings", derive(TS))]
14712pub struct UnixToStr {
14713 pub this: Box<Expression>,
14714 #[serde(default)]
14715 pub format: Option<String>,
14716}
14717
14718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14720#[cfg_attr(feature = "bindings", derive(TS))]
14721pub struct UnixToTime {
14722 pub this: Box<Expression>,
14723 #[serde(default)]
14724 pub scale: Option<i64>,
14725 #[serde(default)]
14726 pub zone: Option<Box<Expression>>,
14727 #[serde(default)]
14728 pub hours: Option<Box<Expression>>,
14729 #[serde(default)]
14730 pub minutes: Option<Box<Expression>>,
14731 #[serde(default)]
14732 pub format: Option<String>,
14733 #[serde(default)]
14734 pub target_type: Option<Box<Expression>>,
14735}
14736
14737#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14739#[cfg_attr(feature = "bindings", derive(TS))]
14740pub struct Uuid {
14741 #[serde(default)]
14742 pub this: Option<Box<Expression>>,
14743 #[serde(default)]
14744 pub name: Option<String>,
14745 #[serde(default)]
14746 pub is_string: Option<Box<Expression>>,
14747}
14748
14749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14751#[cfg_attr(feature = "bindings", derive(TS))]
14752pub struct TimestampFromParts {
14753 #[serde(default)]
14754 pub zone: Option<Box<Expression>>,
14755 #[serde(default)]
14756 pub milli: Option<Box<Expression>>,
14757 #[serde(default)]
14758 pub this: Option<Box<Expression>>,
14759 #[serde(default)]
14760 pub expression: Option<Box<Expression>>,
14761}
14762
14763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14765#[cfg_attr(feature = "bindings", derive(TS))]
14766pub struct TimestampTzFromParts {
14767 #[serde(default)]
14768 pub zone: Option<Box<Expression>>,
14769}
14770
14771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14773#[cfg_attr(feature = "bindings", derive(TS))]
14774pub struct Corr {
14775 pub this: Box<Expression>,
14776 pub expression: Box<Expression>,
14777 #[serde(default)]
14778 pub null_on_zero_variance: Option<Box<Expression>>,
14779}
14780
14781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14783#[cfg_attr(feature = "bindings", derive(TS))]
14784pub struct WidthBucket {
14785 pub this: Box<Expression>,
14786 #[serde(default)]
14787 pub min_value: Option<Box<Expression>>,
14788 #[serde(default)]
14789 pub max_value: Option<Box<Expression>>,
14790 #[serde(default)]
14791 pub num_buckets: Option<Box<Expression>>,
14792 #[serde(default)]
14793 pub threshold: Option<Box<Expression>>,
14794}
14795
14796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14798#[cfg_attr(feature = "bindings", derive(TS))]
14799pub struct CovarSamp {
14800 pub this: Box<Expression>,
14801 pub expression: Box<Expression>,
14802}
14803
14804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14806#[cfg_attr(feature = "bindings", derive(TS))]
14807pub struct CovarPop {
14808 pub this: Box<Expression>,
14809 pub expression: Box<Expression>,
14810}
14811
14812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14814#[cfg_attr(feature = "bindings", derive(TS))]
14815pub struct Week {
14816 pub this: Box<Expression>,
14817 #[serde(default)]
14818 pub mode: Option<Box<Expression>>,
14819}
14820
14821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14823#[cfg_attr(feature = "bindings", derive(TS))]
14824pub struct XMLElement {
14825 pub this: Box<Expression>,
14826 #[serde(default)]
14827 pub expressions: Vec<Expression>,
14828 #[serde(default)]
14829 pub evalname: Option<Box<Expression>>,
14830}
14831
14832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14834#[cfg_attr(feature = "bindings", derive(TS))]
14835pub struct XMLGet {
14836 pub this: Box<Expression>,
14837 pub expression: Box<Expression>,
14838 #[serde(default)]
14839 pub instance: Option<Box<Expression>>,
14840}
14841
14842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14844#[cfg_attr(feature = "bindings", derive(TS))]
14845pub struct XMLTable {
14846 pub this: Box<Expression>,
14847 #[serde(default)]
14848 pub namespaces: Option<Box<Expression>>,
14849 #[serde(default)]
14850 pub passing: Option<Box<Expression>>,
14851 #[serde(default)]
14852 pub columns: Vec<Expression>,
14853 #[serde(default)]
14854 pub by_ref: Option<Box<Expression>>,
14855}
14856
14857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14859#[cfg_attr(feature = "bindings", derive(TS))]
14860pub struct XMLKeyValueOption {
14861 pub this: Box<Expression>,
14862 #[serde(default)]
14863 pub expression: Option<Box<Expression>>,
14864}
14865
14866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14868#[cfg_attr(feature = "bindings", derive(TS))]
14869pub struct Zipf {
14870 pub this: Box<Expression>,
14871 #[serde(default)]
14872 pub elementcount: Option<Box<Expression>>,
14873 #[serde(default)]
14874 pub gen: Option<Box<Expression>>,
14875}
14876
14877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14879#[cfg_attr(feature = "bindings", derive(TS))]
14880pub struct Merge {
14881 pub this: Box<Expression>,
14882 pub using: Box<Expression>,
14883 #[serde(default)]
14884 pub on: Option<Box<Expression>>,
14885 #[serde(default)]
14886 pub using_cond: Option<Box<Expression>>,
14887 #[serde(default)]
14888 pub whens: Option<Box<Expression>>,
14889 #[serde(default)]
14890 pub with_: Option<Box<Expression>>,
14891 #[serde(default)]
14892 pub returning: Option<Box<Expression>>,
14893}
14894
14895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14897#[cfg_attr(feature = "bindings", derive(TS))]
14898pub struct When {
14899 #[serde(default)]
14900 pub matched: Option<Box<Expression>>,
14901 #[serde(default)]
14902 pub source: Option<Box<Expression>>,
14903 #[serde(default)]
14904 pub condition: Option<Box<Expression>>,
14905 pub then: Box<Expression>,
14906}
14907
14908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14910#[cfg_attr(feature = "bindings", derive(TS))]
14911pub struct Whens {
14912 #[serde(default)]
14913 pub expressions: Vec<Expression>,
14914}
14915
14916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14918#[cfg_attr(feature = "bindings", derive(TS))]
14919pub struct NextValueFor {
14920 pub this: Box<Expression>,
14921 #[serde(default)]
14922 pub order: Option<Box<Expression>>,
14923}
14924
14925#[cfg(test)]
14926mod tests {
14927 use super::*;
14928
14929 #[test]
14930 #[cfg(feature = "bindings")]
14931 fn export_typescript_types() {
14932 Expression::export_all(&ts_rs::Config::default())
14935 .expect("Failed to export Expression types");
14936 }
14937
14938 #[test]
14939 fn test_simple_select_builder() {
14940 let select = Select::new()
14941 .column(Expression::star())
14942 .from(Expression::Table(Box::new(TableRef::new("users"))));
14943
14944 assert_eq!(select.expressions.len(), 1);
14945 assert!(select.from.is_some());
14946 }
14947
14948 #[test]
14949 fn test_expression_alias() {
14950 let expr = Expression::column("id").alias("user_id");
14951
14952 match expr {
14953 Expression::Alias(a) => {
14954 assert_eq!(a.alias.name, "user_id");
14955 }
14956 _ => panic!("Expected Alias"),
14957 }
14958 }
14959
14960 #[test]
14961 fn test_literal_creation() {
14962 let num = Expression::number(42);
14963 let str = Expression::string("hello");
14964
14965 match num {
14966 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14967 let Literal::Number(n) = lit.as_ref() else {
14968 unreachable!()
14969 };
14970 assert_eq!(n, "42")
14971 }
14972 _ => panic!("Expected Number"),
14973 }
14974
14975 match str {
14976 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
14977 let Literal::String(s) = lit.as_ref() else {
14978 unreachable!()
14979 };
14980 assert_eq!(s, "hello")
14981 }
14982 _ => panic!("Expected String"),
14983 }
14984 }
14985
14986 #[test]
14987 fn test_expression_sql() {
14988 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14989 assert_eq!(expr.sql(), "SELECT 1 + 2");
14990 }
14991
14992 #[test]
14993 fn test_expression_sql_for() {
14994 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14995 let sql = expr.sql_for(crate::DialectType::Generic);
14996 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
14998 }
14999}