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 TryCatch(Box<TryCatch>),
118
119 Alias(Box<Alias>),
121 Cast(Box<Cast>),
122 Collation(Box<CollationExpr>),
123 Case(Box<Case>),
124
125 And(Box<BinaryOp>),
127 Or(Box<BinaryOp>),
128 Add(Box<BinaryOp>),
129 Sub(Box<BinaryOp>),
130 Mul(Box<BinaryOp>),
131 Div(Box<BinaryOp>),
132 Mod(Box<BinaryOp>),
133 Eq(Box<BinaryOp>),
134 Neq(Box<BinaryOp>),
135 Lt(Box<BinaryOp>),
136 Lte(Box<BinaryOp>),
137 Gt(Box<BinaryOp>),
138 Gte(Box<BinaryOp>),
139 Like(Box<LikeOp>),
140 ILike(Box<LikeOp>),
141 Match(Box<BinaryOp>),
143 BitwiseAnd(Box<BinaryOp>),
144 BitwiseOr(Box<BinaryOp>),
145 BitwiseXor(Box<BinaryOp>),
146 Concat(Box<BinaryOp>),
147 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>),
163 Neg(Box<UnaryOp>),
164 BitwiseNot(Box<UnaryOp>),
165
166 In(Box<In>),
168 Between(Box<Between>),
169 IsNull(Box<IsNull>),
170 IsTrue(Box<IsTrueFalse>),
171 IsFalse(Box<IsTrueFalse>),
172 IsJson(Box<IsJson>),
173 Is(Box<BinaryOp>), Exists(Box<Exists>),
175 MemberOf(Box<BinaryOp>),
177
178 Function(Box<Function>),
180 AggregateFunction(Box<AggregateFunction>),
181 WindowFunction(Box<WindowFunction>),
182
183 From(Box<From>),
185 Join(Box<Join>),
186 JoinedTable(Box<JoinedTable>),
187 Where(Box<Where>),
188 GroupBy(Box<GroupBy>),
189 Having(Box<Having>),
190 OrderBy(Box<OrderBy>),
191 Limit(Box<Limit>),
192 Offset(Box<Offset>),
193 Qualify(Box<Qualify>),
194 With(Box<With>),
195 Cte(Box<Cte>),
196 DistributeBy(Box<DistributeBy>),
197 ClusterBy(Box<ClusterBy>),
198 SortBy(Box<SortBy>),
199 LateralView(Box<LateralView>),
200 Hint(Box<Hint>),
201 Pseudocolumn(Pseudocolumn),
202
203 Connect(Box<Connect>),
205 Prior(Box<Prior>),
206 ConnectByRoot(Box<ConnectByRoot>),
207
208 MatchRecognize(Box<MatchRecognize>),
210
211 Ordered(Box<Ordered>),
213
214 Window(Box<WindowSpec>),
216 Over(Box<Over>),
217 WithinGroup(Box<WithinGroup>),
218
219 DataType(DataType),
221
222 Array(Box<Array>),
224 Struct(Box<Struct>),
225 Tuple(Box<Tuple>),
226
227 Interval(Box<Interval>),
229
230 ConcatWs(Box<ConcatWs>),
232 Substring(Box<SubstringFunc>),
233 Upper(Box<UnaryFunc>),
234 Lower(Box<UnaryFunc>),
235 Length(Box<UnaryFunc>),
236 Trim(Box<TrimFunc>),
237 LTrim(Box<UnaryFunc>),
238 RTrim(Box<UnaryFunc>),
239 Replace(Box<ReplaceFunc>),
240 Reverse(Box<UnaryFunc>),
241 Left(Box<LeftRightFunc>),
242 Right(Box<LeftRightFunc>),
243 Repeat(Box<RepeatFunc>),
244 Lpad(Box<PadFunc>),
245 Rpad(Box<PadFunc>),
246 Split(Box<SplitFunc>),
247 RegexpLike(Box<RegexpFunc>),
248 RegexpReplace(Box<RegexpReplaceFunc>),
249 RegexpExtract(Box<RegexpExtractFunc>),
250 Overlay(Box<OverlayFunc>),
251
252 Abs(Box<UnaryFunc>),
254 Round(Box<RoundFunc>),
255 Floor(Box<FloorFunc>),
256 Ceil(Box<CeilFunc>),
257 Power(Box<BinaryFunc>),
258 Sqrt(Box<UnaryFunc>),
259 Cbrt(Box<UnaryFunc>),
260 Ln(Box<UnaryFunc>),
261 Log(Box<LogFunc>),
262 Exp(Box<UnaryFunc>),
263 Sign(Box<UnaryFunc>),
264 Greatest(Box<VarArgFunc>),
265 Least(Box<VarArgFunc>),
266
267 CurrentDate(CurrentDate),
269 CurrentTime(CurrentTime),
270 CurrentTimestamp(CurrentTimestamp),
271 CurrentTimestampLTZ(CurrentTimestampLTZ),
272 AtTimeZone(Box<AtTimeZone>),
273 DateAdd(Box<DateAddFunc>),
274 DateSub(Box<DateAddFunc>),
275 DateDiff(Box<DateDiffFunc>),
276 DateTrunc(Box<DateTruncFunc>),
277 Extract(Box<ExtractFunc>),
278 ToDate(Box<ToDateFunc>),
279 ToTimestamp(Box<ToTimestampFunc>),
280 Date(Box<UnaryFunc>),
281 Time(Box<UnaryFunc>),
282 DateFromUnixDate(Box<UnaryFunc>),
283 UnixDate(Box<UnaryFunc>),
284 UnixSeconds(Box<UnaryFunc>),
285 UnixMillis(Box<UnaryFunc>),
286 UnixMicros(Box<UnaryFunc>),
287 UnixToTimeStr(Box<BinaryFunc>),
288 TimeStrToDate(Box<UnaryFunc>),
289 DateToDi(Box<UnaryFunc>),
290 DiToDate(Box<UnaryFunc>),
291 TsOrDiToDi(Box<UnaryFunc>),
292 TsOrDsToDatetime(Box<UnaryFunc>),
293 TsOrDsToTimestamp(Box<UnaryFunc>),
294 YearOfWeek(Box<UnaryFunc>),
295 YearOfWeekIso(Box<UnaryFunc>),
296
297 Coalesce(Box<VarArgFunc>),
299 NullIf(Box<BinaryFunc>),
300 IfFunc(Box<IfFunc>),
301 IfNull(Box<BinaryFunc>),
302 Nvl(Box<BinaryFunc>),
303 Nvl2(Box<Nvl2Func>),
304
305 TryCast(Box<Cast>),
307 SafeCast(Box<Cast>),
308
309 Count(Box<CountFunc>),
311 Sum(Box<AggFunc>),
312 Avg(Box<AggFunc>),
313 Min(Box<AggFunc>),
314 Max(Box<AggFunc>),
315 GroupConcat(Box<GroupConcatFunc>),
316 StringAgg(Box<StringAggFunc>),
317 ListAgg(Box<ListAggFunc>),
318 ArrayAgg(Box<AggFunc>),
319 CountIf(Box<AggFunc>),
320 SumIf(Box<SumIfFunc>),
321 Stddev(Box<AggFunc>),
322 StddevPop(Box<AggFunc>),
323 StddevSamp(Box<AggFunc>),
324 Variance(Box<AggFunc>),
325 VarPop(Box<AggFunc>),
326 VarSamp(Box<AggFunc>),
327 Median(Box<AggFunc>),
328 Mode(Box<AggFunc>),
329 First(Box<AggFunc>),
330 Last(Box<AggFunc>),
331 AnyValue(Box<AggFunc>),
332 ApproxDistinct(Box<AggFunc>),
333 ApproxCountDistinct(Box<AggFunc>),
334 ApproxPercentile(Box<ApproxPercentileFunc>),
335 Percentile(Box<PercentileFunc>),
336 LogicalAnd(Box<AggFunc>),
337 LogicalOr(Box<AggFunc>),
338 Skewness(Box<AggFunc>),
339 BitwiseCount(Box<UnaryFunc>),
340 ArrayConcatAgg(Box<AggFunc>),
341 ArrayUniqueAgg(Box<AggFunc>),
342 BoolXorAgg(Box<AggFunc>),
343
344 RowNumber(RowNumber),
346 Rank(Rank),
347 DenseRank(DenseRank),
348 NTile(Box<NTileFunc>),
349 Lead(Box<LeadLagFunc>),
350 Lag(Box<LeadLagFunc>),
351 FirstValue(Box<ValueFunc>),
352 LastValue(Box<ValueFunc>),
353 NthValue(Box<NthValueFunc>),
354 PercentRank(PercentRank),
355 CumeDist(CumeDist),
356 PercentileCont(Box<PercentileFunc>),
357 PercentileDisc(Box<PercentileFunc>),
358
359 Contains(Box<BinaryFunc>),
361 StartsWith(Box<BinaryFunc>),
362 EndsWith(Box<BinaryFunc>),
363 Position(Box<PositionFunc>),
364 Initcap(Box<UnaryFunc>),
365 Ascii(Box<UnaryFunc>),
366 Chr(Box<UnaryFunc>),
367 CharFunc(Box<CharFunc>),
369 Soundex(Box<UnaryFunc>),
370 Levenshtein(Box<BinaryFunc>),
371 ByteLength(Box<UnaryFunc>),
372 Hex(Box<UnaryFunc>),
373 LowerHex(Box<UnaryFunc>),
374 Unicode(Box<UnaryFunc>),
375
376 ModFunc(Box<BinaryFunc>),
378 Random(Random),
379 Rand(Box<Rand>),
380 TruncFunc(Box<TruncateFunc>),
381 Pi(Pi),
382 Radians(Box<UnaryFunc>),
383 Degrees(Box<UnaryFunc>),
384 Sin(Box<UnaryFunc>),
385 Cos(Box<UnaryFunc>),
386 Tan(Box<UnaryFunc>),
387 Asin(Box<UnaryFunc>),
388 Acos(Box<UnaryFunc>),
389 Atan(Box<UnaryFunc>),
390 Atan2(Box<BinaryFunc>),
391 IsNan(Box<UnaryFunc>),
392 IsInf(Box<UnaryFunc>),
393 IntDiv(Box<BinaryFunc>),
394
395 Decode(Box<DecodeFunc>),
397
398 DateFormat(Box<DateFormatFunc>),
400 FormatDate(Box<DateFormatFunc>),
401 Year(Box<UnaryFunc>),
402 Month(Box<UnaryFunc>),
403 Day(Box<UnaryFunc>),
404 Hour(Box<UnaryFunc>),
405 Minute(Box<UnaryFunc>),
406 Second(Box<UnaryFunc>),
407 DayOfWeek(Box<UnaryFunc>),
408 DayOfWeekIso(Box<UnaryFunc>),
409 DayOfMonth(Box<UnaryFunc>),
410 DayOfYear(Box<UnaryFunc>),
411 WeekOfYear(Box<UnaryFunc>),
412 Quarter(Box<UnaryFunc>),
413 AddMonths(Box<BinaryFunc>),
414 MonthsBetween(Box<BinaryFunc>),
415 LastDay(Box<LastDayFunc>),
416 NextDay(Box<BinaryFunc>),
417 Epoch(Box<UnaryFunc>),
418 EpochMs(Box<UnaryFunc>),
419 FromUnixtime(Box<FromUnixtimeFunc>),
420 UnixTimestamp(Box<UnixTimestampFunc>),
421 MakeDate(Box<MakeDateFunc>),
422 MakeTimestamp(Box<MakeTimestampFunc>),
423 TimestampTrunc(Box<DateTruncFunc>),
424 TimeStrToUnix(Box<UnaryFunc>),
425
426 SessionUser(SessionUser),
428
429 SHA(Box<UnaryFunc>),
431 SHA1Digest(Box<UnaryFunc>),
432
433 TimeToUnix(Box<UnaryFunc>),
435
436 ArrayFunc(Box<ArrayConstructor>),
438 ArrayLength(Box<UnaryFunc>),
439 ArraySize(Box<UnaryFunc>),
440 Cardinality(Box<UnaryFunc>),
441 ArrayContains(Box<BinaryFunc>),
442 ArrayPosition(Box<BinaryFunc>),
443 ArrayAppend(Box<BinaryFunc>),
444 ArrayPrepend(Box<BinaryFunc>),
445 ArrayConcat(Box<VarArgFunc>),
446 ArraySort(Box<ArraySortFunc>),
447 ArrayReverse(Box<UnaryFunc>),
448 ArrayDistinct(Box<UnaryFunc>),
449 ArrayJoin(Box<ArrayJoinFunc>),
450 ArrayToString(Box<ArrayJoinFunc>),
451 Unnest(Box<UnnestFunc>),
452 Explode(Box<UnaryFunc>),
453 ExplodeOuter(Box<UnaryFunc>),
454 ArrayFilter(Box<ArrayFilterFunc>),
455 ArrayTransform(Box<ArrayTransformFunc>),
456 ArrayFlatten(Box<UnaryFunc>),
457 ArrayCompact(Box<UnaryFunc>),
458 ArrayIntersect(Box<VarArgFunc>),
459 ArrayUnion(Box<BinaryFunc>),
460 ArrayExcept(Box<BinaryFunc>),
461 ArrayRemove(Box<BinaryFunc>),
462 ArrayZip(Box<VarArgFunc>),
463 Sequence(Box<SequenceFunc>),
464 Generate(Box<SequenceFunc>),
465 ExplodingGenerateSeries(Box<SequenceFunc>),
466 ToArray(Box<UnaryFunc>),
467 StarMap(Box<BinaryFunc>),
468
469 StructFunc(Box<StructConstructor>),
471 StructExtract(Box<StructExtractFunc>),
472 NamedStruct(Box<NamedStructFunc>),
473
474 MapFunc(Box<MapConstructor>),
476 MapFromEntries(Box<UnaryFunc>),
477 MapFromArrays(Box<BinaryFunc>),
478 MapKeys(Box<UnaryFunc>),
479 MapValues(Box<UnaryFunc>),
480 MapContainsKey(Box<BinaryFunc>),
481 MapConcat(Box<VarArgFunc>),
482 ElementAt(Box<BinaryFunc>),
483 TransformKeys(Box<TransformFunc>),
484 TransformValues(Box<TransformFunc>),
485
486 FunctionEmits(Box<FunctionEmits>),
488
489 JsonExtract(Box<JsonExtractFunc>),
491 JsonExtractScalar(Box<JsonExtractFunc>),
492 JsonExtractPath(Box<JsonPathFunc>),
493 JsonArray(Box<VarArgFunc>),
494 JsonObject(Box<JsonObjectFunc>),
495 JsonQuery(Box<JsonExtractFunc>),
496 JsonValue(Box<JsonExtractFunc>),
497 JsonArrayLength(Box<UnaryFunc>),
498 JsonKeys(Box<UnaryFunc>),
499 JsonType(Box<UnaryFunc>),
500 ParseJson(Box<UnaryFunc>),
501 ToJson(Box<UnaryFunc>),
502 JsonSet(Box<JsonModifyFunc>),
503 JsonInsert(Box<JsonModifyFunc>),
504 JsonRemove(Box<JsonPathFunc>),
505 JsonMergePatch(Box<BinaryFunc>),
506 JsonArrayAgg(Box<JsonArrayAggFunc>),
507 JsonObjectAgg(Box<JsonObjectAggFunc>),
508
509 Convert(Box<ConvertFunc>),
511 Typeof(Box<UnaryFunc>),
512
513 Lambda(Box<LambdaExpr>),
515 Parameter(Box<Parameter>),
516 Placeholder(Placeholder),
517 NamedArgument(Box<NamedArgument>),
518 TableArgument(Box<TableArgument>),
521 SqlComment(Box<SqlComment>),
522
523 NullSafeEq(Box<BinaryOp>),
525 NullSafeNeq(Box<BinaryOp>),
526 Glob(Box<BinaryOp>),
527 SimilarTo(Box<SimilarToExpr>),
528 Any(Box<QuantifiedExpr>),
529 All(Box<QuantifiedExpr>),
530 Overlaps(Box<OverlapsExpr>),
531
532 BitwiseLeftShift(Box<BinaryOp>),
534 BitwiseRightShift(Box<BinaryOp>),
535 BitwiseAndAgg(Box<AggFunc>),
536 BitwiseOrAgg(Box<AggFunc>),
537 BitwiseXorAgg(Box<AggFunc>),
538
539 Subscript(Box<Subscript>),
541 Dot(Box<DotAccess>),
542 MethodCall(Box<MethodCall>),
543 ArraySlice(Box<ArraySlice>),
544
545 CreateTable(Box<CreateTable>),
547 DropTable(Box<DropTable>),
548 Undrop(Box<Undrop>),
549 AlterTable(Box<AlterTable>),
550 CreateIndex(Box<CreateIndex>),
551 DropIndex(Box<DropIndex>),
552 CreateView(Box<CreateView>),
553 DropView(Box<DropView>),
554 AlterView(Box<AlterView>),
555 AlterIndex(Box<AlterIndex>),
556 Truncate(Box<Truncate>),
557 Use(Box<Use>),
558 Cache(Box<Cache>),
559 Uncache(Box<Uncache>),
560 LoadData(Box<LoadData>),
561 Pragma(Box<Pragma>),
562 Grant(Box<Grant>),
563 Revoke(Box<Revoke>),
564 Comment(Box<Comment>),
565 SetStatement(Box<SetStatement>),
566 CreateSchema(Box<CreateSchema>),
568 DropSchema(Box<DropSchema>),
569 DropNamespace(Box<DropNamespace>),
570 CreateDatabase(Box<CreateDatabase>),
571 DropDatabase(Box<DropDatabase>),
572 CreateFunction(Box<CreateFunction>),
573 DropFunction(Box<DropFunction>),
574 CreateProcedure(Box<CreateProcedure>),
575 DropProcedure(Box<DropProcedure>),
576 CreateSequence(Box<CreateSequence>),
577 CreateSynonym(Box<CreateSynonym>),
578 DropSequence(Box<DropSequence>),
579 AlterSequence(Box<AlterSequence>),
580 CreateTrigger(Box<CreateTrigger>),
581 DropTrigger(Box<DropTrigger>),
582 CreateType(Box<CreateType>),
583 DropType(Box<DropType>),
584 Describe(Box<Describe>),
585 Show(Box<Show>),
586
587 Command(Box<Command>),
589 Kill(Box<Kill>),
590 Prepare(Box<PrepareStatement>),
592 Execute(Box<ExecuteStatement>),
594
595 CreateTask(Box<CreateTask>),
597
598 Raw(Raw),
600
601 Paren(Box<Paren>),
603
604 Annotated(Box<Annotated>),
606
607 Refresh(Box<Refresh>),
610 LockingStatement(Box<LockingStatement>),
611 SequenceProperties(Box<SequenceProperties>),
612 TruncateTable(Box<TruncateTable>),
613 Clone(Box<Clone>),
614 Attach(Box<Attach>),
615 Detach(Box<Detach>),
616 Install(Box<Install>),
617 Summarize(Box<Summarize>),
618 Declare(Box<Declare>),
619 DeclareItem(Box<DeclareItem>),
620 Set(Box<Set>),
621 Heredoc(Box<Heredoc>),
622 SetItem(Box<SetItem>),
623 QueryBand(Box<QueryBand>),
624 UserDefinedFunction(Box<UserDefinedFunction>),
625 RecursiveWithSearch(Box<RecursiveWithSearch>),
626 ProjectionDef(Box<ProjectionDef>),
627 TableAlias(Box<TableAlias>),
628 ByteString(Box<ByteString>),
629 HexStringExpr(Box<HexStringExpr>),
630 UnicodeString(Box<UnicodeString>),
631 ColumnPosition(Box<ColumnPosition>),
632 ColumnDef(Box<ColumnDef>),
633 AlterColumn(Box<AlterColumn>),
634 AlterSortKey(Box<AlterSortKey>),
635 AlterSet(Box<AlterSet>),
636 RenameColumn(Box<RenameColumn>),
637 Comprehension(Box<Comprehension>),
638 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
639 MergeTreeTTL(Box<MergeTreeTTL>),
640 IndexConstraintOption(Box<IndexConstraintOption>),
641 ColumnConstraint(Box<ColumnConstraint>),
642 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
643 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
644 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
645 CheckColumnConstraint(Box<CheckColumnConstraint>),
646 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
647 CompressColumnConstraint(Box<CompressColumnConstraint>),
648 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
649 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
650 WithOperator(Box<WithOperator>),
651 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
652 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
653 CommentColumnConstraint(CommentColumnConstraint),
654 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
655 IndexColumnConstraint(Box<IndexColumnConstraint>),
656 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
657 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
658 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
659 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
660 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
661 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
662 InOutColumnConstraint(Box<InOutColumnConstraint>),
663 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
664 PathColumnConstraint(Box<PathColumnConstraint>),
665 Constraint(Box<Constraint>),
666 Export(Box<Export>),
667 Filter(Box<Filter>),
668 Changes(Box<Changes>),
669 CopyParameter(Box<CopyParameter>),
670 Credentials(Box<Credentials>),
671 Directory(Box<Directory>),
672 ForeignKey(Box<ForeignKey>),
673 ColumnPrefix(Box<ColumnPrefix>),
674 PrimaryKey(Box<PrimaryKey>),
675 IntoClause(Box<IntoClause>),
676 JoinHint(Box<JoinHint>),
677 Opclass(Box<Opclass>),
678 Index(Box<Index>),
679 IndexParameters(Box<IndexParameters>),
680 ConditionalInsert(Box<ConditionalInsert>),
681 MultitableInserts(Box<MultitableInserts>),
682 OnConflict(Box<OnConflict>),
683 OnCondition(Box<OnCondition>),
684 Returning(Box<Returning>),
685 Introducer(Box<Introducer>),
686 PartitionRange(Box<PartitionRange>),
687 Fetch(Box<Fetch>),
688 Group(Box<Group>),
689 Cube(Box<Cube>),
690 Rollup(Box<Rollup>),
691 GroupingSets(Box<GroupingSets>),
692 LimitOptions(Box<LimitOptions>),
693 Lateral(Box<Lateral>),
694 TableFromRows(Box<TableFromRows>),
695 RowsFrom(Box<RowsFrom>),
696 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
697 WithFill(Box<WithFill>),
698 Property(Box<Property>),
699 GrantPrivilege(Box<GrantPrivilege>),
700 GrantPrincipal(Box<GrantPrincipal>),
701 AllowedValuesProperty(Box<AllowedValuesProperty>),
702 AlgorithmProperty(Box<AlgorithmProperty>),
703 AutoIncrementProperty(Box<AutoIncrementProperty>),
704 AutoRefreshProperty(Box<AutoRefreshProperty>),
705 BackupProperty(Box<BackupProperty>),
706 BuildProperty(Box<BuildProperty>),
707 BlockCompressionProperty(Box<BlockCompressionProperty>),
708 CharacterSetProperty(Box<CharacterSetProperty>),
709 ChecksumProperty(Box<ChecksumProperty>),
710 CollateProperty(Box<CollateProperty>),
711 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
712 DataDeletionProperty(Box<DataDeletionProperty>),
713 DefinerProperty(Box<DefinerProperty>),
714 DistKeyProperty(Box<DistKeyProperty>),
715 DistributedByProperty(Box<DistributedByProperty>),
716 DistStyleProperty(Box<DistStyleProperty>),
717 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
718 EngineProperty(Box<EngineProperty>),
719 ToTableProperty(Box<ToTableProperty>),
720 ExecuteAsProperty(Box<ExecuteAsProperty>),
721 ExternalProperty(Box<ExternalProperty>),
722 FallbackProperty(Box<FallbackProperty>),
723 FileFormatProperty(Box<FileFormatProperty>),
724 CredentialsProperty(Box<CredentialsProperty>),
725 FreespaceProperty(Box<FreespaceProperty>),
726 InheritsProperty(Box<InheritsProperty>),
727 InputModelProperty(Box<InputModelProperty>),
728 OutputModelProperty(Box<OutputModelProperty>),
729 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
730 JournalProperty(Box<JournalProperty>),
731 LanguageProperty(Box<LanguageProperty>),
732 EnviromentProperty(Box<EnviromentProperty>),
733 ClusteredByProperty(Box<ClusteredByProperty>),
734 DictProperty(Box<DictProperty>),
735 DictRange(Box<DictRange>),
736 OnCluster(Box<OnCluster>),
737 LikeProperty(Box<LikeProperty>),
738 LocationProperty(Box<LocationProperty>),
739 LockProperty(Box<LockProperty>),
740 LockingProperty(Box<LockingProperty>),
741 LogProperty(Box<LogProperty>),
742 MaterializedProperty(Box<MaterializedProperty>),
743 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
744 OnProperty(Box<OnProperty>),
745 OnCommitProperty(Box<OnCommitProperty>),
746 PartitionedByProperty(Box<PartitionedByProperty>),
747 PartitionByProperty(Box<PartitionByProperty>),
748 PartitionedByBucket(Box<PartitionedByBucket>),
749 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
750 PartitionByTruncate(Box<PartitionByTruncate>),
751 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
752 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
753 PartitionByListProperty(Box<PartitionByListProperty>),
754 PartitionList(Box<PartitionList>),
755 Partition(Box<Partition>),
756 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
757 UniqueKeyProperty(Box<UniqueKeyProperty>),
758 RollupProperty(Box<RollupProperty>),
759 PartitionBoundSpec(Box<PartitionBoundSpec>),
760 PartitionedOfProperty(Box<PartitionedOfProperty>),
761 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
762 ReturnsProperty(Box<ReturnsProperty>),
763 RowFormatProperty(Box<RowFormatProperty>),
764 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
765 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
766 QueryTransform(Box<QueryTransform>),
767 SampleProperty(Box<SampleProperty>),
768 SecurityProperty(Box<SecurityProperty>),
769 SchemaCommentProperty(Box<SchemaCommentProperty>),
770 SemanticView(Box<SemanticView>),
771 SerdeProperties(Box<SerdeProperties>),
772 SetProperty(Box<SetProperty>),
773 SharingProperty(Box<SharingProperty>),
774 SetConfigProperty(Box<SetConfigProperty>),
775 SettingsProperty(Box<SettingsProperty>),
776 SortKeyProperty(Box<SortKeyProperty>),
777 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
778 SqlSecurityProperty(Box<SqlSecurityProperty>),
779 StabilityProperty(Box<StabilityProperty>),
780 StorageHandlerProperty(Box<StorageHandlerProperty>),
781 TemporaryProperty(Box<TemporaryProperty>),
782 Tags(Box<Tags>),
783 TransformModelProperty(Box<TransformModelProperty>),
784 TransientProperty(Box<TransientProperty>),
785 UsingTemplateProperty(Box<UsingTemplateProperty>),
786 ViewAttributeProperty(Box<ViewAttributeProperty>),
787 VolatileProperty(Box<VolatileProperty>),
788 WithDataProperty(Box<WithDataProperty>),
789 WithJournalTableProperty(Box<WithJournalTableProperty>),
790 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
791 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
792 WithProcedureOptions(Box<WithProcedureOptions>),
793 EncodeProperty(Box<EncodeProperty>),
794 IncludeProperty(Box<IncludeProperty>),
795 Properties(Box<Properties>),
796 OptionsProperty(Box<OptionsProperty>),
797 InputOutputFormat(Box<InputOutputFormat>),
798 Reference(Box<Reference>),
799 QueryOption(Box<QueryOption>),
800 WithTableHint(Box<WithTableHint>),
801 IndexTableHint(Box<IndexTableHint>),
802 HistoricalData(Box<HistoricalData>),
803 Get(Box<Get>),
804 SetOperation(Box<SetOperation>),
805 Var(Box<Var>),
806 Variadic(Box<Variadic>),
807 Version(Box<Version>),
808 Schema(Box<Schema>),
809 Lock(Box<Lock>),
810 TableSample(Box<TableSample>),
811 Tag(Box<Tag>),
812 UnpivotColumns(Box<UnpivotColumns>),
813 WindowSpec(Box<WindowSpec>),
814 SessionParameter(Box<SessionParameter>),
815 PseudoType(Box<PseudoType>),
816 ObjectIdentifier(Box<ObjectIdentifier>),
817 Transaction(Box<Transaction>),
818 Commit(Box<Commit>),
819 Rollback(Box<Rollback>),
820 AlterSession(Box<AlterSession>),
821 Analyze(Box<Analyze>),
822 AnalyzeStatistics(Box<AnalyzeStatistics>),
823 AnalyzeHistogram(Box<AnalyzeHistogram>),
824 AnalyzeSample(Box<AnalyzeSample>),
825 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
826 AnalyzeDelete(Box<AnalyzeDelete>),
827 AnalyzeWith(Box<AnalyzeWith>),
828 AnalyzeValidate(Box<AnalyzeValidate>),
829 AddPartition(Box<AddPartition>),
830 AttachOption(Box<AttachOption>),
831 DropPartition(Box<DropPartition>),
832 ReplacePartition(Box<ReplacePartition>),
833 DPipe(Box<DPipe>),
834 Operator(Box<Operator>),
835 PivotAny(Box<PivotAny>),
836 Aliases(Box<Aliases>),
837 AtIndex(Box<AtIndex>),
838 FromTimeZone(Box<FromTimeZone>),
839 FormatPhrase(Box<FormatPhrase>),
840 ForIn(Box<ForIn>),
841 TimeUnit(Box<TimeUnit>),
842 IntervalOp(Box<IntervalOp>),
843 IntervalSpan(Box<IntervalSpan>),
844 HavingMax(Box<HavingMax>),
845 CosineDistance(Box<CosineDistance>),
846 DotProduct(Box<DotProduct>),
847 EuclideanDistance(Box<EuclideanDistance>),
848 ManhattanDistance(Box<ManhattanDistance>),
849 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
850 Booland(Box<Booland>),
851 Boolor(Box<Boolor>),
852 ParameterizedAgg(Box<ParameterizedAgg>),
853 ArgMax(Box<ArgMax>),
854 ArgMin(Box<ArgMin>),
855 ApproxTopK(Box<ApproxTopK>),
856 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
857 ApproxTopKCombine(Box<ApproxTopKCombine>),
858 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
859 ApproxTopSum(Box<ApproxTopSum>),
860 ApproxQuantiles(Box<ApproxQuantiles>),
861 Minhash(Box<Minhash>),
862 FarmFingerprint(Box<FarmFingerprint>),
863 Float64(Box<Float64>),
864 Transform(Box<Transform>),
865 Translate(Box<Translate>),
866 Grouping(Box<Grouping>),
867 GroupingId(Box<GroupingId>),
868 Anonymous(Box<Anonymous>),
869 AnonymousAggFunc(Box<AnonymousAggFunc>),
870 CombinedAggFunc(Box<CombinedAggFunc>),
871 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
872 HashAgg(Box<HashAgg>),
873 Hll(Box<Hll>),
874 Apply(Box<Apply>),
875 ToBoolean(Box<ToBoolean>),
876 List(Box<List>),
877 ToMap(Box<ToMap>),
878 Pad(Box<Pad>),
879 ToChar(Box<ToChar>),
880 ToNumber(Box<ToNumber>),
881 ToDouble(Box<ToDouble>),
882 Int64(Box<UnaryFunc>),
883 StringFunc(Box<StringFunc>),
884 ToDecfloat(Box<ToDecfloat>),
885 TryToDecfloat(Box<TryToDecfloat>),
886 ToFile(Box<ToFile>),
887 Columns(Box<Columns>),
888 ConvertToCharset(Box<ConvertToCharset>),
889 ConvertTimezone(Box<ConvertTimezone>),
890 GenerateSeries(Box<GenerateSeries>),
891 AIAgg(Box<AIAgg>),
892 AIClassify(Box<AIClassify>),
893 ArrayAll(Box<ArrayAll>),
894 ArrayAny(Box<ArrayAny>),
895 ArrayConstructCompact(Box<ArrayConstructCompact>),
896 StPoint(Box<StPoint>),
897 StDistance(Box<StDistance>),
898 StringToArray(Box<StringToArray>),
899 ArraySum(Box<ArraySum>),
900 ObjectAgg(Box<ObjectAgg>),
901 CastToStrType(Box<CastToStrType>),
902 CheckJson(Box<CheckJson>),
903 CheckXml(Box<CheckXml>),
904 TranslateCharacters(Box<TranslateCharacters>),
905 CurrentSchemas(Box<CurrentSchemas>),
906 CurrentDatetime(Box<CurrentDatetime>),
907 Localtime(Box<Localtime>),
908 Localtimestamp(Box<Localtimestamp>),
909 Systimestamp(Box<Systimestamp>),
910 CurrentSchema(Box<CurrentSchema>),
911 CurrentUser(Box<CurrentUser>),
912 UtcTime(Box<UtcTime>),
913 UtcTimestamp(Box<UtcTimestamp>),
914 Timestamp(Box<TimestampFunc>),
915 DateBin(Box<DateBin>),
916 Datetime(Box<Datetime>),
917 DatetimeAdd(Box<DatetimeAdd>),
918 DatetimeSub(Box<DatetimeSub>),
919 DatetimeDiff(Box<DatetimeDiff>),
920 DatetimeTrunc(Box<DatetimeTrunc>),
921 Dayname(Box<Dayname>),
922 MakeInterval(Box<MakeInterval>),
923 PreviousDay(Box<PreviousDay>),
924 Elt(Box<Elt>),
925 TimestampAdd(Box<TimestampAdd>),
926 TimestampSub(Box<TimestampSub>),
927 TimestampDiff(Box<TimestampDiff>),
928 TimeSlice(Box<TimeSlice>),
929 TimeAdd(Box<TimeAdd>),
930 TimeSub(Box<TimeSub>),
931 TimeDiff(Box<TimeDiff>),
932 TimeTrunc(Box<TimeTrunc>),
933 DateFromParts(Box<DateFromParts>),
934 TimeFromParts(Box<TimeFromParts>),
935 DecodeCase(Box<DecodeCase>),
936 Decrypt(Box<Decrypt>),
937 DecryptRaw(Box<DecryptRaw>),
938 Encode(Box<Encode>),
939 Encrypt(Box<Encrypt>),
940 EncryptRaw(Box<EncryptRaw>),
941 EqualNull(Box<EqualNull>),
942 ToBinary(Box<ToBinary>),
943 Base64DecodeBinary(Box<Base64DecodeBinary>),
944 Base64DecodeString(Box<Base64DecodeString>),
945 Base64Encode(Box<Base64Encode>),
946 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
947 TryBase64DecodeString(Box<TryBase64DecodeString>),
948 GapFill(Box<GapFill>),
949 GenerateDateArray(Box<GenerateDateArray>),
950 GenerateTimestampArray(Box<GenerateTimestampArray>),
951 GetExtract(Box<GetExtract>),
952 Getbit(Box<Getbit>),
953 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
954 HexEncode(Box<HexEncode>),
955 Compress(Box<Compress>),
956 DecompressBinary(Box<DecompressBinary>),
957 DecompressString(Box<DecompressString>),
958 Xor(Box<Xor>),
959 Nullif(Box<Nullif>),
960 JSON(Box<JSON>),
961 JSONPath(Box<JSONPath>),
962 JSONPathFilter(Box<JSONPathFilter>),
963 JSONPathKey(Box<JSONPathKey>),
964 JSONPathRecursive(Box<JSONPathRecursive>),
965 JSONPathScript(Box<JSONPathScript>),
966 JSONPathSlice(Box<JSONPathSlice>),
967 JSONPathSelector(Box<JSONPathSelector>),
968 JSONPathSubscript(Box<JSONPathSubscript>),
969 JSONPathUnion(Box<JSONPathUnion>),
970 Format(Box<Format>),
971 JSONKeys(Box<JSONKeys>),
972 JSONKeyValue(Box<JSONKeyValue>),
973 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
974 JSONObject(Box<JSONObject>),
975 JSONObjectAgg(Box<JSONObjectAgg>),
976 JSONBObjectAgg(Box<JSONBObjectAgg>),
977 JSONArray(Box<JSONArray>),
978 JSONArrayAgg(Box<JSONArrayAgg>),
979 JSONExists(Box<JSONExists>),
980 JSONColumnDef(Box<JSONColumnDef>),
981 JSONSchema(Box<JSONSchema>),
982 JSONSet(Box<JSONSet>),
983 JSONStripNulls(Box<JSONStripNulls>),
984 JSONValue(Box<JSONValue>),
985 JSONValueArray(Box<JSONValueArray>),
986 JSONRemove(Box<JSONRemove>),
987 JSONTable(Box<JSONTable>),
988 JSONType(Box<JSONType>),
989 ObjectInsert(Box<ObjectInsert>),
990 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
991 OpenJSON(Box<OpenJSON>),
992 JSONBExists(Box<JSONBExists>),
993 JSONBContains(Box<BinaryFunc>),
994 JSONBExtract(Box<BinaryFunc>),
995 JSONCast(Box<JSONCast>),
996 JSONExtract(Box<JSONExtract>),
997 JSONExtractQuote(Box<JSONExtractQuote>),
998 JSONExtractArray(Box<JSONExtractArray>),
999 JSONExtractScalar(Box<JSONExtractScalar>),
1000 JSONBExtractScalar(Box<JSONBExtractScalar>),
1001 JSONFormat(Box<JSONFormat>),
1002 JSONBool(Box<UnaryFunc>),
1003 JSONPathRoot(JSONPathRoot),
1004 JSONArrayAppend(Box<JSONArrayAppend>),
1005 JSONArrayContains(Box<JSONArrayContains>),
1006 JSONArrayInsert(Box<JSONArrayInsert>),
1007 ParseJSON(Box<ParseJSON>),
1008 ParseUrl(Box<ParseUrl>),
1009 ParseIp(Box<ParseIp>),
1010 ParseTime(Box<ParseTime>),
1011 ParseDatetime(Box<ParseDatetime>),
1012 Map(Box<Map>),
1013 MapCat(Box<MapCat>),
1014 MapDelete(Box<MapDelete>),
1015 MapInsert(Box<MapInsert>),
1016 MapPick(Box<MapPick>),
1017 ScopeResolution(Box<ScopeResolution>),
1018 Slice(Box<Slice>),
1019 VarMap(Box<VarMap>),
1020 MatchAgainst(Box<MatchAgainst>),
1021 MD5Digest(Box<MD5Digest>),
1022 MD5NumberLower64(Box<UnaryFunc>),
1023 MD5NumberUpper64(Box<UnaryFunc>),
1024 Monthname(Box<Monthname>),
1025 Ntile(Box<Ntile>),
1026 Normalize(Box<Normalize>),
1027 Normal(Box<Normal>),
1028 Predict(Box<Predict>),
1029 MLTranslate(Box<MLTranslate>),
1030 FeaturesAtTime(Box<FeaturesAtTime>),
1031 GenerateEmbedding(Box<GenerateEmbedding>),
1032 MLForecast(Box<MLForecast>),
1033 ModelAttribute(Box<ModelAttribute>),
1034 VectorSearch(Box<VectorSearch>),
1035 Quantile(Box<Quantile>),
1036 ApproxQuantile(Box<ApproxQuantile>),
1037 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1038 Randn(Box<Randn>),
1039 Randstr(Box<Randstr>),
1040 RangeN(Box<RangeN>),
1041 RangeBucket(Box<RangeBucket>),
1042 ReadCSV(Box<ReadCSV>),
1043 ReadParquet(Box<ReadParquet>),
1044 Reduce(Box<Reduce>),
1045 RegexpExtractAll(Box<RegexpExtractAll>),
1046 RegexpILike(Box<RegexpILike>),
1047 RegexpFullMatch(Box<RegexpFullMatch>),
1048 RegexpInstr(Box<RegexpInstr>),
1049 RegexpSplit(Box<RegexpSplit>),
1050 RegexpCount(Box<RegexpCount>),
1051 RegrValx(Box<RegrValx>),
1052 RegrValy(Box<RegrValy>),
1053 RegrAvgy(Box<RegrAvgy>),
1054 RegrAvgx(Box<RegrAvgx>),
1055 RegrCount(Box<RegrCount>),
1056 RegrIntercept(Box<RegrIntercept>),
1057 RegrR2(Box<RegrR2>),
1058 RegrSxx(Box<RegrSxx>),
1059 RegrSxy(Box<RegrSxy>),
1060 RegrSyy(Box<RegrSyy>),
1061 RegrSlope(Box<RegrSlope>),
1062 SafeAdd(Box<SafeAdd>),
1063 SafeDivide(Box<SafeDivide>),
1064 SafeMultiply(Box<SafeMultiply>),
1065 SafeSubtract(Box<SafeSubtract>),
1066 SHA2(Box<SHA2>),
1067 SHA2Digest(Box<SHA2Digest>),
1068 SortArray(Box<SortArray>),
1069 SplitPart(Box<SplitPart>),
1070 SubstringIndex(Box<SubstringIndex>),
1071 StandardHash(Box<StandardHash>),
1072 StrPosition(Box<StrPosition>),
1073 Search(Box<Search>),
1074 SearchIp(Box<SearchIp>),
1075 StrToDate(Box<StrToDate>),
1076 DateStrToDate(Box<UnaryFunc>),
1077 DateToDateStr(Box<UnaryFunc>),
1078 StrToTime(Box<StrToTime>),
1079 StrToUnix(Box<StrToUnix>),
1080 StrToMap(Box<StrToMap>),
1081 NumberToStr(Box<NumberToStr>),
1082 FromBase(Box<FromBase>),
1083 Stuff(Box<Stuff>),
1084 TimeToStr(Box<TimeToStr>),
1085 TimeStrToTime(Box<TimeStrToTime>),
1086 TsOrDsAdd(Box<TsOrDsAdd>),
1087 TsOrDsDiff(Box<TsOrDsDiff>),
1088 TsOrDsToDate(Box<TsOrDsToDate>),
1089 TsOrDsToTime(Box<TsOrDsToTime>),
1090 Unhex(Box<Unhex>),
1091 Uniform(Box<Uniform>),
1092 UnixToStr(Box<UnixToStr>),
1093 UnixToTime(Box<UnixToTime>),
1094 Uuid(Box<Uuid>),
1095 TimestampFromParts(Box<TimestampFromParts>),
1096 TimestampTzFromParts(Box<TimestampTzFromParts>),
1097 Corr(Box<Corr>),
1098 WidthBucket(Box<WidthBucket>),
1099 CovarSamp(Box<CovarSamp>),
1100 CovarPop(Box<CovarPop>),
1101 Week(Box<Week>),
1102 XMLElement(Box<XMLElement>),
1103 XMLGet(Box<XMLGet>),
1104 XMLTable(Box<XMLTable>),
1105 XMLKeyValueOption(Box<XMLKeyValueOption>),
1106 Zipf(Box<Zipf>),
1107 Merge(Box<Merge>),
1108 When(Box<When>),
1109 Whens(Box<Whens>),
1110 NextValueFor(Box<NextValueFor>),
1111 ReturnStmt(Box<Expression>),
1113}
1114
1115impl Expression {
1116 #[inline]
1118 pub fn boxed_column(col: Column) -> Self {
1119 Expression::Column(Box::new(col))
1120 }
1121
1122 #[inline]
1124 pub fn boxed_table(t: TableRef) -> Self {
1125 Expression::Table(Box::new(t))
1126 }
1127
1128 pub fn is_statement(&self) -> bool {
1135 match self {
1136 Expression::Select(_)
1138 | Expression::Union(_)
1139 | Expression::Intersect(_)
1140 | Expression::Except(_)
1141 | Expression::Subquery(_)
1142 | Expression::Values(_)
1143 | Expression::PipeOperator(_)
1144
1145 | Expression::Insert(_)
1147 | Expression::Update(_)
1148 | Expression::Delete(_)
1149 | Expression::Copy(_)
1150 | Expression::Put(_)
1151 | Expression::Merge(_)
1152 | Expression::TryCatch(_)
1153
1154 | Expression::CreateTable(_)
1156 | Expression::DropTable(_)
1157 | Expression::Undrop(_)
1158 | Expression::AlterTable(_)
1159 | Expression::CreateIndex(_)
1160 | Expression::DropIndex(_)
1161 | Expression::CreateView(_)
1162 | Expression::DropView(_)
1163 | Expression::AlterView(_)
1164 | Expression::AlterIndex(_)
1165 | Expression::Truncate(_)
1166 | Expression::TruncateTable(_)
1167 | Expression::CreateSchema(_)
1168 | Expression::DropSchema(_)
1169 | Expression::DropNamespace(_)
1170 | Expression::CreateDatabase(_)
1171 | Expression::DropDatabase(_)
1172 | Expression::CreateFunction(_)
1173 | Expression::DropFunction(_)
1174 | Expression::CreateProcedure(_)
1175 | Expression::DropProcedure(_)
1176 | Expression::CreateSequence(_)
1177 | Expression::CreateSynonym(_)
1178 | Expression::DropSequence(_)
1179 | Expression::AlterSequence(_)
1180 | Expression::CreateTrigger(_)
1181 | Expression::DropTrigger(_)
1182 | Expression::CreateType(_)
1183 | Expression::DropType(_)
1184 | Expression::Comment(_)
1185
1186 | Expression::Use(_)
1188 | Expression::Set(_)
1189 | Expression::SetStatement(_)
1190 | Expression::Transaction(_)
1191 | Expression::Commit(_)
1192 | Expression::Rollback(_)
1193 | Expression::Grant(_)
1194 | Expression::Revoke(_)
1195 | Expression::Cache(_)
1196 | Expression::Uncache(_)
1197 | Expression::LoadData(_)
1198 | Expression::Pragma(_)
1199 | Expression::Describe(_)
1200 | Expression::Show(_)
1201 | Expression::Kill(_)
1202 | Expression::Prepare(_)
1203 | Expression::Execute(_)
1204 | Expression::Declare(_)
1205 | Expression::Refresh(_)
1206 | Expression::AlterSession(_)
1207 | Expression::LockingStatement(_)
1208
1209 | Expression::Analyze(_)
1211 | Expression::AnalyzeStatistics(_)
1212 | Expression::AnalyzeHistogram(_)
1213 | Expression::AnalyzeSample(_)
1214 | Expression::AnalyzeListChainedRows(_)
1215 | Expression::AnalyzeDelete(_)
1216
1217 | Expression::Attach(_)
1219 | Expression::Detach(_)
1220 | Expression::Install(_)
1221 | Expression::Summarize(_)
1222
1223 | Expression::Pivot(_)
1225 | Expression::Unpivot(_)
1226
1227 | Expression::Command(_)
1229 | Expression::Raw(_)
1230 | Expression::CreateTask(_)
1231
1232 | Expression::ReturnStmt(_) => true,
1234
1235 Expression::Annotated(a) => a.this.is_statement(),
1237
1238 Expression::Alias(a) => a.this.is_statement(),
1240
1241 _ => false,
1243 }
1244 }
1245
1246 pub fn number(n: i64) -> Self {
1248 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1249 }
1250
1251 pub fn string(s: impl Into<String>) -> Self {
1253 Expression::Literal(Box::new(Literal::String(s.into())))
1254 }
1255
1256 pub fn float(f: f64) -> Self {
1258 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1259 }
1260
1261 pub fn inferred_type(&self) -> Option<&DataType> {
1267 match self {
1268 Expression::And(op)
1270 | Expression::Or(op)
1271 | Expression::Add(op)
1272 | Expression::Sub(op)
1273 | Expression::Mul(op)
1274 | Expression::Div(op)
1275 | Expression::Mod(op)
1276 | Expression::Eq(op)
1277 | Expression::Neq(op)
1278 | Expression::Lt(op)
1279 | Expression::Lte(op)
1280 | Expression::Gt(op)
1281 | Expression::Gte(op)
1282 | Expression::Concat(op)
1283 | Expression::BitwiseAnd(op)
1284 | Expression::BitwiseOr(op)
1285 | Expression::BitwiseXor(op)
1286 | Expression::Adjacent(op)
1287 | Expression::TsMatch(op)
1288 | Expression::PropertyEQ(op)
1289 | Expression::ArrayContainsAll(op)
1290 | Expression::ArrayContainedBy(op)
1291 | Expression::ArrayOverlaps(op)
1292 | Expression::JSONBContainsAllTopKeys(op)
1293 | Expression::JSONBContainsAnyTopKeys(op)
1294 | Expression::JSONBDeleteAtPath(op)
1295 | Expression::ExtendsLeft(op)
1296 | Expression::ExtendsRight(op)
1297 | Expression::Is(op)
1298 | Expression::MemberOf(op)
1299 | Expression::Match(op)
1300 | Expression::NullSafeEq(op)
1301 | Expression::NullSafeNeq(op)
1302 | Expression::Glob(op)
1303 | Expression::BitwiseLeftShift(op)
1304 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1305
1306 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1307 op.inferred_type.as_ref()
1308 }
1309
1310 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1311
1312 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1313 c.inferred_type.as_ref()
1314 }
1315
1316 Expression::Column(c) => c.inferred_type.as_ref(),
1317 Expression::Function(f) => f.inferred_type.as_ref(),
1318 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1319 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1320 Expression::Case(c) => c.inferred_type.as_ref(),
1321 Expression::Subquery(s) => s.inferred_type.as_ref(),
1322 Expression::Alias(a) => a.inferred_type.as_ref(),
1323 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1324 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1325 Expression::Count(f) => f.inferred_type.as_ref(),
1326 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1327 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1328 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1329 Expression::SumIf(f) => f.inferred_type.as_ref(),
1330
1331 Expression::Upper(f)
1333 | Expression::Lower(f)
1334 | Expression::Length(f)
1335 | Expression::LTrim(f)
1336 | Expression::RTrim(f)
1337 | Expression::Reverse(f)
1338 | Expression::Abs(f)
1339 | Expression::Sqrt(f)
1340 | Expression::Cbrt(f)
1341 | Expression::Ln(f)
1342 | Expression::Exp(f)
1343 | Expression::Sign(f)
1344 | Expression::Date(f)
1345 | Expression::Time(f)
1346 | Expression::Initcap(f)
1347 | Expression::Ascii(f)
1348 | Expression::Chr(f)
1349 | Expression::Soundex(f)
1350 | Expression::ByteLength(f)
1351 | Expression::Hex(f)
1352 | Expression::LowerHex(f)
1353 | Expression::Unicode(f)
1354 | Expression::Typeof(f)
1355 | Expression::Explode(f)
1356 | Expression::ExplodeOuter(f)
1357 | Expression::MapFromEntries(f)
1358 | Expression::MapKeys(f)
1359 | Expression::MapValues(f)
1360 | Expression::ArrayLength(f)
1361 | Expression::ArraySize(f)
1362 | Expression::Cardinality(f)
1363 | Expression::ArrayReverse(f)
1364 | Expression::ArrayDistinct(f)
1365 | Expression::ArrayFlatten(f)
1366 | Expression::ArrayCompact(f)
1367 | Expression::ToArray(f)
1368 | Expression::JsonArrayLength(f)
1369 | Expression::JsonKeys(f)
1370 | Expression::JsonType(f)
1371 | Expression::ParseJson(f)
1372 | Expression::ToJson(f)
1373 | Expression::Radians(f)
1374 | Expression::Degrees(f)
1375 | Expression::Sin(f)
1376 | Expression::Cos(f)
1377 | Expression::Tan(f)
1378 | Expression::Asin(f)
1379 | Expression::Acos(f)
1380 | Expression::Atan(f)
1381 | Expression::IsNan(f)
1382 | Expression::IsInf(f)
1383 | Expression::Year(f)
1384 | Expression::Month(f)
1385 | Expression::Day(f)
1386 | Expression::Hour(f)
1387 | Expression::Minute(f)
1388 | Expression::Second(f)
1389 | Expression::DayOfWeek(f)
1390 | Expression::DayOfWeekIso(f)
1391 | Expression::DayOfMonth(f)
1392 | Expression::DayOfYear(f)
1393 | Expression::WeekOfYear(f)
1394 | Expression::Quarter(f)
1395 | Expression::Epoch(f)
1396 | Expression::EpochMs(f)
1397 | Expression::BitwiseCount(f)
1398 | Expression::DateFromUnixDate(f)
1399 | Expression::UnixDate(f)
1400 | Expression::UnixSeconds(f)
1401 | Expression::UnixMillis(f)
1402 | Expression::UnixMicros(f)
1403 | Expression::TimeStrToDate(f)
1404 | Expression::DateToDi(f)
1405 | Expression::DiToDate(f)
1406 | Expression::TsOrDiToDi(f)
1407 | Expression::TsOrDsToDatetime(f)
1408 | Expression::TsOrDsToTimestamp(f)
1409 | Expression::YearOfWeek(f)
1410 | Expression::YearOfWeekIso(f)
1411 | Expression::SHA(f)
1412 | Expression::SHA1Digest(f)
1413 | Expression::TimeToUnix(f)
1414 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1415
1416 Expression::Power(f)
1418 | Expression::NullIf(f)
1419 | Expression::IfNull(f)
1420 | Expression::Nvl(f)
1421 | Expression::Contains(f)
1422 | Expression::StartsWith(f)
1423 | Expression::EndsWith(f)
1424 | Expression::Levenshtein(f)
1425 | Expression::ModFunc(f)
1426 | Expression::IntDiv(f)
1427 | Expression::Atan2(f)
1428 | Expression::AddMonths(f)
1429 | Expression::MonthsBetween(f)
1430 | Expression::NextDay(f)
1431 | Expression::UnixToTimeStr(f)
1432 | Expression::ArrayContains(f)
1433 | Expression::ArrayPosition(f)
1434 | Expression::ArrayAppend(f)
1435 | Expression::ArrayPrepend(f)
1436 | Expression::ArrayUnion(f)
1437 | Expression::ArrayExcept(f)
1438 | Expression::ArrayRemove(f)
1439 | Expression::StarMap(f)
1440 | Expression::MapFromArrays(f)
1441 | Expression::MapContainsKey(f)
1442 | Expression::ElementAt(f)
1443 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1444
1445 Expression::Coalesce(f)
1447 | Expression::Greatest(f)
1448 | Expression::Least(f)
1449 | Expression::ArrayConcat(f)
1450 | Expression::ArrayIntersect(f)
1451 | Expression::ArrayZip(f)
1452 | Expression::MapConcat(f)
1453 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1454
1455 Expression::Sum(f)
1457 | Expression::Avg(f)
1458 | Expression::Min(f)
1459 | Expression::Max(f)
1460 | Expression::ArrayAgg(f)
1461 | Expression::CountIf(f)
1462 | Expression::Stddev(f)
1463 | Expression::StddevPop(f)
1464 | Expression::StddevSamp(f)
1465 | Expression::Variance(f)
1466 | Expression::VarPop(f)
1467 | Expression::VarSamp(f)
1468 | Expression::Median(f)
1469 | Expression::Mode(f)
1470 | Expression::First(f)
1471 | Expression::Last(f)
1472 | Expression::AnyValue(f)
1473 | Expression::ApproxDistinct(f)
1474 | Expression::ApproxCountDistinct(f)
1475 | Expression::LogicalAnd(f)
1476 | Expression::LogicalOr(f)
1477 | Expression::Skewness(f)
1478 | Expression::ArrayConcatAgg(f)
1479 | Expression::ArrayUniqueAgg(f)
1480 | Expression::BoolXorAgg(f)
1481 | Expression::BitwiseAndAgg(f)
1482 | Expression::BitwiseOrAgg(f)
1483 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1484
1485 _ => None,
1487 }
1488 }
1489
1490 pub fn set_inferred_type(&mut self, dt: DataType) {
1495 match self {
1496 Expression::And(op)
1497 | Expression::Or(op)
1498 | Expression::Add(op)
1499 | Expression::Sub(op)
1500 | Expression::Mul(op)
1501 | Expression::Div(op)
1502 | Expression::Mod(op)
1503 | Expression::Eq(op)
1504 | Expression::Neq(op)
1505 | Expression::Lt(op)
1506 | Expression::Lte(op)
1507 | Expression::Gt(op)
1508 | Expression::Gte(op)
1509 | Expression::Concat(op)
1510 | Expression::BitwiseAnd(op)
1511 | Expression::BitwiseOr(op)
1512 | Expression::BitwiseXor(op)
1513 | Expression::Adjacent(op)
1514 | Expression::TsMatch(op)
1515 | Expression::PropertyEQ(op)
1516 | Expression::ArrayContainsAll(op)
1517 | Expression::ArrayContainedBy(op)
1518 | Expression::ArrayOverlaps(op)
1519 | Expression::JSONBContainsAllTopKeys(op)
1520 | Expression::JSONBContainsAnyTopKeys(op)
1521 | Expression::JSONBDeleteAtPath(op)
1522 | Expression::ExtendsLeft(op)
1523 | Expression::ExtendsRight(op)
1524 | Expression::Is(op)
1525 | Expression::MemberOf(op)
1526 | Expression::Match(op)
1527 | Expression::NullSafeEq(op)
1528 | Expression::NullSafeNeq(op)
1529 | Expression::Glob(op)
1530 | Expression::BitwiseLeftShift(op)
1531 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1532
1533 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1534 op.inferred_type = Some(dt)
1535 }
1536
1537 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1538
1539 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1540 c.inferred_type = Some(dt)
1541 }
1542
1543 Expression::Column(c) => c.inferred_type = Some(dt),
1544 Expression::Function(f) => f.inferred_type = Some(dt),
1545 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1546 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1547 Expression::Case(c) => c.inferred_type = Some(dt),
1548 Expression::Subquery(s) => s.inferred_type = Some(dt),
1549 Expression::Alias(a) => a.inferred_type = Some(dt),
1550 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1551 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1552 Expression::Count(f) => f.inferred_type = Some(dt),
1553 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1554 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1555 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1556 Expression::SumIf(f) => f.inferred_type = Some(dt),
1557
1558 Expression::Upper(f)
1560 | Expression::Lower(f)
1561 | Expression::Length(f)
1562 | Expression::LTrim(f)
1563 | Expression::RTrim(f)
1564 | Expression::Reverse(f)
1565 | Expression::Abs(f)
1566 | Expression::Sqrt(f)
1567 | Expression::Cbrt(f)
1568 | Expression::Ln(f)
1569 | Expression::Exp(f)
1570 | Expression::Sign(f)
1571 | Expression::Date(f)
1572 | Expression::Time(f)
1573 | Expression::Initcap(f)
1574 | Expression::Ascii(f)
1575 | Expression::Chr(f)
1576 | Expression::Soundex(f)
1577 | Expression::ByteLength(f)
1578 | Expression::Hex(f)
1579 | Expression::LowerHex(f)
1580 | Expression::Unicode(f)
1581 | Expression::Typeof(f)
1582 | Expression::Explode(f)
1583 | Expression::ExplodeOuter(f)
1584 | Expression::MapFromEntries(f)
1585 | Expression::MapKeys(f)
1586 | Expression::MapValues(f)
1587 | Expression::ArrayLength(f)
1588 | Expression::ArraySize(f)
1589 | Expression::Cardinality(f)
1590 | Expression::ArrayReverse(f)
1591 | Expression::ArrayDistinct(f)
1592 | Expression::ArrayFlatten(f)
1593 | Expression::ArrayCompact(f)
1594 | Expression::ToArray(f)
1595 | Expression::JsonArrayLength(f)
1596 | Expression::JsonKeys(f)
1597 | Expression::JsonType(f)
1598 | Expression::ParseJson(f)
1599 | Expression::ToJson(f)
1600 | Expression::Radians(f)
1601 | Expression::Degrees(f)
1602 | Expression::Sin(f)
1603 | Expression::Cos(f)
1604 | Expression::Tan(f)
1605 | Expression::Asin(f)
1606 | Expression::Acos(f)
1607 | Expression::Atan(f)
1608 | Expression::IsNan(f)
1609 | Expression::IsInf(f)
1610 | Expression::Year(f)
1611 | Expression::Month(f)
1612 | Expression::Day(f)
1613 | Expression::Hour(f)
1614 | Expression::Minute(f)
1615 | Expression::Second(f)
1616 | Expression::DayOfWeek(f)
1617 | Expression::DayOfWeekIso(f)
1618 | Expression::DayOfMonth(f)
1619 | Expression::DayOfYear(f)
1620 | Expression::WeekOfYear(f)
1621 | Expression::Quarter(f)
1622 | Expression::Epoch(f)
1623 | Expression::EpochMs(f)
1624 | Expression::BitwiseCount(f)
1625 | Expression::DateFromUnixDate(f)
1626 | Expression::UnixDate(f)
1627 | Expression::UnixSeconds(f)
1628 | Expression::UnixMillis(f)
1629 | Expression::UnixMicros(f)
1630 | Expression::TimeStrToDate(f)
1631 | Expression::DateToDi(f)
1632 | Expression::DiToDate(f)
1633 | Expression::TsOrDiToDi(f)
1634 | Expression::TsOrDsToDatetime(f)
1635 | Expression::TsOrDsToTimestamp(f)
1636 | Expression::YearOfWeek(f)
1637 | Expression::YearOfWeekIso(f)
1638 | Expression::SHA(f)
1639 | Expression::SHA1Digest(f)
1640 | Expression::TimeToUnix(f)
1641 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1642
1643 Expression::Power(f)
1645 | Expression::NullIf(f)
1646 | Expression::IfNull(f)
1647 | Expression::Nvl(f)
1648 | Expression::Contains(f)
1649 | Expression::StartsWith(f)
1650 | Expression::EndsWith(f)
1651 | Expression::Levenshtein(f)
1652 | Expression::ModFunc(f)
1653 | Expression::IntDiv(f)
1654 | Expression::Atan2(f)
1655 | Expression::AddMonths(f)
1656 | Expression::MonthsBetween(f)
1657 | Expression::NextDay(f)
1658 | Expression::UnixToTimeStr(f)
1659 | Expression::ArrayContains(f)
1660 | Expression::ArrayPosition(f)
1661 | Expression::ArrayAppend(f)
1662 | Expression::ArrayPrepend(f)
1663 | Expression::ArrayUnion(f)
1664 | Expression::ArrayExcept(f)
1665 | Expression::ArrayRemove(f)
1666 | Expression::StarMap(f)
1667 | Expression::MapFromArrays(f)
1668 | Expression::MapContainsKey(f)
1669 | Expression::ElementAt(f)
1670 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1671
1672 Expression::Coalesce(f)
1674 | Expression::Greatest(f)
1675 | Expression::Least(f)
1676 | Expression::ArrayConcat(f)
1677 | Expression::ArrayIntersect(f)
1678 | Expression::ArrayZip(f)
1679 | Expression::MapConcat(f)
1680 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1681
1682 Expression::Sum(f)
1684 | Expression::Avg(f)
1685 | Expression::Min(f)
1686 | Expression::Max(f)
1687 | Expression::ArrayAgg(f)
1688 | Expression::CountIf(f)
1689 | Expression::Stddev(f)
1690 | Expression::StddevPop(f)
1691 | Expression::StddevSamp(f)
1692 | Expression::Variance(f)
1693 | Expression::VarPop(f)
1694 | Expression::VarSamp(f)
1695 | Expression::Median(f)
1696 | Expression::Mode(f)
1697 | Expression::First(f)
1698 | Expression::Last(f)
1699 | Expression::AnyValue(f)
1700 | Expression::ApproxDistinct(f)
1701 | Expression::ApproxCountDistinct(f)
1702 | Expression::LogicalAnd(f)
1703 | Expression::LogicalOr(f)
1704 | Expression::Skewness(f)
1705 | Expression::ArrayConcatAgg(f)
1706 | Expression::ArrayUniqueAgg(f)
1707 | Expression::BoolXorAgg(f)
1708 | Expression::BitwiseAndAgg(f)
1709 | Expression::BitwiseOrAgg(f)
1710 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1711
1712 _ => {}
1714 }
1715 }
1716
1717 pub fn column(name: impl Into<String>) -> Self {
1719 Expression::Column(Box::new(Column {
1720 name: Identifier::new(name),
1721 table: None,
1722 join_mark: false,
1723 trailing_comments: Vec::new(),
1724 span: None,
1725 inferred_type: None,
1726 }))
1727 }
1728
1729 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1731 Expression::Column(Box::new(Column {
1732 name: Identifier::new(column),
1733 table: Some(Identifier::new(table)),
1734 join_mark: false,
1735 trailing_comments: Vec::new(),
1736 span: None,
1737 inferred_type: None,
1738 }))
1739 }
1740
1741 pub fn identifier(name: impl Into<String>) -> Self {
1743 Expression::Identifier(Identifier::new(name))
1744 }
1745
1746 pub fn null() -> Self {
1748 Expression::Null(Null)
1749 }
1750
1751 pub fn true_() -> Self {
1753 Expression::Boolean(BooleanLiteral { value: true })
1754 }
1755
1756 pub fn false_() -> Self {
1758 Expression::Boolean(BooleanLiteral { value: false })
1759 }
1760
1761 pub fn star() -> Self {
1763 Expression::Star(Star {
1764 table: None,
1765 except: None,
1766 replace: None,
1767 rename: None,
1768 trailing_comments: Vec::new(),
1769 span: None,
1770 })
1771 }
1772
1773 pub fn alias(self, name: impl Into<String>) -> Self {
1775 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1776 }
1777
1778 pub fn is_select(&self) -> bool {
1780 matches!(self, Expression::Select(_))
1781 }
1782
1783 pub fn as_select(&self) -> Option<&Select> {
1785 match self {
1786 Expression::Select(s) => Some(s),
1787 _ => None,
1788 }
1789 }
1790
1791 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1793 match self {
1794 Expression::Select(s) => Some(s),
1795 _ => None,
1796 }
1797 }
1798
1799 #[cfg(feature = "generate")]
1804 pub fn sql(&self) -> String {
1805 crate::generator::Generator::sql(self).unwrap_or_default()
1806 }
1807
1808 #[cfg(feature = "generate")]
1814 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1815 crate::generate(self, dialect).unwrap_or_default()
1816 }
1817}
1818
1819impl Expression {
1822 pub fn variant_name(&self) -> &'static str {
1825 match self {
1826 Expression::Literal(_) => "literal",
1827 Expression::Boolean(_) => "boolean",
1828 Expression::Null(_) => "null",
1829 Expression::Identifier(_) => "identifier",
1830 Expression::Column(_) => "column",
1831 Expression::Table(_) => "table",
1832 Expression::Star(_) => "star",
1833 Expression::BracedWildcard(_) => "braced_wildcard",
1834 Expression::Select(_) => "select",
1835 Expression::Union(_) => "union",
1836 Expression::Intersect(_) => "intersect",
1837 Expression::Except(_) => "except",
1838 Expression::Subquery(_) => "subquery",
1839 Expression::PipeOperator(_) => "pipe_operator",
1840 Expression::Pivot(_) => "pivot",
1841 Expression::PivotAlias(_) => "pivot_alias",
1842 Expression::Unpivot(_) => "unpivot",
1843 Expression::Values(_) => "values",
1844 Expression::PreWhere(_) => "pre_where",
1845 Expression::Stream(_) => "stream",
1846 Expression::UsingData(_) => "using_data",
1847 Expression::XmlNamespace(_) => "xml_namespace",
1848 Expression::Insert(_) => "insert",
1849 Expression::Update(_) => "update",
1850 Expression::Delete(_) => "delete",
1851 Expression::Copy(_) => "copy",
1852 Expression::Put(_) => "put",
1853 Expression::StageReference(_) => "stage_reference",
1854 Expression::Alias(_) => "alias",
1855 Expression::Cast(_) => "cast",
1856 Expression::Collation(_) => "collation",
1857 Expression::Case(_) => "case",
1858 Expression::And(_) => "and",
1859 Expression::Or(_) => "or",
1860 Expression::Add(_) => "add",
1861 Expression::Sub(_) => "sub",
1862 Expression::Mul(_) => "mul",
1863 Expression::Div(_) => "div",
1864 Expression::Mod(_) => "mod",
1865 Expression::Eq(_) => "eq",
1866 Expression::Neq(_) => "neq",
1867 Expression::Lt(_) => "lt",
1868 Expression::Lte(_) => "lte",
1869 Expression::Gt(_) => "gt",
1870 Expression::Gte(_) => "gte",
1871 Expression::Like(_) => "like",
1872 Expression::ILike(_) => "i_like",
1873 Expression::Match(_) => "match",
1874 Expression::BitwiseAnd(_) => "bitwise_and",
1875 Expression::BitwiseOr(_) => "bitwise_or",
1876 Expression::BitwiseXor(_) => "bitwise_xor",
1877 Expression::Concat(_) => "concat",
1878 Expression::Adjacent(_) => "adjacent",
1879 Expression::TsMatch(_) => "ts_match",
1880 Expression::PropertyEQ(_) => "property_e_q",
1881 Expression::ArrayContainsAll(_) => "array_contains_all",
1882 Expression::ArrayContainedBy(_) => "array_contained_by",
1883 Expression::ArrayOverlaps(_) => "array_overlaps",
1884 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1885 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1886 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1887 Expression::ExtendsLeft(_) => "extends_left",
1888 Expression::ExtendsRight(_) => "extends_right",
1889 Expression::Not(_) => "not",
1890 Expression::Neg(_) => "neg",
1891 Expression::BitwiseNot(_) => "bitwise_not",
1892 Expression::In(_) => "in",
1893 Expression::Between(_) => "between",
1894 Expression::IsNull(_) => "is_null",
1895 Expression::IsTrue(_) => "is_true",
1896 Expression::IsFalse(_) => "is_false",
1897 Expression::IsJson(_) => "is_json",
1898 Expression::Is(_) => "is",
1899 Expression::Exists(_) => "exists",
1900 Expression::MemberOf(_) => "member_of",
1901 Expression::Function(_) => "function",
1902 Expression::AggregateFunction(_) => "aggregate_function",
1903 Expression::WindowFunction(_) => "window_function",
1904 Expression::From(_) => "from",
1905 Expression::Join(_) => "join",
1906 Expression::JoinedTable(_) => "joined_table",
1907 Expression::Where(_) => "where",
1908 Expression::GroupBy(_) => "group_by",
1909 Expression::Having(_) => "having",
1910 Expression::OrderBy(_) => "order_by",
1911 Expression::Limit(_) => "limit",
1912 Expression::Offset(_) => "offset",
1913 Expression::Qualify(_) => "qualify",
1914 Expression::With(_) => "with",
1915 Expression::Cte(_) => "cte",
1916 Expression::DistributeBy(_) => "distribute_by",
1917 Expression::ClusterBy(_) => "cluster_by",
1918 Expression::SortBy(_) => "sort_by",
1919 Expression::LateralView(_) => "lateral_view",
1920 Expression::Hint(_) => "hint",
1921 Expression::Pseudocolumn(_) => "pseudocolumn",
1922 Expression::Connect(_) => "connect",
1923 Expression::Prior(_) => "prior",
1924 Expression::ConnectByRoot(_) => "connect_by_root",
1925 Expression::MatchRecognize(_) => "match_recognize",
1926 Expression::Ordered(_) => "ordered",
1927 Expression::Window(_) => "window",
1928 Expression::Over(_) => "over",
1929 Expression::WithinGroup(_) => "within_group",
1930 Expression::DataType(_) => "data_type",
1931 Expression::Array(_) => "array",
1932 Expression::Struct(_) => "struct",
1933 Expression::Tuple(_) => "tuple",
1934 Expression::Interval(_) => "interval",
1935 Expression::ConcatWs(_) => "concat_ws",
1936 Expression::Substring(_) => "substring",
1937 Expression::Upper(_) => "upper",
1938 Expression::Lower(_) => "lower",
1939 Expression::Length(_) => "length",
1940 Expression::Trim(_) => "trim",
1941 Expression::LTrim(_) => "l_trim",
1942 Expression::RTrim(_) => "r_trim",
1943 Expression::Replace(_) => "replace",
1944 Expression::Reverse(_) => "reverse",
1945 Expression::Left(_) => "left",
1946 Expression::Right(_) => "right",
1947 Expression::Repeat(_) => "repeat",
1948 Expression::Lpad(_) => "lpad",
1949 Expression::Rpad(_) => "rpad",
1950 Expression::Split(_) => "split",
1951 Expression::RegexpLike(_) => "regexp_like",
1952 Expression::RegexpReplace(_) => "regexp_replace",
1953 Expression::RegexpExtract(_) => "regexp_extract",
1954 Expression::Overlay(_) => "overlay",
1955 Expression::Abs(_) => "abs",
1956 Expression::Round(_) => "round",
1957 Expression::Floor(_) => "floor",
1958 Expression::Ceil(_) => "ceil",
1959 Expression::Power(_) => "power",
1960 Expression::Sqrt(_) => "sqrt",
1961 Expression::Cbrt(_) => "cbrt",
1962 Expression::Ln(_) => "ln",
1963 Expression::Log(_) => "log",
1964 Expression::Exp(_) => "exp",
1965 Expression::Sign(_) => "sign",
1966 Expression::Greatest(_) => "greatest",
1967 Expression::Least(_) => "least",
1968 Expression::CurrentDate(_) => "current_date",
1969 Expression::CurrentTime(_) => "current_time",
1970 Expression::CurrentTimestamp(_) => "current_timestamp",
1971 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1972 Expression::AtTimeZone(_) => "at_time_zone",
1973 Expression::DateAdd(_) => "date_add",
1974 Expression::DateSub(_) => "date_sub",
1975 Expression::DateDiff(_) => "date_diff",
1976 Expression::DateTrunc(_) => "date_trunc",
1977 Expression::Extract(_) => "extract",
1978 Expression::ToDate(_) => "to_date",
1979 Expression::ToTimestamp(_) => "to_timestamp",
1980 Expression::Date(_) => "date",
1981 Expression::Time(_) => "time",
1982 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1983 Expression::UnixDate(_) => "unix_date",
1984 Expression::UnixSeconds(_) => "unix_seconds",
1985 Expression::UnixMillis(_) => "unix_millis",
1986 Expression::UnixMicros(_) => "unix_micros",
1987 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1988 Expression::TimeStrToDate(_) => "time_str_to_date",
1989 Expression::DateToDi(_) => "date_to_di",
1990 Expression::DiToDate(_) => "di_to_date",
1991 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1992 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1993 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1994 Expression::YearOfWeek(_) => "year_of_week",
1995 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1996 Expression::Coalesce(_) => "coalesce",
1997 Expression::NullIf(_) => "null_if",
1998 Expression::IfFunc(_) => "if_func",
1999 Expression::IfNull(_) => "if_null",
2000 Expression::Nvl(_) => "nvl",
2001 Expression::Nvl2(_) => "nvl2",
2002 Expression::TryCast(_) => "try_cast",
2003 Expression::SafeCast(_) => "safe_cast",
2004 Expression::Count(_) => "count",
2005 Expression::Sum(_) => "sum",
2006 Expression::Avg(_) => "avg",
2007 Expression::Min(_) => "min",
2008 Expression::Max(_) => "max",
2009 Expression::GroupConcat(_) => "group_concat",
2010 Expression::StringAgg(_) => "string_agg",
2011 Expression::ListAgg(_) => "list_agg",
2012 Expression::ArrayAgg(_) => "array_agg",
2013 Expression::CountIf(_) => "count_if",
2014 Expression::SumIf(_) => "sum_if",
2015 Expression::Stddev(_) => "stddev",
2016 Expression::StddevPop(_) => "stddev_pop",
2017 Expression::StddevSamp(_) => "stddev_samp",
2018 Expression::Variance(_) => "variance",
2019 Expression::VarPop(_) => "var_pop",
2020 Expression::VarSamp(_) => "var_samp",
2021 Expression::Median(_) => "median",
2022 Expression::Mode(_) => "mode",
2023 Expression::First(_) => "first",
2024 Expression::Last(_) => "last",
2025 Expression::AnyValue(_) => "any_value",
2026 Expression::ApproxDistinct(_) => "approx_distinct",
2027 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2028 Expression::ApproxPercentile(_) => "approx_percentile",
2029 Expression::Percentile(_) => "percentile",
2030 Expression::LogicalAnd(_) => "logical_and",
2031 Expression::LogicalOr(_) => "logical_or",
2032 Expression::Skewness(_) => "skewness",
2033 Expression::BitwiseCount(_) => "bitwise_count",
2034 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2035 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2036 Expression::BoolXorAgg(_) => "bool_xor_agg",
2037 Expression::RowNumber(_) => "row_number",
2038 Expression::Rank(_) => "rank",
2039 Expression::DenseRank(_) => "dense_rank",
2040 Expression::NTile(_) => "n_tile",
2041 Expression::Lead(_) => "lead",
2042 Expression::Lag(_) => "lag",
2043 Expression::FirstValue(_) => "first_value",
2044 Expression::LastValue(_) => "last_value",
2045 Expression::NthValue(_) => "nth_value",
2046 Expression::PercentRank(_) => "percent_rank",
2047 Expression::CumeDist(_) => "cume_dist",
2048 Expression::PercentileCont(_) => "percentile_cont",
2049 Expression::PercentileDisc(_) => "percentile_disc",
2050 Expression::Contains(_) => "contains",
2051 Expression::StartsWith(_) => "starts_with",
2052 Expression::EndsWith(_) => "ends_with",
2053 Expression::Position(_) => "position",
2054 Expression::Initcap(_) => "initcap",
2055 Expression::Ascii(_) => "ascii",
2056 Expression::Chr(_) => "chr",
2057 Expression::CharFunc(_) => "char_func",
2058 Expression::Soundex(_) => "soundex",
2059 Expression::Levenshtein(_) => "levenshtein",
2060 Expression::ByteLength(_) => "byte_length",
2061 Expression::Hex(_) => "hex",
2062 Expression::LowerHex(_) => "lower_hex",
2063 Expression::Unicode(_) => "unicode",
2064 Expression::ModFunc(_) => "mod_func",
2065 Expression::Random(_) => "random",
2066 Expression::Rand(_) => "rand",
2067 Expression::TruncFunc(_) => "trunc_func",
2068 Expression::Pi(_) => "pi",
2069 Expression::Radians(_) => "radians",
2070 Expression::Degrees(_) => "degrees",
2071 Expression::Sin(_) => "sin",
2072 Expression::Cos(_) => "cos",
2073 Expression::Tan(_) => "tan",
2074 Expression::Asin(_) => "asin",
2075 Expression::Acos(_) => "acos",
2076 Expression::Atan(_) => "atan",
2077 Expression::Atan2(_) => "atan2",
2078 Expression::IsNan(_) => "is_nan",
2079 Expression::IsInf(_) => "is_inf",
2080 Expression::IntDiv(_) => "int_div",
2081 Expression::Decode(_) => "decode",
2082 Expression::DateFormat(_) => "date_format",
2083 Expression::FormatDate(_) => "format_date",
2084 Expression::Year(_) => "year",
2085 Expression::Month(_) => "month",
2086 Expression::Day(_) => "day",
2087 Expression::Hour(_) => "hour",
2088 Expression::Minute(_) => "minute",
2089 Expression::Second(_) => "second",
2090 Expression::DayOfWeek(_) => "day_of_week",
2091 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2092 Expression::DayOfMonth(_) => "day_of_month",
2093 Expression::DayOfYear(_) => "day_of_year",
2094 Expression::WeekOfYear(_) => "week_of_year",
2095 Expression::Quarter(_) => "quarter",
2096 Expression::AddMonths(_) => "add_months",
2097 Expression::MonthsBetween(_) => "months_between",
2098 Expression::LastDay(_) => "last_day",
2099 Expression::NextDay(_) => "next_day",
2100 Expression::Epoch(_) => "epoch",
2101 Expression::EpochMs(_) => "epoch_ms",
2102 Expression::FromUnixtime(_) => "from_unixtime",
2103 Expression::UnixTimestamp(_) => "unix_timestamp",
2104 Expression::MakeDate(_) => "make_date",
2105 Expression::MakeTimestamp(_) => "make_timestamp",
2106 Expression::TimestampTrunc(_) => "timestamp_trunc",
2107 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2108 Expression::SessionUser(_) => "session_user",
2109 Expression::SHA(_) => "s_h_a",
2110 Expression::SHA1Digest(_) => "s_h_a1_digest",
2111 Expression::TimeToUnix(_) => "time_to_unix",
2112 Expression::ArrayFunc(_) => "array_func",
2113 Expression::ArrayLength(_) => "array_length",
2114 Expression::ArraySize(_) => "array_size",
2115 Expression::Cardinality(_) => "cardinality",
2116 Expression::ArrayContains(_) => "array_contains",
2117 Expression::ArrayPosition(_) => "array_position",
2118 Expression::ArrayAppend(_) => "array_append",
2119 Expression::ArrayPrepend(_) => "array_prepend",
2120 Expression::ArrayConcat(_) => "array_concat",
2121 Expression::ArraySort(_) => "array_sort",
2122 Expression::ArrayReverse(_) => "array_reverse",
2123 Expression::ArrayDistinct(_) => "array_distinct",
2124 Expression::ArrayJoin(_) => "array_join",
2125 Expression::ArrayToString(_) => "array_to_string",
2126 Expression::Unnest(_) => "unnest",
2127 Expression::Explode(_) => "explode",
2128 Expression::ExplodeOuter(_) => "explode_outer",
2129 Expression::ArrayFilter(_) => "array_filter",
2130 Expression::ArrayTransform(_) => "array_transform",
2131 Expression::ArrayFlatten(_) => "array_flatten",
2132 Expression::ArrayCompact(_) => "array_compact",
2133 Expression::ArrayIntersect(_) => "array_intersect",
2134 Expression::ArrayUnion(_) => "array_union",
2135 Expression::ArrayExcept(_) => "array_except",
2136 Expression::ArrayRemove(_) => "array_remove",
2137 Expression::ArrayZip(_) => "array_zip",
2138 Expression::Sequence(_) => "sequence",
2139 Expression::Generate(_) => "generate",
2140 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2141 Expression::ToArray(_) => "to_array",
2142 Expression::StarMap(_) => "star_map",
2143 Expression::StructFunc(_) => "struct_func",
2144 Expression::StructExtract(_) => "struct_extract",
2145 Expression::NamedStruct(_) => "named_struct",
2146 Expression::MapFunc(_) => "map_func",
2147 Expression::MapFromEntries(_) => "map_from_entries",
2148 Expression::MapFromArrays(_) => "map_from_arrays",
2149 Expression::MapKeys(_) => "map_keys",
2150 Expression::MapValues(_) => "map_values",
2151 Expression::MapContainsKey(_) => "map_contains_key",
2152 Expression::MapConcat(_) => "map_concat",
2153 Expression::ElementAt(_) => "element_at",
2154 Expression::TransformKeys(_) => "transform_keys",
2155 Expression::TransformValues(_) => "transform_values",
2156 Expression::FunctionEmits(_) => "function_emits",
2157 Expression::JsonExtract(_) => "json_extract",
2158 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2159 Expression::JsonExtractPath(_) => "json_extract_path",
2160 Expression::JsonArray(_) => "json_array",
2161 Expression::JsonObject(_) => "json_object",
2162 Expression::JsonQuery(_) => "json_query",
2163 Expression::JsonValue(_) => "json_value",
2164 Expression::JsonArrayLength(_) => "json_array_length",
2165 Expression::JsonKeys(_) => "json_keys",
2166 Expression::JsonType(_) => "json_type",
2167 Expression::ParseJson(_) => "parse_json",
2168 Expression::ToJson(_) => "to_json",
2169 Expression::JsonSet(_) => "json_set",
2170 Expression::JsonInsert(_) => "json_insert",
2171 Expression::JsonRemove(_) => "json_remove",
2172 Expression::JsonMergePatch(_) => "json_merge_patch",
2173 Expression::JsonArrayAgg(_) => "json_array_agg",
2174 Expression::JsonObjectAgg(_) => "json_object_agg",
2175 Expression::Convert(_) => "convert",
2176 Expression::Typeof(_) => "typeof",
2177 Expression::Lambda(_) => "lambda",
2178 Expression::Parameter(_) => "parameter",
2179 Expression::Placeholder(_) => "placeholder",
2180 Expression::NamedArgument(_) => "named_argument",
2181 Expression::TableArgument(_) => "table_argument",
2182 Expression::SqlComment(_) => "sql_comment",
2183 Expression::NullSafeEq(_) => "null_safe_eq",
2184 Expression::NullSafeNeq(_) => "null_safe_neq",
2185 Expression::Glob(_) => "glob",
2186 Expression::SimilarTo(_) => "similar_to",
2187 Expression::Any(_) => "any",
2188 Expression::All(_) => "all",
2189 Expression::Overlaps(_) => "overlaps",
2190 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2191 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2192 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2193 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2194 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2195 Expression::Subscript(_) => "subscript",
2196 Expression::Dot(_) => "dot",
2197 Expression::MethodCall(_) => "method_call",
2198 Expression::ArraySlice(_) => "array_slice",
2199 Expression::CreateTable(_) => "create_table",
2200 Expression::DropTable(_) => "drop_table",
2201 Expression::Undrop(_) => "undrop",
2202 Expression::AlterTable(_) => "alter_table",
2203 Expression::CreateIndex(_) => "create_index",
2204 Expression::DropIndex(_) => "drop_index",
2205 Expression::CreateView(_) => "create_view",
2206 Expression::DropView(_) => "drop_view",
2207 Expression::AlterView(_) => "alter_view",
2208 Expression::AlterIndex(_) => "alter_index",
2209 Expression::Truncate(_) => "truncate",
2210 Expression::Use(_) => "use",
2211 Expression::Cache(_) => "cache",
2212 Expression::Uncache(_) => "uncache",
2213 Expression::LoadData(_) => "load_data",
2214 Expression::Pragma(_) => "pragma",
2215 Expression::Grant(_) => "grant",
2216 Expression::Revoke(_) => "revoke",
2217 Expression::Comment(_) => "comment",
2218 Expression::SetStatement(_) => "set_statement",
2219 Expression::CreateSchema(_) => "create_schema",
2220 Expression::DropSchema(_) => "drop_schema",
2221 Expression::DropNamespace(_) => "drop_namespace",
2222 Expression::CreateDatabase(_) => "create_database",
2223 Expression::DropDatabase(_) => "drop_database",
2224 Expression::CreateFunction(_) => "create_function",
2225 Expression::DropFunction(_) => "drop_function",
2226 Expression::CreateProcedure(_) => "create_procedure",
2227 Expression::DropProcedure(_) => "drop_procedure",
2228 Expression::CreateSequence(_) => "create_sequence",
2229 Expression::CreateSynonym(_) => "create_synonym",
2230 Expression::DropSequence(_) => "drop_sequence",
2231 Expression::AlterSequence(_) => "alter_sequence",
2232 Expression::CreateTrigger(_) => "create_trigger",
2233 Expression::DropTrigger(_) => "drop_trigger",
2234 Expression::CreateType(_) => "create_type",
2235 Expression::DropType(_) => "drop_type",
2236 Expression::Describe(_) => "describe",
2237 Expression::Show(_) => "show",
2238 Expression::Command(_) => "command",
2239 Expression::TryCatch(_) => "try_catch",
2240 Expression::Kill(_) => "kill",
2241 Expression::Prepare(_) => "prepare",
2242 Expression::Execute(_) => "execute",
2243 Expression::Raw(_) => "raw",
2244 Expression::CreateTask(_) => "create_task",
2245 Expression::Paren(_) => "paren",
2246 Expression::Annotated(_) => "annotated",
2247 Expression::Refresh(_) => "refresh",
2248 Expression::LockingStatement(_) => "locking_statement",
2249 Expression::SequenceProperties(_) => "sequence_properties",
2250 Expression::TruncateTable(_) => "truncate_table",
2251 Expression::Clone(_) => "clone",
2252 Expression::Attach(_) => "attach",
2253 Expression::Detach(_) => "detach",
2254 Expression::Install(_) => "install",
2255 Expression::Summarize(_) => "summarize",
2256 Expression::Declare(_) => "declare",
2257 Expression::DeclareItem(_) => "declare_item",
2258 Expression::Set(_) => "set",
2259 Expression::Heredoc(_) => "heredoc",
2260 Expression::SetItem(_) => "set_item",
2261 Expression::QueryBand(_) => "query_band",
2262 Expression::UserDefinedFunction(_) => "user_defined_function",
2263 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2264 Expression::ProjectionDef(_) => "projection_def",
2265 Expression::TableAlias(_) => "table_alias",
2266 Expression::ByteString(_) => "byte_string",
2267 Expression::HexStringExpr(_) => "hex_string_expr",
2268 Expression::UnicodeString(_) => "unicode_string",
2269 Expression::ColumnPosition(_) => "column_position",
2270 Expression::ColumnDef(_) => "column_def",
2271 Expression::AlterColumn(_) => "alter_column",
2272 Expression::AlterSortKey(_) => "alter_sort_key",
2273 Expression::AlterSet(_) => "alter_set",
2274 Expression::RenameColumn(_) => "rename_column",
2275 Expression::Comprehension(_) => "comprehension",
2276 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2277 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2278 Expression::IndexConstraintOption(_) => "index_constraint_option",
2279 Expression::ColumnConstraint(_) => "column_constraint",
2280 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2281 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2282 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2283 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2284 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2285 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2286 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2287 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2288 Expression::WithOperator(_) => "with_operator",
2289 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2290 "generated_as_identity_column_constraint"
2291 }
2292 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2293 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2294 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2295 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2296 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2297 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2298 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2299 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2300 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2301 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2302 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2303 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2304 Expression::PathColumnConstraint(_) => "path_column_constraint",
2305 Expression::Constraint(_) => "constraint",
2306 Expression::Export(_) => "export",
2307 Expression::Filter(_) => "filter",
2308 Expression::Changes(_) => "changes",
2309 Expression::CopyParameter(_) => "copy_parameter",
2310 Expression::Credentials(_) => "credentials",
2311 Expression::Directory(_) => "directory",
2312 Expression::ForeignKey(_) => "foreign_key",
2313 Expression::ColumnPrefix(_) => "column_prefix",
2314 Expression::PrimaryKey(_) => "primary_key",
2315 Expression::IntoClause(_) => "into_clause",
2316 Expression::JoinHint(_) => "join_hint",
2317 Expression::Opclass(_) => "opclass",
2318 Expression::Index(_) => "index",
2319 Expression::IndexParameters(_) => "index_parameters",
2320 Expression::ConditionalInsert(_) => "conditional_insert",
2321 Expression::MultitableInserts(_) => "multitable_inserts",
2322 Expression::OnConflict(_) => "on_conflict",
2323 Expression::OnCondition(_) => "on_condition",
2324 Expression::Returning(_) => "returning",
2325 Expression::Introducer(_) => "introducer",
2326 Expression::PartitionRange(_) => "partition_range",
2327 Expression::Fetch(_) => "fetch",
2328 Expression::Group(_) => "group",
2329 Expression::Cube(_) => "cube",
2330 Expression::Rollup(_) => "rollup",
2331 Expression::GroupingSets(_) => "grouping_sets",
2332 Expression::LimitOptions(_) => "limit_options",
2333 Expression::Lateral(_) => "lateral",
2334 Expression::TableFromRows(_) => "table_from_rows",
2335 Expression::RowsFrom(_) => "rows_from",
2336 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2337 Expression::WithFill(_) => "with_fill",
2338 Expression::Property(_) => "property",
2339 Expression::GrantPrivilege(_) => "grant_privilege",
2340 Expression::GrantPrincipal(_) => "grant_principal",
2341 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2342 Expression::AlgorithmProperty(_) => "algorithm_property",
2343 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2344 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2345 Expression::BackupProperty(_) => "backup_property",
2346 Expression::BuildProperty(_) => "build_property",
2347 Expression::BlockCompressionProperty(_) => "block_compression_property",
2348 Expression::CharacterSetProperty(_) => "character_set_property",
2349 Expression::ChecksumProperty(_) => "checksum_property",
2350 Expression::CollateProperty(_) => "collate_property",
2351 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2352 Expression::DataDeletionProperty(_) => "data_deletion_property",
2353 Expression::DefinerProperty(_) => "definer_property",
2354 Expression::DistKeyProperty(_) => "dist_key_property",
2355 Expression::DistributedByProperty(_) => "distributed_by_property",
2356 Expression::DistStyleProperty(_) => "dist_style_property",
2357 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2358 Expression::EngineProperty(_) => "engine_property",
2359 Expression::ToTableProperty(_) => "to_table_property",
2360 Expression::ExecuteAsProperty(_) => "execute_as_property",
2361 Expression::ExternalProperty(_) => "external_property",
2362 Expression::FallbackProperty(_) => "fallback_property",
2363 Expression::FileFormatProperty(_) => "file_format_property",
2364 Expression::CredentialsProperty(_) => "credentials_property",
2365 Expression::FreespaceProperty(_) => "freespace_property",
2366 Expression::InheritsProperty(_) => "inherits_property",
2367 Expression::InputModelProperty(_) => "input_model_property",
2368 Expression::OutputModelProperty(_) => "output_model_property",
2369 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2370 Expression::JournalProperty(_) => "journal_property",
2371 Expression::LanguageProperty(_) => "language_property",
2372 Expression::EnviromentProperty(_) => "enviroment_property",
2373 Expression::ClusteredByProperty(_) => "clustered_by_property",
2374 Expression::DictProperty(_) => "dict_property",
2375 Expression::DictRange(_) => "dict_range",
2376 Expression::OnCluster(_) => "on_cluster",
2377 Expression::LikeProperty(_) => "like_property",
2378 Expression::LocationProperty(_) => "location_property",
2379 Expression::LockProperty(_) => "lock_property",
2380 Expression::LockingProperty(_) => "locking_property",
2381 Expression::LogProperty(_) => "log_property",
2382 Expression::MaterializedProperty(_) => "materialized_property",
2383 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2384 Expression::OnProperty(_) => "on_property",
2385 Expression::OnCommitProperty(_) => "on_commit_property",
2386 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2387 Expression::PartitionByProperty(_) => "partition_by_property",
2388 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2389 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2390 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2391 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2392 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2393 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2394 Expression::PartitionList(_) => "partition_list",
2395 Expression::Partition(_) => "partition",
2396 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2397 Expression::UniqueKeyProperty(_) => "unique_key_property",
2398 Expression::RollupProperty(_) => "rollup_property",
2399 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2400 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2401 Expression::RemoteWithConnectionModelProperty(_) => {
2402 "remote_with_connection_model_property"
2403 }
2404 Expression::ReturnsProperty(_) => "returns_property",
2405 Expression::RowFormatProperty(_) => "row_format_property",
2406 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2407 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2408 Expression::QueryTransform(_) => "query_transform",
2409 Expression::SampleProperty(_) => "sample_property",
2410 Expression::SecurityProperty(_) => "security_property",
2411 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2412 Expression::SemanticView(_) => "semantic_view",
2413 Expression::SerdeProperties(_) => "serde_properties",
2414 Expression::SetProperty(_) => "set_property",
2415 Expression::SharingProperty(_) => "sharing_property",
2416 Expression::SetConfigProperty(_) => "set_config_property",
2417 Expression::SettingsProperty(_) => "settings_property",
2418 Expression::SortKeyProperty(_) => "sort_key_property",
2419 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2420 Expression::SqlSecurityProperty(_) => "sql_security_property",
2421 Expression::StabilityProperty(_) => "stability_property",
2422 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2423 Expression::TemporaryProperty(_) => "temporary_property",
2424 Expression::Tags(_) => "tags",
2425 Expression::TransformModelProperty(_) => "transform_model_property",
2426 Expression::TransientProperty(_) => "transient_property",
2427 Expression::UsingTemplateProperty(_) => "using_template_property",
2428 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2429 Expression::VolatileProperty(_) => "volatile_property",
2430 Expression::WithDataProperty(_) => "with_data_property",
2431 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2432 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2433 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2434 Expression::WithProcedureOptions(_) => "with_procedure_options",
2435 Expression::EncodeProperty(_) => "encode_property",
2436 Expression::IncludeProperty(_) => "include_property",
2437 Expression::Properties(_) => "properties",
2438 Expression::OptionsProperty(_) => "options_property",
2439 Expression::InputOutputFormat(_) => "input_output_format",
2440 Expression::Reference(_) => "reference",
2441 Expression::QueryOption(_) => "query_option",
2442 Expression::WithTableHint(_) => "with_table_hint",
2443 Expression::IndexTableHint(_) => "index_table_hint",
2444 Expression::HistoricalData(_) => "historical_data",
2445 Expression::Get(_) => "get",
2446 Expression::SetOperation(_) => "set_operation",
2447 Expression::Var(_) => "var",
2448 Expression::Variadic(_) => "variadic",
2449 Expression::Version(_) => "version",
2450 Expression::Schema(_) => "schema",
2451 Expression::Lock(_) => "lock",
2452 Expression::TableSample(_) => "table_sample",
2453 Expression::Tag(_) => "tag",
2454 Expression::UnpivotColumns(_) => "unpivot_columns",
2455 Expression::WindowSpec(_) => "window_spec",
2456 Expression::SessionParameter(_) => "session_parameter",
2457 Expression::PseudoType(_) => "pseudo_type",
2458 Expression::ObjectIdentifier(_) => "object_identifier",
2459 Expression::Transaction(_) => "transaction",
2460 Expression::Commit(_) => "commit",
2461 Expression::Rollback(_) => "rollback",
2462 Expression::AlterSession(_) => "alter_session",
2463 Expression::Analyze(_) => "analyze",
2464 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2465 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2466 Expression::AnalyzeSample(_) => "analyze_sample",
2467 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2468 Expression::AnalyzeDelete(_) => "analyze_delete",
2469 Expression::AnalyzeWith(_) => "analyze_with",
2470 Expression::AnalyzeValidate(_) => "analyze_validate",
2471 Expression::AddPartition(_) => "add_partition",
2472 Expression::AttachOption(_) => "attach_option",
2473 Expression::DropPartition(_) => "drop_partition",
2474 Expression::ReplacePartition(_) => "replace_partition",
2475 Expression::DPipe(_) => "d_pipe",
2476 Expression::Operator(_) => "operator",
2477 Expression::PivotAny(_) => "pivot_any",
2478 Expression::Aliases(_) => "aliases",
2479 Expression::AtIndex(_) => "at_index",
2480 Expression::FromTimeZone(_) => "from_time_zone",
2481 Expression::FormatPhrase(_) => "format_phrase",
2482 Expression::ForIn(_) => "for_in",
2483 Expression::TimeUnit(_) => "time_unit",
2484 Expression::IntervalOp(_) => "interval_op",
2485 Expression::IntervalSpan(_) => "interval_span",
2486 Expression::HavingMax(_) => "having_max",
2487 Expression::CosineDistance(_) => "cosine_distance",
2488 Expression::DotProduct(_) => "dot_product",
2489 Expression::EuclideanDistance(_) => "euclidean_distance",
2490 Expression::ManhattanDistance(_) => "manhattan_distance",
2491 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2492 Expression::Booland(_) => "booland",
2493 Expression::Boolor(_) => "boolor",
2494 Expression::ParameterizedAgg(_) => "parameterized_agg",
2495 Expression::ArgMax(_) => "arg_max",
2496 Expression::ArgMin(_) => "arg_min",
2497 Expression::ApproxTopK(_) => "approx_top_k",
2498 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2499 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2500 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2501 Expression::ApproxTopSum(_) => "approx_top_sum",
2502 Expression::ApproxQuantiles(_) => "approx_quantiles",
2503 Expression::Minhash(_) => "minhash",
2504 Expression::FarmFingerprint(_) => "farm_fingerprint",
2505 Expression::Float64(_) => "float64",
2506 Expression::Transform(_) => "transform",
2507 Expression::Translate(_) => "translate",
2508 Expression::Grouping(_) => "grouping",
2509 Expression::GroupingId(_) => "grouping_id",
2510 Expression::Anonymous(_) => "anonymous",
2511 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2512 Expression::CombinedAggFunc(_) => "combined_agg_func",
2513 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2514 Expression::HashAgg(_) => "hash_agg",
2515 Expression::Hll(_) => "hll",
2516 Expression::Apply(_) => "apply",
2517 Expression::ToBoolean(_) => "to_boolean",
2518 Expression::List(_) => "list",
2519 Expression::ToMap(_) => "to_map",
2520 Expression::Pad(_) => "pad",
2521 Expression::ToChar(_) => "to_char",
2522 Expression::ToNumber(_) => "to_number",
2523 Expression::ToDouble(_) => "to_double",
2524 Expression::Int64(_) => "int64",
2525 Expression::StringFunc(_) => "string_func",
2526 Expression::ToDecfloat(_) => "to_decfloat",
2527 Expression::TryToDecfloat(_) => "try_to_decfloat",
2528 Expression::ToFile(_) => "to_file",
2529 Expression::Columns(_) => "columns",
2530 Expression::ConvertToCharset(_) => "convert_to_charset",
2531 Expression::ConvertTimezone(_) => "convert_timezone",
2532 Expression::GenerateSeries(_) => "generate_series",
2533 Expression::AIAgg(_) => "a_i_agg",
2534 Expression::AIClassify(_) => "a_i_classify",
2535 Expression::ArrayAll(_) => "array_all",
2536 Expression::ArrayAny(_) => "array_any",
2537 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2538 Expression::StPoint(_) => "st_point",
2539 Expression::StDistance(_) => "st_distance",
2540 Expression::StringToArray(_) => "string_to_array",
2541 Expression::ArraySum(_) => "array_sum",
2542 Expression::ObjectAgg(_) => "object_agg",
2543 Expression::CastToStrType(_) => "cast_to_str_type",
2544 Expression::CheckJson(_) => "check_json",
2545 Expression::CheckXml(_) => "check_xml",
2546 Expression::TranslateCharacters(_) => "translate_characters",
2547 Expression::CurrentSchemas(_) => "current_schemas",
2548 Expression::CurrentDatetime(_) => "current_datetime",
2549 Expression::Localtime(_) => "localtime",
2550 Expression::Localtimestamp(_) => "localtimestamp",
2551 Expression::Systimestamp(_) => "systimestamp",
2552 Expression::CurrentSchema(_) => "current_schema",
2553 Expression::CurrentUser(_) => "current_user",
2554 Expression::UtcTime(_) => "utc_time",
2555 Expression::UtcTimestamp(_) => "utc_timestamp",
2556 Expression::Timestamp(_) => "timestamp",
2557 Expression::DateBin(_) => "date_bin",
2558 Expression::Datetime(_) => "datetime",
2559 Expression::DatetimeAdd(_) => "datetime_add",
2560 Expression::DatetimeSub(_) => "datetime_sub",
2561 Expression::DatetimeDiff(_) => "datetime_diff",
2562 Expression::DatetimeTrunc(_) => "datetime_trunc",
2563 Expression::Dayname(_) => "dayname",
2564 Expression::MakeInterval(_) => "make_interval",
2565 Expression::PreviousDay(_) => "previous_day",
2566 Expression::Elt(_) => "elt",
2567 Expression::TimestampAdd(_) => "timestamp_add",
2568 Expression::TimestampSub(_) => "timestamp_sub",
2569 Expression::TimestampDiff(_) => "timestamp_diff",
2570 Expression::TimeSlice(_) => "time_slice",
2571 Expression::TimeAdd(_) => "time_add",
2572 Expression::TimeSub(_) => "time_sub",
2573 Expression::TimeDiff(_) => "time_diff",
2574 Expression::TimeTrunc(_) => "time_trunc",
2575 Expression::DateFromParts(_) => "date_from_parts",
2576 Expression::TimeFromParts(_) => "time_from_parts",
2577 Expression::DecodeCase(_) => "decode_case",
2578 Expression::Decrypt(_) => "decrypt",
2579 Expression::DecryptRaw(_) => "decrypt_raw",
2580 Expression::Encode(_) => "encode",
2581 Expression::Encrypt(_) => "encrypt",
2582 Expression::EncryptRaw(_) => "encrypt_raw",
2583 Expression::EqualNull(_) => "equal_null",
2584 Expression::ToBinary(_) => "to_binary",
2585 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2586 Expression::Base64DecodeString(_) => "base64_decode_string",
2587 Expression::Base64Encode(_) => "base64_encode",
2588 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2589 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2590 Expression::GapFill(_) => "gap_fill",
2591 Expression::GenerateDateArray(_) => "generate_date_array",
2592 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2593 Expression::GetExtract(_) => "get_extract",
2594 Expression::Getbit(_) => "getbit",
2595 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2596 Expression::HexEncode(_) => "hex_encode",
2597 Expression::Compress(_) => "compress",
2598 Expression::DecompressBinary(_) => "decompress_binary",
2599 Expression::DecompressString(_) => "decompress_string",
2600 Expression::Xor(_) => "xor",
2601 Expression::Nullif(_) => "nullif",
2602 Expression::JSON(_) => "j_s_o_n",
2603 Expression::JSONPath(_) => "j_s_o_n_path",
2604 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2605 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2606 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2607 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2608 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2609 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2610 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2611 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2612 Expression::Format(_) => "format",
2613 Expression::JSONKeys(_) => "j_s_o_n_keys",
2614 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2615 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2616 Expression::JSONObject(_) => "j_s_o_n_object",
2617 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2618 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2619 Expression::JSONArray(_) => "j_s_o_n_array",
2620 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2621 Expression::JSONExists(_) => "j_s_o_n_exists",
2622 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2623 Expression::JSONSchema(_) => "j_s_o_n_schema",
2624 Expression::JSONSet(_) => "j_s_o_n_set",
2625 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2626 Expression::JSONValue(_) => "j_s_o_n_value",
2627 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2628 Expression::JSONRemove(_) => "j_s_o_n_remove",
2629 Expression::JSONTable(_) => "j_s_o_n_table",
2630 Expression::JSONType(_) => "j_s_o_n_type",
2631 Expression::ObjectInsert(_) => "object_insert",
2632 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2633 Expression::OpenJSON(_) => "open_j_s_o_n",
2634 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2635 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2636 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2637 Expression::JSONCast(_) => "j_s_o_n_cast",
2638 Expression::JSONExtract(_) => "j_s_o_n_extract",
2639 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2640 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2641 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2642 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2643 Expression::JSONFormat(_) => "j_s_o_n_format",
2644 Expression::JSONBool(_) => "j_s_o_n_bool",
2645 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2646 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2647 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2648 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2649 Expression::ParseJSON(_) => "parse_j_s_o_n",
2650 Expression::ParseUrl(_) => "parse_url",
2651 Expression::ParseIp(_) => "parse_ip",
2652 Expression::ParseTime(_) => "parse_time",
2653 Expression::ParseDatetime(_) => "parse_datetime",
2654 Expression::Map(_) => "map",
2655 Expression::MapCat(_) => "map_cat",
2656 Expression::MapDelete(_) => "map_delete",
2657 Expression::MapInsert(_) => "map_insert",
2658 Expression::MapPick(_) => "map_pick",
2659 Expression::ScopeResolution(_) => "scope_resolution",
2660 Expression::Slice(_) => "slice",
2661 Expression::VarMap(_) => "var_map",
2662 Expression::MatchAgainst(_) => "match_against",
2663 Expression::MD5Digest(_) => "m_d5_digest",
2664 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2665 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2666 Expression::Monthname(_) => "monthname",
2667 Expression::Ntile(_) => "ntile",
2668 Expression::Normalize(_) => "normalize",
2669 Expression::Normal(_) => "normal",
2670 Expression::Predict(_) => "predict",
2671 Expression::MLTranslate(_) => "m_l_translate",
2672 Expression::FeaturesAtTime(_) => "features_at_time",
2673 Expression::GenerateEmbedding(_) => "generate_embedding",
2674 Expression::MLForecast(_) => "m_l_forecast",
2675 Expression::ModelAttribute(_) => "model_attribute",
2676 Expression::VectorSearch(_) => "vector_search",
2677 Expression::Quantile(_) => "quantile",
2678 Expression::ApproxQuantile(_) => "approx_quantile",
2679 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2680 Expression::Randn(_) => "randn",
2681 Expression::Randstr(_) => "randstr",
2682 Expression::RangeN(_) => "range_n",
2683 Expression::RangeBucket(_) => "range_bucket",
2684 Expression::ReadCSV(_) => "read_c_s_v",
2685 Expression::ReadParquet(_) => "read_parquet",
2686 Expression::Reduce(_) => "reduce",
2687 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2688 Expression::RegexpILike(_) => "regexp_i_like",
2689 Expression::RegexpFullMatch(_) => "regexp_full_match",
2690 Expression::RegexpInstr(_) => "regexp_instr",
2691 Expression::RegexpSplit(_) => "regexp_split",
2692 Expression::RegexpCount(_) => "regexp_count",
2693 Expression::RegrValx(_) => "regr_valx",
2694 Expression::RegrValy(_) => "regr_valy",
2695 Expression::RegrAvgy(_) => "regr_avgy",
2696 Expression::RegrAvgx(_) => "regr_avgx",
2697 Expression::RegrCount(_) => "regr_count",
2698 Expression::RegrIntercept(_) => "regr_intercept",
2699 Expression::RegrR2(_) => "regr_r2",
2700 Expression::RegrSxx(_) => "regr_sxx",
2701 Expression::RegrSxy(_) => "regr_sxy",
2702 Expression::RegrSyy(_) => "regr_syy",
2703 Expression::RegrSlope(_) => "regr_slope",
2704 Expression::SafeAdd(_) => "safe_add",
2705 Expression::SafeDivide(_) => "safe_divide",
2706 Expression::SafeMultiply(_) => "safe_multiply",
2707 Expression::SafeSubtract(_) => "safe_subtract",
2708 Expression::SHA2(_) => "s_h_a2",
2709 Expression::SHA2Digest(_) => "s_h_a2_digest",
2710 Expression::SortArray(_) => "sort_array",
2711 Expression::SplitPart(_) => "split_part",
2712 Expression::SubstringIndex(_) => "substring_index",
2713 Expression::StandardHash(_) => "standard_hash",
2714 Expression::StrPosition(_) => "str_position",
2715 Expression::Search(_) => "search",
2716 Expression::SearchIp(_) => "search_ip",
2717 Expression::StrToDate(_) => "str_to_date",
2718 Expression::DateStrToDate(_) => "date_str_to_date",
2719 Expression::DateToDateStr(_) => "date_to_date_str",
2720 Expression::StrToTime(_) => "str_to_time",
2721 Expression::StrToUnix(_) => "str_to_unix",
2722 Expression::StrToMap(_) => "str_to_map",
2723 Expression::NumberToStr(_) => "number_to_str",
2724 Expression::FromBase(_) => "from_base",
2725 Expression::Stuff(_) => "stuff",
2726 Expression::TimeToStr(_) => "time_to_str",
2727 Expression::TimeStrToTime(_) => "time_str_to_time",
2728 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2729 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2730 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2731 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2732 Expression::Unhex(_) => "unhex",
2733 Expression::Uniform(_) => "uniform",
2734 Expression::UnixToStr(_) => "unix_to_str",
2735 Expression::UnixToTime(_) => "unix_to_time",
2736 Expression::Uuid(_) => "uuid",
2737 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2738 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2739 Expression::Corr(_) => "corr",
2740 Expression::WidthBucket(_) => "width_bucket",
2741 Expression::CovarSamp(_) => "covar_samp",
2742 Expression::CovarPop(_) => "covar_pop",
2743 Expression::Week(_) => "week",
2744 Expression::XMLElement(_) => "x_m_l_element",
2745 Expression::XMLGet(_) => "x_m_l_get",
2746 Expression::XMLTable(_) => "x_m_l_table",
2747 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2748 Expression::Zipf(_) => "zipf",
2749 Expression::Merge(_) => "merge",
2750 Expression::When(_) => "when",
2751 Expression::Whens(_) => "whens",
2752 Expression::NextValueFor(_) => "next_value_for",
2753 Expression::ReturnStmt(_) => "return_stmt",
2754 }
2755 }
2756
2757 pub fn get_this(&self) -> Option<&Expression> {
2759 match self {
2760 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2762 Expression::Upper(f)
2764 | Expression::Lower(f)
2765 | Expression::Length(f)
2766 | Expression::LTrim(f)
2767 | Expression::RTrim(f)
2768 | Expression::Reverse(f)
2769 | Expression::Abs(f)
2770 | Expression::Sqrt(f)
2771 | Expression::Cbrt(f)
2772 | Expression::Ln(f)
2773 | Expression::Exp(f)
2774 | Expression::Sign(f)
2775 | Expression::Date(f)
2776 | Expression::Time(f)
2777 | Expression::Initcap(f)
2778 | Expression::Ascii(f)
2779 | Expression::Chr(f)
2780 | Expression::Soundex(f)
2781 | Expression::ByteLength(f)
2782 | Expression::Hex(f)
2783 | Expression::LowerHex(f)
2784 | Expression::Unicode(f)
2785 | Expression::Typeof(f)
2786 | Expression::Explode(f)
2787 | Expression::ExplodeOuter(f)
2788 | Expression::MapFromEntries(f)
2789 | Expression::MapKeys(f)
2790 | Expression::MapValues(f)
2791 | Expression::ArrayLength(f)
2792 | Expression::ArraySize(f)
2793 | Expression::Cardinality(f)
2794 | Expression::ArrayReverse(f)
2795 | Expression::ArrayDistinct(f)
2796 | Expression::ArrayFlatten(f)
2797 | Expression::ArrayCompact(f)
2798 | Expression::ToArray(f)
2799 | Expression::JsonArrayLength(f)
2800 | Expression::JsonKeys(f)
2801 | Expression::JsonType(f)
2802 | Expression::ParseJson(f)
2803 | Expression::ToJson(f)
2804 | Expression::Radians(f)
2805 | Expression::Degrees(f)
2806 | Expression::Sin(f)
2807 | Expression::Cos(f)
2808 | Expression::Tan(f)
2809 | Expression::Asin(f)
2810 | Expression::Acos(f)
2811 | Expression::Atan(f)
2812 | Expression::IsNan(f)
2813 | Expression::IsInf(f)
2814 | Expression::Year(f)
2815 | Expression::Month(f)
2816 | Expression::Day(f)
2817 | Expression::Hour(f)
2818 | Expression::Minute(f)
2819 | Expression::Second(f)
2820 | Expression::DayOfWeek(f)
2821 | Expression::DayOfWeekIso(f)
2822 | Expression::DayOfMonth(f)
2823 | Expression::DayOfYear(f)
2824 | Expression::WeekOfYear(f)
2825 | Expression::Quarter(f)
2826 | Expression::Epoch(f)
2827 | Expression::EpochMs(f)
2828 | Expression::BitwiseCount(f)
2829 | Expression::DateFromUnixDate(f)
2830 | Expression::UnixDate(f)
2831 | Expression::UnixSeconds(f)
2832 | Expression::UnixMillis(f)
2833 | Expression::UnixMicros(f)
2834 | Expression::TimeStrToDate(f)
2835 | Expression::DateToDi(f)
2836 | Expression::DiToDate(f)
2837 | Expression::TsOrDiToDi(f)
2838 | Expression::TsOrDsToDatetime(f)
2839 | Expression::TsOrDsToTimestamp(f)
2840 | Expression::YearOfWeek(f)
2841 | Expression::YearOfWeekIso(f)
2842 | Expression::SHA(f)
2843 | Expression::SHA1Digest(f)
2844 | Expression::TimeToUnix(f)
2845 | Expression::TimeStrToUnix(f)
2846 | Expression::Int64(f)
2847 | Expression::JSONBool(f)
2848 | Expression::MD5NumberLower64(f)
2849 | Expression::MD5NumberUpper64(f)
2850 | Expression::DateStrToDate(f)
2851 | Expression::DateToDateStr(f) => Some(&f.this),
2852 Expression::Power(f)
2854 | Expression::NullIf(f)
2855 | Expression::IfNull(f)
2856 | Expression::Nvl(f)
2857 | Expression::Contains(f)
2858 | Expression::StartsWith(f)
2859 | Expression::EndsWith(f)
2860 | Expression::Levenshtein(f)
2861 | Expression::ModFunc(f)
2862 | Expression::IntDiv(f)
2863 | Expression::Atan2(f)
2864 | Expression::AddMonths(f)
2865 | Expression::MonthsBetween(f)
2866 | Expression::NextDay(f)
2867 | Expression::UnixToTimeStr(f)
2868 | Expression::ArrayContains(f)
2869 | Expression::ArrayPosition(f)
2870 | Expression::ArrayAppend(f)
2871 | Expression::ArrayPrepend(f)
2872 | Expression::ArrayUnion(f)
2873 | Expression::ArrayExcept(f)
2874 | Expression::ArrayRemove(f)
2875 | Expression::StarMap(f)
2876 | Expression::MapFromArrays(f)
2877 | Expression::MapContainsKey(f)
2878 | Expression::ElementAt(f)
2879 | Expression::JsonMergePatch(f)
2880 | Expression::JSONBContains(f)
2881 | Expression::JSONBExtract(f) => Some(&f.this),
2882 Expression::Sum(af)
2884 | Expression::Avg(af)
2885 | Expression::Min(af)
2886 | Expression::Max(af)
2887 | Expression::ArrayAgg(af)
2888 | Expression::CountIf(af)
2889 | Expression::Stddev(af)
2890 | Expression::StddevPop(af)
2891 | Expression::StddevSamp(af)
2892 | Expression::Variance(af)
2893 | Expression::VarPop(af)
2894 | Expression::VarSamp(af)
2895 | Expression::Median(af)
2896 | Expression::Mode(af)
2897 | Expression::First(af)
2898 | Expression::Last(af)
2899 | Expression::AnyValue(af)
2900 | Expression::ApproxDistinct(af)
2901 | Expression::ApproxCountDistinct(af)
2902 | Expression::LogicalAnd(af)
2903 | Expression::LogicalOr(af)
2904 | Expression::Skewness(af)
2905 | Expression::ArrayConcatAgg(af)
2906 | Expression::ArrayUniqueAgg(af)
2907 | Expression::BoolXorAgg(af)
2908 | Expression::BitwiseAndAgg(af)
2909 | Expression::BitwiseOrAgg(af)
2910 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2911 Expression::And(op)
2913 | Expression::Or(op)
2914 | Expression::Add(op)
2915 | Expression::Sub(op)
2916 | Expression::Mul(op)
2917 | Expression::Div(op)
2918 | Expression::Mod(op)
2919 | Expression::Eq(op)
2920 | Expression::Neq(op)
2921 | Expression::Lt(op)
2922 | Expression::Lte(op)
2923 | Expression::Gt(op)
2924 | Expression::Gte(op)
2925 | Expression::BitwiseAnd(op)
2926 | Expression::BitwiseOr(op)
2927 | Expression::BitwiseXor(op)
2928 | Expression::Concat(op)
2929 | Expression::Adjacent(op)
2930 | Expression::TsMatch(op)
2931 | Expression::PropertyEQ(op)
2932 | Expression::ArrayContainsAll(op)
2933 | Expression::ArrayContainedBy(op)
2934 | Expression::ArrayOverlaps(op)
2935 | Expression::JSONBContainsAllTopKeys(op)
2936 | Expression::JSONBContainsAnyTopKeys(op)
2937 | Expression::JSONBDeleteAtPath(op)
2938 | Expression::ExtendsLeft(op)
2939 | Expression::ExtendsRight(op)
2940 | Expression::Is(op)
2941 | Expression::MemberOf(op)
2942 | Expression::Match(op)
2943 | Expression::NullSafeEq(op)
2944 | Expression::NullSafeNeq(op)
2945 | Expression::Glob(op)
2946 | Expression::BitwiseLeftShift(op)
2947 | Expression::BitwiseRightShift(op) => Some(&op.left),
2948 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2950 Expression::Alias(a) => Some(&a.this),
2952 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2953 Expression::Paren(p) => Some(&p.this),
2954 Expression::Annotated(a) => Some(&a.this),
2955 Expression::Subquery(s) => Some(&s.this),
2956 Expression::Where(w) => Some(&w.this),
2957 Expression::Having(h) => Some(&h.this),
2958 Expression::Qualify(q) => Some(&q.this),
2959 Expression::IsNull(i) => Some(&i.this),
2960 Expression::Exists(e) => Some(&e.this),
2961 Expression::Ordered(o) => Some(&o.this),
2962 Expression::WindowFunction(wf) => Some(&wf.this),
2963 Expression::Cte(cte) => Some(&cte.this),
2964 Expression::Between(b) => Some(&b.this),
2965 Expression::In(i) => Some(&i.this),
2966 Expression::ReturnStmt(e) => Some(e),
2967 _ => None,
2968 }
2969 }
2970
2971 pub fn get_expression(&self) -> Option<&Expression> {
2973 match self {
2974 Expression::And(op)
2976 | Expression::Or(op)
2977 | Expression::Add(op)
2978 | Expression::Sub(op)
2979 | Expression::Mul(op)
2980 | Expression::Div(op)
2981 | Expression::Mod(op)
2982 | Expression::Eq(op)
2983 | Expression::Neq(op)
2984 | Expression::Lt(op)
2985 | Expression::Lte(op)
2986 | Expression::Gt(op)
2987 | Expression::Gte(op)
2988 | Expression::BitwiseAnd(op)
2989 | Expression::BitwiseOr(op)
2990 | Expression::BitwiseXor(op)
2991 | Expression::Concat(op)
2992 | Expression::Adjacent(op)
2993 | Expression::TsMatch(op)
2994 | Expression::PropertyEQ(op)
2995 | Expression::ArrayContainsAll(op)
2996 | Expression::ArrayContainedBy(op)
2997 | Expression::ArrayOverlaps(op)
2998 | Expression::JSONBContainsAllTopKeys(op)
2999 | Expression::JSONBContainsAnyTopKeys(op)
3000 | Expression::JSONBDeleteAtPath(op)
3001 | Expression::ExtendsLeft(op)
3002 | Expression::ExtendsRight(op)
3003 | Expression::Is(op)
3004 | Expression::MemberOf(op)
3005 | Expression::Match(op)
3006 | Expression::NullSafeEq(op)
3007 | Expression::NullSafeNeq(op)
3008 | Expression::Glob(op)
3009 | Expression::BitwiseLeftShift(op)
3010 | Expression::BitwiseRightShift(op) => Some(&op.right),
3011 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3013 Expression::Power(f)
3015 | Expression::NullIf(f)
3016 | Expression::IfNull(f)
3017 | Expression::Nvl(f)
3018 | Expression::Contains(f)
3019 | Expression::StartsWith(f)
3020 | Expression::EndsWith(f)
3021 | Expression::Levenshtein(f)
3022 | Expression::ModFunc(f)
3023 | Expression::IntDiv(f)
3024 | Expression::Atan2(f)
3025 | Expression::AddMonths(f)
3026 | Expression::MonthsBetween(f)
3027 | Expression::NextDay(f)
3028 | Expression::UnixToTimeStr(f)
3029 | Expression::ArrayContains(f)
3030 | Expression::ArrayPosition(f)
3031 | Expression::ArrayAppend(f)
3032 | Expression::ArrayPrepend(f)
3033 | Expression::ArrayUnion(f)
3034 | Expression::ArrayExcept(f)
3035 | Expression::ArrayRemove(f)
3036 | Expression::StarMap(f)
3037 | Expression::MapFromArrays(f)
3038 | Expression::MapContainsKey(f)
3039 | Expression::ElementAt(f)
3040 | Expression::JsonMergePatch(f)
3041 | Expression::JSONBContains(f)
3042 | Expression::JSONBExtract(f) => Some(&f.expression),
3043 _ => None,
3044 }
3045 }
3046
3047 pub fn get_expressions(&self) -> &[Expression] {
3049 match self {
3050 Expression::Select(s) => &s.expressions,
3051 Expression::Function(f) => &f.args,
3052 Expression::AggregateFunction(f) => &f.args,
3053 Expression::From(f) => &f.expressions,
3054 Expression::GroupBy(g) => &g.expressions,
3055 Expression::In(i) => &i.expressions,
3056 Expression::Array(a) => &a.expressions,
3057 Expression::Tuple(t) => &t.expressions,
3058 Expression::Coalesce(f)
3059 | Expression::Greatest(f)
3060 | Expression::Least(f)
3061 | Expression::ArrayConcat(f)
3062 | Expression::ArrayIntersect(f)
3063 | Expression::ArrayZip(f)
3064 | Expression::MapConcat(f)
3065 | Expression::JsonArray(f) => &f.expressions,
3066 _ => &[],
3067 }
3068 }
3069
3070 pub fn get_name(&self) -> &str {
3072 match self {
3073 Expression::Identifier(id) => &id.name,
3074 Expression::Column(col) => &col.name.name,
3075 Expression::Table(t) => &t.name.name,
3076 Expression::Literal(lit) => lit.value_str(),
3077 Expression::Star(_) => "*",
3078 Expression::Function(f) => &f.name,
3079 Expression::AggregateFunction(f) => &f.name,
3080 Expression::Alias(a) => a.this.get_name(),
3081 Expression::Boolean(b) => {
3082 if b.value {
3083 "TRUE"
3084 } else {
3085 "FALSE"
3086 }
3087 }
3088 Expression::Null(_) => "NULL",
3089 _ => "",
3090 }
3091 }
3092
3093 pub fn get_alias(&self) -> &str {
3095 match self {
3096 Expression::Alias(a) => &a.alias.name,
3097 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3098 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3099 _ => "",
3100 }
3101 }
3102
3103 pub fn get_output_name(&self) -> &str {
3105 match self {
3106 Expression::Alias(a) => &a.alias.name,
3107 Expression::Column(c) => &c.name.name,
3108 Expression::Identifier(id) => &id.name,
3109 Expression::Literal(lit) => lit.value_str(),
3110 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3111 Expression::Star(_) => "*",
3112 _ => "",
3113 }
3114 }
3115
3116 pub fn get_comments(&self) -> Vec<&str> {
3118 match self {
3119 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3120 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3121 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3122 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3123 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3124 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3125 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3126 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3127 }
3128 Expression::And(op)
3129 | Expression::Or(op)
3130 | Expression::Add(op)
3131 | Expression::Sub(op)
3132 | Expression::Mul(op)
3133 | Expression::Div(op)
3134 | Expression::Mod(op)
3135 | Expression::Eq(op)
3136 | Expression::Neq(op)
3137 | Expression::Lt(op)
3138 | Expression::Lte(op)
3139 | Expression::Gt(op)
3140 | Expression::Gte(op)
3141 | Expression::Concat(op)
3142 | Expression::BitwiseAnd(op)
3143 | Expression::BitwiseOr(op)
3144 | Expression::BitwiseXor(op) => {
3145 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3146 }
3147 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3148 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3149 _ => Vec::new(),
3150 }
3151 }
3152}
3153
3154impl fmt::Display for Expression {
3155 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3156 match self {
3158 Expression::Literal(lit) => write!(f, "{}", lit),
3159 Expression::Identifier(id) => write!(f, "{}", id),
3160 Expression::Column(col) => write!(f, "{}", col),
3161 Expression::Star(_) => write!(f, "*"),
3162 Expression::Null(_) => write!(f, "NULL"),
3163 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3164 Expression::Select(_) => write!(f, "SELECT ..."),
3165 _ => write!(f, "{:?}", self),
3166 }
3167 }
3168}
3169
3170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3180#[cfg_attr(feature = "bindings", derive(TS))]
3181#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3182pub enum Literal {
3183 String(String),
3185 Number(String),
3187 HexString(String),
3189 HexNumber(String),
3191 BitString(String),
3192 ByteString(String),
3194 NationalString(String),
3196 Date(String),
3198 Time(String),
3200 Timestamp(String),
3202 Datetime(String),
3204 TripleQuotedString(String, char),
3207 EscapeString(String),
3209 DollarString(String),
3211 RawString(String),
3215}
3216
3217impl Literal {
3218 pub fn value_str(&self) -> &str {
3220 match self {
3221 Literal::String(s)
3222 | Literal::Number(s)
3223 | Literal::HexString(s)
3224 | Literal::HexNumber(s)
3225 | Literal::BitString(s)
3226 | Literal::ByteString(s)
3227 | Literal::NationalString(s)
3228 | Literal::Date(s)
3229 | Literal::Time(s)
3230 | Literal::Timestamp(s)
3231 | Literal::Datetime(s)
3232 | Literal::EscapeString(s)
3233 | Literal::DollarString(s)
3234 | Literal::RawString(s) => s.as_str(),
3235 Literal::TripleQuotedString(s, _) => s.as_str(),
3236 }
3237 }
3238
3239 pub fn is_string(&self) -> bool {
3241 matches!(
3242 self,
3243 Literal::String(_)
3244 | Literal::NationalString(_)
3245 | Literal::EscapeString(_)
3246 | Literal::DollarString(_)
3247 | Literal::RawString(_)
3248 | Literal::TripleQuotedString(_, _)
3249 )
3250 }
3251
3252 pub fn is_number(&self) -> bool {
3254 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3255 }
3256}
3257
3258impl fmt::Display for Literal {
3259 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3260 match self {
3261 Literal::String(s) => write!(f, "'{}'", s),
3262 Literal::Number(n) => write!(f, "{}", n),
3263 Literal::HexString(h) => write!(f, "X'{}'", h),
3264 Literal::HexNumber(h) => write!(f, "0x{}", h),
3265 Literal::BitString(b) => write!(f, "B'{}'", b),
3266 Literal::ByteString(b) => write!(f, "b'{}'", b),
3267 Literal::NationalString(s) => write!(f, "N'{}'", s),
3268 Literal::Date(d) => write!(f, "DATE '{}'", d),
3269 Literal::Time(t) => write!(f, "TIME '{}'", t),
3270 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3271 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3272 Literal::TripleQuotedString(s, q) => {
3273 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3274 }
3275 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3276 Literal::DollarString(s) => write!(f, "$${}$$", s),
3277 Literal::RawString(s) => write!(f, "r'{}'", s),
3278 }
3279 }
3280}
3281
3282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3284#[cfg_attr(feature = "bindings", derive(TS))]
3285pub struct BooleanLiteral {
3286 pub value: bool,
3287}
3288
3289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3291#[cfg_attr(feature = "bindings", derive(TS))]
3292pub struct Null;
3293
3294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3301#[cfg_attr(feature = "bindings", derive(TS))]
3302pub struct Identifier {
3303 pub name: String,
3305 pub quoted: bool,
3307 #[serde(default)]
3308 pub trailing_comments: Vec<String>,
3309 #[serde(default, skip_serializing_if = "Option::is_none")]
3311 pub span: Option<Span>,
3312}
3313
3314impl Identifier {
3315 pub fn new(name: impl Into<String>) -> Self {
3316 Self {
3317 name: name.into(),
3318 quoted: false,
3319 trailing_comments: Vec::new(),
3320 span: None,
3321 }
3322 }
3323
3324 pub fn quoted(name: impl Into<String>) -> Self {
3325 Self {
3326 name: name.into(),
3327 quoted: true,
3328 trailing_comments: Vec::new(),
3329 span: None,
3330 }
3331 }
3332
3333 pub fn empty() -> Self {
3334 Self {
3335 name: String::new(),
3336 quoted: false,
3337 trailing_comments: Vec::new(),
3338 span: None,
3339 }
3340 }
3341
3342 pub fn is_empty(&self) -> bool {
3343 self.name.is_empty()
3344 }
3345
3346 pub fn with_span(mut self, span: Span) -> Self {
3348 self.span = Some(span);
3349 self
3350 }
3351}
3352
3353impl fmt::Display for Identifier {
3354 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3355 if self.quoted {
3356 write!(f, "\"{}\"", self.name)
3357 } else {
3358 write!(f, "{}", self.name)
3359 }
3360 }
3361}
3362
3363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3369#[cfg_attr(feature = "bindings", derive(TS))]
3370pub struct Column {
3371 pub name: Identifier,
3373 pub table: Option<Identifier>,
3375 #[serde(default)]
3377 pub join_mark: bool,
3378 #[serde(default)]
3380 pub trailing_comments: Vec<String>,
3381 #[serde(default, skip_serializing_if = "Option::is_none")]
3383 pub span: Option<Span>,
3384 #[serde(default, skip_serializing_if = "Option::is_none")]
3386 pub inferred_type: Option<DataType>,
3387}
3388
3389impl fmt::Display for Column {
3390 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3391 if let Some(table) = &self.table {
3392 write!(f, "{}.{}", table, self.name)
3393 } else {
3394 write!(f, "{}", self.name)
3395 }
3396 }
3397}
3398
3399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3406#[cfg_attr(feature = "bindings", derive(TS))]
3407pub struct TableRef {
3408 pub name: Identifier,
3410 pub schema: Option<Identifier>,
3412 pub catalog: Option<Identifier>,
3414 pub alias: Option<Identifier>,
3416 #[serde(default)]
3418 pub alias_explicit_as: bool,
3419 #[serde(default)]
3421 pub column_aliases: Vec<Identifier>,
3422 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3424 pub leading_comments: Vec<String>,
3425 #[serde(default)]
3427 pub trailing_comments: Vec<String>,
3428 #[serde(default)]
3430 pub when: Option<Box<HistoricalData>>,
3431 #[serde(default)]
3433 pub only: bool,
3434 #[serde(default)]
3436 pub final_: bool,
3437 #[serde(default, skip_serializing_if = "Option::is_none")]
3439 pub table_sample: Option<Box<Sample>>,
3440 #[serde(default)]
3442 pub hints: Vec<Expression>,
3443 #[serde(default, skip_serializing_if = "Option::is_none")]
3446 pub system_time: Option<String>,
3447 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3449 pub partitions: Vec<Identifier>,
3450 #[serde(default, skip_serializing_if = "Option::is_none")]
3453 pub identifier_func: Option<Box<Expression>>,
3454 #[serde(default, skip_serializing_if = "Option::is_none")]
3456 pub changes: Option<Box<Changes>>,
3457 #[serde(default, skip_serializing_if = "Option::is_none")]
3459 pub version: Option<Box<Version>>,
3460 #[serde(default, skip_serializing_if = "Option::is_none")]
3462 pub span: Option<Span>,
3463}
3464
3465impl TableRef {
3466 pub fn new(name: impl Into<String>) -> Self {
3467 Self {
3468 name: Identifier::new(name),
3469 schema: None,
3470 catalog: None,
3471 alias: None,
3472 alias_explicit_as: false,
3473 column_aliases: Vec::new(),
3474 leading_comments: Vec::new(),
3475 trailing_comments: Vec::new(),
3476 when: None,
3477 only: false,
3478 final_: false,
3479 table_sample: None,
3480 hints: Vec::new(),
3481 system_time: None,
3482 partitions: Vec::new(),
3483 identifier_func: None,
3484 changes: None,
3485 version: None,
3486 span: None,
3487 }
3488 }
3489
3490 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3492 let mut t = Self::new(name);
3493 t.schema = Some(Identifier::new(schema));
3494 t
3495 }
3496
3497 pub fn new_with_catalog(
3499 name: impl Into<String>,
3500 schema: impl Into<String>,
3501 catalog: impl Into<String>,
3502 ) -> Self {
3503 let mut t = Self::new(name);
3504 t.schema = Some(Identifier::new(schema));
3505 t.catalog = Some(Identifier::new(catalog));
3506 t
3507 }
3508
3509 pub fn from_identifier(name: Identifier) -> Self {
3511 Self {
3512 name,
3513 schema: None,
3514 catalog: None,
3515 alias: None,
3516 alias_explicit_as: false,
3517 column_aliases: Vec::new(),
3518 leading_comments: Vec::new(),
3519 trailing_comments: Vec::new(),
3520 when: None,
3521 only: false,
3522 final_: false,
3523 table_sample: None,
3524 hints: Vec::new(),
3525 system_time: None,
3526 partitions: Vec::new(),
3527 identifier_func: None,
3528 changes: None,
3529 version: None,
3530 span: None,
3531 }
3532 }
3533
3534 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3535 self.alias = Some(Identifier::new(alias));
3536 self
3537 }
3538
3539 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3540 self.schema = Some(Identifier::new(schema));
3541 self
3542 }
3543}
3544
3545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3550#[cfg_attr(feature = "bindings", derive(TS))]
3551pub struct Star {
3552 pub table: Option<Identifier>,
3554 pub except: Option<Vec<Identifier>>,
3556 pub replace: Option<Vec<Alias>>,
3558 pub rename: Option<Vec<(Identifier, Identifier)>>,
3560 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3562 pub trailing_comments: Vec<String>,
3563 #[serde(default, skip_serializing_if = "Option::is_none")]
3565 pub span: Option<Span>,
3566}
3567
3568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3592#[cfg_attr(feature = "bindings", derive(TS))]
3593pub struct Select {
3594 pub expressions: Vec<Expression>,
3596 pub from: Option<From>,
3598 pub joins: Vec<Join>,
3600 pub lateral_views: Vec<LateralView>,
3601 #[serde(default, skip_serializing_if = "Option::is_none")]
3603 pub prewhere: Option<Expression>,
3604 pub where_clause: Option<Where>,
3605 pub group_by: Option<GroupBy>,
3606 pub having: Option<Having>,
3607 pub qualify: Option<Qualify>,
3608 pub order_by: Option<OrderBy>,
3609 pub distribute_by: Option<DistributeBy>,
3610 pub cluster_by: Option<ClusterBy>,
3611 pub sort_by: Option<SortBy>,
3612 pub limit: Option<Limit>,
3613 pub offset: Option<Offset>,
3614 #[serde(default, skip_serializing_if = "Option::is_none")]
3616 pub limit_by: Option<Vec<Expression>>,
3617 pub fetch: Option<Fetch>,
3618 pub distinct: bool,
3619 pub distinct_on: Option<Vec<Expression>>,
3620 pub top: Option<Top>,
3621 pub with: Option<With>,
3622 pub sample: Option<Sample>,
3623 #[serde(default, skip_serializing_if = "Option::is_none")]
3625 pub settings: Option<Vec<Expression>>,
3626 #[serde(default, skip_serializing_if = "Option::is_none")]
3628 pub format: Option<Expression>,
3629 pub windows: Option<Vec<NamedWindow>>,
3630 pub hint: Option<Hint>,
3631 pub connect: Option<Connect>,
3633 pub into: Option<SelectInto>,
3635 #[serde(default)]
3637 pub locks: Vec<Lock>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3640 pub for_xml: Vec<Expression>,
3641 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3643 pub for_json: Vec<Expression>,
3644 #[serde(default)]
3646 pub leading_comments: Vec<String>,
3647 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3650 pub post_select_comments: Vec<String>,
3651 #[serde(default, skip_serializing_if = "Option::is_none")]
3653 pub kind: Option<String>,
3654 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3656 pub operation_modifiers: Vec<String>,
3657 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3659 pub qualify_after_window: bool,
3660 #[serde(default, skip_serializing_if = "Option::is_none")]
3662 pub option: Option<String>,
3663 #[serde(default, skip_serializing_if = "Option::is_none")]
3666 pub exclude: Option<Vec<Expression>>,
3667}
3668
3669impl Select {
3670 pub fn new() -> Self {
3671 Self {
3672 expressions: Vec::new(),
3673 from: None,
3674 joins: Vec::new(),
3675 lateral_views: Vec::new(),
3676 prewhere: None,
3677 where_clause: None,
3678 group_by: None,
3679 having: None,
3680 qualify: None,
3681 order_by: None,
3682 distribute_by: None,
3683 cluster_by: None,
3684 sort_by: None,
3685 limit: None,
3686 offset: None,
3687 limit_by: None,
3688 fetch: None,
3689 distinct: false,
3690 distinct_on: None,
3691 top: None,
3692 with: None,
3693 sample: None,
3694 settings: None,
3695 format: None,
3696 windows: None,
3697 hint: None,
3698 connect: None,
3699 into: None,
3700 locks: Vec::new(),
3701 for_xml: Vec::new(),
3702 for_json: Vec::new(),
3703 leading_comments: Vec::new(),
3704 post_select_comments: Vec::new(),
3705 kind: None,
3706 operation_modifiers: Vec::new(),
3707 qualify_after_window: false,
3708 option: None,
3709 exclude: None,
3710 }
3711 }
3712
3713 pub fn column(mut self, expr: Expression) -> Self {
3715 self.expressions.push(expr);
3716 self
3717 }
3718
3719 pub fn from(mut self, table: Expression) -> Self {
3721 self.from = Some(From {
3722 expressions: vec![table],
3723 });
3724 self
3725 }
3726
3727 pub fn where_(mut self, condition: Expression) -> Self {
3729 self.where_clause = Some(Where { this: condition });
3730 self
3731 }
3732
3733 pub fn distinct(mut self) -> Self {
3735 self.distinct = true;
3736 self
3737 }
3738
3739 pub fn join(mut self, join: Join) -> Self {
3741 self.joins.push(join);
3742 self
3743 }
3744
3745 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3747 self.order_by = Some(OrderBy {
3748 expressions,
3749 siblings: false,
3750 comments: Vec::new(),
3751 });
3752 self
3753 }
3754
3755 pub fn limit(mut self, n: Expression) -> Self {
3757 self.limit = Some(Limit {
3758 this: n,
3759 percent: false,
3760 comments: Vec::new(),
3761 });
3762 self
3763 }
3764
3765 pub fn offset(mut self, n: Expression) -> Self {
3767 self.offset = Some(Offset {
3768 this: n,
3769 rows: None,
3770 });
3771 self
3772 }
3773}
3774
3775impl Default for Select {
3776 fn default() -> Self {
3777 Self::new()
3778 }
3779}
3780
3781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3787#[cfg_attr(feature = "bindings", derive(TS))]
3788pub struct Union {
3789 pub left: Expression,
3791 pub right: Expression,
3793 pub all: bool,
3795 #[serde(default)]
3797 pub distinct: bool,
3798 pub with: Option<With>,
3800 pub order_by: Option<OrderBy>,
3802 pub limit: Option<Box<Expression>>,
3804 pub offset: Option<Box<Expression>>,
3806 #[serde(default, skip_serializing_if = "Option::is_none")]
3808 pub distribute_by: Option<DistributeBy>,
3809 #[serde(default, skip_serializing_if = "Option::is_none")]
3811 pub sort_by: Option<SortBy>,
3812 #[serde(default, skip_serializing_if = "Option::is_none")]
3814 pub cluster_by: Option<ClusterBy>,
3815 #[serde(default)]
3817 pub by_name: bool,
3818 #[serde(default, skip_serializing_if = "Option::is_none")]
3820 pub side: Option<String>,
3821 #[serde(default, skip_serializing_if = "Option::is_none")]
3823 pub kind: Option<String>,
3824 #[serde(default)]
3826 pub corresponding: bool,
3827 #[serde(default)]
3829 pub strict: bool,
3830 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3832 pub on_columns: Vec<Expression>,
3833}
3834
3835impl Drop for Union {
3838 fn drop(&mut self) {
3839 loop {
3840 if let Expression::Union(ref mut inner) = self.left {
3841 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3842 let old_left = std::mem::replace(&mut self.left, next_left);
3843 drop(old_left);
3844 } else {
3845 break;
3846 }
3847 }
3848 }
3849}
3850
3851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3856#[cfg_attr(feature = "bindings", derive(TS))]
3857pub struct Intersect {
3858 pub left: Expression,
3860 pub right: Expression,
3862 pub all: bool,
3864 #[serde(default)]
3866 pub distinct: bool,
3867 pub with: Option<With>,
3869 pub order_by: Option<OrderBy>,
3871 pub limit: Option<Box<Expression>>,
3873 pub offset: Option<Box<Expression>>,
3875 #[serde(default, skip_serializing_if = "Option::is_none")]
3877 pub distribute_by: Option<DistributeBy>,
3878 #[serde(default, skip_serializing_if = "Option::is_none")]
3880 pub sort_by: Option<SortBy>,
3881 #[serde(default, skip_serializing_if = "Option::is_none")]
3883 pub cluster_by: Option<ClusterBy>,
3884 #[serde(default)]
3886 pub by_name: bool,
3887 #[serde(default, skip_serializing_if = "Option::is_none")]
3889 pub side: Option<String>,
3890 #[serde(default, skip_serializing_if = "Option::is_none")]
3892 pub kind: Option<String>,
3893 #[serde(default)]
3895 pub corresponding: bool,
3896 #[serde(default)]
3898 pub strict: bool,
3899 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3901 pub on_columns: Vec<Expression>,
3902}
3903
3904impl Drop for Intersect {
3905 fn drop(&mut self) {
3906 loop {
3907 if let Expression::Intersect(ref mut inner) = self.left {
3908 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3909 let old_left = std::mem::replace(&mut self.left, next_left);
3910 drop(old_left);
3911 } else {
3912 break;
3913 }
3914 }
3915 }
3916}
3917
3918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3923#[cfg_attr(feature = "bindings", derive(TS))]
3924pub struct Except {
3925 pub left: Expression,
3927 pub right: Expression,
3929 pub all: bool,
3931 #[serde(default)]
3933 pub distinct: bool,
3934 pub with: Option<With>,
3936 pub order_by: Option<OrderBy>,
3938 pub limit: Option<Box<Expression>>,
3940 pub offset: Option<Box<Expression>>,
3942 #[serde(default, skip_serializing_if = "Option::is_none")]
3944 pub distribute_by: Option<DistributeBy>,
3945 #[serde(default, skip_serializing_if = "Option::is_none")]
3947 pub sort_by: Option<SortBy>,
3948 #[serde(default, skip_serializing_if = "Option::is_none")]
3950 pub cluster_by: Option<ClusterBy>,
3951 #[serde(default)]
3953 pub by_name: bool,
3954 #[serde(default, skip_serializing_if = "Option::is_none")]
3956 pub side: Option<String>,
3957 #[serde(default, skip_serializing_if = "Option::is_none")]
3959 pub kind: Option<String>,
3960 #[serde(default)]
3962 pub corresponding: bool,
3963 #[serde(default)]
3965 pub strict: bool,
3966 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3968 pub on_columns: Vec<Expression>,
3969}
3970
3971impl Drop for Except {
3972 fn drop(&mut self) {
3973 loop {
3974 if let Expression::Except(ref mut inner) = self.left {
3975 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3976 let old_left = std::mem::replace(&mut self.left, next_left);
3977 drop(old_left);
3978 } else {
3979 break;
3980 }
3981 }
3982 }
3983}
3984
3985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3987#[cfg_attr(feature = "bindings", derive(TS))]
3988pub struct SelectInto {
3989 pub this: Expression,
3991 #[serde(default)]
3993 pub temporary: bool,
3994 #[serde(default)]
3996 pub unlogged: bool,
3997 #[serde(default)]
3999 pub bulk_collect: bool,
4000 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4002 pub expressions: Vec<Expression>,
4003}
4004
4005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4015#[cfg_attr(feature = "bindings", derive(TS))]
4016pub struct Subquery {
4017 pub this: Expression,
4019 pub alias: Option<Identifier>,
4021 pub column_aliases: Vec<Identifier>,
4023 #[serde(default)]
4025 pub alias_explicit_as: bool,
4026 #[serde(skip_serializing_if = "Option::is_none", default)]
4028 pub alias_keyword: Option<String>,
4029 pub order_by: Option<OrderBy>,
4031 pub limit: Option<Limit>,
4033 pub offset: Option<Offset>,
4035 #[serde(default, skip_serializing_if = "Option::is_none")]
4037 pub distribute_by: Option<DistributeBy>,
4038 #[serde(default, skip_serializing_if = "Option::is_none")]
4040 pub sort_by: Option<SortBy>,
4041 #[serde(default, skip_serializing_if = "Option::is_none")]
4043 pub cluster_by: Option<ClusterBy>,
4044 #[serde(default)]
4046 pub lateral: bool,
4047 #[serde(default)]
4051 pub modifiers_inside: bool,
4052 #[serde(default)]
4054 pub trailing_comments: Vec<String>,
4055 #[serde(default, skip_serializing_if = "Option::is_none")]
4057 pub inferred_type: Option<DataType>,
4058}
4059
4060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4065#[cfg_attr(feature = "bindings", derive(TS))]
4066pub struct PipeOperator {
4067 pub this: Expression,
4069 pub expression: Expression,
4071}
4072
4073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4075#[cfg_attr(feature = "bindings", derive(TS))]
4076pub struct Values {
4077 pub expressions: Vec<Tuple>,
4079 pub alias: Option<Identifier>,
4081 pub column_aliases: Vec<Identifier>,
4083}
4084
4085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4095#[cfg_attr(feature = "bindings", derive(TS))]
4096pub struct Pivot {
4097 pub this: Expression,
4099 #[serde(default)]
4102 pub expressions: Vec<Expression>,
4103 #[serde(default)]
4105 pub fields: Vec<Expression>,
4106 #[serde(default)]
4108 pub using: Vec<Expression>,
4109 #[serde(default)]
4111 pub group: Option<Box<Expression>>,
4112 #[serde(default)]
4114 pub unpivot: bool,
4115 #[serde(default)]
4117 pub into: Option<Box<Expression>>,
4118 #[serde(default)]
4120 pub alias: Option<Identifier>,
4121 #[serde(default)]
4123 pub include_nulls: Option<bool>,
4124 #[serde(default)]
4126 pub default_on_null: Option<Box<Expression>>,
4127 #[serde(default, skip_serializing_if = "Option::is_none")]
4129 pub with: Option<With>,
4130}
4131
4132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4134#[cfg_attr(feature = "bindings", derive(TS))]
4135pub struct Unpivot {
4136 pub this: Expression,
4137 pub value_column: Identifier,
4138 pub name_column: Identifier,
4139 pub columns: Vec<Expression>,
4140 pub alias: Option<Identifier>,
4141 #[serde(default)]
4143 pub value_column_parenthesized: bool,
4144 #[serde(default)]
4146 pub include_nulls: Option<bool>,
4147 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4149 pub extra_value_columns: Vec<Identifier>,
4150}
4151
4152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4155#[cfg_attr(feature = "bindings", derive(TS))]
4156pub struct PivotAlias {
4157 pub this: Expression,
4158 pub alias: Expression,
4159}
4160
4161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4163#[cfg_attr(feature = "bindings", derive(TS))]
4164pub struct PreWhere {
4165 pub this: Expression,
4166}
4167
4168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4170#[cfg_attr(feature = "bindings", derive(TS))]
4171pub struct Stream {
4172 pub this: Expression,
4173 #[serde(skip_serializing_if = "Option::is_none")]
4174 pub on: Option<Expression>,
4175 #[serde(skip_serializing_if = "Option::is_none")]
4176 pub show_initial_rows: Option<bool>,
4177}
4178
4179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4181#[cfg_attr(feature = "bindings", derive(TS))]
4182pub struct UsingData {
4183 pub this: Expression,
4184}
4185
4186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4188#[cfg_attr(feature = "bindings", derive(TS))]
4189pub struct XmlNamespace {
4190 pub this: Expression,
4191 #[serde(skip_serializing_if = "Option::is_none")]
4192 pub alias: Option<Identifier>,
4193}
4194
4195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4197#[cfg_attr(feature = "bindings", derive(TS))]
4198pub struct RowFormat {
4199 pub delimited: bool,
4200 pub fields_terminated_by: Option<String>,
4201 pub collection_items_terminated_by: Option<String>,
4202 pub map_keys_terminated_by: Option<String>,
4203 pub lines_terminated_by: Option<String>,
4204 pub null_defined_as: Option<String>,
4205}
4206
4207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4209#[cfg_attr(feature = "bindings", derive(TS))]
4210pub struct DirectoryInsert {
4211 pub local: bool,
4212 pub path: String,
4213 pub row_format: Option<RowFormat>,
4214 #[serde(default)]
4216 pub stored_as: Option<String>,
4217}
4218
4219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4221#[cfg_attr(feature = "bindings", derive(TS))]
4222pub struct Insert {
4223 pub table: TableRef,
4224 pub columns: Vec<Identifier>,
4225 pub values: Vec<Vec<Expression>>,
4226 pub query: Option<Expression>,
4227 pub overwrite: bool,
4229 pub partition: Vec<(Identifier, Option<Expression>)>,
4231 #[serde(default)]
4233 pub directory: Option<DirectoryInsert>,
4234 #[serde(default)]
4236 pub returning: Vec<Expression>,
4237 #[serde(default)]
4239 pub output: Option<OutputClause>,
4240 #[serde(default)]
4242 pub on_conflict: Option<Box<Expression>>,
4243 #[serde(default)]
4245 pub leading_comments: Vec<String>,
4246 #[serde(default)]
4248 pub if_exists: bool,
4249 #[serde(default)]
4251 pub with: Option<With>,
4252 #[serde(default)]
4254 pub ignore: bool,
4255 #[serde(default)]
4257 pub source_alias: Option<Identifier>,
4258 #[serde(default)]
4260 pub alias: Option<Identifier>,
4261 #[serde(default)]
4263 pub alias_explicit_as: bool,
4264 #[serde(default)]
4266 pub default_values: bool,
4267 #[serde(default)]
4269 pub by_name: bool,
4270 #[serde(default, skip_serializing_if = "Option::is_none")]
4272 pub conflict_action: Option<String>,
4273 #[serde(default)]
4275 pub is_replace: bool,
4276 #[serde(default, skip_serializing_if = "Option::is_none")]
4278 pub hint: Option<Hint>,
4279 #[serde(default)]
4281 pub replace_where: Option<Box<Expression>>,
4282 #[serde(default)]
4284 pub source: Option<Box<Expression>>,
4285 #[serde(default, skip_serializing_if = "Option::is_none")]
4287 pub function_target: Option<Box<Expression>>,
4288 #[serde(default, skip_serializing_if = "Option::is_none")]
4290 pub partition_by: Option<Box<Expression>>,
4291 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4293 pub settings: Vec<Expression>,
4294}
4295
4296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4298#[cfg_attr(feature = "bindings", derive(TS))]
4299pub struct OutputClause {
4300 pub columns: Vec<Expression>,
4302 #[serde(default)]
4304 pub into_table: Option<Expression>,
4305}
4306
4307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4309#[cfg_attr(feature = "bindings", derive(TS))]
4310pub struct Update {
4311 pub table: TableRef,
4312 #[serde(default)]
4313 pub hint: Option<Hint>,
4314 #[serde(default)]
4316 pub extra_tables: Vec<TableRef>,
4317 #[serde(default)]
4319 pub table_joins: Vec<Join>,
4320 pub set: Vec<(Identifier, Expression)>,
4321 pub from_clause: Option<From>,
4322 #[serde(default)]
4324 pub from_joins: Vec<Join>,
4325 pub where_clause: Option<Where>,
4326 #[serde(default)]
4328 pub returning: Vec<Expression>,
4329 #[serde(default)]
4331 pub output: Option<OutputClause>,
4332 #[serde(default)]
4334 pub with: Option<With>,
4335 #[serde(default)]
4337 pub leading_comments: Vec<String>,
4338 #[serde(default)]
4340 pub limit: Option<Expression>,
4341 #[serde(default)]
4343 pub order_by: Option<OrderBy>,
4344 #[serde(default)]
4346 pub from_before_set: bool,
4347}
4348
4349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4351#[cfg_attr(feature = "bindings", derive(TS))]
4352pub struct Delete {
4353 pub table: TableRef,
4354 #[serde(default)]
4355 pub hint: Option<Hint>,
4356 #[serde(default, skip_serializing_if = "Option::is_none")]
4358 pub on_cluster: Option<OnCluster>,
4359 pub alias: Option<Identifier>,
4361 #[serde(default)]
4363 pub alias_explicit_as: bool,
4364 pub using: Vec<TableRef>,
4366 pub where_clause: Option<Where>,
4367 #[serde(default)]
4369 pub output: Option<OutputClause>,
4370 #[serde(default)]
4372 pub leading_comments: Vec<String>,
4373 #[serde(default)]
4375 pub with: Option<With>,
4376 #[serde(default)]
4378 pub limit: Option<Expression>,
4379 #[serde(default)]
4381 pub order_by: Option<OrderBy>,
4382 #[serde(default)]
4384 pub returning: Vec<Expression>,
4385 #[serde(default)]
4388 pub tables: Vec<TableRef>,
4389 #[serde(default)]
4392 pub tables_from_using: bool,
4393 #[serde(default)]
4395 pub joins: Vec<Join>,
4396 #[serde(default)]
4398 pub force_index: Option<String>,
4399 #[serde(default)]
4401 pub no_from: bool,
4402}
4403
4404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4406#[cfg_attr(feature = "bindings", derive(TS))]
4407pub struct CopyStmt {
4408 pub this: Expression,
4410 pub kind: bool,
4412 pub files: Vec<Expression>,
4414 #[serde(default)]
4416 pub params: Vec<CopyParameter>,
4417 #[serde(default)]
4419 pub credentials: Option<Box<Credentials>>,
4420 #[serde(default)]
4422 pub is_into: bool,
4423 #[serde(default)]
4425 pub with_wrapped: bool,
4426}
4427
4428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4430#[cfg_attr(feature = "bindings", derive(TS))]
4431pub struct CopyParameter {
4432 pub name: String,
4433 pub value: Option<Expression>,
4434 pub values: Vec<Expression>,
4435 #[serde(default)]
4437 pub eq: bool,
4438}
4439
4440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4442#[cfg_attr(feature = "bindings", derive(TS))]
4443pub struct Credentials {
4444 pub credentials: Vec<(String, String)>,
4445 pub encryption: Option<String>,
4446 pub storage: Option<String>,
4447}
4448
4449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4451#[cfg_attr(feature = "bindings", derive(TS))]
4452pub struct PutStmt {
4453 pub source: String,
4455 #[serde(default)]
4457 pub source_quoted: bool,
4458 pub target: Expression,
4460 #[serde(default)]
4462 pub params: Vec<CopyParameter>,
4463}
4464
4465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4467#[cfg_attr(feature = "bindings", derive(TS))]
4468pub struct StageReference {
4469 pub name: String,
4471 #[serde(default)]
4473 pub path: Option<String>,
4474 #[serde(default)]
4476 pub file_format: Option<Expression>,
4477 #[serde(default)]
4479 pub pattern: Option<String>,
4480 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4482 pub quoted: bool,
4483}
4484
4485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4487#[cfg_attr(feature = "bindings", derive(TS))]
4488pub struct HistoricalData {
4489 pub this: Box<Expression>,
4491 pub kind: String,
4493 pub expression: Box<Expression>,
4495}
4496
4497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4502#[cfg_attr(feature = "bindings", derive(TS))]
4503pub struct Alias {
4504 pub this: Expression,
4506 pub alias: Identifier,
4508 #[serde(default)]
4510 pub column_aliases: Vec<Identifier>,
4511 #[serde(default)]
4513 pub alias_explicit_as: bool,
4514 #[serde(skip_serializing_if = "Option::is_none", default)]
4516 pub alias_keyword: Option<String>,
4517 #[serde(default)]
4519 pub pre_alias_comments: Vec<String>,
4520 #[serde(default)]
4522 pub trailing_comments: Vec<String>,
4523 #[serde(default, skip_serializing_if = "Option::is_none")]
4525 pub inferred_type: Option<DataType>,
4526}
4527
4528impl Alias {
4529 pub fn new(this: Expression, alias: Identifier) -> Self {
4531 Self {
4532 this,
4533 alias,
4534 column_aliases: Vec::new(),
4535 alias_explicit_as: false,
4536 alias_keyword: None,
4537 pre_alias_comments: Vec::new(),
4538 trailing_comments: Vec::new(),
4539 inferred_type: None,
4540 }
4541 }
4542
4543 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4545 Self {
4546 this,
4547 alias: Identifier::empty(),
4548 column_aliases,
4549 alias_explicit_as: false,
4550 alias_keyword: None,
4551 pre_alias_comments: Vec::new(),
4552 trailing_comments: Vec::new(),
4553 inferred_type: None,
4554 }
4555 }
4556}
4557
4558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4565#[cfg_attr(feature = "bindings", derive(TS))]
4566pub struct Cast {
4567 pub this: Expression,
4569 pub to: DataType,
4571 #[serde(default)]
4572 pub trailing_comments: Vec<String>,
4573 #[serde(default)]
4575 pub double_colon_syntax: bool,
4576 #[serde(skip_serializing_if = "Option::is_none", default)]
4578 pub format: Option<Box<Expression>>,
4579 #[serde(skip_serializing_if = "Option::is_none", default)]
4581 pub default: Option<Box<Expression>>,
4582 #[serde(default, skip_serializing_if = "Option::is_none")]
4584 pub inferred_type: Option<DataType>,
4585}
4586
4587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4589#[cfg_attr(feature = "bindings", derive(TS))]
4590pub struct CollationExpr {
4591 pub this: Expression,
4592 pub collation: String,
4593 #[serde(default)]
4595 pub quoted: bool,
4596 #[serde(default)]
4598 pub double_quoted: bool,
4599}
4600
4601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4607#[cfg_attr(feature = "bindings", derive(TS))]
4608pub struct Case {
4609 pub operand: Option<Expression>,
4611 pub whens: Vec<(Expression, Expression)>,
4613 pub else_: Option<Expression>,
4615 #[serde(default)]
4617 #[serde(skip_serializing_if = "Vec::is_empty")]
4618 pub comments: Vec<String>,
4619 #[serde(default, skip_serializing_if = "Option::is_none")]
4621 pub inferred_type: Option<DataType>,
4622}
4623
4624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4632#[cfg_attr(feature = "bindings", derive(TS))]
4633pub struct BinaryOp {
4634 pub left: Expression,
4635 pub right: Expression,
4636 #[serde(default)]
4638 pub left_comments: Vec<String>,
4639 #[serde(default)]
4641 pub operator_comments: Vec<String>,
4642 #[serde(default)]
4644 pub trailing_comments: Vec<String>,
4645 #[serde(default, skip_serializing_if = "Option::is_none")]
4647 pub inferred_type: Option<DataType>,
4648}
4649
4650impl BinaryOp {
4651 pub fn new(left: Expression, right: Expression) -> Self {
4652 Self {
4653 left,
4654 right,
4655 left_comments: Vec::new(),
4656 operator_comments: Vec::new(),
4657 trailing_comments: Vec::new(),
4658 inferred_type: None,
4659 }
4660 }
4661}
4662
4663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4665#[cfg_attr(feature = "bindings", derive(TS))]
4666pub struct LikeOp {
4667 pub left: Expression,
4668 pub right: Expression,
4669 #[serde(default)]
4671 pub escape: Option<Expression>,
4672 #[serde(default)]
4674 pub quantifier: Option<String>,
4675 #[serde(default, skip_serializing_if = "Option::is_none")]
4677 pub inferred_type: Option<DataType>,
4678}
4679
4680impl LikeOp {
4681 pub fn new(left: Expression, right: Expression) -> Self {
4682 Self {
4683 left,
4684 right,
4685 escape: None,
4686 quantifier: None,
4687 inferred_type: None,
4688 }
4689 }
4690
4691 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4692 Self {
4693 left,
4694 right,
4695 escape: Some(escape),
4696 quantifier: None,
4697 inferred_type: None,
4698 }
4699 }
4700}
4701
4702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4706#[cfg_attr(feature = "bindings", derive(TS))]
4707pub struct UnaryOp {
4708 pub this: Expression,
4710 #[serde(default, skip_serializing_if = "Option::is_none")]
4712 pub inferred_type: Option<DataType>,
4713}
4714
4715impl UnaryOp {
4716 pub fn new(this: Expression) -> Self {
4717 Self {
4718 this,
4719 inferred_type: None,
4720 }
4721 }
4722}
4723
4724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4729#[cfg_attr(feature = "bindings", derive(TS))]
4730pub struct In {
4731 pub this: Expression,
4733 pub expressions: Vec<Expression>,
4735 pub query: Option<Expression>,
4737 pub not: bool,
4739 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4740 pub global: bool,
4741 #[serde(default, skip_serializing_if = "Option::is_none")]
4743 pub unnest: Option<Box<Expression>>,
4744 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4748 pub is_field: bool,
4749}
4750
4751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4753#[cfg_attr(feature = "bindings", derive(TS))]
4754pub struct Between {
4755 pub this: Expression,
4757 pub low: Expression,
4759 pub high: Expression,
4761 pub not: bool,
4763 #[serde(default)]
4765 pub symmetric: Option<bool>,
4766}
4767
4768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4770#[cfg_attr(feature = "bindings", derive(TS))]
4771pub struct IsNull {
4772 pub this: Expression,
4773 pub not: bool,
4774 #[serde(default)]
4776 pub postfix_form: bool,
4777}
4778
4779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4781#[cfg_attr(feature = "bindings", derive(TS))]
4782pub struct IsTrueFalse {
4783 pub this: Expression,
4784 pub not: bool,
4785}
4786
4787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4790#[cfg_attr(feature = "bindings", derive(TS))]
4791pub struct IsJson {
4792 pub this: Expression,
4793 pub json_type: Option<String>,
4795 pub unique_keys: Option<JsonUniqueKeys>,
4797 pub negated: bool,
4799}
4800
4801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4803#[cfg_attr(feature = "bindings", derive(TS))]
4804pub enum JsonUniqueKeys {
4805 With,
4807 Without,
4809 Shorthand,
4811}
4812
4813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4815#[cfg_attr(feature = "bindings", derive(TS))]
4816pub struct Exists {
4817 pub this: Expression,
4819 pub not: bool,
4821}
4822
4823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4830#[cfg_attr(feature = "bindings", derive(TS))]
4831pub struct Function {
4832 pub name: String,
4834 pub args: Vec<Expression>,
4836 pub distinct: bool,
4838 #[serde(default)]
4839 pub trailing_comments: Vec<String>,
4840 #[serde(default)]
4842 pub use_bracket_syntax: bool,
4843 #[serde(default)]
4845 pub no_parens: bool,
4846 #[serde(default)]
4848 pub quoted: bool,
4849 #[serde(default, skip_serializing_if = "Option::is_none")]
4851 pub span: Option<Span>,
4852 #[serde(default, skip_serializing_if = "Option::is_none")]
4854 pub inferred_type: Option<DataType>,
4855}
4856
4857impl Default for Function {
4858 fn default() -> Self {
4859 Self {
4860 name: String::new(),
4861 args: Vec::new(),
4862 distinct: false,
4863 trailing_comments: Vec::new(),
4864 use_bracket_syntax: false,
4865 no_parens: false,
4866 quoted: false,
4867 span: None,
4868 inferred_type: None,
4869 }
4870 }
4871}
4872
4873impl Function {
4874 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4875 Self {
4876 name: name.into(),
4877 args,
4878 distinct: false,
4879 trailing_comments: Vec::new(),
4880 use_bracket_syntax: false,
4881 no_parens: false,
4882 quoted: false,
4883 span: None,
4884 inferred_type: None,
4885 }
4886 }
4887}
4888
4889#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4896#[cfg_attr(feature = "bindings", derive(TS))]
4897pub struct AggregateFunction {
4898 pub name: String,
4900 pub args: Vec<Expression>,
4902 pub distinct: bool,
4904 pub filter: Option<Expression>,
4906 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4908 pub order_by: Vec<Ordered>,
4909 #[serde(default, skip_serializing_if = "Option::is_none")]
4911 pub limit: Option<Box<Expression>>,
4912 #[serde(default, skip_serializing_if = "Option::is_none")]
4914 pub ignore_nulls: Option<bool>,
4915 #[serde(default, skip_serializing_if = "Option::is_none")]
4917 pub inferred_type: Option<DataType>,
4918}
4919
4920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4927#[cfg_attr(feature = "bindings", derive(TS))]
4928pub struct WindowFunction {
4929 pub this: Expression,
4931 pub over: Over,
4933 #[serde(default, skip_serializing_if = "Option::is_none")]
4935 pub keep: Option<Keep>,
4936 #[serde(default, skip_serializing_if = "Option::is_none")]
4938 pub inferred_type: Option<DataType>,
4939}
4940
4941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4944#[cfg_attr(feature = "bindings", derive(TS))]
4945pub struct Keep {
4946 pub first: bool,
4948 pub order_by: Vec<Ordered>,
4950}
4951
4952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4954#[cfg_attr(feature = "bindings", derive(TS))]
4955pub struct WithinGroup {
4956 pub this: Expression,
4958 pub order_by: Vec<Ordered>,
4960}
4961
4962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4967#[cfg_attr(feature = "bindings", derive(TS))]
4968pub struct From {
4969 pub expressions: Vec<Expression>,
4971}
4972
4973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4979#[cfg_attr(feature = "bindings", derive(TS))]
4980pub struct Join {
4981 pub this: Expression,
4983 pub on: Option<Expression>,
4985 pub using: Vec<Identifier>,
4987 pub kind: JoinKind,
4989 pub use_inner_keyword: bool,
4991 pub use_outer_keyword: bool,
4993 pub deferred_condition: bool,
4995 #[serde(default, skip_serializing_if = "Option::is_none")]
4997 pub join_hint: Option<String>,
4998 #[serde(default, skip_serializing_if = "Option::is_none")]
5000 pub match_condition: Option<Expression>,
5001 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5003 pub pivots: Vec<Expression>,
5004 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5006 pub comments: Vec<String>,
5007 #[serde(default)]
5011 pub nesting_group: usize,
5012 #[serde(default)]
5014 pub directed: bool,
5015}
5016
5017#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5024#[cfg_attr(feature = "bindings", derive(TS))]
5025pub enum JoinKind {
5026 Inner,
5027 Left,
5028 Right,
5029 Full,
5030 Outer, Cross,
5032 Natural,
5033 NaturalLeft,
5034 NaturalRight,
5035 NaturalFull,
5036 Semi,
5037 Anti,
5038 LeftSemi,
5040 LeftAnti,
5041 RightSemi,
5042 RightAnti,
5043 CrossApply,
5045 OuterApply,
5046 AsOf,
5048 AsOfLeft,
5049 AsOfRight,
5050 Lateral,
5052 LeftLateral,
5053 Straight,
5055 Implicit,
5057 Array,
5059 LeftArray,
5060 Paste,
5062 Positional,
5064}
5065
5066impl Default for JoinKind {
5067 fn default() -> Self {
5068 JoinKind::Inner
5069 }
5070}
5071
5072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5075#[cfg_attr(feature = "bindings", derive(TS))]
5076pub struct JoinedTable {
5077 pub left: Expression,
5079 pub joins: Vec<Join>,
5081 pub lateral_views: Vec<LateralView>,
5083 pub alias: Option<Identifier>,
5085}
5086
5087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5089#[cfg_attr(feature = "bindings", derive(TS))]
5090pub struct Where {
5091 pub this: Expression,
5093}
5094
5095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5100#[cfg_attr(feature = "bindings", derive(TS))]
5101pub struct GroupBy {
5102 pub expressions: Vec<Expression>,
5104 #[serde(default)]
5106 pub all: Option<bool>,
5107 #[serde(default)]
5109 pub totals: bool,
5110 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5112 pub comments: Vec<String>,
5113}
5114
5115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5117#[cfg_attr(feature = "bindings", derive(TS))]
5118pub struct Having {
5119 pub this: Expression,
5121 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5123 pub comments: Vec<String>,
5124}
5125
5126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5128#[cfg_attr(feature = "bindings", derive(TS))]
5129pub struct OrderBy {
5130 pub expressions: Vec<Ordered>,
5132 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5134 pub siblings: bool,
5135 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5137 pub comments: Vec<String>,
5138}
5139
5140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5147#[cfg_attr(feature = "bindings", derive(TS))]
5148pub struct Ordered {
5149 pub this: Expression,
5151 pub desc: bool,
5153 pub nulls_first: Option<bool>,
5155 #[serde(default)]
5157 pub explicit_asc: bool,
5158 #[serde(default, skip_serializing_if = "Option::is_none")]
5160 pub with_fill: Option<Box<WithFill>>,
5161}
5162
5163impl Ordered {
5164 pub fn asc(expr: Expression) -> Self {
5165 Self {
5166 this: expr,
5167 desc: false,
5168 nulls_first: None,
5169 explicit_asc: false,
5170 with_fill: None,
5171 }
5172 }
5173
5174 pub fn desc(expr: Expression) -> Self {
5175 Self {
5176 this: expr,
5177 desc: true,
5178 nulls_first: None,
5179 explicit_asc: false,
5180 with_fill: None,
5181 }
5182 }
5183}
5184
5185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5188#[cfg_attr(feature = "bindings", derive(TS))]
5189#[cfg_attr(feature = "bindings", ts(export))]
5190pub struct DistributeBy {
5191 pub expressions: Vec<Expression>,
5192}
5193
5194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5197#[cfg_attr(feature = "bindings", derive(TS))]
5198#[cfg_attr(feature = "bindings", ts(export))]
5199pub struct ClusterBy {
5200 pub expressions: Vec<Ordered>,
5201}
5202
5203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5206#[cfg_attr(feature = "bindings", derive(TS))]
5207#[cfg_attr(feature = "bindings", ts(export))]
5208pub struct SortBy {
5209 pub expressions: Vec<Ordered>,
5210}
5211
5212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5215#[cfg_attr(feature = "bindings", derive(TS))]
5216#[cfg_attr(feature = "bindings", ts(export))]
5217pub struct LateralView {
5218 pub this: Expression,
5220 pub table_alias: Option<Identifier>,
5222 pub column_aliases: Vec<Identifier>,
5224 pub outer: bool,
5226}
5227
5228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5230#[cfg_attr(feature = "bindings", derive(TS))]
5231#[cfg_attr(feature = "bindings", ts(export))]
5232pub struct Hint {
5233 pub expressions: Vec<HintExpression>,
5234}
5235
5236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5238#[cfg_attr(feature = "bindings", derive(TS))]
5239#[cfg_attr(feature = "bindings", ts(export))]
5240pub enum HintExpression {
5241 Function { name: String, args: Vec<Expression> },
5243 Identifier(String),
5245 Raw(String),
5247}
5248
5249#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5251#[cfg_attr(feature = "bindings", derive(TS))]
5252#[cfg_attr(feature = "bindings", ts(export))]
5253pub enum PseudocolumnType {
5254 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5261
5262impl PseudocolumnType {
5263 pub fn as_str(&self) -> &'static str {
5264 match self {
5265 PseudocolumnType::Rownum => "ROWNUM",
5266 PseudocolumnType::Rowid => "ROWID",
5267 PseudocolumnType::Level => "LEVEL",
5268 PseudocolumnType::Sysdate => "SYSDATE",
5269 PseudocolumnType::ObjectId => "OBJECT_ID",
5270 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5271 }
5272 }
5273
5274 pub fn from_str(s: &str) -> Option<Self> {
5275 match s.to_uppercase().as_str() {
5276 "ROWNUM" => Some(PseudocolumnType::Rownum),
5277 "ROWID" => Some(PseudocolumnType::Rowid),
5278 "LEVEL" => Some(PseudocolumnType::Level),
5279 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5280 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5281 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5282 _ => None,
5283 }
5284 }
5285}
5286
5287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5290#[cfg_attr(feature = "bindings", derive(TS))]
5291#[cfg_attr(feature = "bindings", ts(export))]
5292pub struct Pseudocolumn {
5293 pub kind: PseudocolumnType,
5294}
5295
5296impl Pseudocolumn {
5297 pub fn rownum() -> Self {
5298 Self {
5299 kind: PseudocolumnType::Rownum,
5300 }
5301 }
5302
5303 pub fn rowid() -> Self {
5304 Self {
5305 kind: PseudocolumnType::Rowid,
5306 }
5307 }
5308
5309 pub fn level() -> Self {
5310 Self {
5311 kind: PseudocolumnType::Level,
5312 }
5313 }
5314}
5315
5316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5318#[cfg_attr(feature = "bindings", derive(TS))]
5319#[cfg_attr(feature = "bindings", ts(export))]
5320pub struct Connect {
5321 pub start: Option<Expression>,
5323 pub connect: Expression,
5325 pub nocycle: bool,
5327}
5328
5329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5331#[cfg_attr(feature = "bindings", derive(TS))]
5332#[cfg_attr(feature = "bindings", ts(export))]
5333pub struct Prior {
5334 pub this: Expression,
5335}
5336
5337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5339#[cfg_attr(feature = "bindings", derive(TS))]
5340#[cfg_attr(feature = "bindings", ts(export))]
5341pub struct ConnectByRoot {
5342 pub this: Expression,
5343}
5344
5345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5347#[cfg_attr(feature = "bindings", derive(TS))]
5348#[cfg_attr(feature = "bindings", ts(export))]
5349pub struct MatchRecognize {
5350 pub this: Option<Box<Expression>>,
5352 pub partition_by: Option<Vec<Expression>>,
5354 pub order_by: Option<Vec<Ordered>>,
5356 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5358 pub rows: Option<MatchRecognizeRows>,
5360 pub after: Option<MatchRecognizeAfter>,
5362 pub pattern: Option<String>,
5364 pub define: Option<Vec<(Identifier, Expression)>>,
5366 pub alias: Option<Identifier>,
5368 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5370 pub alias_explicit_as: bool,
5371}
5372
5373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5375#[cfg_attr(feature = "bindings", derive(TS))]
5376#[cfg_attr(feature = "bindings", ts(export))]
5377pub struct MatchRecognizeMeasure {
5378 pub this: Expression,
5380 pub window_frame: Option<MatchRecognizeSemantics>,
5382}
5383
5384#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5386#[cfg_attr(feature = "bindings", derive(TS))]
5387#[cfg_attr(feature = "bindings", ts(export))]
5388pub enum MatchRecognizeSemantics {
5389 Running,
5390 Final,
5391}
5392
5393#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5395#[cfg_attr(feature = "bindings", derive(TS))]
5396#[cfg_attr(feature = "bindings", ts(export))]
5397pub enum MatchRecognizeRows {
5398 OneRowPerMatch,
5399 AllRowsPerMatch,
5400 AllRowsPerMatchShowEmptyMatches,
5401 AllRowsPerMatchOmitEmptyMatches,
5402 AllRowsPerMatchWithUnmatchedRows,
5403}
5404
5405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5407#[cfg_attr(feature = "bindings", derive(TS))]
5408#[cfg_attr(feature = "bindings", ts(export))]
5409pub enum MatchRecognizeAfter {
5410 PastLastRow,
5411 ToNextRow,
5412 ToFirst(Identifier),
5413 ToLast(Identifier),
5414}
5415
5416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5418#[cfg_attr(feature = "bindings", derive(TS))]
5419pub struct Limit {
5420 pub this: Expression,
5422 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5424 pub percent: bool,
5425 #[serde(default)]
5427 #[serde(skip_serializing_if = "Vec::is_empty")]
5428 pub comments: Vec<String>,
5429}
5430
5431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5433#[cfg_attr(feature = "bindings", derive(TS))]
5434pub struct Offset {
5435 pub this: Expression,
5436 #[serde(skip_serializing_if = "Option::is_none", default)]
5438 pub rows: Option<bool>,
5439}
5440
5441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5443#[cfg_attr(feature = "bindings", derive(TS))]
5444pub struct Top {
5445 pub this: Expression,
5446 pub percent: bool,
5447 pub with_ties: bool,
5448 #[serde(default)]
5450 pub parenthesized: bool,
5451}
5452
5453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5455#[cfg_attr(feature = "bindings", derive(TS))]
5456pub struct Fetch {
5457 pub direction: String,
5459 pub count: Option<Expression>,
5461 pub percent: bool,
5463 pub rows: bool,
5465 pub with_ties: bool,
5467}
5468
5469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5475#[cfg_attr(feature = "bindings", derive(TS))]
5476pub struct Qualify {
5477 pub this: Expression,
5479}
5480
5481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5483#[cfg_attr(feature = "bindings", derive(TS))]
5484pub struct Sample {
5485 pub method: SampleMethod,
5486 pub size: Expression,
5487 pub seed: Option<Expression>,
5488 #[serde(default)]
5490 pub offset: Option<Expression>,
5491 pub unit_after_size: bool,
5493 #[serde(default)]
5495 pub use_sample_keyword: bool,
5496 #[serde(default)]
5498 pub explicit_method: bool,
5499 #[serde(default)]
5501 pub method_before_size: bool,
5502 #[serde(default)]
5504 pub use_seed_keyword: bool,
5505 pub bucket_numerator: Option<Box<Expression>>,
5507 pub bucket_denominator: Option<Box<Expression>>,
5509 pub bucket_field: Option<Box<Expression>>,
5511 #[serde(default)]
5513 pub is_using_sample: bool,
5514 #[serde(default)]
5516 pub is_percent: bool,
5517 #[serde(default)]
5519 pub suppress_method_output: bool,
5520}
5521
5522#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5524#[cfg_attr(feature = "bindings", derive(TS))]
5525pub enum SampleMethod {
5526 Bernoulli,
5527 System,
5528 Block,
5529 Row,
5530 Percent,
5531 Bucket,
5533 Reservoir,
5535}
5536
5537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5539#[cfg_attr(feature = "bindings", derive(TS))]
5540pub struct NamedWindow {
5541 pub name: Identifier,
5542 pub spec: Over,
5543}
5544
5545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5551#[cfg_attr(feature = "bindings", derive(TS))]
5552pub struct With {
5553 pub ctes: Vec<Cte>,
5555 pub recursive: bool,
5557 #[serde(default)]
5559 pub leading_comments: Vec<String>,
5560 #[serde(default, skip_serializing_if = "Option::is_none")]
5562 pub search: Option<Box<Expression>>,
5563}
5564
5565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5572#[cfg_attr(feature = "bindings", derive(TS))]
5573pub struct Cte {
5574 pub alias: Identifier,
5576 pub this: Expression,
5578 pub columns: Vec<Identifier>,
5580 pub materialized: Option<bool>,
5582 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5584 pub key_expressions: Vec<Identifier>,
5585 #[serde(default)]
5587 pub alias_first: bool,
5588 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5590 pub comments: Vec<String>,
5591}
5592
5593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5595#[cfg_attr(feature = "bindings", derive(TS))]
5596pub struct WindowSpec {
5597 pub partition_by: Vec<Expression>,
5598 pub order_by: Vec<Ordered>,
5599 pub frame: Option<WindowFrame>,
5600}
5601
5602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5604#[cfg_attr(feature = "bindings", derive(TS))]
5605pub struct Over {
5606 pub window_name: Option<Identifier>,
5608 pub partition_by: Vec<Expression>,
5609 pub order_by: Vec<Ordered>,
5610 pub frame: Option<WindowFrame>,
5611 pub alias: Option<Identifier>,
5612}
5613
5614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5616#[cfg_attr(feature = "bindings", derive(TS))]
5617pub struct WindowFrame {
5618 pub kind: WindowFrameKind,
5619 pub start: WindowFrameBound,
5620 pub end: Option<WindowFrameBound>,
5621 pub exclude: Option<WindowFrameExclude>,
5622 #[serde(default, skip_serializing_if = "Option::is_none")]
5624 pub kind_text: Option<String>,
5625 #[serde(default, skip_serializing_if = "Option::is_none")]
5627 pub start_side_text: Option<String>,
5628 #[serde(default, skip_serializing_if = "Option::is_none")]
5630 pub end_side_text: Option<String>,
5631}
5632
5633#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5634#[cfg_attr(feature = "bindings", derive(TS))]
5635pub enum WindowFrameKind {
5636 Rows,
5637 Range,
5638 Groups,
5639}
5640
5641#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5643#[cfg_attr(feature = "bindings", derive(TS))]
5644pub enum WindowFrameExclude {
5645 CurrentRow,
5646 Group,
5647 Ties,
5648 NoOthers,
5649}
5650
5651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5652#[cfg_attr(feature = "bindings", derive(TS))]
5653pub enum WindowFrameBound {
5654 CurrentRow,
5655 UnboundedPreceding,
5656 UnboundedFollowing,
5657 Preceding(Box<Expression>),
5658 Following(Box<Expression>),
5659 BarePreceding,
5661 BareFollowing,
5663 Value(Box<Expression>),
5665}
5666
5667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5669#[cfg_attr(feature = "bindings", derive(TS))]
5670pub struct StructField {
5671 pub name: String,
5672 pub data_type: DataType,
5673 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5674 pub options: Vec<Expression>,
5675 #[serde(default, skip_serializing_if = "Option::is_none")]
5676 pub comment: Option<String>,
5677}
5678
5679impl StructField {
5680 pub fn new(name: String, data_type: DataType) -> Self {
5682 Self {
5683 name,
5684 data_type,
5685 options: Vec::new(),
5686 comment: None,
5687 }
5688 }
5689
5690 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5692 Self {
5693 name,
5694 data_type,
5695 options,
5696 comment: None,
5697 }
5698 }
5699
5700 pub fn with_options_and_comment(
5702 name: String,
5703 data_type: DataType,
5704 options: Vec<Expression>,
5705 comment: Option<String>,
5706 ) -> Self {
5707 Self {
5708 name,
5709 data_type,
5710 options,
5711 comment,
5712 }
5713 }
5714}
5715
5716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5728#[cfg_attr(feature = "bindings", derive(TS))]
5729#[serde(tag = "data_type", rename_all = "snake_case")]
5730pub enum DataType {
5731 Boolean,
5733 TinyInt {
5734 length: Option<u32>,
5735 },
5736 SmallInt {
5737 length: Option<u32>,
5738 },
5739 Int {
5743 length: Option<u32>,
5744 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5745 integer_spelling: bool,
5746 },
5747 BigInt {
5748 length: Option<u32>,
5749 },
5750 Float {
5754 precision: Option<u32>,
5755 scale: Option<u32>,
5756 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5757 real_spelling: bool,
5758 },
5759 Double {
5760 precision: Option<u32>,
5761 scale: Option<u32>,
5762 },
5763 Decimal {
5764 precision: Option<u32>,
5765 scale: Option<u32>,
5766 },
5767
5768 Char {
5770 length: Option<u32>,
5771 },
5772 VarChar {
5775 length: Option<u32>,
5776 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5777 parenthesized_length: bool,
5778 },
5779 String {
5781 length: Option<u32>,
5782 },
5783 Text,
5784 TextWithLength {
5786 length: u32,
5787 },
5788
5789 Binary {
5791 length: Option<u32>,
5792 },
5793 VarBinary {
5794 length: Option<u32>,
5795 },
5796 Blob,
5797
5798 Bit {
5800 length: Option<u32>,
5801 },
5802 VarBit {
5803 length: Option<u32>,
5804 },
5805
5806 Date,
5808 Time {
5809 precision: Option<u32>,
5810 #[serde(default)]
5811 timezone: bool,
5812 },
5813 Timestamp {
5814 precision: Option<u32>,
5815 timezone: bool,
5816 },
5817 Interval {
5818 unit: Option<String>,
5819 #[serde(default, skip_serializing_if = "Option::is_none")]
5821 to: Option<String>,
5822 },
5823
5824 Json,
5826 JsonB,
5827
5828 Uuid,
5830
5831 Array {
5833 element_type: Box<DataType>,
5834 #[serde(default, skip_serializing_if = "Option::is_none")]
5836 dimension: Option<u32>,
5837 },
5838
5839 List {
5842 element_type: Box<DataType>,
5843 },
5844
5845 Struct {
5849 fields: Vec<StructField>,
5850 nested: bool,
5851 },
5852 Map {
5853 key_type: Box<DataType>,
5854 value_type: Box<DataType>,
5855 },
5856
5857 Enum {
5859 values: Vec<String>,
5860 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5861 assignments: Vec<Option<String>>,
5862 },
5863
5864 Set {
5866 values: Vec<String>,
5867 },
5868
5869 Union {
5871 fields: Vec<(String, DataType)>,
5872 },
5873
5874 Vector {
5876 #[serde(default)]
5877 element_type: Option<Box<DataType>>,
5878 dimension: Option<u32>,
5879 },
5880
5881 Object {
5884 fields: Vec<(String, DataType, bool)>,
5885 modifier: Option<String>,
5886 },
5887
5888 Nullable {
5890 inner: Box<DataType>,
5891 },
5892
5893 Custom {
5895 name: String,
5896 },
5897
5898 Geometry {
5900 subtype: Option<String>,
5901 srid: Option<u32>,
5902 },
5903 Geography {
5904 subtype: Option<String>,
5905 srid: Option<u32>,
5906 },
5907
5908 CharacterSet {
5911 name: String,
5912 },
5913
5914 Unknown,
5916}
5917
5918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5920#[cfg_attr(feature = "bindings", derive(TS))]
5921#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5922pub struct Array {
5923 pub expressions: Vec<Expression>,
5924}
5925
5926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5928#[cfg_attr(feature = "bindings", derive(TS))]
5929pub struct Struct {
5930 pub fields: Vec<(Option<String>, Expression)>,
5931}
5932
5933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5935#[cfg_attr(feature = "bindings", derive(TS))]
5936pub struct Tuple {
5937 pub expressions: Vec<Expression>,
5938}
5939
5940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5942#[cfg_attr(feature = "bindings", derive(TS))]
5943pub struct Interval {
5944 pub this: Option<Expression>,
5946 pub unit: Option<IntervalUnitSpec>,
5948}
5949
5950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5952#[cfg_attr(feature = "bindings", derive(TS))]
5953#[serde(tag = "type", rename_all = "snake_case")]
5954pub enum IntervalUnitSpec {
5955 Simple {
5957 unit: IntervalUnit,
5958 use_plural: bool,
5960 },
5961 Span(IntervalSpan),
5963 ExprSpan(IntervalSpanExpr),
5966 Expr(Box<Expression>),
5968}
5969
5970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5972#[cfg_attr(feature = "bindings", derive(TS))]
5973pub struct IntervalSpan {
5974 pub this: IntervalUnit,
5976 pub expression: IntervalUnit,
5978}
5979
5980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5983#[cfg_attr(feature = "bindings", derive(TS))]
5984pub struct IntervalSpanExpr {
5985 pub this: Box<Expression>,
5987 pub expression: Box<Expression>,
5989}
5990
5991#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5992#[cfg_attr(feature = "bindings", derive(TS))]
5993pub enum IntervalUnit {
5994 Year,
5995 Quarter,
5996 Month,
5997 Week,
5998 Day,
5999 Hour,
6000 Minute,
6001 Second,
6002 Millisecond,
6003 Microsecond,
6004 Nanosecond,
6005}
6006
6007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6009#[cfg_attr(feature = "bindings", derive(TS))]
6010pub struct Command {
6011 pub this: String,
6013}
6014
6015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6018#[cfg_attr(feature = "bindings", derive(TS))]
6019pub struct PrepareStatement {
6020 pub name: Identifier,
6022 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6024 pub parameter_types: Vec<DataType>,
6025 pub statement: Expression,
6027}
6028
6029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6031#[cfg_attr(feature = "bindings", derive(TS))]
6032pub struct TryCatch {
6033 #[serde(default)]
6035 pub try_body: Vec<Expression>,
6036 #[serde(default, skip_serializing_if = "Option::is_none")]
6038 pub catch_body: Option<Vec<Expression>>,
6039}
6040
6041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6044#[cfg_attr(feature = "bindings", derive(TS))]
6045pub struct ExecuteStatement {
6046 pub this: Expression,
6048 #[serde(default)]
6050 pub parameters: Vec<ExecuteParameter>,
6051 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6053 pub arguments: Vec<Expression>,
6054 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6056 pub prepared: bool,
6057 #[serde(default, skip_serializing_if = "Option::is_none")]
6059 pub suffix: Option<String>,
6060}
6061
6062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6064#[cfg_attr(feature = "bindings", derive(TS))]
6065pub struct ExecuteParameter {
6066 pub name: String,
6068 pub value: Expression,
6070 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6072 pub positional: bool,
6073 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6075 pub output: bool,
6076}
6077
6078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6081#[cfg_attr(feature = "bindings", derive(TS))]
6082pub struct Kill {
6083 pub this: Expression,
6085 pub kind: Option<String>,
6087}
6088
6089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6091#[cfg_attr(feature = "bindings", derive(TS))]
6092pub struct CreateTask {
6093 pub or_replace: bool,
6094 pub if_not_exists: bool,
6095 pub name: String,
6097 pub properties: String,
6099 pub body: Expression,
6101}
6102
6103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6105#[cfg_attr(feature = "bindings", derive(TS))]
6106pub struct Raw {
6107 pub sql: String,
6108}
6109
6110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6116#[cfg_attr(feature = "bindings", derive(TS))]
6117pub struct UnaryFunc {
6118 pub this: Expression,
6119 #[serde(skip_serializing_if = "Option::is_none", default)]
6121 pub original_name: Option<String>,
6122 #[serde(default, skip_serializing_if = "Option::is_none")]
6124 pub inferred_type: Option<DataType>,
6125}
6126
6127impl UnaryFunc {
6128 pub fn new(this: Expression) -> Self {
6130 Self {
6131 this,
6132 original_name: None,
6133 inferred_type: None,
6134 }
6135 }
6136
6137 pub fn with_name(this: Expression, name: String) -> Self {
6139 Self {
6140 this,
6141 original_name: Some(name),
6142 inferred_type: None,
6143 }
6144 }
6145}
6146
6147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6151#[cfg_attr(feature = "bindings", derive(TS))]
6152pub struct CharFunc {
6153 pub args: Vec<Expression>,
6154 #[serde(skip_serializing_if = "Option::is_none", default)]
6155 pub charset: Option<String>,
6156 #[serde(skip_serializing_if = "Option::is_none", default)]
6158 pub name: Option<String>,
6159}
6160
6161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6163#[cfg_attr(feature = "bindings", derive(TS))]
6164pub struct BinaryFunc {
6165 pub this: Expression,
6166 pub expression: Expression,
6167 #[serde(skip_serializing_if = "Option::is_none", default)]
6169 pub original_name: Option<String>,
6170 #[serde(default, skip_serializing_if = "Option::is_none")]
6172 pub inferred_type: Option<DataType>,
6173}
6174
6175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6177#[cfg_attr(feature = "bindings", derive(TS))]
6178pub struct VarArgFunc {
6179 pub expressions: Vec<Expression>,
6180 #[serde(skip_serializing_if = "Option::is_none", default)]
6182 pub original_name: Option<String>,
6183 #[serde(default, skip_serializing_if = "Option::is_none")]
6185 pub inferred_type: Option<DataType>,
6186}
6187
6188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6190#[cfg_attr(feature = "bindings", derive(TS))]
6191pub struct ConcatWs {
6192 pub separator: Expression,
6193 pub expressions: Vec<Expression>,
6194}
6195
6196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6198#[cfg_attr(feature = "bindings", derive(TS))]
6199pub struct SubstringFunc {
6200 pub this: Expression,
6201 pub start: Expression,
6202 pub length: Option<Expression>,
6203 #[serde(default)]
6205 pub from_for_syntax: bool,
6206}
6207
6208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6210#[cfg_attr(feature = "bindings", derive(TS))]
6211pub struct OverlayFunc {
6212 pub this: Expression,
6213 pub replacement: Expression,
6214 pub from: Expression,
6215 pub length: Option<Expression>,
6216}
6217
6218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6220#[cfg_attr(feature = "bindings", derive(TS))]
6221pub struct TrimFunc {
6222 pub this: Expression,
6223 pub characters: Option<Expression>,
6224 pub position: TrimPosition,
6225 #[serde(default)]
6227 pub sql_standard_syntax: bool,
6228 #[serde(default)]
6230 pub position_explicit: bool,
6231}
6232
6233#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6234#[cfg_attr(feature = "bindings", derive(TS))]
6235pub enum TrimPosition {
6236 Both,
6237 Leading,
6238 Trailing,
6239}
6240
6241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6243#[cfg_attr(feature = "bindings", derive(TS))]
6244pub struct ReplaceFunc {
6245 pub this: Expression,
6246 pub old: Expression,
6247 pub new: Expression,
6248}
6249
6250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6252#[cfg_attr(feature = "bindings", derive(TS))]
6253pub struct LeftRightFunc {
6254 pub this: Expression,
6255 pub length: Expression,
6256}
6257
6258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6260#[cfg_attr(feature = "bindings", derive(TS))]
6261pub struct RepeatFunc {
6262 pub this: Expression,
6263 pub times: Expression,
6264}
6265
6266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6268#[cfg_attr(feature = "bindings", derive(TS))]
6269pub struct PadFunc {
6270 pub this: Expression,
6271 pub length: Expression,
6272 pub fill: Option<Expression>,
6273}
6274
6275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6277#[cfg_attr(feature = "bindings", derive(TS))]
6278pub struct SplitFunc {
6279 pub this: Expression,
6280 pub delimiter: Expression,
6281}
6282
6283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6285#[cfg_attr(feature = "bindings", derive(TS))]
6286pub struct RegexpFunc {
6287 pub this: Expression,
6288 pub pattern: Expression,
6289 pub flags: Option<Expression>,
6290}
6291
6292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6294#[cfg_attr(feature = "bindings", derive(TS))]
6295pub struct RegexpReplaceFunc {
6296 pub this: Expression,
6297 pub pattern: Expression,
6298 pub replacement: Expression,
6299 pub flags: Option<Expression>,
6300}
6301
6302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6304#[cfg_attr(feature = "bindings", derive(TS))]
6305pub struct RegexpExtractFunc {
6306 pub this: Expression,
6307 pub pattern: Expression,
6308 pub group: Option<Expression>,
6309}
6310
6311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6313#[cfg_attr(feature = "bindings", derive(TS))]
6314pub struct RoundFunc {
6315 pub this: Expression,
6316 pub decimals: Option<Expression>,
6317}
6318
6319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6321#[cfg_attr(feature = "bindings", derive(TS))]
6322pub struct FloorFunc {
6323 pub this: Expression,
6324 pub scale: Option<Expression>,
6325 #[serde(skip_serializing_if = "Option::is_none", default)]
6327 pub to: Option<Expression>,
6328}
6329
6330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6332#[cfg_attr(feature = "bindings", derive(TS))]
6333pub struct CeilFunc {
6334 pub this: Expression,
6335 #[serde(skip_serializing_if = "Option::is_none", default)]
6336 pub decimals: Option<Expression>,
6337 #[serde(skip_serializing_if = "Option::is_none", default)]
6339 pub to: Option<Expression>,
6340}
6341
6342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6344#[cfg_attr(feature = "bindings", derive(TS))]
6345pub struct LogFunc {
6346 pub this: Expression,
6347 pub base: Option<Expression>,
6348}
6349
6350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6352#[cfg_attr(feature = "bindings", derive(TS))]
6353pub struct CurrentDate;
6354
6355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6357#[cfg_attr(feature = "bindings", derive(TS))]
6358pub struct CurrentTime {
6359 pub precision: Option<u32>,
6360}
6361
6362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6364#[cfg_attr(feature = "bindings", derive(TS))]
6365pub struct CurrentTimestamp {
6366 pub precision: Option<u32>,
6367 #[serde(default)]
6369 pub sysdate: bool,
6370}
6371
6372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6374#[cfg_attr(feature = "bindings", derive(TS))]
6375pub struct CurrentTimestampLTZ {
6376 pub precision: Option<u32>,
6377}
6378
6379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6381#[cfg_attr(feature = "bindings", derive(TS))]
6382pub struct AtTimeZone {
6383 pub this: Expression,
6385 pub zone: Expression,
6387}
6388
6389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6391#[cfg_attr(feature = "bindings", derive(TS))]
6392pub struct DateAddFunc {
6393 pub this: Expression,
6394 pub interval: Expression,
6395 pub unit: IntervalUnit,
6396}
6397
6398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6400#[cfg_attr(feature = "bindings", derive(TS))]
6401pub struct DateDiffFunc {
6402 pub this: Expression,
6403 pub expression: Expression,
6404 pub unit: Option<IntervalUnit>,
6405}
6406
6407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6409#[cfg_attr(feature = "bindings", derive(TS))]
6410pub struct DateTruncFunc {
6411 pub this: Expression,
6412 pub unit: DateTimeField,
6413}
6414
6415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6417#[cfg_attr(feature = "bindings", derive(TS))]
6418pub struct ExtractFunc {
6419 pub this: Expression,
6420 pub field: DateTimeField,
6421}
6422
6423#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6424#[cfg_attr(feature = "bindings", derive(TS))]
6425pub enum DateTimeField {
6426 Year,
6427 Month,
6428 Day,
6429 Hour,
6430 Minute,
6431 Second,
6432 Millisecond,
6433 Microsecond,
6434 DayOfWeek,
6435 DayOfYear,
6436 Week,
6437 WeekWithModifier(String),
6439 Quarter,
6440 Epoch,
6441 Timezone,
6442 TimezoneHour,
6443 TimezoneMinute,
6444 Date,
6445 Time,
6446 Custom(String),
6448}
6449
6450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6452#[cfg_attr(feature = "bindings", derive(TS))]
6453pub struct ToDateFunc {
6454 pub this: Expression,
6455 pub format: Option<Expression>,
6456}
6457
6458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6460#[cfg_attr(feature = "bindings", derive(TS))]
6461pub struct ToTimestampFunc {
6462 pub this: Expression,
6463 pub format: Option<Expression>,
6464}
6465
6466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6468#[cfg_attr(feature = "bindings", derive(TS))]
6469pub struct IfFunc {
6470 pub condition: Expression,
6471 pub true_value: Expression,
6472 pub false_value: Option<Expression>,
6473 #[serde(skip_serializing_if = "Option::is_none", default)]
6475 pub original_name: Option<String>,
6476 #[serde(default, skip_serializing_if = "Option::is_none")]
6478 pub inferred_type: Option<DataType>,
6479}
6480
6481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6483#[cfg_attr(feature = "bindings", derive(TS))]
6484pub struct Nvl2Func {
6485 pub this: Expression,
6486 pub true_value: Expression,
6487 pub false_value: Expression,
6488 #[serde(default, skip_serializing_if = "Option::is_none")]
6490 pub inferred_type: Option<DataType>,
6491}
6492
6493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6499#[cfg_attr(feature = "bindings", derive(TS))]
6500pub struct AggFunc {
6501 pub this: Expression,
6502 pub distinct: bool,
6503 pub filter: Option<Expression>,
6504 pub order_by: Vec<Ordered>,
6505 #[serde(skip_serializing_if = "Option::is_none", default)]
6507 pub name: Option<String>,
6508 #[serde(skip_serializing_if = "Option::is_none", default)]
6510 pub ignore_nulls: Option<bool>,
6511 #[serde(skip_serializing_if = "Option::is_none", default)]
6514 pub having_max: Option<(Box<Expression>, bool)>,
6515 #[serde(skip_serializing_if = "Option::is_none", default)]
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 CountFunc {
6527 pub this: Option<Expression>,
6528 pub star: bool,
6529 pub distinct: bool,
6530 pub filter: Option<Expression>,
6531 #[serde(default, skip_serializing_if = "Option::is_none")]
6533 pub ignore_nulls: Option<bool>,
6534 #[serde(default, skip_serializing_if = "Option::is_none")]
6536 pub original_name: Option<String>,
6537 #[serde(default, skip_serializing_if = "Option::is_none")]
6539 pub inferred_type: Option<DataType>,
6540}
6541
6542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6544#[cfg_attr(feature = "bindings", derive(TS))]
6545pub struct GroupConcatFunc {
6546 pub this: Expression,
6547 pub separator: Option<Expression>,
6548 pub order_by: Option<Vec<Ordered>>,
6549 pub distinct: bool,
6550 pub filter: Option<Expression>,
6551 #[serde(default, skip_serializing_if = "Option::is_none")]
6553 pub limit: Option<Box<Expression>>,
6554 #[serde(default, skip_serializing_if = "Option::is_none")]
6556 pub inferred_type: Option<DataType>,
6557}
6558
6559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6561#[cfg_attr(feature = "bindings", derive(TS))]
6562pub struct StringAggFunc {
6563 pub this: Expression,
6564 #[serde(default)]
6565 pub separator: Option<Expression>,
6566 #[serde(default)]
6567 pub order_by: Option<Vec<Ordered>>,
6568 #[serde(default)]
6569 pub distinct: bool,
6570 #[serde(default)]
6571 pub filter: Option<Expression>,
6572 #[serde(default, skip_serializing_if = "Option::is_none")]
6574 pub limit: Option<Box<Expression>>,
6575 #[serde(default, skip_serializing_if = "Option::is_none")]
6577 pub inferred_type: Option<DataType>,
6578}
6579
6580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6582#[cfg_attr(feature = "bindings", derive(TS))]
6583pub struct ListAggFunc {
6584 pub this: Expression,
6585 pub separator: Option<Expression>,
6586 pub on_overflow: Option<ListAggOverflow>,
6587 pub order_by: Option<Vec<Ordered>>,
6588 pub distinct: bool,
6589 pub filter: Option<Expression>,
6590 #[serde(default, skip_serializing_if = "Option::is_none")]
6592 pub inferred_type: Option<DataType>,
6593}
6594
6595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6597#[cfg_attr(feature = "bindings", derive(TS))]
6598pub enum ListAggOverflow {
6599 Error,
6600 Truncate {
6601 filler: Option<Expression>,
6602 with_count: bool,
6603 },
6604}
6605
6606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6608#[cfg_attr(feature = "bindings", derive(TS))]
6609pub struct SumIfFunc {
6610 pub this: Expression,
6611 pub condition: Expression,
6612 pub filter: Option<Expression>,
6613 #[serde(default, skip_serializing_if = "Option::is_none")]
6615 pub inferred_type: Option<DataType>,
6616}
6617
6618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6620#[cfg_attr(feature = "bindings", derive(TS))]
6621pub struct ApproxPercentileFunc {
6622 pub this: Expression,
6623 pub percentile: Expression,
6624 pub accuracy: Option<Expression>,
6625 pub filter: Option<Expression>,
6626}
6627
6628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6630#[cfg_attr(feature = "bindings", derive(TS))]
6631pub struct PercentileFunc {
6632 pub this: Expression,
6633 pub percentile: Expression,
6634 pub order_by: Option<Vec<Ordered>>,
6635 pub filter: Option<Expression>,
6636}
6637
6638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6644#[cfg_attr(feature = "bindings", derive(TS))]
6645pub struct RowNumber;
6646
6647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6649#[cfg_attr(feature = "bindings", derive(TS))]
6650pub struct Rank {
6651 #[serde(default, skip_serializing_if = "Option::is_none")]
6653 pub order_by: Option<Vec<Ordered>>,
6654 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6656 pub args: Vec<Expression>,
6657}
6658
6659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6661#[cfg_attr(feature = "bindings", derive(TS))]
6662pub struct DenseRank {
6663 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6665 pub args: Vec<Expression>,
6666}
6667
6668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6670#[cfg_attr(feature = "bindings", derive(TS))]
6671pub struct NTileFunc {
6672 #[serde(default, skip_serializing_if = "Option::is_none")]
6674 pub num_buckets: Option<Expression>,
6675 #[serde(default, skip_serializing_if = "Option::is_none")]
6677 pub order_by: Option<Vec<Ordered>>,
6678}
6679
6680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6682#[cfg_attr(feature = "bindings", derive(TS))]
6683pub struct LeadLagFunc {
6684 pub this: Expression,
6685 pub offset: Option<Expression>,
6686 pub default: Option<Expression>,
6687 #[serde(default, skip_serializing_if = "Option::is_none")]
6689 pub ignore_nulls: Option<bool>,
6690}
6691
6692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6694#[cfg_attr(feature = "bindings", derive(TS))]
6695pub struct ValueFunc {
6696 pub this: Expression,
6697 #[serde(default, skip_serializing_if = "Option::is_none")]
6699 pub ignore_nulls: Option<bool>,
6700 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6702 pub order_by: Vec<Ordered>,
6703}
6704
6705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6707#[cfg_attr(feature = "bindings", derive(TS))]
6708pub struct NthValueFunc {
6709 pub this: Expression,
6710 pub offset: Expression,
6711 #[serde(default, skip_serializing_if = "Option::is_none")]
6713 pub ignore_nulls: Option<bool>,
6714 #[serde(default, skip_serializing_if = "Option::is_none")]
6717 pub from_first: Option<bool>,
6718}
6719
6720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6722#[cfg_attr(feature = "bindings", derive(TS))]
6723pub struct PercentRank {
6724 #[serde(default, skip_serializing_if = "Option::is_none")]
6726 pub order_by: Option<Vec<Ordered>>,
6727 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6729 pub args: Vec<Expression>,
6730}
6731
6732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6734#[cfg_attr(feature = "bindings", derive(TS))]
6735pub struct CumeDist {
6736 #[serde(default, skip_serializing_if = "Option::is_none")]
6738 pub order_by: Option<Vec<Ordered>>,
6739 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6741 pub args: Vec<Expression>,
6742}
6743
6744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6750#[cfg_attr(feature = "bindings", derive(TS))]
6751pub struct PositionFunc {
6752 pub substring: Expression,
6753 pub string: Expression,
6754 pub start: Option<Expression>,
6755}
6756
6757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6763#[cfg_attr(feature = "bindings", derive(TS))]
6764pub struct Random;
6765
6766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6768#[cfg_attr(feature = "bindings", derive(TS))]
6769pub struct Rand {
6770 pub seed: Option<Box<Expression>>,
6771 #[serde(default)]
6773 pub lower: Option<Box<Expression>>,
6774 #[serde(default)]
6776 pub upper: Option<Box<Expression>>,
6777}
6778
6779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6781#[cfg_attr(feature = "bindings", derive(TS))]
6782pub struct TruncateFunc {
6783 pub this: Expression,
6784 pub decimals: Option<Expression>,
6785}
6786
6787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6789#[cfg_attr(feature = "bindings", derive(TS))]
6790pub struct Pi;
6791
6792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6798#[cfg_attr(feature = "bindings", derive(TS))]
6799pub struct DecodeFunc {
6800 pub this: Expression,
6801 pub search_results: Vec<(Expression, Expression)>,
6802 pub default: Option<Expression>,
6803}
6804
6805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6811#[cfg_attr(feature = "bindings", derive(TS))]
6812pub struct DateFormatFunc {
6813 pub this: Expression,
6814 pub format: Expression,
6815}
6816
6817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6819#[cfg_attr(feature = "bindings", derive(TS))]
6820pub struct FromUnixtimeFunc {
6821 pub this: Expression,
6822 pub format: Option<Expression>,
6823}
6824
6825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6827#[cfg_attr(feature = "bindings", derive(TS))]
6828pub struct UnixTimestampFunc {
6829 pub this: Option<Expression>,
6830 pub format: Option<Expression>,
6831}
6832
6833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6835#[cfg_attr(feature = "bindings", derive(TS))]
6836pub struct MakeDateFunc {
6837 pub year: Expression,
6838 pub month: Expression,
6839 pub day: Expression,
6840}
6841
6842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6844#[cfg_attr(feature = "bindings", derive(TS))]
6845pub struct MakeTimestampFunc {
6846 pub year: Expression,
6847 pub month: Expression,
6848 pub day: Expression,
6849 pub hour: Expression,
6850 pub minute: Expression,
6851 pub second: Expression,
6852 pub timezone: Option<Expression>,
6853}
6854
6855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6857#[cfg_attr(feature = "bindings", derive(TS))]
6858pub struct LastDayFunc {
6859 pub this: Expression,
6860 #[serde(skip_serializing_if = "Option::is_none", default)]
6862 pub unit: Option<DateTimeField>,
6863}
6864
6865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6871#[cfg_attr(feature = "bindings", derive(TS))]
6872pub struct ArrayConstructor {
6873 pub expressions: Vec<Expression>,
6874 pub bracket_notation: bool,
6875 pub use_list_keyword: bool,
6877}
6878
6879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6881#[cfg_attr(feature = "bindings", derive(TS))]
6882pub struct ArraySortFunc {
6883 pub this: Expression,
6884 pub comparator: Option<Expression>,
6885 pub desc: bool,
6886 pub nulls_first: Option<bool>,
6887}
6888
6889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6891#[cfg_attr(feature = "bindings", derive(TS))]
6892pub struct ArrayJoinFunc {
6893 pub this: Expression,
6894 pub separator: Expression,
6895 pub null_replacement: Option<Expression>,
6896}
6897
6898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6900#[cfg_attr(feature = "bindings", derive(TS))]
6901pub struct UnnestFunc {
6902 pub this: Expression,
6903 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6905 pub expressions: Vec<Expression>,
6906 pub with_ordinality: bool,
6907 pub alias: Option<Identifier>,
6908 #[serde(default, skip_serializing_if = "Option::is_none")]
6910 pub offset_alias: Option<Identifier>,
6911}
6912
6913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6915#[cfg_attr(feature = "bindings", derive(TS))]
6916pub struct ArrayFilterFunc {
6917 pub this: Expression,
6918 pub filter: Expression,
6919}
6920
6921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6923#[cfg_attr(feature = "bindings", derive(TS))]
6924pub struct ArrayTransformFunc {
6925 pub this: Expression,
6926 pub transform: Expression,
6927}
6928
6929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6931#[cfg_attr(feature = "bindings", derive(TS))]
6932pub struct SequenceFunc {
6933 pub start: Expression,
6934 pub stop: Expression,
6935 pub step: Option<Expression>,
6936}
6937
6938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6944#[cfg_attr(feature = "bindings", derive(TS))]
6945pub struct StructConstructor {
6946 pub fields: Vec<(Option<Identifier>, Expression)>,
6947}
6948
6949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6951#[cfg_attr(feature = "bindings", derive(TS))]
6952pub struct StructExtractFunc {
6953 pub this: Expression,
6954 pub field: Identifier,
6955}
6956
6957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6959#[cfg_attr(feature = "bindings", derive(TS))]
6960pub struct NamedStructFunc {
6961 pub pairs: Vec<(Expression, Expression)>,
6962}
6963
6964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6970#[cfg_attr(feature = "bindings", derive(TS))]
6971pub struct MapConstructor {
6972 pub keys: Vec<Expression>,
6973 pub values: Vec<Expression>,
6974 #[serde(default)]
6976 pub curly_brace_syntax: bool,
6977 #[serde(default)]
6979 pub with_map_keyword: bool,
6980}
6981
6982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6984#[cfg_attr(feature = "bindings", derive(TS))]
6985pub struct TransformFunc {
6986 pub this: Expression,
6987 pub transform: Expression,
6988}
6989
6990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6993#[cfg_attr(feature = "bindings", derive(TS))]
6994pub struct FunctionEmits {
6995 pub this: Expression,
6997 pub emits: Expression,
6999}
7000
7001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7007#[cfg_attr(feature = "bindings", derive(TS))]
7008pub struct JsonExtractFunc {
7009 pub this: Expression,
7010 pub path: Expression,
7011 pub returning: Option<DataType>,
7012 #[serde(default)]
7014 pub arrow_syntax: bool,
7015 #[serde(default)]
7017 pub hash_arrow_syntax: bool,
7018 #[serde(default)]
7020 pub wrapper_option: Option<String>,
7021 #[serde(default)]
7023 pub quotes_option: Option<String>,
7024 #[serde(default)]
7026 pub on_scalar_string: bool,
7027 #[serde(default)]
7029 pub on_error: Option<String>,
7030}
7031
7032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7034#[cfg_attr(feature = "bindings", derive(TS))]
7035pub struct JsonPathFunc {
7036 pub this: Expression,
7037 pub paths: Vec<Expression>,
7038}
7039
7040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7042#[cfg_attr(feature = "bindings", derive(TS))]
7043pub struct JsonObjectFunc {
7044 pub pairs: Vec<(Expression, Expression)>,
7045 pub null_handling: Option<JsonNullHandling>,
7046 #[serde(default)]
7047 pub with_unique_keys: bool,
7048 #[serde(default)]
7049 pub returning_type: Option<DataType>,
7050 #[serde(default)]
7051 pub format_json: bool,
7052 #[serde(default)]
7053 pub encoding: Option<String>,
7054 #[serde(default)]
7056 pub star: bool,
7057}
7058
7059#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7061#[cfg_attr(feature = "bindings", derive(TS))]
7062pub enum JsonNullHandling {
7063 NullOnNull,
7064 AbsentOnNull,
7065}
7066
7067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7069#[cfg_attr(feature = "bindings", derive(TS))]
7070pub struct JsonModifyFunc {
7071 pub this: Expression,
7072 pub path_values: Vec<(Expression, Expression)>,
7073}
7074
7075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7077#[cfg_attr(feature = "bindings", derive(TS))]
7078pub struct JsonArrayAggFunc {
7079 pub this: Expression,
7080 pub order_by: Option<Vec<Ordered>>,
7081 pub null_handling: Option<JsonNullHandling>,
7082 pub filter: Option<Expression>,
7083}
7084
7085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7087#[cfg_attr(feature = "bindings", derive(TS))]
7088pub struct JsonObjectAggFunc {
7089 pub key: Expression,
7090 pub value: Expression,
7091 pub null_handling: Option<JsonNullHandling>,
7092 pub filter: Option<Expression>,
7093}
7094
7095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7101#[cfg_attr(feature = "bindings", derive(TS))]
7102pub struct ConvertFunc {
7103 pub this: Expression,
7104 pub to: DataType,
7105 pub style: Option<Expression>,
7106}
7107
7108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7114#[cfg_attr(feature = "bindings", derive(TS))]
7115pub struct LambdaExpr {
7116 pub parameters: Vec<Identifier>,
7117 pub body: Expression,
7118 #[serde(default)]
7120 pub colon: bool,
7121 #[serde(default)]
7124 pub parameter_types: Vec<Option<DataType>>,
7125}
7126
7127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7129#[cfg_attr(feature = "bindings", derive(TS))]
7130pub struct Parameter {
7131 pub name: Option<String>,
7132 pub index: Option<u32>,
7133 pub style: ParameterStyle,
7134 #[serde(default)]
7136 pub quoted: bool,
7137 #[serde(default)]
7139 pub string_quoted: bool,
7140 #[serde(default)]
7142 pub expression: Option<String>,
7143}
7144
7145#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7147#[cfg_attr(feature = "bindings", derive(TS))]
7148pub enum ParameterStyle {
7149 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7159
7160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7162#[cfg_attr(feature = "bindings", derive(TS))]
7163pub struct Placeholder {
7164 pub index: Option<u32>,
7165}
7166
7167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7169#[cfg_attr(feature = "bindings", derive(TS))]
7170pub struct NamedArgument {
7171 pub name: Identifier,
7172 pub value: Expression,
7173 pub separator: NamedArgSeparator,
7175}
7176
7177#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7179#[cfg_attr(feature = "bindings", derive(TS))]
7180pub enum NamedArgSeparator {
7181 DArrow,
7183 ColonEq,
7185 Eq,
7187}
7188
7189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7192#[cfg_attr(feature = "bindings", derive(TS))]
7193pub struct TableArgument {
7194 pub prefix: String,
7196 pub this: Expression,
7198}
7199
7200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7202#[cfg_attr(feature = "bindings", derive(TS))]
7203pub struct SqlComment {
7204 pub text: String,
7205 pub is_block: bool,
7206}
7207
7208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7214#[cfg_attr(feature = "bindings", derive(TS))]
7215pub struct SimilarToExpr {
7216 pub this: Expression,
7217 pub pattern: Expression,
7218 pub escape: Option<Expression>,
7219 pub not: bool,
7220}
7221
7222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7224#[cfg_attr(feature = "bindings", derive(TS))]
7225pub struct QuantifiedExpr {
7226 pub this: Expression,
7227 pub subquery: Expression,
7228 pub op: Option<QuantifiedOp>,
7229}
7230
7231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7233#[cfg_attr(feature = "bindings", derive(TS))]
7234pub enum QuantifiedOp {
7235 Eq,
7236 Neq,
7237 Lt,
7238 Lte,
7239 Gt,
7240 Gte,
7241}
7242
7243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7248#[cfg_attr(feature = "bindings", derive(TS))]
7249pub struct OverlapsExpr {
7250 #[serde(skip_serializing_if = "Option::is_none")]
7252 pub this: Option<Expression>,
7253 #[serde(skip_serializing_if = "Option::is_none")]
7255 pub expression: Option<Expression>,
7256 #[serde(skip_serializing_if = "Option::is_none")]
7258 pub left_start: Option<Expression>,
7259 #[serde(skip_serializing_if = "Option::is_none")]
7261 pub left_end: Option<Expression>,
7262 #[serde(skip_serializing_if = "Option::is_none")]
7264 pub right_start: Option<Expression>,
7265 #[serde(skip_serializing_if = "Option::is_none")]
7267 pub right_end: Option<Expression>,
7268}
7269
7270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7276#[cfg_attr(feature = "bindings", derive(TS))]
7277pub struct Subscript {
7278 pub this: Expression,
7279 pub index: Expression,
7280}
7281
7282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7284#[cfg_attr(feature = "bindings", derive(TS))]
7285pub struct DotAccess {
7286 pub this: Expression,
7287 pub field: Identifier,
7288}
7289
7290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7292#[cfg_attr(feature = "bindings", derive(TS))]
7293pub struct MethodCall {
7294 pub this: Expression,
7295 pub method: Identifier,
7296 pub args: Vec<Expression>,
7297}
7298
7299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7301#[cfg_attr(feature = "bindings", derive(TS))]
7302pub struct ArraySlice {
7303 pub this: Expression,
7304 pub start: Option<Expression>,
7305 pub end: Option<Expression>,
7306}
7307
7308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7314#[cfg_attr(feature = "bindings", derive(TS))]
7315pub enum OnCommit {
7316 PreserveRows,
7318 DeleteRows,
7320}
7321
7322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7324#[cfg_attr(feature = "bindings", derive(TS))]
7325pub struct CreateTable {
7326 pub name: TableRef,
7327 #[serde(default, skip_serializing_if = "Option::is_none")]
7329 pub on_cluster: Option<OnCluster>,
7330 pub columns: Vec<ColumnDef>,
7331 pub constraints: Vec<TableConstraint>,
7332 pub if_not_exists: bool,
7333 pub temporary: bool,
7334 pub or_replace: bool,
7335 #[serde(default, skip_serializing_if = "Option::is_none")]
7337 pub table_modifier: Option<String>,
7338 pub as_select: Option<Expression>,
7339 #[serde(default)]
7341 pub as_select_parenthesized: bool,
7342 #[serde(default)]
7344 pub on_commit: Option<OnCommit>,
7345 #[serde(default)]
7347 pub clone_source: Option<TableRef>,
7348 #[serde(default, skip_serializing_if = "Option::is_none")]
7350 pub clone_at_clause: Option<Expression>,
7351 #[serde(default)]
7353 pub is_copy: bool,
7354 #[serde(default)]
7356 pub shallow_clone: bool,
7357 #[serde(default)]
7359 pub deep_clone: bool,
7360 #[serde(default)]
7362 pub leading_comments: Vec<String>,
7363 #[serde(default)]
7365 pub with_properties: Vec<(String, String)>,
7366 #[serde(default)]
7368 pub teradata_post_name_options: Vec<String>,
7369 #[serde(default)]
7371 pub with_data: Option<bool>,
7372 #[serde(default)]
7374 pub with_statistics: Option<bool>,
7375 #[serde(default)]
7377 pub teradata_indexes: Vec<TeradataIndex>,
7378 #[serde(default)]
7380 pub with_cte: Option<With>,
7381 #[serde(default)]
7383 pub properties: Vec<Expression>,
7384 #[serde(default, skip_serializing_if = "Option::is_none")]
7386 pub partition_of: Option<Expression>,
7387 #[serde(default)]
7389 pub post_table_properties: Vec<Expression>,
7390 #[serde(default)]
7392 pub mysql_table_options: Vec<(String, String)>,
7393 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7395 pub inherits: Vec<TableRef>,
7396 #[serde(default, skip_serializing_if = "Option::is_none")]
7398 pub on_property: Option<OnProperty>,
7399 #[serde(default)]
7401 pub copy_grants: bool,
7402 #[serde(default, skip_serializing_if = "Option::is_none")]
7404 pub using_template: Option<Box<Expression>>,
7405 #[serde(default, skip_serializing_if = "Option::is_none")]
7407 pub rollup: Option<RollupProperty>,
7408 #[serde(default, skip_serializing_if = "Option::is_none")]
7410 pub uuid: Option<String>,
7411 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7415 pub with_partition_columns: Vec<ColumnDef>,
7416 #[serde(default, skip_serializing_if = "Option::is_none")]
7419 pub with_connection: Option<TableRef>,
7420}
7421
7422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7424#[cfg_attr(feature = "bindings", derive(TS))]
7425pub struct TeradataIndex {
7426 pub kind: TeradataIndexKind,
7428 pub name: Option<String>,
7430 pub columns: Vec<String>,
7432}
7433
7434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7436#[cfg_attr(feature = "bindings", derive(TS))]
7437pub enum TeradataIndexKind {
7438 NoPrimary,
7440 Primary,
7442 PrimaryAmp,
7444 Unique,
7446 UniquePrimary,
7448 Secondary,
7450}
7451
7452impl CreateTable {
7453 pub fn new(name: impl Into<String>) -> Self {
7454 Self {
7455 name: TableRef::new(name),
7456 on_cluster: None,
7457 columns: Vec::new(),
7458 constraints: Vec::new(),
7459 if_not_exists: false,
7460 temporary: false,
7461 or_replace: false,
7462 table_modifier: None,
7463 as_select: None,
7464 as_select_parenthesized: false,
7465 on_commit: None,
7466 clone_source: None,
7467 clone_at_clause: None,
7468 shallow_clone: false,
7469 deep_clone: false,
7470 is_copy: false,
7471 leading_comments: Vec::new(),
7472 with_properties: Vec::new(),
7473 teradata_post_name_options: Vec::new(),
7474 with_data: None,
7475 with_statistics: None,
7476 teradata_indexes: Vec::new(),
7477 with_cte: None,
7478 properties: Vec::new(),
7479 partition_of: None,
7480 post_table_properties: Vec::new(),
7481 mysql_table_options: Vec::new(),
7482 inherits: Vec::new(),
7483 on_property: None,
7484 copy_grants: false,
7485 using_template: None,
7486 rollup: None,
7487 uuid: None,
7488 with_partition_columns: Vec::new(),
7489 with_connection: None,
7490 }
7491 }
7492}
7493
7494#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7496#[cfg_attr(feature = "bindings", derive(TS))]
7497pub enum SortOrder {
7498 Asc,
7499 Desc,
7500}
7501
7502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7504#[cfg_attr(feature = "bindings", derive(TS))]
7505pub enum ConstraintType {
7506 NotNull,
7507 Null,
7508 PrimaryKey,
7509 Unique,
7510 Default,
7511 AutoIncrement,
7512 Collate,
7513 Comment,
7514 References,
7515 Check,
7516 GeneratedAsIdentity,
7517 Tags,
7519 ComputedColumn,
7521 GeneratedAsRow,
7523 OnUpdate,
7525 Path,
7527 Encode,
7529}
7530
7531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7533#[cfg_attr(feature = "bindings", derive(TS))]
7534pub struct ColumnDef {
7535 pub name: Identifier,
7536 pub data_type: DataType,
7537 pub nullable: Option<bool>,
7538 pub default: Option<Expression>,
7539 pub primary_key: bool,
7540 #[serde(default)]
7542 pub primary_key_order: Option<SortOrder>,
7543 pub unique: bool,
7544 #[serde(default)]
7546 pub unique_nulls_not_distinct: bool,
7547 pub auto_increment: bool,
7548 pub comment: Option<String>,
7549 pub constraints: Vec<ColumnConstraint>,
7550 #[serde(default)]
7552 pub constraint_order: Vec<ConstraintType>,
7553 #[serde(default)]
7555 pub format: Option<String>,
7556 #[serde(default)]
7558 pub title: Option<String>,
7559 #[serde(default)]
7561 pub inline_length: Option<u64>,
7562 #[serde(default)]
7564 pub compress: Option<Vec<Expression>>,
7565 #[serde(default)]
7567 pub character_set: Option<String>,
7568 #[serde(default)]
7570 pub uppercase: bool,
7571 #[serde(default)]
7573 pub casespecific: Option<bool>,
7574 #[serde(default)]
7576 pub auto_increment_start: Option<Box<Expression>>,
7577 #[serde(default)]
7579 pub auto_increment_increment: Option<Box<Expression>>,
7580 #[serde(default)]
7582 pub auto_increment_order: Option<bool>,
7583 #[serde(default)]
7585 pub unsigned: bool,
7586 #[serde(default)]
7588 pub zerofill: bool,
7589 #[serde(default, skip_serializing_if = "Option::is_none")]
7591 pub on_update: Option<Expression>,
7592 #[serde(default, skip_serializing_if = "Option::is_none")]
7594 pub visible: Option<bool>,
7595 #[serde(default, skip_serializing_if = "Option::is_none")]
7597 pub unique_constraint_name: Option<String>,
7598 #[serde(default, skip_serializing_if = "Option::is_none")]
7600 pub not_null_constraint_name: Option<String>,
7601 #[serde(default, skip_serializing_if = "Option::is_none")]
7603 pub primary_key_constraint_name: Option<String>,
7604 #[serde(default, skip_serializing_if = "Option::is_none")]
7606 pub check_constraint_name: Option<String>,
7607 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7609 pub options: Vec<Expression>,
7610 #[serde(default)]
7612 pub no_type: bool,
7613 #[serde(default, skip_serializing_if = "Option::is_none")]
7615 pub encoding: Option<String>,
7616 #[serde(default, skip_serializing_if = "Option::is_none")]
7618 pub codec: Option<String>,
7619 #[serde(default, skip_serializing_if = "Option::is_none")]
7621 pub ephemeral: Option<Option<Box<Expression>>>,
7622 #[serde(default, skip_serializing_if = "Option::is_none")]
7624 pub materialized_expr: Option<Box<Expression>>,
7625 #[serde(default, skip_serializing_if = "Option::is_none")]
7627 pub alias_expr: Option<Box<Expression>>,
7628 #[serde(default, skip_serializing_if = "Option::is_none")]
7630 pub ttl_expr: Option<Box<Expression>>,
7631 #[serde(default)]
7633 pub not_for_replication: bool,
7634}
7635
7636impl ColumnDef {
7637 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7638 Self {
7639 name: Identifier::new(name),
7640 data_type,
7641 nullable: None,
7642 default: None,
7643 primary_key: false,
7644 primary_key_order: None,
7645 unique: false,
7646 unique_nulls_not_distinct: false,
7647 auto_increment: false,
7648 comment: None,
7649 constraints: Vec::new(),
7650 constraint_order: Vec::new(),
7651 format: None,
7652 title: None,
7653 inline_length: None,
7654 compress: None,
7655 character_set: None,
7656 uppercase: false,
7657 casespecific: None,
7658 auto_increment_start: None,
7659 auto_increment_increment: None,
7660 auto_increment_order: None,
7661 unsigned: false,
7662 zerofill: false,
7663 on_update: None,
7664 visible: None,
7665 unique_constraint_name: None,
7666 not_null_constraint_name: None,
7667 primary_key_constraint_name: None,
7668 check_constraint_name: None,
7669 options: Vec::new(),
7670 no_type: false,
7671 encoding: None,
7672 codec: None,
7673 ephemeral: None,
7674 materialized_expr: None,
7675 alias_expr: None,
7676 ttl_expr: None,
7677 not_for_replication: false,
7678 }
7679 }
7680}
7681
7682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7684#[cfg_attr(feature = "bindings", derive(TS))]
7685pub enum ColumnConstraint {
7686 NotNull,
7687 Null,
7688 Unique,
7689 PrimaryKey,
7690 Default(Expression),
7691 Check(Expression),
7692 References(ForeignKeyRef),
7693 GeneratedAsIdentity(GeneratedAsIdentity),
7694 Collate(Identifier),
7695 Comment(String),
7696 Tags(Tags),
7698 ComputedColumn(ComputedColumn),
7701 GeneratedAsRow(GeneratedAsRow),
7703 Path(Expression),
7705}
7706
7707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7709#[cfg_attr(feature = "bindings", derive(TS))]
7710pub struct ComputedColumn {
7711 pub expression: Box<Expression>,
7713 #[serde(default)]
7715 pub persisted: bool,
7716 #[serde(default)]
7718 pub not_null: bool,
7719 #[serde(default)]
7722 pub persistence_kind: Option<String>,
7723 #[serde(default, skip_serializing_if = "Option::is_none")]
7725 pub data_type: Option<DataType>,
7726}
7727
7728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7730#[cfg_attr(feature = "bindings", derive(TS))]
7731pub struct GeneratedAsRow {
7732 pub start: bool,
7734 #[serde(default)]
7736 pub hidden: bool,
7737}
7738
7739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7741#[cfg_attr(feature = "bindings", derive(TS))]
7742pub struct GeneratedAsIdentity {
7743 pub always: bool,
7745 pub on_null: bool,
7747 pub start: Option<Box<Expression>>,
7749 pub increment: Option<Box<Expression>>,
7751 pub minvalue: Option<Box<Expression>>,
7753 pub maxvalue: Option<Box<Expression>>,
7755 pub cycle: Option<bool>,
7757}
7758
7759#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7761#[cfg_attr(feature = "bindings", derive(TS))]
7762pub struct ConstraintModifiers {
7763 pub enforced: Option<bool>,
7765 pub deferrable: Option<bool>,
7767 pub initially_deferred: Option<bool>,
7769 pub norely: bool,
7771 pub rely: bool,
7773 #[serde(default)]
7775 pub using: Option<String>,
7776 #[serde(default)]
7778 pub using_before_columns: bool,
7779 #[serde(default, skip_serializing_if = "Option::is_none")]
7781 pub comment: Option<String>,
7782 #[serde(default, skip_serializing_if = "Option::is_none")]
7784 pub visible: Option<bool>,
7785 #[serde(default, skip_serializing_if = "Option::is_none")]
7787 pub engine_attribute: Option<String>,
7788 #[serde(default, skip_serializing_if = "Option::is_none")]
7790 pub with_parser: Option<String>,
7791 #[serde(default)]
7793 pub not_valid: bool,
7794 #[serde(default, skip_serializing_if = "Option::is_none")]
7796 pub clustered: Option<String>,
7797 #[serde(default, skip_serializing_if = "Option::is_none")]
7799 pub on_conflict: Option<String>,
7800 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7802 pub with_options: Vec<(String, String)>,
7803 #[serde(default, skip_serializing_if = "Option::is_none")]
7805 pub on_filegroup: Option<Identifier>,
7806}
7807
7808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7810#[cfg_attr(feature = "bindings", derive(TS))]
7811pub enum TableConstraint {
7812 PrimaryKey {
7813 name: Option<Identifier>,
7814 columns: Vec<Identifier>,
7815 #[serde(default)]
7817 include_columns: Vec<Identifier>,
7818 #[serde(default)]
7819 modifiers: ConstraintModifiers,
7820 #[serde(default)]
7822 has_constraint_keyword: bool,
7823 },
7824 Unique {
7825 name: Option<Identifier>,
7826 columns: Vec<Identifier>,
7827 #[serde(default)]
7829 columns_parenthesized: bool,
7830 #[serde(default)]
7831 modifiers: ConstraintModifiers,
7832 #[serde(default)]
7834 has_constraint_keyword: bool,
7835 #[serde(default)]
7837 nulls_not_distinct: bool,
7838 },
7839 ForeignKey {
7840 name: Option<Identifier>,
7841 columns: Vec<Identifier>,
7842 #[serde(default)]
7843 references: Option<ForeignKeyRef>,
7844 #[serde(default)]
7846 on_delete: Option<ReferentialAction>,
7847 #[serde(default)]
7849 on_update: Option<ReferentialAction>,
7850 #[serde(default)]
7851 modifiers: ConstraintModifiers,
7852 },
7853 Check {
7854 name: Option<Identifier>,
7855 expression: Expression,
7856 #[serde(default)]
7857 modifiers: ConstraintModifiers,
7858 },
7859 Assume {
7861 name: Option<Identifier>,
7862 expression: Expression,
7863 },
7864 Default {
7866 name: Option<Identifier>,
7867 expression: Expression,
7868 column: Identifier,
7869 },
7870 Index {
7872 name: Option<Identifier>,
7873 columns: Vec<Identifier>,
7874 #[serde(default)]
7876 kind: Option<String>,
7877 #[serde(default)]
7878 modifiers: ConstraintModifiers,
7879 #[serde(default)]
7881 use_key_keyword: bool,
7882 #[serde(default, skip_serializing_if = "Option::is_none")]
7884 expression: Option<Box<Expression>>,
7885 #[serde(default, skip_serializing_if = "Option::is_none")]
7887 index_type: Option<Box<Expression>>,
7888 #[serde(default, skip_serializing_if = "Option::is_none")]
7890 granularity: Option<Box<Expression>>,
7891 },
7892 Projection {
7894 name: Identifier,
7895 expression: Expression,
7896 },
7897 Like {
7899 source: TableRef,
7900 options: Vec<(LikeOptionAction, String)>,
7902 },
7903 PeriodForSystemTime {
7905 start_col: Identifier,
7906 end_col: Identifier,
7907 },
7908 Exclude {
7911 name: Option<Identifier>,
7912 #[serde(default)]
7914 using: Option<String>,
7915 elements: Vec<ExcludeElement>,
7917 #[serde(default)]
7919 include_columns: Vec<Identifier>,
7920 #[serde(default)]
7922 where_clause: Option<Box<Expression>>,
7923 #[serde(default)]
7925 with_params: Vec<(String, String)>,
7926 #[serde(default)]
7928 using_index_tablespace: Option<String>,
7929 #[serde(default)]
7930 modifiers: ConstraintModifiers,
7931 },
7932 Tags(Tags),
7934 InitiallyDeferred {
7938 deferred: bool,
7940 },
7941}
7942
7943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7945#[cfg_attr(feature = "bindings", derive(TS))]
7946pub struct ExcludeElement {
7947 pub expression: String,
7949 pub operator: String,
7951}
7952
7953#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7955#[cfg_attr(feature = "bindings", derive(TS))]
7956pub enum LikeOptionAction {
7957 Including,
7958 Excluding,
7959}
7960
7961#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7963#[cfg_attr(feature = "bindings", derive(TS))]
7964pub enum MatchType {
7965 Full,
7966 Partial,
7967 Simple,
7968}
7969
7970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7972#[cfg_attr(feature = "bindings", derive(TS))]
7973pub struct ForeignKeyRef {
7974 pub table: TableRef,
7975 pub columns: Vec<Identifier>,
7976 pub on_delete: Option<ReferentialAction>,
7977 pub on_update: Option<ReferentialAction>,
7978 #[serde(default)]
7980 pub on_update_first: bool,
7981 #[serde(default)]
7983 pub match_type: Option<MatchType>,
7984 #[serde(default)]
7986 pub match_after_actions: bool,
7987 #[serde(default)]
7989 pub constraint_name: Option<String>,
7990 #[serde(default)]
7992 pub deferrable: Option<bool>,
7993 #[serde(default)]
7995 pub has_foreign_key_keywords: bool,
7996}
7997
7998#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8000#[cfg_attr(feature = "bindings", derive(TS))]
8001pub enum ReferentialAction {
8002 Cascade,
8003 SetNull,
8004 SetDefault,
8005 Restrict,
8006 NoAction,
8007}
8008
8009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8011#[cfg_attr(feature = "bindings", derive(TS))]
8012pub struct DropTable {
8013 pub names: Vec<TableRef>,
8014 pub if_exists: bool,
8015 pub cascade: bool,
8016 #[serde(default)]
8018 pub cascade_constraints: bool,
8019 #[serde(default)]
8021 pub purge: bool,
8022 #[serde(default)]
8024 pub leading_comments: Vec<String>,
8025 #[serde(default, skip_serializing_if = "Option::is_none")]
8028 pub object_id_args: Option<String>,
8029 #[serde(default)]
8031 pub sync: bool,
8032 #[serde(default)]
8034 pub iceberg: bool,
8035 #[serde(default)]
8037 pub restrict: bool,
8038}
8039
8040impl DropTable {
8041 pub fn new(name: impl Into<String>) -> Self {
8042 Self {
8043 names: vec![TableRef::new(name)],
8044 if_exists: false,
8045 cascade: false,
8046 cascade_constraints: false,
8047 purge: false,
8048 leading_comments: Vec::new(),
8049 object_id_args: None,
8050 sync: false,
8051 iceberg: false,
8052 restrict: false,
8053 }
8054 }
8055}
8056
8057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8059#[cfg_attr(feature = "bindings", derive(TS))]
8060pub struct Undrop {
8061 pub kind: String,
8063 pub name: TableRef,
8065 #[serde(default)]
8067 pub if_exists: bool,
8068}
8069
8070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8072#[cfg_attr(feature = "bindings", derive(TS))]
8073pub struct AlterTable {
8074 pub name: TableRef,
8075 pub actions: Vec<AlterTableAction>,
8076 #[serde(default)]
8078 pub if_exists: bool,
8079 #[serde(default, skip_serializing_if = "Option::is_none")]
8081 pub algorithm: Option<String>,
8082 #[serde(default, skip_serializing_if = "Option::is_none")]
8084 pub lock: Option<String>,
8085 #[serde(default, skip_serializing_if = "Option::is_none")]
8087 pub with_check: Option<String>,
8088 #[serde(default, skip_serializing_if = "Option::is_none")]
8090 pub partition: Option<Vec<(Identifier, Expression)>>,
8091 #[serde(default, skip_serializing_if = "Option::is_none")]
8093 pub on_cluster: Option<OnCluster>,
8094 #[serde(default, skip_serializing_if = "Option::is_none")]
8096 pub table_modifier: Option<String>,
8097}
8098
8099impl AlterTable {
8100 pub fn new(name: impl Into<String>) -> Self {
8101 Self {
8102 name: TableRef::new(name),
8103 actions: Vec::new(),
8104 if_exists: false,
8105 algorithm: None,
8106 lock: None,
8107 with_check: None,
8108 partition: None,
8109 on_cluster: None,
8110 table_modifier: None,
8111 }
8112 }
8113}
8114
8115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8117#[cfg_attr(feature = "bindings", derive(TS))]
8118pub enum ColumnPosition {
8119 First,
8120 After(Identifier),
8121}
8122
8123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8125#[cfg_attr(feature = "bindings", derive(TS))]
8126pub enum AlterTableAction {
8127 AddColumn {
8128 column: ColumnDef,
8129 if_not_exists: bool,
8130 position: Option<ColumnPosition>,
8131 },
8132 DropColumn {
8133 name: Identifier,
8134 if_exists: bool,
8135 cascade: bool,
8136 },
8137 RenameColumn {
8138 old_name: Identifier,
8139 new_name: Identifier,
8140 if_exists: bool,
8141 },
8142 AlterColumn {
8143 name: Identifier,
8144 action: AlterColumnAction,
8145 #[serde(default)]
8147 use_modify_keyword: bool,
8148 },
8149 RenameTable(TableRef),
8150 AddConstraint(TableConstraint),
8151 DropConstraint {
8152 name: Identifier,
8153 if_exists: bool,
8154 },
8155 DropForeignKey {
8157 name: Identifier,
8158 },
8159 DropPartition {
8161 partitions: Vec<Vec<(Identifier, Expression)>>,
8163 if_exists: bool,
8164 },
8165 AddPartition {
8167 partition: Expression,
8169 if_not_exists: bool,
8170 location: Option<Expression>,
8171 },
8172 Delete {
8174 where_clause: Expression,
8175 },
8176 SwapWith(TableRef),
8178 SetProperty {
8180 properties: Vec<(String, Expression)>,
8181 },
8182 UnsetProperty {
8184 properties: Vec<String>,
8185 },
8186 ClusterBy {
8188 expressions: Vec<Expression>,
8189 },
8190 SetTag {
8192 expressions: Vec<(String, Expression)>,
8193 },
8194 UnsetTag {
8196 names: Vec<String>,
8197 },
8198 SetOptions {
8200 expressions: Vec<Expression>,
8201 },
8202 AlterIndex {
8204 name: Identifier,
8205 visible: bool,
8206 },
8207 SetAttribute {
8209 attribute: String,
8210 },
8211 SetStageFileFormat {
8213 options: Option<Expression>,
8214 },
8215 SetStageCopyOptions {
8217 options: Option<Expression>,
8218 },
8219 AddColumns {
8221 columns: Vec<ColumnDef>,
8222 cascade: bool,
8223 },
8224 DropColumns {
8226 names: Vec<Identifier>,
8227 },
8228 ChangeColumn {
8231 old_name: Identifier,
8232 new_name: Identifier,
8233 #[serde(default, skip_serializing_if = "Option::is_none")]
8234 data_type: Option<DataType>,
8235 comment: Option<String>,
8236 #[serde(default)]
8237 cascade: bool,
8238 },
8239 AlterSortKey {
8242 this: Option<String>,
8244 expressions: Vec<Expression>,
8246 compound: bool,
8248 },
8249 AlterDistStyle {
8253 style: String,
8255 distkey: Option<Identifier>,
8257 },
8258 SetTableProperties {
8260 properties: Vec<(Expression, Expression)>,
8261 },
8262 SetLocation {
8264 location: String,
8265 },
8266 SetFileFormat {
8268 format: String,
8269 },
8270 ReplacePartition {
8272 partition: Expression,
8273 source: Option<Box<Expression>>,
8274 },
8275 Raw {
8277 sql: String,
8278 },
8279}
8280
8281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8283#[cfg_attr(feature = "bindings", derive(TS))]
8284pub enum AlterColumnAction {
8285 SetDataType {
8286 data_type: DataType,
8287 using: Option<Expression>,
8289 #[serde(default, skip_serializing_if = "Option::is_none")]
8291 collate: Option<String>,
8292 },
8293 SetDefault(Expression),
8294 DropDefault,
8295 SetNotNull,
8296 DropNotNull,
8297 Comment(String),
8299 SetVisible,
8301 SetInvisible,
8303}
8304
8305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8307#[cfg_attr(feature = "bindings", derive(TS))]
8308pub struct CreateIndex {
8309 pub name: Identifier,
8310 pub table: TableRef,
8311 pub columns: Vec<IndexColumn>,
8312 pub unique: bool,
8313 pub if_not_exists: bool,
8314 pub using: Option<String>,
8315 #[serde(default)]
8317 pub clustered: Option<String>,
8318 #[serde(default)]
8320 pub concurrently: bool,
8321 #[serde(default)]
8323 pub where_clause: Option<Box<Expression>>,
8324 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8326 pub include_columns: Vec<Identifier>,
8327 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8329 pub with_options: Vec<(String, String)>,
8330 #[serde(default)]
8332 pub on_filegroup: Option<String>,
8333}
8334
8335impl CreateIndex {
8336 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8337 Self {
8338 name: Identifier::new(name),
8339 table: TableRef::new(table),
8340 columns: Vec::new(),
8341 unique: false,
8342 if_not_exists: false,
8343 using: None,
8344 clustered: None,
8345 concurrently: false,
8346 where_clause: None,
8347 include_columns: Vec::new(),
8348 with_options: Vec::new(),
8349 on_filegroup: None,
8350 }
8351 }
8352}
8353
8354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8356#[cfg_attr(feature = "bindings", derive(TS))]
8357pub struct IndexColumn {
8358 pub column: Identifier,
8359 pub desc: bool,
8360 #[serde(default)]
8362 pub asc: bool,
8363 pub nulls_first: Option<bool>,
8364 #[serde(default, skip_serializing_if = "Option::is_none")]
8366 pub opclass: Option<String>,
8367}
8368
8369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8371#[cfg_attr(feature = "bindings", derive(TS))]
8372pub struct DropIndex {
8373 pub name: TableRef,
8374 pub table: Option<TableRef>,
8375 pub if_exists: bool,
8376 #[serde(default)]
8378 pub concurrently: bool,
8379}
8380
8381impl DropIndex {
8382 pub fn new(name: impl Into<String>) -> Self {
8383 Self {
8384 name: TableRef::new(name),
8385 table: None,
8386 if_exists: false,
8387 concurrently: false,
8388 }
8389 }
8390}
8391
8392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8394#[cfg_attr(feature = "bindings", derive(TS))]
8395pub struct ViewColumn {
8396 pub name: Identifier,
8397 pub comment: Option<String>,
8398 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8400 pub options: Vec<Expression>,
8401}
8402
8403impl ViewColumn {
8404 pub fn new(name: impl Into<String>) -> Self {
8405 Self {
8406 name: Identifier::new(name),
8407 comment: None,
8408 options: Vec::new(),
8409 }
8410 }
8411
8412 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8413 Self {
8414 name: Identifier::new(name),
8415 comment: Some(comment.into()),
8416 options: Vec::new(),
8417 }
8418 }
8419}
8420
8421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8423#[cfg_attr(feature = "bindings", derive(TS))]
8424pub struct CreateView {
8425 pub name: TableRef,
8426 pub columns: Vec<ViewColumn>,
8427 pub query: Expression,
8428 pub or_replace: bool,
8429 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8431 pub or_alter: bool,
8432 pub if_not_exists: bool,
8433 pub materialized: bool,
8434 pub temporary: bool,
8435 #[serde(default)]
8437 pub secure: bool,
8438 #[serde(skip_serializing_if = "Option::is_none")]
8440 pub algorithm: Option<String>,
8441 #[serde(skip_serializing_if = "Option::is_none")]
8443 pub definer: Option<String>,
8444 #[serde(skip_serializing_if = "Option::is_none")]
8446 pub security: Option<FunctionSecurity>,
8447 #[serde(default = "default_true")]
8449 pub security_sql_style: bool,
8450 #[serde(default)]
8452 pub security_after_name: bool,
8453 #[serde(default)]
8455 pub query_parenthesized: bool,
8456 #[serde(skip_serializing_if = "Option::is_none")]
8458 pub locking_mode: Option<String>,
8459 #[serde(skip_serializing_if = "Option::is_none")]
8461 pub locking_access: Option<String>,
8462 #[serde(default)]
8464 pub copy_grants: bool,
8465 #[serde(skip_serializing_if = "Option::is_none", default)]
8467 pub comment: Option<String>,
8468 #[serde(skip_serializing_if = "Option::is_none", default)]
8470 pub row_access_policy: Option<String>,
8471 #[serde(default)]
8473 pub tags: Vec<(String, String)>,
8474 #[serde(default)]
8476 pub options: Vec<Expression>,
8477 #[serde(skip_serializing_if = "Option::is_none", default)]
8479 pub build: Option<String>,
8480 #[serde(skip_serializing_if = "Option::is_none", default)]
8482 pub refresh: Option<Box<RefreshTriggerProperty>>,
8483 #[serde(skip_serializing_if = "Option::is_none", default)]
8486 pub schema: Option<Box<Schema>>,
8487 #[serde(skip_serializing_if = "Option::is_none", default)]
8489 pub unique_key: Option<Box<UniqueKeyProperty>>,
8490 #[serde(default)]
8492 pub no_schema_binding: bool,
8493 #[serde(skip_serializing_if = "Option::is_none", default)]
8495 pub auto_refresh: Option<bool>,
8496 #[serde(skip_serializing_if = "Option::is_none", default)]
8498 pub clickhouse_population: Option<String>,
8499 #[serde(default, skip_serializing_if = "Option::is_none")]
8501 pub on_cluster: Option<OnCluster>,
8502 #[serde(default, skip_serializing_if = "Option::is_none")]
8504 pub to_table: Option<TableRef>,
8505 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8507 pub table_properties: Vec<Expression>,
8508}
8509
8510impl CreateView {
8511 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8512 Self {
8513 name: TableRef::new(name),
8514 columns: Vec::new(),
8515 query,
8516 or_replace: false,
8517 or_alter: false,
8518 if_not_exists: false,
8519 materialized: false,
8520 temporary: false,
8521 secure: false,
8522 algorithm: None,
8523 definer: None,
8524 security: None,
8525 security_sql_style: true,
8526 security_after_name: false,
8527 query_parenthesized: false,
8528 locking_mode: None,
8529 locking_access: None,
8530 copy_grants: false,
8531 comment: None,
8532 row_access_policy: None,
8533 tags: Vec::new(),
8534 options: Vec::new(),
8535 build: None,
8536 refresh: None,
8537 schema: None,
8538 unique_key: None,
8539 no_schema_binding: false,
8540 auto_refresh: None,
8541 clickhouse_population: None,
8542 on_cluster: None,
8543 to_table: None,
8544 table_properties: Vec::new(),
8545 }
8546 }
8547}
8548
8549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8551#[cfg_attr(feature = "bindings", derive(TS))]
8552pub struct DropView {
8553 pub name: TableRef,
8554 pub if_exists: bool,
8555 pub materialized: bool,
8556}
8557
8558impl DropView {
8559 pub fn new(name: impl Into<String>) -> Self {
8560 Self {
8561 name: TableRef::new(name),
8562 if_exists: false,
8563 materialized: false,
8564 }
8565 }
8566}
8567
8568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8570#[cfg_attr(feature = "bindings", derive(TS))]
8571pub struct Truncate {
8572 #[serde(default)]
8574 pub target: TruncateTarget,
8575 #[serde(default)]
8577 pub if_exists: bool,
8578 pub table: TableRef,
8579 #[serde(default, skip_serializing_if = "Option::is_none")]
8581 pub on_cluster: Option<OnCluster>,
8582 pub cascade: bool,
8583 #[serde(default)]
8585 pub extra_tables: Vec<TruncateTableEntry>,
8586 #[serde(default)]
8588 pub identity: Option<TruncateIdentity>,
8589 #[serde(default)]
8591 pub restrict: bool,
8592 #[serde(default, skip_serializing_if = "Option::is_none")]
8594 pub partition: Option<Box<Expression>>,
8595}
8596
8597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8599#[cfg_attr(feature = "bindings", derive(TS))]
8600pub struct TruncateTableEntry {
8601 pub table: TableRef,
8602 #[serde(default)]
8604 pub star: bool,
8605}
8606
8607#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8609#[cfg_attr(feature = "bindings", derive(TS))]
8610pub enum TruncateTarget {
8611 Table,
8612 Database,
8613}
8614
8615impl Default for TruncateTarget {
8616 fn default() -> Self {
8617 TruncateTarget::Table
8618 }
8619}
8620
8621#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8623#[cfg_attr(feature = "bindings", derive(TS))]
8624pub enum TruncateIdentity {
8625 Restart,
8626 Continue,
8627}
8628
8629impl Truncate {
8630 pub fn new(table: impl Into<String>) -> Self {
8631 Self {
8632 target: TruncateTarget::Table,
8633 if_exists: false,
8634 table: TableRef::new(table),
8635 on_cluster: None,
8636 cascade: false,
8637 extra_tables: Vec::new(),
8638 identity: None,
8639 restrict: false,
8640 partition: None,
8641 }
8642 }
8643}
8644
8645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8647#[cfg_attr(feature = "bindings", derive(TS))]
8648pub struct Use {
8649 pub kind: Option<UseKind>,
8651 pub this: Identifier,
8653}
8654
8655#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8657#[cfg_attr(feature = "bindings", derive(TS))]
8658pub enum UseKind {
8659 Database,
8660 Schema,
8661 Role,
8662 Warehouse,
8663 Catalog,
8664 SecondaryRoles,
8666}
8667
8668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8670#[cfg_attr(feature = "bindings", derive(TS))]
8671pub struct SetStatement {
8672 pub items: Vec<SetItem>,
8674}
8675
8676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8678#[cfg_attr(feature = "bindings", derive(TS))]
8679pub struct SetItem {
8680 pub name: Expression,
8682 pub value: Expression,
8684 pub kind: Option<String>,
8686 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8688 pub no_equals: bool,
8689}
8690
8691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8693#[cfg_attr(feature = "bindings", derive(TS))]
8694pub struct Cache {
8695 pub table: Identifier,
8697 pub lazy: bool,
8699 pub options: Vec<(Expression, Expression)>,
8701 pub query: Option<Expression>,
8703}
8704
8705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8707#[cfg_attr(feature = "bindings", derive(TS))]
8708pub struct Uncache {
8709 pub table: Identifier,
8711 pub if_exists: bool,
8713}
8714
8715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8717#[cfg_attr(feature = "bindings", derive(TS))]
8718pub struct LoadData {
8719 pub local: bool,
8721 pub inpath: String,
8723 pub overwrite: bool,
8725 pub table: Expression,
8727 pub partition: Vec<(Identifier, Expression)>,
8729 pub input_format: Option<String>,
8731 pub serde: Option<String>,
8733}
8734
8735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8737#[cfg_attr(feature = "bindings", derive(TS))]
8738pub struct Pragma {
8739 pub schema: Option<Identifier>,
8741 pub name: Identifier,
8743 pub value: Option<Expression>,
8745 pub args: Vec<Expression>,
8747 #[serde(default)]
8749 pub use_assignment_syntax: bool,
8750}
8751
8752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8755#[cfg_attr(feature = "bindings", derive(TS))]
8756pub struct Privilege {
8757 pub name: String,
8759 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8761 pub columns: Vec<String>,
8762}
8763
8764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8766#[cfg_attr(feature = "bindings", derive(TS))]
8767pub struct GrantPrincipal {
8768 pub name: Identifier,
8770 pub is_role: bool,
8772 #[serde(default)]
8774 pub is_group: bool,
8775 #[serde(default)]
8777 pub is_share: bool,
8778}
8779
8780#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8782#[cfg_attr(feature = "bindings", derive(TS))]
8783pub struct Grant {
8784 pub privileges: Vec<Privilege>,
8786 pub kind: Option<String>,
8788 pub securable: Identifier,
8790 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8792 pub function_params: Vec<String>,
8793 pub principals: Vec<GrantPrincipal>,
8795 pub grant_option: bool,
8797 #[serde(default, skip_serializing_if = "Option::is_none")]
8799 pub as_principal: Option<Identifier>,
8800}
8801
8802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8804#[cfg_attr(feature = "bindings", derive(TS))]
8805pub struct Revoke {
8806 pub privileges: Vec<Privilege>,
8808 pub kind: Option<String>,
8810 pub securable: Identifier,
8812 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8814 pub function_params: Vec<String>,
8815 pub principals: Vec<GrantPrincipal>,
8817 pub grant_option: bool,
8819 pub cascade: bool,
8821 #[serde(default)]
8823 pub restrict: bool,
8824}
8825
8826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8828#[cfg_attr(feature = "bindings", derive(TS))]
8829pub struct Comment {
8830 pub this: Expression,
8832 pub kind: String,
8834 pub expression: Expression,
8836 pub exists: bool,
8838 pub materialized: bool,
8840}
8841
8842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8848#[cfg_attr(feature = "bindings", derive(TS))]
8849pub struct AlterView {
8850 pub name: TableRef,
8851 pub actions: Vec<AlterViewAction>,
8852 #[serde(default, skip_serializing_if = "Option::is_none")]
8854 pub algorithm: Option<String>,
8855 #[serde(default, skip_serializing_if = "Option::is_none")]
8857 pub definer: Option<String>,
8858 #[serde(default, skip_serializing_if = "Option::is_none")]
8860 pub sql_security: Option<String>,
8861 #[serde(default, skip_serializing_if = "Option::is_none")]
8863 pub with_option: Option<String>,
8864 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8866 pub columns: Vec<ViewColumn>,
8867}
8868
8869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8871#[cfg_attr(feature = "bindings", derive(TS))]
8872pub enum AlterViewAction {
8873 Rename(TableRef),
8875 OwnerTo(Identifier),
8877 SetSchema(Identifier),
8879 SetAuthorization(String),
8881 AlterColumn {
8883 name: Identifier,
8884 action: AlterColumnAction,
8885 },
8886 AsSelect(Box<Expression>),
8888 SetTblproperties(Vec<(String, String)>),
8890 UnsetTblproperties(Vec<String>),
8892}
8893
8894impl AlterView {
8895 pub fn new(name: impl Into<String>) -> Self {
8896 Self {
8897 name: TableRef::new(name),
8898 actions: Vec::new(),
8899 algorithm: None,
8900 definer: None,
8901 sql_security: None,
8902 with_option: None,
8903 columns: Vec::new(),
8904 }
8905 }
8906}
8907
8908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8910#[cfg_attr(feature = "bindings", derive(TS))]
8911pub struct AlterIndex {
8912 pub name: Identifier,
8913 pub table: Option<TableRef>,
8914 pub actions: Vec<AlterIndexAction>,
8915}
8916
8917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8919#[cfg_attr(feature = "bindings", derive(TS))]
8920pub enum AlterIndexAction {
8921 Rename(Identifier),
8923 SetTablespace(Identifier),
8925 Visible(bool),
8927}
8928
8929impl AlterIndex {
8930 pub fn new(name: impl Into<String>) -> Self {
8931 Self {
8932 name: Identifier::new(name),
8933 table: None,
8934 actions: Vec::new(),
8935 }
8936 }
8937}
8938
8939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8941#[cfg_attr(feature = "bindings", derive(TS))]
8942pub struct CreateSchema {
8943 pub name: Vec<Identifier>,
8945 pub if_not_exists: bool,
8946 pub authorization: Option<Identifier>,
8947 #[serde(default)]
8949 pub clone_from: Option<Vec<Identifier>>,
8950 #[serde(default)]
8952 pub at_clause: Option<Expression>,
8953 #[serde(default)]
8955 pub properties: Vec<Expression>,
8956 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8958 pub leading_comments: Vec<String>,
8959}
8960
8961impl CreateSchema {
8962 pub fn new(name: impl Into<String>) -> Self {
8963 Self {
8964 name: vec![Identifier::new(name)],
8965 if_not_exists: false,
8966 authorization: None,
8967 clone_from: None,
8968 at_clause: None,
8969 properties: Vec::new(),
8970 leading_comments: Vec::new(),
8971 }
8972 }
8973}
8974
8975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8977#[cfg_attr(feature = "bindings", derive(TS))]
8978pub struct DropSchema {
8979 pub name: Identifier,
8980 pub if_exists: bool,
8981 pub cascade: bool,
8982}
8983
8984impl DropSchema {
8985 pub fn new(name: impl Into<String>) -> Self {
8986 Self {
8987 name: Identifier::new(name),
8988 if_exists: false,
8989 cascade: false,
8990 }
8991 }
8992}
8993
8994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8996#[cfg_attr(feature = "bindings", derive(TS))]
8997pub struct DropNamespace {
8998 pub name: Identifier,
8999 pub if_exists: bool,
9000 pub cascade: bool,
9001}
9002
9003impl DropNamespace {
9004 pub fn new(name: impl Into<String>) -> Self {
9005 Self {
9006 name: Identifier::new(name),
9007 if_exists: false,
9008 cascade: false,
9009 }
9010 }
9011}
9012
9013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9015#[cfg_attr(feature = "bindings", derive(TS))]
9016pub struct CreateDatabase {
9017 pub name: Identifier,
9018 pub if_not_exists: bool,
9019 pub options: Vec<DatabaseOption>,
9020 #[serde(default)]
9022 pub clone_from: Option<Identifier>,
9023 #[serde(default)]
9025 pub at_clause: Option<Expression>,
9026}
9027
9028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9030#[cfg_attr(feature = "bindings", derive(TS))]
9031pub enum DatabaseOption {
9032 CharacterSet(String),
9033 Collate(String),
9034 Owner(Identifier),
9035 Template(Identifier),
9036 Encoding(String),
9037 Location(String),
9038}
9039
9040impl CreateDatabase {
9041 pub fn new(name: impl Into<String>) -> Self {
9042 Self {
9043 name: Identifier::new(name),
9044 if_not_exists: false,
9045 options: Vec::new(),
9046 clone_from: None,
9047 at_clause: None,
9048 }
9049 }
9050}
9051
9052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9054#[cfg_attr(feature = "bindings", derive(TS))]
9055pub struct DropDatabase {
9056 pub name: Identifier,
9057 pub if_exists: bool,
9058 #[serde(default)]
9060 pub sync: bool,
9061}
9062
9063impl DropDatabase {
9064 pub fn new(name: impl Into<String>) -> Self {
9065 Self {
9066 name: Identifier::new(name),
9067 if_exists: false,
9068 sync: false,
9069 }
9070 }
9071}
9072
9073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9075#[cfg_attr(feature = "bindings", derive(TS))]
9076pub struct CreateFunction {
9077 pub name: TableRef,
9078 pub parameters: Vec<FunctionParameter>,
9079 pub return_type: Option<DataType>,
9080 pub body: Option<FunctionBody>,
9081 pub or_replace: bool,
9082 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9084 pub or_alter: bool,
9085 pub if_not_exists: bool,
9086 pub temporary: bool,
9087 pub language: Option<String>,
9088 pub deterministic: Option<bool>,
9089 pub returns_null_on_null_input: Option<bool>,
9090 pub security: Option<FunctionSecurity>,
9091 #[serde(default = "default_true")]
9093 pub has_parens: bool,
9094 #[serde(default)]
9096 pub sql_data_access: Option<SqlDataAccess>,
9097 #[serde(default, skip_serializing_if = "Option::is_none")]
9099 pub returns_table_body: Option<String>,
9100 #[serde(default)]
9102 pub language_first: bool,
9103 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9105 pub set_options: Vec<FunctionSetOption>,
9106 #[serde(default)]
9108 pub strict: bool,
9109 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9111 pub options: Vec<Expression>,
9112 #[serde(default)]
9114 pub is_table_function: bool,
9115 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9117 pub property_order: Vec<FunctionPropertyKind>,
9118 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9120 pub using_resources: Vec<FunctionUsingResource>,
9121 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9123 pub environment: Vec<Expression>,
9124 #[serde(default, skip_serializing_if = "Option::is_none")]
9126 pub handler: Option<String>,
9127 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9129 pub handler_uses_eq: bool,
9130 #[serde(default, skip_serializing_if = "Option::is_none")]
9132 pub runtime_version: Option<String>,
9133 #[serde(default, skip_serializing_if = "Option::is_none")]
9135 pub packages: Option<Vec<String>>,
9136 #[serde(default, skip_serializing_if = "Option::is_none")]
9138 pub parameter_style: Option<String>,
9139}
9140
9141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9143#[cfg_attr(feature = "bindings", derive(TS))]
9144pub struct FunctionSetOption {
9145 pub name: String,
9146 pub value: FunctionSetValue,
9147}
9148
9149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9151#[cfg_attr(feature = "bindings", derive(TS))]
9152pub enum FunctionSetValue {
9153 Value { value: String, use_to: bool },
9155 FromCurrent,
9157}
9158
9159#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9161#[cfg_attr(feature = "bindings", derive(TS))]
9162pub enum SqlDataAccess {
9163 NoSql,
9165 ContainsSql,
9167 ReadsSqlData,
9169 ModifiesSqlData,
9171}
9172
9173#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9175#[cfg_attr(feature = "bindings", derive(TS))]
9176pub enum FunctionPropertyKind {
9177 Set,
9179 As,
9181 Using,
9183 Language,
9185 Determinism,
9187 NullInput,
9189 Security,
9191 SqlDataAccess,
9193 Options,
9195 Environment,
9197 Handler,
9199 RuntimeVersion,
9201 Packages,
9203 ParameterStyle,
9205}
9206
9207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9209#[cfg_attr(feature = "bindings", derive(TS))]
9210pub struct FunctionUsingResource {
9211 pub kind: String,
9212 pub uri: String,
9213}
9214
9215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9217#[cfg_attr(feature = "bindings", derive(TS))]
9218pub struct FunctionParameter {
9219 pub name: Option<Identifier>,
9220 pub data_type: DataType,
9221 pub mode: Option<ParameterMode>,
9222 pub default: Option<Expression>,
9223 #[serde(default, skip_serializing_if = "Option::is_none")]
9225 pub mode_text: Option<String>,
9226}
9227
9228#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9230#[cfg_attr(feature = "bindings", derive(TS))]
9231pub enum ParameterMode {
9232 In,
9233 Out,
9234 InOut,
9235 Variadic,
9236}
9237
9238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9240#[cfg_attr(feature = "bindings", derive(TS))]
9241pub enum FunctionBody {
9242 Block(String),
9244 StringLiteral(String),
9246 Expression(Expression),
9248 External(String),
9250 Return(Expression),
9252 Statements(Vec<Expression>),
9254 DollarQuoted {
9257 content: String,
9258 tag: Option<String>,
9259 },
9260 RawBlock(String),
9262}
9263
9264#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9266#[cfg_attr(feature = "bindings", derive(TS))]
9267pub enum FunctionSecurity {
9268 Definer,
9269 Invoker,
9270 None,
9272}
9273
9274impl CreateFunction {
9275 pub fn new(name: impl Into<String>) -> Self {
9276 Self {
9277 name: TableRef::new(name),
9278 parameters: Vec::new(),
9279 return_type: None,
9280 body: None,
9281 or_replace: false,
9282 or_alter: false,
9283 if_not_exists: false,
9284 temporary: false,
9285 language: None,
9286 deterministic: None,
9287 returns_null_on_null_input: None,
9288 security: None,
9289 has_parens: true,
9290 sql_data_access: None,
9291 returns_table_body: None,
9292 language_first: false,
9293 set_options: Vec::new(),
9294 strict: false,
9295 options: Vec::new(),
9296 is_table_function: false,
9297 property_order: Vec::new(),
9298 using_resources: Vec::new(),
9299 environment: Vec::new(),
9300 handler: None,
9301 handler_uses_eq: false,
9302 runtime_version: None,
9303 packages: None,
9304 parameter_style: None,
9305 }
9306 }
9307}
9308
9309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9311#[cfg_attr(feature = "bindings", derive(TS))]
9312pub struct DropFunction {
9313 pub name: TableRef,
9314 pub parameters: Option<Vec<DataType>>,
9315 pub if_exists: bool,
9316 pub cascade: bool,
9317}
9318
9319impl DropFunction {
9320 pub fn new(name: impl Into<String>) -> Self {
9321 Self {
9322 name: TableRef::new(name),
9323 parameters: None,
9324 if_exists: false,
9325 cascade: false,
9326 }
9327 }
9328}
9329
9330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9332#[cfg_attr(feature = "bindings", derive(TS))]
9333pub struct CreateProcedure {
9334 pub name: TableRef,
9335 pub parameters: Vec<FunctionParameter>,
9336 pub body: Option<FunctionBody>,
9337 pub or_replace: bool,
9338 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9340 pub or_alter: bool,
9341 pub if_not_exists: bool,
9342 pub language: Option<String>,
9343 pub security: Option<FunctionSecurity>,
9344 #[serde(default)]
9346 pub return_type: Option<DataType>,
9347 #[serde(default)]
9349 pub execute_as: Option<String>,
9350 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9352 pub with_options: Vec<String>,
9353 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9355 pub has_parens: bool,
9356 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9358 pub use_proc_keyword: bool,
9359}
9360
9361impl CreateProcedure {
9362 pub fn new(name: impl Into<String>) -> Self {
9363 Self {
9364 name: TableRef::new(name),
9365 parameters: Vec::new(),
9366 body: None,
9367 or_replace: false,
9368 or_alter: false,
9369 if_not_exists: false,
9370 language: None,
9371 security: None,
9372 return_type: None,
9373 execute_as: None,
9374 with_options: Vec::new(),
9375 has_parens: true,
9376 use_proc_keyword: false,
9377 }
9378 }
9379}
9380
9381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9383#[cfg_attr(feature = "bindings", derive(TS))]
9384pub struct DropProcedure {
9385 pub name: TableRef,
9386 pub parameters: Option<Vec<DataType>>,
9387 pub if_exists: bool,
9388 pub cascade: bool,
9389}
9390
9391impl DropProcedure {
9392 pub fn new(name: impl Into<String>) -> Self {
9393 Self {
9394 name: TableRef::new(name),
9395 parameters: None,
9396 if_exists: false,
9397 cascade: false,
9398 }
9399 }
9400}
9401
9402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9404#[cfg_attr(feature = "bindings", derive(TS))]
9405pub enum SeqPropKind {
9406 Start,
9407 Increment,
9408 Minvalue,
9409 Maxvalue,
9410 Cache,
9411 NoCache,
9412 Cycle,
9413 NoCycle,
9414 OwnedBy,
9415 Order,
9416 NoOrder,
9417 Comment,
9418 Sharing,
9420 Keep,
9422 NoKeep,
9424 Scale,
9426 NoScale,
9428 Shard,
9430 NoShard,
9432 Session,
9434 Global,
9436 NoCacheWord,
9438 NoCycleWord,
9440 NoMinvalueWord,
9442 NoMaxvalueWord,
9444}
9445
9446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9448#[cfg_attr(feature = "bindings", derive(TS))]
9449pub struct CreateSynonym {
9450 pub name: TableRef,
9452 pub target: TableRef,
9454}
9455
9456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9458#[cfg_attr(feature = "bindings", derive(TS))]
9459pub struct CreateSequence {
9460 pub name: TableRef,
9461 pub if_not_exists: bool,
9462 pub temporary: bool,
9463 #[serde(default)]
9464 pub or_replace: bool,
9465 #[serde(default, skip_serializing_if = "Option::is_none")]
9467 pub as_type: Option<DataType>,
9468 pub increment: Option<i64>,
9469 pub minvalue: Option<SequenceBound>,
9470 pub maxvalue: Option<SequenceBound>,
9471 pub start: Option<i64>,
9472 pub cache: Option<i64>,
9473 pub cycle: bool,
9474 pub owned_by: Option<TableRef>,
9475 #[serde(default)]
9477 pub owned_by_none: bool,
9478 #[serde(default)]
9480 pub order: Option<bool>,
9481 #[serde(default)]
9483 pub comment: Option<String>,
9484 #[serde(default, skip_serializing_if = "Option::is_none")]
9486 pub sharing: Option<String>,
9487 #[serde(default, skip_serializing_if = "Option::is_none")]
9489 pub scale_modifier: Option<String>,
9490 #[serde(default, skip_serializing_if = "Option::is_none")]
9492 pub shard_modifier: Option<String>,
9493 #[serde(default)]
9495 pub property_order: Vec<SeqPropKind>,
9496}
9497
9498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9500#[cfg_attr(feature = "bindings", derive(TS))]
9501pub enum SequenceBound {
9502 Value(i64),
9503 None,
9504}
9505
9506impl CreateSequence {
9507 pub fn new(name: impl Into<String>) -> Self {
9508 Self {
9509 name: TableRef::new(name),
9510 if_not_exists: false,
9511 temporary: false,
9512 or_replace: false,
9513 as_type: None,
9514 increment: None,
9515 minvalue: None,
9516 maxvalue: None,
9517 start: None,
9518 cache: None,
9519 cycle: false,
9520 owned_by: None,
9521 owned_by_none: false,
9522 order: None,
9523 comment: None,
9524 sharing: None,
9525 scale_modifier: None,
9526 shard_modifier: None,
9527 property_order: Vec::new(),
9528 }
9529 }
9530}
9531
9532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9534#[cfg_attr(feature = "bindings", derive(TS))]
9535pub struct DropSequence {
9536 pub name: TableRef,
9537 pub if_exists: bool,
9538 pub cascade: bool,
9539}
9540
9541impl DropSequence {
9542 pub fn new(name: impl Into<String>) -> Self {
9543 Self {
9544 name: TableRef::new(name),
9545 if_exists: false,
9546 cascade: false,
9547 }
9548 }
9549}
9550
9551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9553#[cfg_attr(feature = "bindings", derive(TS))]
9554pub struct AlterSequence {
9555 pub name: TableRef,
9556 pub if_exists: bool,
9557 pub increment: Option<i64>,
9558 pub minvalue: Option<SequenceBound>,
9559 pub maxvalue: Option<SequenceBound>,
9560 pub start: Option<i64>,
9561 pub restart: Option<Option<i64>>,
9562 pub cache: Option<i64>,
9563 pub cycle: Option<bool>,
9564 pub owned_by: Option<Option<TableRef>>,
9565}
9566
9567impl AlterSequence {
9568 pub fn new(name: impl Into<String>) -> Self {
9569 Self {
9570 name: TableRef::new(name),
9571 if_exists: false,
9572 increment: None,
9573 minvalue: None,
9574 maxvalue: None,
9575 start: None,
9576 restart: None,
9577 cache: None,
9578 cycle: None,
9579 owned_by: None,
9580 }
9581 }
9582}
9583
9584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9586#[cfg_attr(feature = "bindings", derive(TS))]
9587pub struct CreateTrigger {
9588 pub name: Identifier,
9589 pub table: TableRef,
9590 pub timing: TriggerTiming,
9591 pub events: Vec<TriggerEvent>,
9592 #[serde(default, skip_serializing_if = "Option::is_none")]
9593 pub for_each: Option<TriggerForEach>,
9594 pub when: Option<Expression>,
9595 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9597 pub when_paren: bool,
9598 pub body: TriggerBody,
9599 pub or_replace: bool,
9600 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9602 pub or_alter: bool,
9603 pub constraint: bool,
9604 pub deferrable: Option<bool>,
9605 pub initially_deferred: Option<bool>,
9606 pub referencing: Option<TriggerReferencing>,
9607}
9608
9609#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9611#[cfg_attr(feature = "bindings", derive(TS))]
9612pub enum TriggerTiming {
9613 Before,
9614 After,
9615 InsteadOf,
9616}
9617
9618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9620#[cfg_attr(feature = "bindings", derive(TS))]
9621pub enum TriggerEvent {
9622 Insert,
9623 Update(Option<Vec<Identifier>>),
9624 Delete,
9625 Truncate,
9626}
9627
9628#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9630#[cfg_attr(feature = "bindings", derive(TS))]
9631pub enum TriggerForEach {
9632 Row,
9633 Statement,
9634}
9635
9636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9638#[cfg_attr(feature = "bindings", derive(TS))]
9639pub enum TriggerBody {
9640 Execute {
9642 function: TableRef,
9643 args: Vec<Expression>,
9644 },
9645 Block(String),
9647}
9648
9649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9651#[cfg_attr(feature = "bindings", derive(TS))]
9652pub struct TriggerReferencing {
9653 pub old_table: Option<Identifier>,
9654 pub new_table: Option<Identifier>,
9655 pub old_row: Option<Identifier>,
9656 pub new_row: Option<Identifier>,
9657}
9658
9659impl CreateTrigger {
9660 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9661 Self {
9662 name: Identifier::new(name),
9663 table: TableRef::new(table),
9664 timing: TriggerTiming::Before,
9665 events: Vec::new(),
9666 for_each: Some(TriggerForEach::Row),
9667 when: None,
9668 when_paren: false,
9669 body: TriggerBody::Execute {
9670 function: TableRef::new(""),
9671 args: Vec::new(),
9672 },
9673 or_replace: false,
9674 or_alter: false,
9675 constraint: false,
9676 deferrable: None,
9677 initially_deferred: None,
9678 referencing: None,
9679 }
9680 }
9681}
9682
9683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9685#[cfg_attr(feature = "bindings", derive(TS))]
9686pub struct DropTrigger {
9687 pub name: Identifier,
9688 pub table: Option<TableRef>,
9689 pub if_exists: bool,
9690 pub cascade: bool,
9691}
9692
9693impl DropTrigger {
9694 pub fn new(name: impl Into<String>) -> Self {
9695 Self {
9696 name: Identifier::new(name),
9697 table: None,
9698 if_exists: false,
9699 cascade: false,
9700 }
9701 }
9702}
9703
9704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9706#[cfg_attr(feature = "bindings", derive(TS))]
9707pub struct CreateType {
9708 pub name: TableRef,
9709 pub definition: TypeDefinition,
9710 pub if_not_exists: bool,
9711}
9712
9713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9715#[cfg_attr(feature = "bindings", derive(TS))]
9716pub enum TypeDefinition {
9717 Enum(Vec<String>),
9719 Composite(Vec<TypeAttribute>),
9721 Range {
9723 subtype: DataType,
9724 subtype_diff: Option<String>,
9725 canonical: Option<String>,
9726 },
9727 Base {
9729 input: String,
9730 output: String,
9731 internallength: Option<i32>,
9732 },
9733 Domain {
9735 base_type: DataType,
9736 default: Option<Expression>,
9737 constraints: Vec<DomainConstraint>,
9738 },
9739}
9740
9741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9743#[cfg_attr(feature = "bindings", derive(TS))]
9744pub struct TypeAttribute {
9745 pub name: Identifier,
9746 pub data_type: DataType,
9747 pub collate: Option<Identifier>,
9748}
9749
9750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9752#[cfg_attr(feature = "bindings", derive(TS))]
9753pub struct DomainConstraint {
9754 pub name: Option<Identifier>,
9755 pub check: Expression,
9756}
9757
9758impl CreateType {
9759 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9760 Self {
9761 name: TableRef::new(name),
9762 definition: TypeDefinition::Enum(values),
9763 if_not_exists: false,
9764 }
9765 }
9766
9767 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9768 Self {
9769 name: TableRef::new(name),
9770 definition: TypeDefinition::Composite(attributes),
9771 if_not_exists: false,
9772 }
9773 }
9774}
9775
9776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9778#[cfg_attr(feature = "bindings", derive(TS))]
9779pub struct DropType {
9780 pub name: TableRef,
9781 pub if_exists: bool,
9782 pub cascade: bool,
9783}
9784
9785impl DropType {
9786 pub fn new(name: impl Into<String>) -> Self {
9787 Self {
9788 name: TableRef::new(name),
9789 if_exists: false,
9790 cascade: false,
9791 }
9792 }
9793}
9794
9795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9797#[cfg_attr(feature = "bindings", derive(TS))]
9798pub struct Describe {
9799 pub target: Expression,
9801 pub extended: bool,
9803 pub formatted: bool,
9805 #[serde(default)]
9807 pub kind: Option<String>,
9808 #[serde(default)]
9810 pub properties: Vec<(String, String)>,
9811 #[serde(default, skip_serializing_if = "Option::is_none")]
9813 pub style: Option<String>,
9814 #[serde(default)]
9816 pub partition: Option<Box<Expression>>,
9817 #[serde(default)]
9819 pub leading_comments: Vec<String>,
9820 #[serde(default)]
9822 pub as_json: bool,
9823 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9825 pub params: Vec<String>,
9826}
9827
9828impl Describe {
9829 pub fn new(target: Expression) -> Self {
9830 Self {
9831 target,
9832 extended: false,
9833 formatted: false,
9834 kind: None,
9835 properties: Vec::new(),
9836 style: None,
9837 partition: None,
9838 leading_comments: Vec::new(),
9839 as_json: false,
9840 params: Vec::new(),
9841 }
9842 }
9843}
9844
9845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9847#[cfg_attr(feature = "bindings", derive(TS))]
9848pub struct Show {
9849 pub this: String,
9851 #[serde(default)]
9853 pub terse: bool,
9854 #[serde(default)]
9856 pub history: bool,
9857 pub like: Option<Expression>,
9859 pub scope_kind: Option<String>,
9861 pub scope: Option<Expression>,
9863 pub starts_with: Option<Expression>,
9865 pub limit: Option<Box<Limit>>,
9867 pub from: Option<Expression>,
9869 #[serde(default, skip_serializing_if = "Option::is_none")]
9871 pub where_clause: Option<Expression>,
9872 #[serde(default, skip_serializing_if = "Option::is_none")]
9874 pub for_target: Option<Expression>,
9875 #[serde(default, skip_serializing_if = "Option::is_none")]
9877 pub db: Option<Expression>,
9878 #[serde(default, skip_serializing_if = "Option::is_none")]
9880 pub target: Option<Expression>,
9881 #[serde(default, skip_serializing_if = "Option::is_none")]
9883 pub mutex: Option<bool>,
9884 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9886 pub privileges: Vec<String>,
9887}
9888
9889impl Show {
9890 pub fn new(this: impl Into<String>) -> Self {
9891 Self {
9892 this: this.into(),
9893 terse: false,
9894 history: false,
9895 like: None,
9896 scope_kind: None,
9897 scope: None,
9898 starts_with: None,
9899 limit: None,
9900 from: None,
9901 where_clause: None,
9902 for_target: None,
9903 db: None,
9904 target: None,
9905 mutex: None,
9906 privileges: Vec::new(),
9907 }
9908 }
9909}
9910
9911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9916#[cfg_attr(feature = "bindings", derive(TS))]
9917pub struct Paren {
9918 pub this: Expression,
9920 #[serde(default)]
9921 pub trailing_comments: Vec<String>,
9922}
9923
9924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9926#[cfg_attr(feature = "bindings", derive(TS))]
9927pub struct Annotated {
9928 pub this: Expression,
9929 pub trailing_comments: Vec<String>,
9930}
9931
9932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9937#[cfg_attr(feature = "bindings", derive(TS))]
9938pub struct Refresh {
9939 pub this: Box<Expression>,
9940 pub kind: String,
9941}
9942
9943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9945#[cfg_attr(feature = "bindings", derive(TS))]
9946pub struct LockingStatement {
9947 pub this: Box<Expression>,
9948 pub expression: Box<Expression>,
9949}
9950
9951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9953#[cfg_attr(feature = "bindings", derive(TS))]
9954pub struct SequenceProperties {
9955 #[serde(default)]
9956 pub increment: Option<Box<Expression>>,
9957 #[serde(default)]
9958 pub minvalue: Option<Box<Expression>>,
9959 #[serde(default)]
9960 pub maxvalue: Option<Box<Expression>>,
9961 #[serde(default)]
9962 pub cache: Option<Box<Expression>>,
9963 #[serde(default)]
9964 pub start: Option<Box<Expression>>,
9965 #[serde(default)]
9966 pub owned: Option<Box<Expression>>,
9967 #[serde(default)]
9968 pub options: Vec<Expression>,
9969}
9970
9971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9973#[cfg_attr(feature = "bindings", derive(TS))]
9974pub struct TruncateTable {
9975 #[serde(default)]
9976 pub expressions: Vec<Expression>,
9977 #[serde(default)]
9978 pub is_database: Option<Box<Expression>>,
9979 #[serde(default)]
9980 pub exists: bool,
9981 #[serde(default)]
9982 pub only: Option<Box<Expression>>,
9983 #[serde(default)]
9984 pub cluster: Option<Box<Expression>>,
9985 #[serde(default)]
9986 pub identity: Option<Box<Expression>>,
9987 #[serde(default)]
9988 pub option: Option<Box<Expression>>,
9989 #[serde(default)]
9990 pub partition: Option<Box<Expression>>,
9991}
9992
9993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9995#[cfg_attr(feature = "bindings", derive(TS))]
9996pub struct Clone {
9997 pub this: Box<Expression>,
9998 #[serde(default)]
9999 pub shallow: Option<Box<Expression>>,
10000 #[serde(default)]
10001 pub copy: Option<Box<Expression>>,
10002}
10003
10004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10006#[cfg_attr(feature = "bindings", derive(TS))]
10007pub struct Attach {
10008 pub this: Box<Expression>,
10009 #[serde(default)]
10010 pub exists: bool,
10011 #[serde(default)]
10012 pub expressions: Vec<Expression>,
10013}
10014
10015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10017#[cfg_attr(feature = "bindings", derive(TS))]
10018pub struct Detach {
10019 pub this: Box<Expression>,
10020 #[serde(default)]
10021 pub exists: bool,
10022}
10023
10024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10026#[cfg_attr(feature = "bindings", derive(TS))]
10027pub struct Install {
10028 pub this: Box<Expression>,
10029 #[serde(default)]
10030 pub from_: Option<Box<Expression>>,
10031 #[serde(default)]
10032 pub force: Option<Box<Expression>>,
10033}
10034
10035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10037#[cfg_attr(feature = "bindings", derive(TS))]
10038pub struct Summarize {
10039 pub this: Box<Expression>,
10040 #[serde(default)]
10041 pub table: Option<Box<Expression>>,
10042}
10043
10044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10046#[cfg_attr(feature = "bindings", derive(TS))]
10047pub struct Declare {
10048 #[serde(default)]
10049 pub expressions: Vec<Expression>,
10050 #[serde(default)]
10051 pub replace: bool,
10052}
10053
10054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10056#[cfg_attr(feature = "bindings", derive(TS))]
10057pub struct DeclareItem {
10058 pub this: Box<Expression>,
10059 #[serde(default)]
10060 pub kind: Option<String>,
10061 #[serde(default)]
10062 pub default: Option<Box<Expression>>,
10063 #[serde(default)]
10064 pub has_as: bool,
10065 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10067 pub additional_names: Vec<Expression>,
10068}
10069
10070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10072#[cfg_attr(feature = "bindings", derive(TS))]
10073pub struct Set {
10074 #[serde(default)]
10075 pub expressions: Vec<Expression>,
10076 #[serde(default)]
10077 pub unset: Option<Box<Expression>>,
10078 #[serde(default)]
10079 pub tag: Option<Box<Expression>>,
10080}
10081
10082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10084#[cfg_attr(feature = "bindings", derive(TS))]
10085pub struct Heredoc {
10086 pub this: Box<Expression>,
10087 #[serde(default)]
10088 pub tag: Option<Box<Expression>>,
10089}
10090
10091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10093#[cfg_attr(feature = "bindings", derive(TS))]
10094pub struct QueryBand {
10095 pub this: Box<Expression>,
10096 #[serde(default)]
10097 pub scope: Option<Box<Expression>>,
10098 #[serde(default)]
10099 pub update: Option<Box<Expression>>,
10100}
10101
10102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10104#[cfg_attr(feature = "bindings", derive(TS))]
10105pub struct UserDefinedFunction {
10106 pub this: Box<Expression>,
10107 #[serde(default)]
10108 pub expressions: Vec<Expression>,
10109 #[serde(default)]
10110 pub wrapped: Option<Box<Expression>>,
10111}
10112
10113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10115#[cfg_attr(feature = "bindings", derive(TS))]
10116pub struct RecursiveWithSearch {
10117 pub kind: String,
10118 pub this: Box<Expression>,
10119 pub expression: Box<Expression>,
10120 #[serde(default)]
10121 pub using: Option<Box<Expression>>,
10122}
10123
10124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10126#[cfg_attr(feature = "bindings", derive(TS))]
10127pub struct ProjectionDef {
10128 pub this: Box<Expression>,
10129 pub expression: Box<Expression>,
10130}
10131
10132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10134#[cfg_attr(feature = "bindings", derive(TS))]
10135pub struct TableAlias {
10136 #[serde(default)]
10137 pub this: Option<Box<Expression>>,
10138 #[serde(default)]
10139 pub columns: Vec<Expression>,
10140}
10141
10142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10144#[cfg_attr(feature = "bindings", derive(TS))]
10145pub struct ByteString {
10146 pub this: Box<Expression>,
10147 #[serde(default)]
10148 pub is_bytes: Option<Box<Expression>>,
10149}
10150
10151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10154#[cfg_attr(feature = "bindings", derive(TS))]
10155pub struct HexStringExpr {
10156 pub this: Box<Expression>,
10157 #[serde(default)]
10158 pub is_integer: Option<bool>,
10159}
10160
10161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10163#[cfg_attr(feature = "bindings", derive(TS))]
10164pub struct UnicodeString {
10165 pub this: Box<Expression>,
10166 #[serde(default)]
10167 pub escape: Option<Box<Expression>>,
10168}
10169
10170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10172#[cfg_attr(feature = "bindings", derive(TS))]
10173pub struct AlterColumn {
10174 pub this: Box<Expression>,
10175 #[serde(default)]
10176 pub dtype: Option<Box<Expression>>,
10177 #[serde(default)]
10178 pub collate: Option<Box<Expression>>,
10179 #[serde(default)]
10180 pub using: Option<Box<Expression>>,
10181 #[serde(default)]
10182 pub default: Option<Box<Expression>>,
10183 #[serde(default)]
10184 pub drop: Option<Box<Expression>>,
10185 #[serde(default)]
10186 pub comment: Option<Box<Expression>>,
10187 #[serde(default)]
10188 pub allow_null: Option<Box<Expression>>,
10189 #[serde(default)]
10190 pub visible: Option<Box<Expression>>,
10191 #[serde(default)]
10192 pub rename_to: Option<Box<Expression>>,
10193}
10194
10195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10197#[cfg_attr(feature = "bindings", derive(TS))]
10198pub struct AlterSortKey {
10199 #[serde(default)]
10200 pub this: Option<Box<Expression>>,
10201 #[serde(default)]
10202 pub expressions: Vec<Expression>,
10203 #[serde(default)]
10204 pub compound: Option<Box<Expression>>,
10205}
10206
10207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10209#[cfg_attr(feature = "bindings", derive(TS))]
10210pub struct AlterSet {
10211 #[serde(default)]
10212 pub expressions: Vec<Expression>,
10213 #[serde(default)]
10214 pub option: Option<Box<Expression>>,
10215 #[serde(default)]
10216 pub tablespace: Option<Box<Expression>>,
10217 #[serde(default)]
10218 pub access_method: Option<Box<Expression>>,
10219 #[serde(default)]
10220 pub file_format: Option<Box<Expression>>,
10221 #[serde(default)]
10222 pub copy_options: Option<Box<Expression>>,
10223 #[serde(default)]
10224 pub tag: Option<Box<Expression>>,
10225 #[serde(default)]
10226 pub location: Option<Box<Expression>>,
10227 #[serde(default)]
10228 pub serde: Option<Box<Expression>>,
10229}
10230
10231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10233#[cfg_attr(feature = "bindings", derive(TS))]
10234pub struct RenameColumn {
10235 pub this: Box<Expression>,
10236 #[serde(default)]
10237 pub to: Option<Box<Expression>>,
10238 #[serde(default)]
10239 pub exists: bool,
10240}
10241
10242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10244#[cfg_attr(feature = "bindings", derive(TS))]
10245pub struct Comprehension {
10246 pub this: Box<Expression>,
10247 pub expression: Box<Expression>,
10248 #[serde(default)]
10249 pub position: Option<Box<Expression>>,
10250 #[serde(default)]
10251 pub iterator: Option<Box<Expression>>,
10252 #[serde(default)]
10253 pub condition: Option<Box<Expression>>,
10254}
10255
10256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10258#[cfg_attr(feature = "bindings", derive(TS))]
10259pub struct MergeTreeTTLAction {
10260 pub this: Box<Expression>,
10261 #[serde(default)]
10262 pub delete: Option<Box<Expression>>,
10263 #[serde(default)]
10264 pub recompress: Option<Box<Expression>>,
10265 #[serde(default)]
10266 pub to_disk: Option<Box<Expression>>,
10267 #[serde(default)]
10268 pub to_volume: Option<Box<Expression>>,
10269}
10270
10271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10273#[cfg_attr(feature = "bindings", derive(TS))]
10274pub struct MergeTreeTTL {
10275 #[serde(default)]
10276 pub expressions: Vec<Expression>,
10277 #[serde(default)]
10278 pub where_: Option<Box<Expression>>,
10279 #[serde(default)]
10280 pub group: Option<Box<Expression>>,
10281 #[serde(default)]
10282 pub aggregates: Option<Box<Expression>>,
10283}
10284
10285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10287#[cfg_attr(feature = "bindings", derive(TS))]
10288pub struct IndexConstraintOption {
10289 #[serde(default)]
10290 pub key_block_size: Option<Box<Expression>>,
10291 #[serde(default)]
10292 pub using: Option<Box<Expression>>,
10293 #[serde(default)]
10294 pub parser: Option<Box<Expression>>,
10295 #[serde(default)]
10296 pub comment: Option<Box<Expression>>,
10297 #[serde(default)]
10298 pub visible: Option<Box<Expression>>,
10299 #[serde(default)]
10300 pub engine_attr: Option<Box<Expression>>,
10301 #[serde(default)]
10302 pub secondary_engine_attr: Option<Box<Expression>>,
10303}
10304
10305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10307#[cfg_attr(feature = "bindings", derive(TS))]
10308pub struct PeriodForSystemTimeConstraint {
10309 pub this: Box<Expression>,
10310 pub expression: Box<Expression>,
10311}
10312
10313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10315#[cfg_attr(feature = "bindings", derive(TS))]
10316pub struct CaseSpecificColumnConstraint {
10317 #[serde(default)]
10318 pub not_: Option<Box<Expression>>,
10319}
10320
10321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10323#[cfg_attr(feature = "bindings", derive(TS))]
10324pub struct CharacterSetColumnConstraint {
10325 pub this: Box<Expression>,
10326}
10327
10328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10330#[cfg_attr(feature = "bindings", derive(TS))]
10331pub struct CheckColumnConstraint {
10332 pub this: Box<Expression>,
10333 #[serde(default)]
10334 pub enforced: Option<Box<Expression>>,
10335}
10336
10337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10339#[cfg_attr(feature = "bindings", derive(TS))]
10340pub struct AssumeColumnConstraint {
10341 pub this: Box<Expression>,
10342}
10343
10344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10346#[cfg_attr(feature = "bindings", derive(TS))]
10347pub struct CompressColumnConstraint {
10348 #[serde(default)]
10349 pub this: Option<Box<Expression>>,
10350}
10351
10352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10354#[cfg_attr(feature = "bindings", derive(TS))]
10355pub struct DateFormatColumnConstraint {
10356 pub this: Box<Expression>,
10357}
10358
10359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10361#[cfg_attr(feature = "bindings", derive(TS))]
10362pub struct EphemeralColumnConstraint {
10363 #[serde(default)]
10364 pub this: Option<Box<Expression>>,
10365}
10366
10367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10369#[cfg_attr(feature = "bindings", derive(TS))]
10370pub struct WithOperator {
10371 pub this: Box<Expression>,
10372 pub op: String,
10373}
10374
10375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10377#[cfg_attr(feature = "bindings", derive(TS))]
10378pub struct GeneratedAsIdentityColumnConstraint {
10379 #[serde(default)]
10380 pub this: Option<Box<Expression>>,
10381 #[serde(default)]
10382 pub expression: Option<Box<Expression>>,
10383 #[serde(default)]
10384 pub on_null: Option<Box<Expression>>,
10385 #[serde(default)]
10386 pub start: Option<Box<Expression>>,
10387 #[serde(default)]
10388 pub increment: Option<Box<Expression>>,
10389 #[serde(default)]
10390 pub minvalue: Option<Box<Expression>>,
10391 #[serde(default)]
10392 pub maxvalue: Option<Box<Expression>>,
10393 #[serde(default)]
10394 pub cycle: Option<Box<Expression>>,
10395 #[serde(default)]
10396 pub order: Option<Box<Expression>>,
10397}
10398
10399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10402#[cfg_attr(feature = "bindings", derive(TS))]
10403pub struct AutoIncrementColumnConstraint;
10404
10405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10407#[cfg_attr(feature = "bindings", derive(TS))]
10408pub struct CommentColumnConstraint;
10409
10410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10412#[cfg_attr(feature = "bindings", derive(TS))]
10413pub struct GeneratedAsRowColumnConstraint {
10414 #[serde(default)]
10415 pub start: Option<Box<Expression>>,
10416 #[serde(default)]
10417 pub hidden: Option<Box<Expression>>,
10418}
10419
10420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10422#[cfg_attr(feature = "bindings", derive(TS))]
10423pub struct IndexColumnConstraint {
10424 #[serde(default)]
10425 pub this: Option<Box<Expression>>,
10426 #[serde(default)]
10427 pub expressions: Vec<Expression>,
10428 #[serde(default)]
10429 pub kind: Option<String>,
10430 #[serde(default)]
10431 pub index_type: Option<Box<Expression>>,
10432 #[serde(default)]
10433 pub options: Vec<Expression>,
10434 #[serde(default)]
10435 pub expression: Option<Box<Expression>>,
10436 #[serde(default)]
10437 pub granularity: Option<Box<Expression>>,
10438}
10439
10440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10442#[cfg_attr(feature = "bindings", derive(TS))]
10443pub struct MaskingPolicyColumnConstraint {
10444 pub this: Box<Expression>,
10445 #[serde(default)]
10446 pub expressions: Vec<Expression>,
10447}
10448
10449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10451#[cfg_attr(feature = "bindings", derive(TS))]
10452pub struct NotNullColumnConstraint {
10453 #[serde(default)]
10454 pub allow_null: Option<Box<Expression>>,
10455}
10456
10457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10459#[cfg_attr(feature = "bindings", derive(TS))]
10460pub struct DefaultColumnConstraint {
10461 pub this: Box<Expression>,
10462 #[serde(default, skip_serializing_if = "Option::is_none")]
10464 pub for_column: Option<Identifier>,
10465}
10466
10467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10469#[cfg_attr(feature = "bindings", derive(TS))]
10470pub struct PrimaryKeyColumnConstraint {
10471 #[serde(default)]
10472 pub desc: Option<Box<Expression>>,
10473 #[serde(default)]
10474 pub options: Vec<Expression>,
10475}
10476
10477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10479#[cfg_attr(feature = "bindings", derive(TS))]
10480pub struct UniqueColumnConstraint {
10481 #[serde(default)]
10482 pub this: Option<Box<Expression>>,
10483 #[serde(default)]
10484 pub index_type: Option<Box<Expression>>,
10485 #[serde(default)]
10486 pub on_conflict: Option<Box<Expression>>,
10487 #[serde(default)]
10488 pub nulls: Option<Box<Expression>>,
10489 #[serde(default)]
10490 pub options: Vec<Expression>,
10491}
10492
10493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10495#[cfg_attr(feature = "bindings", derive(TS))]
10496pub struct WatermarkColumnConstraint {
10497 pub this: Box<Expression>,
10498 pub expression: Box<Expression>,
10499}
10500
10501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10503#[cfg_attr(feature = "bindings", derive(TS))]
10504pub struct ComputedColumnConstraint {
10505 pub this: Box<Expression>,
10506 #[serde(default)]
10507 pub persisted: Option<Box<Expression>>,
10508 #[serde(default)]
10509 pub not_null: Option<Box<Expression>>,
10510 #[serde(default)]
10511 pub data_type: Option<Box<Expression>>,
10512}
10513
10514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10516#[cfg_attr(feature = "bindings", derive(TS))]
10517pub struct InOutColumnConstraint {
10518 #[serde(default)]
10519 pub input_: Option<Box<Expression>>,
10520 #[serde(default)]
10521 pub output: Option<Box<Expression>>,
10522}
10523
10524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10526#[cfg_attr(feature = "bindings", derive(TS))]
10527pub struct PathColumnConstraint {
10528 pub this: Box<Expression>,
10529}
10530
10531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10533#[cfg_attr(feature = "bindings", derive(TS))]
10534pub struct Constraint {
10535 pub this: Box<Expression>,
10536 #[serde(default)]
10537 pub expressions: Vec<Expression>,
10538}
10539
10540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10542#[cfg_attr(feature = "bindings", derive(TS))]
10543pub struct Export {
10544 pub this: Box<Expression>,
10545 #[serde(default)]
10546 pub connection: Option<Box<Expression>>,
10547 #[serde(default)]
10548 pub options: Vec<Expression>,
10549}
10550
10551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10553#[cfg_attr(feature = "bindings", derive(TS))]
10554pub struct Filter {
10555 pub this: Box<Expression>,
10556 pub expression: Box<Expression>,
10557}
10558
10559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10561#[cfg_attr(feature = "bindings", derive(TS))]
10562pub struct Changes {
10563 #[serde(default)]
10564 pub information: Option<Box<Expression>>,
10565 #[serde(default)]
10566 pub at_before: Option<Box<Expression>>,
10567 #[serde(default)]
10568 pub end: Option<Box<Expression>>,
10569}
10570
10571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10573#[cfg_attr(feature = "bindings", derive(TS))]
10574pub struct Directory {
10575 pub this: Box<Expression>,
10576 #[serde(default)]
10577 pub local: Option<Box<Expression>>,
10578 #[serde(default)]
10579 pub row_format: Option<Box<Expression>>,
10580}
10581
10582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10584#[cfg_attr(feature = "bindings", derive(TS))]
10585pub struct ForeignKey {
10586 #[serde(default)]
10587 pub expressions: Vec<Expression>,
10588 #[serde(default)]
10589 pub reference: Option<Box<Expression>>,
10590 #[serde(default)]
10591 pub delete: Option<Box<Expression>>,
10592 #[serde(default)]
10593 pub update: Option<Box<Expression>>,
10594 #[serde(default)]
10595 pub options: Vec<Expression>,
10596}
10597
10598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10600#[cfg_attr(feature = "bindings", derive(TS))]
10601pub struct ColumnPrefix {
10602 pub this: Box<Expression>,
10603 pub expression: Box<Expression>,
10604}
10605
10606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10608#[cfg_attr(feature = "bindings", derive(TS))]
10609pub struct PrimaryKey {
10610 #[serde(default)]
10611 pub this: Option<Box<Expression>>,
10612 #[serde(default)]
10613 pub expressions: Vec<Expression>,
10614 #[serde(default)]
10615 pub options: Vec<Expression>,
10616 #[serde(default)]
10617 pub include: Option<Box<Expression>>,
10618}
10619
10620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10622#[cfg_attr(feature = "bindings", derive(TS))]
10623pub struct IntoClause {
10624 #[serde(default)]
10625 pub this: Option<Box<Expression>>,
10626 #[serde(default)]
10627 pub temporary: bool,
10628 #[serde(default)]
10629 pub unlogged: Option<Box<Expression>>,
10630 #[serde(default)]
10631 pub bulk_collect: Option<Box<Expression>>,
10632 #[serde(default)]
10633 pub expressions: Vec<Expression>,
10634}
10635
10636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10638#[cfg_attr(feature = "bindings", derive(TS))]
10639pub struct JoinHint {
10640 pub this: Box<Expression>,
10641 #[serde(default)]
10642 pub expressions: Vec<Expression>,
10643}
10644
10645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10647#[cfg_attr(feature = "bindings", derive(TS))]
10648pub struct Opclass {
10649 pub this: Box<Expression>,
10650 pub expression: Box<Expression>,
10651}
10652
10653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10655#[cfg_attr(feature = "bindings", derive(TS))]
10656pub struct Index {
10657 #[serde(default)]
10658 pub this: Option<Box<Expression>>,
10659 #[serde(default)]
10660 pub table: Option<Box<Expression>>,
10661 #[serde(default)]
10662 pub unique: bool,
10663 #[serde(default)]
10664 pub primary: Option<Box<Expression>>,
10665 #[serde(default)]
10666 pub amp: Option<Box<Expression>>,
10667 #[serde(default)]
10668 pub params: Vec<Expression>,
10669}
10670
10671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10673#[cfg_attr(feature = "bindings", derive(TS))]
10674pub struct IndexParameters {
10675 #[serde(default)]
10676 pub using: Option<Box<Expression>>,
10677 #[serde(default)]
10678 pub include: Option<Box<Expression>>,
10679 #[serde(default)]
10680 pub columns: Vec<Expression>,
10681 #[serde(default)]
10682 pub with_storage: Option<Box<Expression>>,
10683 #[serde(default)]
10684 pub partition_by: Option<Box<Expression>>,
10685 #[serde(default)]
10686 pub tablespace: Option<Box<Expression>>,
10687 #[serde(default)]
10688 pub where_: Option<Box<Expression>>,
10689 #[serde(default)]
10690 pub on: Option<Box<Expression>>,
10691}
10692
10693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10695#[cfg_attr(feature = "bindings", derive(TS))]
10696pub struct ConditionalInsert {
10697 pub this: Box<Expression>,
10698 #[serde(default)]
10699 pub expression: Option<Box<Expression>>,
10700 #[serde(default)]
10701 pub else_: Option<Box<Expression>>,
10702}
10703
10704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10706#[cfg_attr(feature = "bindings", derive(TS))]
10707pub struct MultitableInserts {
10708 #[serde(default)]
10709 pub expressions: Vec<Expression>,
10710 pub kind: String,
10711 #[serde(default)]
10712 pub source: Option<Box<Expression>>,
10713 #[serde(default)]
10715 pub leading_comments: Vec<String>,
10716 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10718 pub overwrite: bool,
10719}
10720
10721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10723#[cfg_attr(feature = "bindings", derive(TS))]
10724pub struct OnConflict {
10725 #[serde(default)]
10726 pub duplicate: Option<Box<Expression>>,
10727 #[serde(default)]
10728 pub expressions: Vec<Expression>,
10729 #[serde(default)]
10730 pub action: Option<Box<Expression>>,
10731 #[serde(default)]
10732 pub conflict_keys: Option<Box<Expression>>,
10733 #[serde(default)]
10734 pub index_predicate: Option<Box<Expression>>,
10735 #[serde(default)]
10736 pub constraint: Option<Box<Expression>>,
10737 #[serde(default)]
10738 pub where_: Option<Box<Expression>>,
10739}
10740
10741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10743#[cfg_attr(feature = "bindings", derive(TS))]
10744pub struct OnCondition {
10745 #[serde(default)]
10746 pub error: Option<Box<Expression>>,
10747 #[serde(default)]
10748 pub empty: Option<Box<Expression>>,
10749 #[serde(default)]
10750 pub null: Option<Box<Expression>>,
10751}
10752
10753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10755#[cfg_attr(feature = "bindings", derive(TS))]
10756pub struct Returning {
10757 #[serde(default)]
10758 pub expressions: Vec<Expression>,
10759 #[serde(default)]
10760 pub into: Option<Box<Expression>>,
10761}
10762
10763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10765#[cfg_attr(feature = "bindings", derive(TS))]
10766pub struct Introducer {
10767 pub this: Box<Expression>,
10768 pub expression: Box<Expression>,
10769}
10770
10771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10773#[cfg_attr(feature = "bindings", derive(TS))]
10774pub struct PartitionRange {
10775 pub this: Box<Expression>,
10776 #[serde(default)]
10777 pub expression: Option<Box<Expression>>,
10778 #[serde(default)]
10779 pub expressions: Vec<Expression>,
10780}
10781
10782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10784#[cfg_attr(feature = "bindings", derive(TS))]
10785pub struct Group {
10786 #[serde(default)]
10787 pub expressions: Vec<Expression>,
10788 #[serde(default)]
10789 pub grouping_sets: Option<Box<Expression>>,
10790 #[serde(default)]
10791 pub cube: Option<Box<Expression>>,
10792 #[serde(default)]
10793 pub rollup: Option<Box<Expression>>,
10794 #[serde(default)]
10795 pub totals: Option<Box<Expression>>,
10796 #[serde(default)]
10798 pub all: Option<bool>,
10799}
10800
10801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10803#[cfg_attr(feature = "bindings", derive(TS))]
10804pub struct Cube {
10805 #[serde(default)]
10806 pub expressions: Vec<Expression>,
10807}
10808
10809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10811#[cfg_attr(feature = "bindings", derive(TS))]
10812pub struct Rollup {
10813 #[serde(default)]
10814 pub expressions: Vec<Expression>,
10815}
10816
10817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10819#[cfg_attr(feature = "bindings", derive(TS))]
10820pub struct GroupingSets {
10821 #[serde(default)]
10822 pub expressions: Vec<Expression>,
10823}
10824
10825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10827#[cfg_attr(feature = "bindings", derive(TS))]
10828pub struct LimitOptions {
10829 #[serde(default)]
10830 pub percent: Option<Box<Expression>>,
10831 #[serde(default)]
10832 pub rows: Option<Box<Expression>>,
10833 #[serde(default)]
10834 pub with_ties: Option<Box<Expression>>,
10835}
10836
10837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10839#[cfg_attr(feature = "bindings", derive(TS))]
10840pub struct Lateral {
10841 pub this: Box<Expression>,
10842 #[serde(default)]
10843 pub view: Option<Box<Expression>>,
10844 #[serde(default)]
10845 pub outer: Option<Box<Expression>>,
10846 #[serde(default)]
10847 pub alias: Option<String>,
10848 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10850 pub alias_quoted: bool,
10851 #[serde(default)]
10852 pub cross_apply: Option<Box<Expression>>,
10853 #[serde(default)]
10854 pub ordinality: Option<Box<Expression>>,
10855 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10857 pub column_aliases: Vec<String>,
10858}
10859
10860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10862#[cfg_attr(feature = "bindings", derive(TS))]
10863pub struct TableFromRows {
10864 pub this: Box<Expression>,
10865 #[serde(default)]
10866 pub alias: Option<String>,
10867 #[serde(default)]
10868 pub joins: Vec<Expression>,
10869 #[serde(default)]
10870 pub pivots: Option<Box<Expression>>,
10871 #[serde(default)]
10872 pub sample: Option<Box<Expression>>,
10873}
10874
10875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10878#[cfg_attr(feature = "bindings", derive(TS))]
10879pub struct RowsFrom {
10880 pub expressions: Vec<Expression>,
10882 #[serde(default)]
10884 pub ordinality: bool,
10885 #[serde(default)]
10887 pub alias: Option<Box<Expression>>,
10888}
10889
10890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10892#[cfg_attr(feature = "bindings", derive(TS))]
10893pub struct WithFill {
10894 #[serde(default)]
10895 pub from_: Option<Box<Expression>>,
10896 #[serde(default)]
10897 pub to: Option<Box<Expression>>,
10898 #[serde(default)]
10899 pub step: Option<Box<Expression>>,
10900 #[serde(default)]
10901 pub staleness: Option<Box<Expression>>,
10902 #[serde(default)]
10903 pub interpolate: Option<Box<Expression>>,
10904}
10905
10906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10908#[cfg_attr(feature = "bindings", derive(TS))]
10909pub struct Property {
10910 pub this: Box<Expression>,
10911 #[serde(default)]
10912 pub value: Option<Box<Expression>>,
10913}
10914
10915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10917#[cfg_attr(feature = "bindings", derive(TS))]
10918pub struct GrantPrivilege {
10919 pub this: Box<Expression>,
10920 #[serde(default)]
10921 pub expressions: Vec<Expression>,
10922}
10923
10924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10926#[cfg_attr(feature = "bindings", derive(TS))]
10927pub struct AllowedValuesProperty {
10928 #[serde(default)]
10929 pub expressions: Vec<Expression>,
10930}
10931
10932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10934#[cfg_attr(feature = "bindings", derive(TS))]
10935pub struct AlgorithmProperty {
10936 pub this: Box<Expression>,
10937}
10938
10939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10941#[cfg_attr(feature = "bindings", derive(TS))]
10942pub struct AutoIncrementProperty {
10943 pub this: Box<Expression>,
10944}
10945
10946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10948#[cfg_attr(feature = "bindings", derive(TS))]
10949pub struct AutoRefreshProperty {
10950 pub this: Box<Expression>,
10951}
10952
10953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10955#[cfg_attr(feature = "bindings", derive(TS))]
10956pub struct BackupProperty {
10957 pub this: Box<Expression>,
10958}
10959
10960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10962#[cfg_attr(feature = "bindings", derive(TS))]
10963pub struct BuildProperty {
10964 pub this: Box<Expression>,
10965}
10966
10967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10969#[cfg_attr(feature = "bindings", derive(TS))]
10970pub struct BlockCompressionProperty {
10971 #[serde(default)]
10972 pub autotemp: Option<Box<Expression>>,
10973 #[serde(default)]
10974 pub always: Option<Box<Expression>>,
10975 #[serde(default)]
10976 pub default: Option<Box<Expression>>,
10977 #[serde(default)]
10978 pub manual: Option<Box<Expression>>,
10979 #[serde(default)]
10980 pub never: Option<Box<Expression>>,
10981}
10982
10983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10985#[cfg_attr(feature = "bindings", derive(TS))]
10986pub struct CharacterSetProperty {
10987 pub this: Box<Expression>,
10988 #[serde(default)]
10989 pub default: Option<Box<Expression>>,
10990}
10991
10992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10994#[cfg_attr(feature = "bindings", derive(TS))]
10995pub struct ChecksumProperty {
10996 #[serde(default)]
10997 pub on: Option<Box<Expression>>,
10998 #[serde(default)]
10999 pub default: Option<Box<Expression>>,
11000}
11001
11002#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11004#[cfg_attr(feature = "bindings", derive(TS))]
11005pub struct CollateProperty {
11006 pub this: Box<Expression>,
11007 #[serde(default)]
11008 pub default: Option<Box<Expression>>,
11009}
11010
11011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11013#[cfg_attr(feature = "bindings", derive(TS))]
11014pub struct DataBlocksizeProperty {
11015 #[serde(default)]
11016 pub size: Option<i64>,
11017 #[serde(default)]
11018 pub units: Option<Box<Expression>>,
11019 #[serde(default)]
11020 pub minimum: Option<Box<Expression>>,
11021 #[serde(default)]
11022 pub maximum: Option<Box<Expression>>,
11023 #[serde(default)]
11024 pub default: Option<Box<Expression>>,
11025}
11026
11027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11029#[cfg_attr(feature = "bindings", derive(TS))]
11030pub struct DataDeletionProperty {
11031 pub on: Box<Expression>,
11032 #[serde(default)]
11033 pub filter_column: Option<Box<Expression>>,
11034 #[serde(default)]
11035 pub retention_period: Option<Box<Expression>>,
11036}
11037
11038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11040#[cfg_attr(feature = "bindings", derive(TS))]
11041pub struct DefinerProperty {
11042 pub this: Box<Expression>,
11043}
11044
11045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11047#[cfg_attr(feature = "bindings", derive(TS))]
11048pub struct DistKeyProperty {
11049 pub this: Box<Expression>,
11050}
11051
11052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11054#[cfg_attr(feature = "bindings", derive(TS))]
11055pub struct DistributedByProperty {
11056 #[serde(default)]
11057 pub expressions: Vec<Expression>,
11058 pub kind: String,
11059 #[serde(default)]
11060 pub buckets: Option<Box<Expression>>,
11061 #[serde(default)]
11062 pub order: Option<Box<Expression>>,
11063}
11064
11065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11067#[cfg_attr(feature = "bindings", derive(TS))]
11068pub struct DistStyleProperty {
11069 pub this: Box<Expression>,
11070}
11071
11072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11074#[cfg_attr(feature = "bindings", derive(TS))]
11075pub struct DuplicateKeyProperty {
11076 #[serde(default)]
11077 pub expressions: Vec<Expression>,
11078}
11079
11080#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11082#[cfg_attr(feature = "bindings", derive(TS))]
11083pub struct EngineProperty {
11084 pub this: Box<Expression>,
11085}
11086
11087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11089#[cfg_attr(feature = "bindings", derive(TS))]
11090pub struct ToTableProperty {
11091 pub this: Box<Expression>,
11092}
11093
11094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11096#[cfg_attr(feature = "bindings", derive(TS))]
11097pub struct ExecuteAsProperty {
11098 pub this: Box<Expression>,
11099}
11100
11101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11103#[cfg_attr(feature = "bindings", derive(TS))]
11104pub struct ExternalProperty {
11105 #[serde(default)]
11106 pub this: Option<Box<Expression>>,
11107}
11108
11109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11111#[cfg_attr(feature = "bindings", derive(TS))]
11112pub struct FallbackProperty {
11113 #[serde(default)]
11114 pub no: Option<Box<Expression>>,
11115 #[serde(default)]
11116 pub protection: Option<Box<Expression>>,
11117}
11118
11119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11121#[cfg_attr(feature = "bindings", derive(TS))]
11122pub struct FileFormatProperty {
11123 #[serde(default)]
11124 pub this: Option<Box<Expression>>,
11125 #[serde(default)]
11126 pub expressions: Vec<Expression>,
11127 #[serde(default)]
11128 pub hive_format: Option<Box<Expression>>,
11129}
11130
11131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11133#[cfg_attr(feature = "bindings", derive(TS))]
11134pub struct CredentialsProperty {
11135 #[serde(default)]
11136 pub expressions: Vec<Expression>,
11137}
11138
11139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11141#[cfg_attr(feature = "bindings", derive(TS))]
11142pub struct FreespaceProperty {
11143 pub this: Box<Expression>,
11144 #[serde(default)]
11145 pub percent: Option<Box<Expression>>,
11146}
11147
11148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11150#[cfg_attr(feature = "bindings", derive(TS))]
11151pub struct InheritsProperty {
11152 #[serde(default)]
11153 pub expressions: Vec<Expression>,
11154}
11155
11156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11158#[cfg_attr(feature = "bindings", derive(TS))]
11159pub struct InputModelProperty {
11160 pub this: Box<Expression>,
11161}
11162
11163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11165#[cfg_attr(feature = "bindings", derive(TS))]
11166pub struct OutputModelProperty {
11167 pub this: Box<Expression>,
11168}
11169
11170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11172#[cfg_attr(feature = "bindings", derive(TS))]
11173pub struct IsolatedLoadingProperty {
11174 #[serde(default)]
11175 pub no: Option<Box<Expression>>,
11176 #[serde(default)]
11177 pub concurrent: Option<Box<Expression>>,
11178 #[serde(default)]
11179 pub target: Option<Box<Expression>>,
11180}
11181
11182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11184#[cfg_attr(feature = "bindings", derive(TS))]
11185pub struct JournalProperty {
11186 #[serde(default)]
11187 pub no: Option<Box<Expression>>,
11188 #[serde(default)]
11189 pub dual: Option<Box<Expression>>,
11190 #[serde(default)]
11191 pub before: Option<Box<Expression>>,
11192 #[serde(default)]
11193 pub local: Option<Box<Expression>>,
11194 #[serde(default)]
11195 pub after: Option<Box<Expression>>,
11196}
11197
11198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11200#[cfg_attr(feature = "bindings", derive(TS))]
11201pub struct LanguageProperty {
11202 pub this: Box<Expression>,
11203}
11204
11205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11207#[cfg_attr(feature = "bindings", derive(TS))]
11208pub struct EnviromentProperty {
11209 #[serde(default)]
11210 pub expressions: Vec<Expression>,
11211}
11212
11213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11215#[cfg_attr(feature = "bindings", derive(TS))]
11216pub struct ClusteredByProperty {
11217 #[serde(default)]
11218 pub expressions: Vec<Expression>,
11219 #[serde(default)]
11220 pub sorted_by: Option<Box<Expression>>,
11221 #[serde(default)]
11222 pub buckets: Option<Box<Expression>>,
11223}
11224
11225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11227#[cfg_attr(feature = "bindings", derive(TS))]
11228pub struct DictProperty {
11229 pub this: Box<Expression>,
11230 pub kind: String,
11231 #[serde(default)]
11232 pub settings: Option<Box<Expression>>,
11233}
11234
11235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11237#[cfg_attr(feature = "bindings", derive(TS))]
11238pub struct DictRange {
11239 pub this: Box<Expression>,
11240 #[serde(default)]
11241 pub min: Option<Box<Expression>>,
11242 #[serde(default)]
11243 pub max: Option<Box<Expression>>,
11244}
11245
11246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11248#[cfg_attr(feature = "bindings", derive(TS))]
11249pub struct OnCluster {
11250 pub this: Box<Expression>,
11251}
11252
11253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11255#[cfg_attr(feature = "bindings", derive(TS))]
11256pub struct LikeProperty {
11257 pub this: Box<Expression>,
11258 #[serde(default)]
11259 pub expressions: Vec<Expression>,
11260}
11261
11262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11264#[cfg_attr(feature = "bindings", derive(TS))]
11265pub struct LocationProperty {
11266 pub this: Box<Expression>,
11267}
11268
11269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11271#[cfg_attr(feature = "bindings", derive(TS))]
11272pub struct LockProperty {
11273 pub this: Box<Expression>,
11274}
11275
11276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11278#[cfg_attr(feature = "bindings", derive(TS))]
11279pub struct LockingProperty {
11280 #[serde(default)]
11281 pub this: Option<Box<Expression>>,
11282 pub kind: String,
11283 #[serde(default)]
11284 pub for_or_in: Option<Box<Expression>>,
11285 #[serde(default)]
11286 pub lock_type: Option<Box<Expression>>,
11287 #[serde(default)]
11288 pub override_: Option<Box<Expression>>,
11289}
11290
11291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11293#[cfg_attr(feature = "bindings", derive(TS))]
11294pub struct LogProperty {
11295 #[serde(default)]
11296 pub no: Option<Box<Expression>>,
11297}
11298
11299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11301#[cfg_attr(feature = "bindings", derive(TS))]
11302pub struct MaterializedProperty {
11303 #[serde(default)]
11304 pub this: Option<Box<Expression>>,
11305}
11306
11307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11309#[cfg_attr(feature = "bindings", derive(TS))]
11310pub struct MergeBlockRatioProperty {
11311 #[serde(default)]
11312 pub this: Option<Box<Expression>>,
11313 #[serde(default)]
11314 pub no: Option<Box<Expression>>,
11315 #[serde(default)]
11316 pub default: Option<Box<Expression>>,
11317 #[serde(default)]
11318 pub percent: Option<Box<Expression>>,
11319}
11320
11321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11323#[cfg_attr(feature = "bindings", derive(TS))]
11324pub struct OnProperty {
11325 pub this: Box<Expression>,
11326}
11327
11328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11330#[cfg_attr(feature = "bindings", derive(TS))]
11331pub struct OnCommitProperty {
11332 #[serde(default)]
11333 pub delete: Option<Box<Expression>>,
11334}
11335
11336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11338#[cfg_attr(feature = "bindings", derive(TS))]
11339pub struct PartitionedByProperty {
11340 pub this: Box<Expression>,
11341}
11342
11343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11345#[cfg_attr(feature = "bindings", derive(TS))]
11346pub struct PartitionByProperty {
11347 #[serde(default)]
11348 pub expressions: Vec<Expression>,
11349}
11350
11351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11353#[cfg_attr(feature = "bindings", derive(TS))]
11354pub struct PartitionedByBucket {
11355 pub this: Box<Expression>,
11356 pub expression: Box<Expression>,
11357}
11358
11359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11361#[cfg_attr(feature = "bindings", derive(TS))]
11362pub struct ClusterByColumnsProperty {
11363 #[serde(default)]
11364 pub columns: Vec<Identifier>,
11365}
11366
11367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11369#[cfg_attr(feature = "bindings", derive(TS))]
11370pub struct PartitionByTruncate {
11371 pub this: Box<Expression>,
11372 pub expression: Box<Expression>,
11373}
11374
11375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11377#[cfg_attr(feature = "bindings", derive(TS))]
11378pub struct PartitionByRangeProperty {
11379 #[serde(default)]
11380 pub partition_expressions: Option<Box<Expression>>,
11381 #[serde(default)]
11382 pub create_expressions: Option<Box<Expression>>,
11383}
11384
11385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11387#[cfg_attr(feature = "bindings", derive(TS))]
11388pub struct PartitionByRangePropertyDynamic {
11389 #[serde(default)]
11390 pub this: Option<Box<Expression>>,
11391 #[serde(default)]
11392 pub start: Option<Box<Expression>>,
11393 #[serde(default)]
11395 pub use_start_end: bool,
11396 #[serde(default)]
11397 pub end: Option<Box<Expression>>,
11398 #[serde(default)]
11399 pub every: Option<Box<Expression>>,
11400}
11401
11402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11404#[cfg_attr(feature = "bindings", derive(TS))]
11405pub struct PartitionByListProperty {
11406 #[serde(default)]
11407 pub partition_expressions: Option<Box<Expression>>,
11408 #[serde(default)]
11409 pub create_expressions: Option<Box<Expression>>,
11410}
11411
11412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11414#[cfg_attr(feature = "bindings", derive(TS))]
11415pub struct PartitionList {
11416 pub this: Box<Expression>,
11417 #[serde(default)]
11418 pub expressions: Vec<Expression>,
11419}
11420
11421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11423#[cfg_attr(feature = "bindings", derive(TS))]
11424pub struct Partition {
11425 pub expressions: Vec<Expression>,
11426 #[serde(default)]
11427 pub subpartition: bool,
11428}
11429
11430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11433#[cfg_attr(feature = "bindings", derive(TS))]
11434pub struct RefreshTriggerProperty {
11435 pub method: String,
11437 #[serde(default)]
11439 pub kind: Option<String>,
11440 #[serde(default)]
11442 pub every: Option<Box<Expression>>,
11443 #[serde(default)]
11445 pub unit: Option<String>,
11446 #[serde(default)]
11448 pub starts: Option<Box<Expression>>,
11449}
11450
11451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11453#[cfg_attr(feature = "bindings", derive(TS))]
11454pub struct UniqueKeyProperty {
11455 #[serde(default)]
11456 pub expressions: Vec<Expression>,
11457}
11458
11459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11461#[cfg_attr(feature = "bindings", derive(TS))]
11462pub struct RollupProperty {
11463 pub expressions: Vec<RollupIndex>,
11464}
11465
11466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11468#[cfg_attr(feature = "bindings", derive(TS))]
11469pub struct RollupIndex {
11470 pub name: Identifier,
11471 pub expressions: Vec<Identifier>,
11472}
11473
11474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11476#[cfg_attr(feature = "bindings", derive(TS))]
11477pub struct PartitionBoundSpec {
11478 #[serde(default)]
11479 pub this: Option<Box<Expression>>,
11480 #[serde(default)]
11481 pub expression: Option<Box<Expression>>,
11482 #[serde(default)]
11483 pub from_expressions: Option<Box<Expression>>,
11484 #[serde(default)]
11485 pub to_expressions: Option<Box<Expression>>,
11486}
11487
11488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11490#[cfg_attr(feature = "bindings", derive(TS))]
11491pub struct PartitionedOfProperty {
11492 pub this: Box<Expression>,
11493 pub expression: Box<Expression>,
11494}
11495
11496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11498#[cfg_attr(feature = "bindings", derive(TS))]
11499pub struct RemoteWithConnectionModelProperty {
11500 pub this: Box<Expression>,
11501}
11502
11503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11505#[cfg_attr(feature = "bindings", derive(TS))]
11506pub struct ReturnsProperty {
11507 #[serde(default)]
11508 pub this: Option<Box<Expression>>,
11509 #[serde(default)]
11510 pub is_table: Option<Box<Expression>>,
11511 #[serde(default)]
11512 pub table: Option<Box<Expression>>,
11513 #[serde(default)]
11514 pub null: Option<Box<Expression>>,
11515}
11516
11517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11519#[cfg_attr(feature = "bindings", derive(TS))]
11520pub struct RowFormatProperty {
11521 pub this: Box<Expression>,
11522}
11523
11524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11526#[cfg_attr(feature = "bindings", derive(TS))]
11527pub struct RowFormatDelimitedProperty {
11528 #[serde(default)]
11529 pub fields: Option<Box<Expression>>,
11530 #[serde(default)]
11531 pub escaped: Option<Box<Expression>>,
11532 #[serde(default)]
11533 pub collection_items: Option<Box<Expression>>,
11534 #[serde(default)]
11535 pub map_keys: Option<Box<Expression>>,
11536 #[serde(default)]
11537 pub lines: Option<Box<Expression>>,
11538 #[serde(default)]
11539 pub null: Option<Box<Expression>>,
11540 #[serde(default)]
11541 pub serde: Option<Box<Expression>>,
11542}
11543
11544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11546#[cfg_attr(feature = "bindings", derive(TS))]
11547pub struct RowFormatSerdeProperty {
11548 pub this: Box<Expression>,
11549 #[serde(default)]
11550 pub serde_properties: Option<Box<Expression>>,
11551}
11552
11553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11555#[cfg_attr(feature = "bindings", derive(TS))]
11556pub struct QueryTransform {
11557 #[serde(default)]
11558 pub expressions: Vec<Expression>,
11559 #[serde(default)]
11560 pub command_script: Option<Box<Expression>>,
11561 #[serde(default)]
11562 pub schema: Option<Box<Expression>>,
11563 #[serde(default)]
11564 pub row_format_before: Option<Box<Expression>>,
11565 #[serde(default)]
11566 pub record_writer: Option<Box<Expression>>,
11567 #[serde(default)]
11568 pub row_format_after: Option<Box<Expression>>,
11569 #[serde(default)]
11570 pub record_reader: Option<Box<Expression>>,
11571}
11572
11573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11575#[cfg_attr(feature = "bindings", derive(TS))]
11576pub struct SampleProperty {
11577 pub this: Box<Expression>,
11578}
11579
11580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11582#[cfg_attr(feature = "bindings", derive(TS))]
11583pub struct SecurityProperty {
11584 pub this: Box<Expression>,
11585}
11586
11587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11589#[cfg_attr(feature = "bindings", derive(TS))]
11590pub struct SchemaCommentProperty {
11591 pub this: Box<Expression>,
11592}
11593
11594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11596#[cfg_attr(feature = "bindings", derive(TS))]
11597pub struct SemanticView {
11598 pub this: Box<Expression>,
11599 #[serde(default)]
11600 pub metrics: Option<Box<Expression>>,
11601 #[serde(default)]
11602 pub dimensions: Option<Box<Expression>>,
11603 #[serde(default)]
11604 pub facts: Option<Box<Expression>>,
11605 #[serde(default)]
11606 pub where_: Option<Box<Expression>>,
11607}
11608
11609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11611#[cfg_attr(feature = "bindings", derive(TS))]
11612pub struct SerdeProperties {
11613 #[serde(default)]
11614 pub expressions: Vec<Expression>,
11615 #[serde(default)]
11616 pub with_: Option<Box<Expression>>,
11617}
11618
11619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11621#[cfg_attr(feature = "bindings", derive(TS))]
11622pub struct SetProperty {
11623 #[serde(default)]
11624 pub multi: Option<Box<Expression>>,
11625}
11626
11627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11629#[cfg_attr(feature = "bindings", derive(TS))]
11630pub struct SharingProperty {
11631 #[serde(default)]
11632 pub this: Option<Box<Expression>>,
11633}
11634
11635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11637#[cfg_attr(feature = "bindings", derive(TS))]
11638pub struct SetConfigProperty {
11639 pub this: Box<Expression>,
11640}
11641
11642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11644#[cfg_attr(feature = "bindings", derive(TS))]
11645pub struct SettingsProperty {
11646 #[serde(default)]
11647 pub expressions: Vec<Expression>,
11648}
11649
11650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11652#[cfg_attr(feature = "bindings", derive(TS))]
11653pub struct SortKeyProperty {
11654 pub this: Box<Expression>,
11655 #[serde(default)]
11656 pub compound: Option<Box<Expression>>,
11657}
11658
11659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11661#[cfg_attr(feature = "bindings", derive(TS))]
11662pub struct SqlReadWriteProperty {
11663 pub this: Box<Expression>,
11664}
11665
11666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11668#[cfg_attr(feature = "bindings", derive(TS))]
11669pub struct SqlSecurityProperty {
11670 pub this: Box<Expression>,
11671}
11672
11673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11675#[cfg_attr(feature = "bindings", derive(TS))]
11676pub struct StabilityProperty {
11677 pub this: Box<Expression>,
11678}
11679
11680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11682#[cfg_attr(feature = "bindings", derive(TS))]
11683pub struct StorageHandlerProperty {
11684 pub this: Box<Expression>,
11685}
11686
11687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11689#[cfg_attr(feature = "bindings", derive(TS))]
11690pub struct TemporaryProperty {
11691 #[serde(default)]
11692 pub this: Option<Box<Expression>>,
11693}
11694
11695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11697#[cfg_attr(feature = "bindings", derive(TS))]
11698pub struct Tags {
11699 #[serde(default)]
11700 pub expressions: Vec<Expression>,
11701}
11702
11703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11705#[cfg_attr(feature = "bindings", derive(TS))]
11706pub struct TransformModelProperty {
11707 #[serde(default)]
11708 pub expressions: Vec<Expression>,
11709}
11710
11711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11713#[cfg_attr(feature = "bindings", derive(TS))]
11714pub struct TransientProperty {
11715 #[serde(default)]
11716 pub this: Option<Box<Expression>>,
11717}
11718
11719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11721#[cfg_attr(feature = "bindings", derive(TS))]
11722pub struct UsingTemplateProperty {
11723 pub this: Box<Expression>,
11724}
11725
11726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11728#[cfg_attr(feature = "bindings", derive(TS))]
11729pub struct ViewAttributeProperty {
11730 pub this: Box<Expression>,
11731}
11732
11733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11735#[cfg_attr(feature = "bindings", derive(TS))]
11736pub struct VolatileProperty {
11737 #[serde(default)]
11738 pub this: Option<Box<Expression>>,
11739}
11740
11741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11743#[cfg_attr(feature = "bindings", derive(TS))]
11744pub struct WithDataProperty {
11745 #[serde(default)]
11746 pub no: Option<Box<Expression>>,
11747 #[serde(default)]
11748 pub statistics: Option<Box<Expression>>,
11749}
11750
11751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11753#[cfg_attr(feature = "bindings", derive(TS))]
11754pub struct WithJournalTableProperty {
11755 pub this: Box<Expression>,
11756}
11757
11758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11760#[cfg_attr(feature = "bindings", derive(TS))]
11761pub struct WithSchemaBindingProperty {
11762 pub this: Box<Expression>,
11763}
11764
11765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11767#[cfg_attr(feature = "bindings", derive(TS))]
11768pub struct WithSystemVersioningProperty {
11769 #[serde(default)]
11770 pub on: Option<Box<Expression>>,
11771 #[serde(default)]
11772 pub this: Option<Box<Expression>>,
11773 #[serde(default)]
11774 pub data_consistency: Option<Box<Expression>>,
11775 #[serde(default)]
11776 pub retention_period: Option<Box<Expression>>,
11777 #[serde(default)]
11778 pub with_: Option<Box<Expression>>,
11779}
11780
11781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11783#[cfg_attr(feature = "bindings", derive(TS))]
11784pub struct WithProcedureOptions {
11785 #[serde(default)]
11786 pub expressions: Vec<Expression>,
11787}
11788
11789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11791#[cfg_attr(feature = "bindings", derive(TS))]
11792pub struct EncodeProperty {
11793 pub this: Box<Expression>,
11794 #[serde(default)]
11795 pub properties: Vec<Expression>,
11796 #[serde(default)]
11797 pub key: Option<Box<Expression>>,
11798}
11799
11800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11802#[cfg_attr(feature = "bindings", derive(TS))]
11803pub struct IncludeProperty {
11804 pub this: Box<Expression>,
11805 #[serde(default)]
11806 pub alias: Option<String>,
11807 #[serde(default)]
11808 pub column_def: Option<Box<Expression>>,
11809}
11810
11811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11813#[cfg_attr(feature = "bindings", derive(TS))]
11814pub struct Properties {
11815 #[serde(default)]
11816 pub expressions: Vec<Expression>,
11817}
11818
11819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11821#[cfg_attr(feature = "bindings", derive(TS))]
11822pub struct OptionEntry {
11823 pub key: Identifier,
11824 pub value: Expression,
11825}
11826
11827#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11829#[cfg_attr(feature = "bindings", derive(TS))]
11830pub struct OptionsProperty {
11831 #[serde(default)]
11832 pub entries: Vec<OptionEntry>,
11833}
11834
11835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11837#[cfg_attr(feature = "bindings", derive(TS))]
11838pub struct InputOutputFormat {
11839 #[serde(default)]
11840 pub input_format: Option<Box<Expression>>,
11841 #[serde(default)]
11842 pub output_format: Option<Box<Expression>>,
11843}
11844
11845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11847#[cfg_attr(feature = "bindings", derive(TS))]
11848pub struct Reference {
11849 pub this: Box<Expression>,
11850 #[serde(default)]
11851 pub expressions: Vec<Expression>,
11852 #[serde(default)]
11853 pub options: Vec<Expression>,
11854}
11855
11856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11858#[cfg_attr(feature = "bindings", derive(TS))]
11859pub struct QueryOption {
11860 pub this: Box<Expression>,
11861 #[serde(default)]
11862 pub expression: Option<Box<Expression>>,
11863}
11864
11865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11867#[cfg_attr(feature = "bindings", derive(TS))]
11868pub struct WithTableHint {
11869 #[serde(default)]
11870 pub expressions: Vec<Expression>,
11871}
11872
11873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11875#[cfg_attr(feature = "bindings", derive(TS))]
11876pub struct IndexTableHint {
11877 pub this: Box<Expression>,
11878 #[serde(default)]
11879 pub expressions: Vec<Expression>,
11880 #[serde(default)]
11881 pub target: Option<Box<Expression>>,
11882}
11883
11884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11886#[cfg_attr(feature = "bindings", derive(TS))]
11887pub struct Get {
11888 pub this: Box<Expression>,
11889 #[serde(default)]
11890 pub target: Option<Box<Expression>>,
11891 #[serde(default)]
11892 pub properties: Vec<Expression>,
11893}
11894
11895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11897#[cfg_attr(feature = "bindings", derive(TS))]
11898pub struct SetOperation {
11899 #[serde(default)]
11900 pub with_: Option<Box<Expression>>,
11901 pub this: Box<Expression>,
11902 pub expression: Box<Expression>,
11903 #[serde(default)]
11904 pub distinct: bool,
11905 #[serde(default)]
11906 pub by_name: Option<Box<Expression>>,
11907 #[serde(default)]
11908 pub side: Option<Box<Expression>>,
11909 #[serde(default)]
11910 pub kind: Option<String>,
11911 #[serde(default)]
11912 pub on: Option<Box<Expression>>,
11913}
11914
11915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11917#[cfg_attr(feature = "bindings", derive(TS))]
11918pub struct Var {
11919 pub this: String,
11920}
11921
11922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11924#[cfg_attr(feature = "bindings", derive(TS))]
11925pub struct Variadic {
11926 pub this: Box<Expression>,
11927}
11928
11929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11931#[cfg_attr(feature = "bindings", derive(TS))]
11932pub struct Version {
11933 pub this: Box<Expression>,
11934 pub kind: String,
11935 #[serde(default)]
11936 pub expression: Option<Box<Expression>>,
11937}
11938
11939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11941#[cfg_attr(feature = "bindings", derive(TS))]
11942pub struct Schema {
11943 #[serde(default)]
11944 pub this: Option<Box<Expression>>,
11945 #[serde(default)]
11946 pub expressions: Vec<Expression>,
11947}
11948
11949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11951#[cfg_attr(feature = "bindings", derive(TS))]
11952pub struct Lock {
11953 #[serde(default)]
11954 pub update: Option<Box<Expression>>,
11955 #[serde(default)]
11956 pub expressions: Vec<Expression>,
11957 #[serde(default)]
11958 pub wait: Option<Box<Expression>>,
11959 #[serde(default)]
11960 pub key: Option<Box<Expression>>,
11961}
11962
11963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11966#[cfg_attr(feature = "bindings", derive(TS))]
11967pub struct TableSample {
11968 #[serde(default, skip_serializing_if = "Option::is_none")]
11970 pub this: Option<Box<Expression>>,
11971 #[serde(default, skip_serializing_if = "Option::is_none")]
11973 pub sample: Option<Box<Sample>>,
11974 #[serde(default)]
11975 pub expressions: Vec<Expression>,
11976 #[serde(default)]
11977 pub method: Option<String>,
11978 #[serde(default)]
11979 pub bucket_numerator: Option<Box<Expression>>,
11980 #[serde(default)]
11981 pub bucket_denominator: Option<Box<Expression>>,
11982 #[serde(default)]
11983 pub bucket_field: Option<Box<Expression>>,
11984 #[serde(default)]
11985 pub percent: Option<Box<Expression>>,
11986 #[serde(default)]
11987 pub rows: Option<Box<Expression>>,
11988 #[serde(default)]
11989 pub size: Option<i64>,
11990 #[serde(default)]
11991 pub seed: Option<Box<Expression>>,
11992}
11993
11994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11996#[cfg_attr(feature = "bindings", derive(TS))]
11997pub struct Tag {
11998 #[serde(default)]
11999 pub this: Option<Box<Expression>>,
12000 #[serde(default)]
12001 pub prefix: Option<Box<Expression>>,
12002 #[serde(default)]
12003 pub postfix: Option<Box<Expression>>,
12004}
12005
12006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12008#[cfg_attr(feature = "bindings", derive(TS))]
12009pub struct UnpivotColumns {
12010 pub this: Box<Expression>,
12011 #[serde(default)]
12012 pub expressions: Vec<Expression>,
12013}
12014
12015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12017#[cfg_attr(feature = "bindings", derive(TS))]
12018pub struct SessionParameter {
12019 pub this: Box<Expression>,
12020 #[serde(default)]
12021 pub kind: Option<String>,
12022}
12023
12024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12026#[cfg_attr(feature = "bindings", derive(TS))]
12027pub struct PseudoType {
12028 pub this: Box<Expression>,
12029}
12030
12031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12033#[cfg_attr(feature = "bindings", derive(TS))]
12034pub struct ObjectIdentifier {
12035 pub this: Box<Expression>,
12036}
12037
12038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12040#[cfg_attr(feature = "bindings", derive(TS))]
12041pub struct Transaction {
12042 #[serde(default)]
12043 pub this: Option<Box<Expression>>,
12044 #[serde(default)]
12045 pub modes: Option<Box<Expression>>,
12046 #[serde(default)]
12047 pub mark: Option<Box<Expression>>,
12048}
12049
12050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12052#[cfg_attr(feature = "bindings", derive(TS))]
12053pub struct Commit {
12054 #[serde(default)]
12055 pub chain: Option<Box<Expression>>,
12056 #[serde(default)]
12057 pub this: Option<Box<Expression>>,
12058 #[serde(default)]
12059 pub durability: Option<Box<Expression>>,
12060}
12061
12062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12064#[cfg_attr(feature = "bindings", derive(TS))]
12065pub struct Rollback {
12066 #[serde(default)]
12067 pub savepoint: Option<Box<Expression>>,
12068 #[serde(default)]
12069 pub this: Option<Box<Expression>>,
12070}
12071
12072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12074#[cfg_attr(feature = "bindings", derive(TS))]
12075pub struct AlterSession {
12076 #[serde(default)]
12077 pub expressions: Vec<Expression>,
12078 #[serde(default)]
12079 pub unset: Option<Box<Expression>>,
12080}
12081
12082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12084#[cfg_attr(feature = "bindings", derive(TS))]
12085pub struct Analyze {
12086 #[serde(default)]
12087 pub kind: Option<String>,
12088 #[serde(default)]
12089 pub this: Option<Box<Expression>>,
12090 #[serde(default)]
12091 pub options: Vec<Expression>,
12092 #[serde(default)]
12093 pub mode: Option<Box<Expression>>,
12094 #[serde(default)]
12095 pub partition: Option<Box<Expression>>,
12096 #[serde(default)]
12097 pub expression: Option<Box<Expression>>,
12098 #[serde(default)]
12099 pub properties: Vec<Expression>,
12100 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12102 pub columns: Vec<String>,
12103}
12104
12105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12107#[cfg_attr(feature = "bindings", derive(TS))]
12108pub struct AnalyzeStatistics {
12109 pub kind: String,
12110 #[serde(default)]
12111 pub option: Option<Box<Expression>>,
12112 #[serde(default)]
12113 pub this: Option<Box<Expression>>,
12114 #[serde(default)]
12115 pub expressions: Vec<Expression>,
12116}
12117
12118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12120#[cfg_attr(feature = "bindings", derive(TS))]
12121pub struct AnalyzeHistogram {
12122 pub this: Box<Expression>,
12123 #[serde(default)]
12124 pub expressions: Vec<Expression>,
12125 #[serde(default)]
12126 pub expression: Option<Box<Expression>>,
12127 #[serde(default)]
12128 pub update_options: Option<Box<Expression>>,
12129}
12130
12131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12133#[cfg_attr(feature = "bindings", derive(TS))]
12134pub struct AnalyzeSample {
12135 pub kind: String,
12136 #[serde(default)]
12137 pub sample: Option<Box<Expression>>,
12138}
12139
12140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12142#[cfg_attr(feature = "bindings", derive(TS))]
12143pub struct AnalyzeListChainedRows {
12144 #[serde(default)]
12145 pub expression: Option<Box<Expression>>,
12146}
12147
12148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12150#[cfg_attr(feature = "bindings", derive(TS))]
12151pub struct AnalyzeDelete {
12152 #[serde(default)]
12153 pub kind: Option<String>,
12154}
12155
12156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12158#[cfg_attr(feature = "bindings", derive(TS))]
12159pub struct AnalyzeWith {
12160 #[serde(default)]
12161 pub expressions: Vec<Expression>,
12162}
12163
12164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12166#[cfg_attr(feature = "bindings", derive(TS))]
12167pub struct AnalyzeValidate {
12168 pub kind: String,
12169 #[serde(default)]
12170 pub this: Option<Box<Expression>>,
12171 #[serde(default)]
12172 pub expression: Option<Box<Expression>>,
12173}
12174
12175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12177#[cfg_attr(feature = "bindings", derive(TS))]
12178pub struct AddPartition {
12179 pub this: Box<Expression>,
12180 #[serde(default)]
12181 pub exists: bool,
12182 #[serde(default)]
12183 pub location: Option<Box<Expression>>,
12184}
12185
12186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12188#[cfg_attr(feature = "bindings", derive(TS))]
12189pub struct AttachOption {
12190 pub this: Box<Expression>,
12191 #[serde(default)]
12192 pub expression: Option<Box<Expression>>,
12193}
12194
12195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12197#[cfg_attr(feature = "bindings", derive(TS))]
12198pub struct DropPartition {
12199 #[serde(default)]
12200 pub expressions: Vec<Expression>,
12201 #[serde(default)]
12202 pub exists: bool,
12203}
12204
12205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12207#[cfg_attr(feature = "bindings", derive(TS))]
12208pub struct ReplacePartition {
12209 pub expression: Box<Expression>,
12210 #[serde(default)]
12211 pub source: Option<Box<Expression>>,
12212}
12213
12214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12216#[cfg_attr(feature = "bindings", derive(TS))]
12217pub struct DPipe {
12218 pub this: Box<Expression>,
12219 pub expression: Box<Expression>,
12220 #[serde(default)]
12221 pub safe: Option<Box<Expression>>,
12222}
12223
12224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12226#[cfg_attr(feature = "bindings", derive(TS))]
12227pub struct Operator {
12228 pub this: Box<Expression>,
12229 #[serde(default)]
12230 pub operator: Option<Box<Expression>>,
12231 pub expression: Box<Expression>,
12232 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12234 pub comments: Vec<String>,
12235}
12236
12237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12239#[cfg_attr(feature = "bindings", derive(TS))]
12240pub struct PivotAny {
12241 #[serde(default)]
12242 pub this: Option<Box<Expression>>,
12243}
12244
12245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12247#[cfg_attr(feature = "bindings", derive(TS))]
12248pub struct Aliases {
12249 pub this: Box<Expression>,
12250 #[serde(default)]
12251 pub expressions: Vec<Expression>,
12252}
12253
12254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12256#[cfg_attr(feature = "bindings", derive(TS))]
12257pub struct AtIndex {
12258 pub this: Box<Expression>,
12259 pub expression: Box<Expression>,
12260}
12261
12262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12264#[cfg_attr(feature = "bindings", derive(TS))]
12265pub struct FromTimeZone {
12266 pub this: Box<Expression>,
12267 #[serde(default)]
12268 pub zone: Option<Box<Expression>>,
12269}
12270
12271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12273#[cfg_attr(feature = "bindings", derive(TS))]
12274pub struct FormatPhrase {
12275 pub this: Box<Expression>,
12276 pub format: String,
12277}
12278
12279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12281#[cfg_attr(feature = "bindings", derive(TS))]
12282pub struct ForIn {
12283 pub this: Box<Expression>,
12284 pub expression: Box<Expression>,
12285}
12286
12287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12289#[cfg_attr(feature = "bindings", derive(TS))]
12290pub struct TimeUnit {
12291 #[serde(default)]
12292 pub unit: Option<String>,
12293}
12294
12295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12297#[cfg_attr(feature = "bindings", derive(TS))]
12298pub struct IntervalOp {
12299 #[serde(default)]
12300 pub unit: Option<String>,
12301 pub expression: Box<Expression>,
12302}
12303
12304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12306#[cfg_attr(feature = "bindings", derive(TS))]
12307pub struct HavingMax {
12308 pub this: Box<Expression>,
12309 pub expression: Box<Expression>,
12310 #[serde(default)]
12311 pub max: Option<Box<Expression>>,
12312}
12313
12314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12316#[cfg_attr(feature = "bindings", derive(TS))]
12317pub struct CosineDistance {
12318 pub this: Box<Expression>,
12319 pub expression: Box<Expression>,
12320}
12321
12322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12324#[cfg_attr(feature = "bindings", derive(TS))]
12325pub struct DotProduct {
12326 pub this: Box<Expression>,
12327 pub expression: Box<Expression>,
12328}
12329
12330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12332#[cfg_attr(feature = "bindings", derive(TS))]
12333pub struct EuclideanDistance {
12334 pub this: Box<Expression>,
12335 pub expression: Box<Expression>,
12336}
12337
12338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12340#[cfg_attr(feature = "bindings", derive(TS))]
12341pub struct ManhattanDistance {
12342 pub this: Box<Expression>,
12343 pub expression: Box<Expression>,
12344}
12345
12346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12348#[cfg_attr(feature = "bindings", derive(TS))]
12349pub struct JarowinklerSimilarity {
12350 pub this: Box<Expression>,
12351 pub expression: Box<Expression>,
12352}
12353
12354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12356#[cfg_attr(feature = "bindings", derive(TS))]
12357pub struct Booland {
12358 pub this: Box<Expression>,
12359 pub expression: Box<Expression>,
12360}
12361
12362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12364#[cfg_attr(feature = "bindings", derive(TS))]
12365pub struct Boolor {
12366 pub this: Box<Expression>,
12367 pub expression: Box<Expression>,
12368}
12369
12370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12372#[cfg_attr(feature = "bindings", derive(TS))]
12373pub struct ParameterizedAgg {
12374 pub this: Box<Expression>,
12375 #[serde(default)]
12376 pub expressions: Vec<Expression>,
12377 #[serde(default)]
12378 pub params: Vec<Expression>,
12379}
12380
12381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12383#[cfg_attr(feature = "bindings", derive(TS))]
12384pub struct ArgMax {
12385 pub this: Box<Expression>,
12386 pub expression: Box<Expression>,
12387 #[serde(default)]
12388 pub count: Option<Box<Expression>>,
12389}
12390
12391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12393#[cfg_attr(feature = "bindings", derive(TS))]
12394pub struct ArgMin {
12395 pub this: Box<Expression>,
12396 pub expression: Box<Expression>,
12397 #[serde(default)]
12398 pub count: Option<Box<Expression>>,
12399}
12400
12401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12403#[cfg_attr(feature = "bindings", derive(TS))]
12404pub struct ApproxTopK {
12405 pub this: Box<Expression>,
12406 #[serde(default)]
12407 pub expression: Option<Box<Expression>>,
12408 #[serde(default)]
12409 pub counters: Option<Box<Expression>>,
12410}
12411
12412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12414#[cfg_attr(feature = "bindings", derive(TS))]
12415pub struct ApproxTopKAccumulate {
12416 pub this: Box<Expression>,
12417 #[serde(default)]
12418 pub expression: Option<Box<Expression>>,
12419}
12420
12421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12423#[cfg_attr(feature = "bindings", derive(TS))]
12424pub struct ApproxTopKCombine {
12425 pub this: Box<Expression>,
12426 #[serde(default)]
12427 pub expression: Option<Box<Expression>>,
12428}
12429
12430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12432#[cfg_attr(feature = "bindings", derive(TS))]
12433pub struct ApproxTopKEstimate {
12434 pub this: Box<Expression>,
12435 #[serde(default)]
12436 pub expression: Option<Box<Expression>>,
12437}
12438
12439#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12441#[cfg_attr(feature = "bindings", derive(TS))]
12442pub struct ApproxTopSum {
12443 pub this: Box<Expression>,
12444 pub expression: Box<Expression>,
12445 #[serde(default)]
12446 pub count: Option<Box<Expression>>,
12447}
12448
12449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12451#[cfg_attr(feature = "bindings", derive(TS))]
12452pub struct ApproxQuantiles {
12453 pub this: Box<Expression>,
12454 #[serde(default)]
12455 pub expression: Option<Box<Expression>>,
12456}
12457
12458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12460#[cfg_attr(feature = "bindings", derive(TS))]
12461pub struct Minhash {
12462 pub this: Box<Expression>,
12463 #[serde(default)]
12464 pub expressions: Vec<Expression>,
12465}
12466
12467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12469#[cfg_attr(feature = "bindings", derive(TS))]
12470pub struct FarmFingerprint {
12471 #[serde(default)]
12472 pub expressions: Vec<Expression>,
12473}
12474
12475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12477#[cfg_attr(feature = "bindings", derive(TS))]
12478pub struct Float64 {
12479 pub this: Box<Expression>,
12480 #[serde(default)]
12481 pub expression: Option<Box<Expression>>,
12482}
12483
12484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12486#[cfg_attr(feature = "bindings", derive(TS))]
12487pub struct Transform {
12488 pub this: Box<Expression>,
12489 pub expression: Box<Expression>,
12490}
12491
12492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12494#[cfg_attr(feature = "bindings", derive(TS))]
12495pub struct Translate {
12496 pub this: Box<Expression>,
12497 #[serde(default)]
12498 pub from_: Option<Box<Expression>>,
12499 #[serde(default)]
12500 pub to: Option<Box<Expression>>,
12501}
12502
12503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12505#[cfg_attr(feature = "bindings", derive(TS))]
12506pub struct Grouping {
12507 #[serde(default)]
12508 pub expressions: Vec<Expression>,
12509}
12510
12511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12513#[cfg_attr(feature = "bindings", derive(TS))]
12514pub struct GroupingId {
12515 #[serde(default)]
12516 pub expressions: Vec<Expression>,
12517}
12518
12519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12521#[cfg_attr(feature = "bindings", derive(TS))]
12522pub struct Anonymous {
12523 pub this: Box<Expression>,
12524 #[serde(default)]
12525 pub expressions: Vec<Expression>,
12526}
12527
12528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12530#[cfg_attr(feature = "bindings", derive(TS))]
12531pub struct AnonymousAggFunc {
12532 pub this: Box<Expression>,
12533 #[serde(default)]
12534 pub expressions: Vec<Expression>,
12535}
12536
12537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12539#[cfg_attr(feature = "bindings", derive(TS))]
12540pub struct CombinedAggFunc {
12541 pub this: Box<Expression>,
12542 #[serde(default)]
12543 pub expressions: Vec<Expression>,
12544}
12545
12546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12548#[cfg_attr(feature = "bindings", derive(TS))]
12549pub struct CombinedParameterizedAgg {
12550 pub this: Box<Expression>,
12551 #[serde(default)]
12552 pub expressions: Vec<Expression>,
12553 #[serde(default)]
12554 pub params: Vec<Expression>,
12555}
12556
12557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12559#[cfg_attr(feature = "bindings", derive(TS))]
12560pub struct HashAgg {
12561 pub this: Box<Expression>,
12562 #[serde(default)]
12563 pub expressions: Vec<Expression>,
12564}
12565
12566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12568#[cfg_attr(feature = "bindings", derive(TS))]
12569pub struct Hll {
12570 pub this: Box<Expression>,
12571 #[serde(default)]
12572 pub expressions: Vec<Expression>,
12573}
12574
12575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12577#[cfg_attr(feature = "bindings", derive(TS))]
12578pub struct Apply {
12579 pub this: Box<Expression>,
12580 pub expression: Box<Expression>,
12581}
12582
12583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12585#[cfg_attr(feature = "bindings", derive(TS))]
12586pub struct ToBoolean {
12587 pub this: Box<Expression>,
12588 #[serde(default)]
12589 pub safe: Option<Box<Expression>>,
12590}
12591
12592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12594#[cfg_attr(feature = "bindings", derive(TS))]
12595pub struct List {
12596 #[serde(default)]
12597 pub expressions: Vec<Expression>,
12598}
12599
12600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12605#[cfg_attr(feature = "bindings", derive(TS))]
12606pub struct ToMap {
12607 pub this: Box<Expression>,
12609}
12610
12611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12613#[cfg_attr(feature = "bindings", derive(TS))]
12614pub struct Pad {
12615 pub this: Box<Expression>,
12616 pub expression: Box<Expression>,
12617 #[serde(default)]
12618 pub fill_pattern: Option<Box<Expression>>,
12619 #[serde(default)]
12620 pub is_left: Option<Box<Expression>>,
12621}
12622
12623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12625#[cfg_attr(feature = "bindings", derive(TS))]
12626pub struct ToChar {
12627 pub this: Box<Expression>,
12628 #[serde(default)]
12629 pub format: Option<String>,
12630 #[serde(default)]
12631 pub nlsparam: Option<Box<Expression>>,
12632 #[serde(default)]
12633 pub is_numeric: Option<Box<Expression>>,
12634}
12635
12636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12638#[cfg_attr(feature = "bindings", derive(TS))]
12639pub struct StringFunc {
12640 pub this: Box<Expression>,
12641 #[serde(default)]
12642 pub zone: Option<Box<Expression>>,
12643}
12644
12645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12647#[cfg_attr(feature = "bindings", derive(TS))]
12648pub struct ToNumber {
12649 pub this: Box<Expression>,
12650 #[serde(default)]
12651 pub format: Option<Box<Expression>>,
12652 #[serde(default)]
12653 pub nlsparam: Option<Box<Expression>>,
12654 #[serde(default)]
12655 pub precision: Option<Box<Expression>>,
12656 #[serde(default)]
12657 pub scale: Option<Box<Expression>>,
12658 #[serde(default)]
12659 pub safe: Option<Box<Expression>>,
12660 #[serde(default)]
12661 pub safe_name: Option<Box<Expression>>,
12662}
12663
12664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12666#[cfg_attr(feature = "bindings", derive(TS))]
12667pub struct ToDouble {
12668 pub this: Box<Expression>,
12669 #[serde(default)]
12670 pub format: Option<String>,
12671 #[serde(default)]
12672 pub safe: Option<Box<Expression>>,
12673}
12674
12675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12677#[cfg_attr(feature = "bindings", derive(TS))]
12678pub struct ToDecfloat {
12679 pub this: Box<Expression>,
12680 #[serde(default)]
12681 pub format: Option<String>,
12682}
12683
12684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12686#[cfg_attr(feature = "bindings", derive(TS))]
12687pub struct TryToDecfloat {
12688 pub this: Box<Expression>,
12689 #[serde(default)]
12690 pub format: Option<String>,
12691}
12692
12693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12695#[cfg_attr(feature = "bindings", derive(TS))]
12696pub struct ToFile {
12697 pub this: Box<Expression>,
12698 #[serde(default)]
12699 pub path: Option<Box<Expression>>,
12700 #[serde(default)]
12701 pub safe: Option<Box<Expression>>,
12702}
12703
12704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12706#[cfg_attr(feature = "bindings", derive(TS))]
12707pub struct Columns {
12708 pub this: Box<Expression>,
12709 #[serde(default)]
12710 pub unpack: Option<Box<Expression>>,
12711}
12712
12713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12715#[cfg_attr(feature = "bindings", derive(TS))]
12716pub struct ConvertToCharset {
12717 pub this: Box<Expression>,
12718 #[serde(default)]
12719 pub dest: Option<Box<Expression>>,
12720 #[serde(default)]
12721 pub source: Option<Box<Expression>>,
12722}
12723
12724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12726#[cfg_attr(feature = "bindings", derive(TS))]
12727pub struct ConvertTimezone {
12728 #[serde(default)]
12729 pub source_tz: Option<Box<Expression>>,
12730 #[serde(default)]
12731 pub target_tz: Option<Box<Expression>>,
12732 #[serde(default)]
12733 pub timestamp: Option<Box<Expression>>,
12734 #[serde(default)]
12735 pub options: Vec<Expression>,
12736}
12737
12738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12740#[cfg_attr(feature = "bindings", derive(TS))]
12741pub struct GenerateSeries {
12742 #[serde(default)]
12743 pub start: Option<Box<Expression>>,
12744 #[serde(default)]
12745 pub end: Option<Box<Expression>>,
12746 #[serde(default)]
12747 pub step: Option<Box<Expression>>,
12748 #[serde(default)]
12749 pub is_end_exclusive: Option<Box<Expression>>,
12750}
12751
12752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12754#[cfg_attr(feature = "bindings", derive(TS))]
12755pub struct AIAgg {
12756 pub this: Box<Expression>,
12757 pub expression: Box<Expression>,
12758}
12759
12760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12762#[cfg_attr(feature = "bindings", derive(TS))]
12763pub struct AIClassify {
12764 pub this: Box<Expression>,
12765 #[serde(default)]
12766 pub categories: Option<Box<Expression>>,
12767 #[serde(default)]
12768 pub config: Option<Box<Expression>>,
12769}
12770
12771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12773#[cfg_attr(feature = "bindings", derive(TS))]
12774pub struct ArrayAll {
12775 pub this: Box<Expression>,
12776 pub expression: Box<Expression>,
12777}
12778
12779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12781#[cfg_attr(feature = "bindings", derive(TS))]
12782pub struct ArrayAny {
12783 pub this: Box<Expression>,
12784 pub expression: Box<Expression>,
12785}
12786
12787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12789#[cfg_attr(feature = "bindings", derive(TS))]
12790pub struct ArrayConstructCompact {
12791 #[serde(default)]
12792 pub expressions: Vec<Expression>,
12793}
12794
12795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12797#[cfg_attr(feature = "bindings", derive(TS))]
12798pub struct StPoint {
12799 pub this: Box<Expression>,
12800 pub expression: Box<Expression>,
12801 #[serde(default)]
12802 pub null: Option<Box<Expression>>,
12803}
12804
12805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12807#[cfg_attr(feature = "bindings", derive(TS))]
12808pub struct StDistance {
12809 pub this: Box<Expression>,
12810 pub expression: Box<Expression>,
12811 #[serde(default)]
12812 pub use_spheroid: Option<Box<Expression>>,
12813}
12814
12815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12817#[cfg_attr(feature = "bindings", derive(TS))]
12818pub struct StringToArray {
12819 pub this: Box<Expression>,
12820 #[serde(default)]
12821 pub expression: Option<Box<Expression>>,
12822 #[serde(default)]
12823 pub null: Option<Box<Expression>>,
12824}
12825
12826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12828#[cfg_attr(feature = "bindings", derive(TS))]
12829pub struct ArraySum {
12830 pub this: Box<Expression>,
12831 #[serde(default)]
12832 pub expression: Option<Box<Expression>>,
12833}
12834
12835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12837#[cfg_attr(feature = "bindings", derive(TS))]
12838pub struct ObjectAgg {
12839 pub this: Box<Expression>,
12840 pub expression: Box<Expression>,
12841}
12842
12843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12845#[cfg_attr(feature = "bindings", derive(TS))]
12846pub struct CastToStrType {
12847 pub this: Box<Expression>,
12848 #[serde(default)]
12849 pub to: Option<Box<Expression>>,
12850}
12851
12852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12854#[cfg_attr(feature = "bindings", derive(TS))]
12855pub struct CheckJson {
12856 pub this: Box<Expression>,
12857}
12858
12859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12861#[cfg_attr(feature = "bindings", derive(TS))]
12862pub struct CheckXml {
12863 pub this: Box<Expression>,
12864 #[serde(default)]
12865 pub disable_auto_convert: Option<Box<Expression>>,
12866}
12867
12868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12870#[cfg_attr(feature = "bindings", derive(TS))]
12871pub struct TranslateCharacters {
12872 pub this: Box<Expression>,
12873 pub expression: Box<Expression>,
12874 #[serde(default)]
12875 pub with_error: Option<Box<Expression>>,
12876}
12877
12878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12880#[cfg_attr(feature = "bindings", derive(TS))]
12881pub struct CurrentSchemas {
12882 #[serde(default)]
12883 pub this: Option<Box<Expression>>,
12884}
12885
12886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12888#[cfg_attr(feature = "bindings", derive(TS))]
12889pub struct CurrentDatetime {
12890 #[serde(default)]
12891 pub this: Option<Box<Expression>>,
12892}
12893
12894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12896#[cfg_attr(feature = "bindings", derive(TS))]
12897pub struct Localtime {
12898 #[serde(default)]
12899 pub this: Option<Box<Expression>>,
12900}
12901
12902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12904#[cfg_attr(feature = "bindings", derive(TS))]
12905pub struct Localtimestamp {
12906 #[serde(default)]
12907 pub this: Option<Box<Expression>>,
12908}
12909
12910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12912#[cfg_attr(feature = "bindings", derive(TS))]
12913pub struct Systimestamp {
12914 #[serde(default)]
12915 pub this: Option<Box<Expression>>,
12916}
12917
12918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12920#[cfg_attr(feature = "bindings", derive(TS))]
12921pub struct CurrentSchema {
12922 #[serde(default)]
12923 pub this: Option<Box<Expression>>,
12924}
12925
12926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12928#[cfg_attr(feature = "bindings", derive(TS))]
12929pub struct CurrentUser {
12930 #[serde(default)]
12931 pub this: Option<Box<Expression>>,
12932}
12933
12934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12936#[cfg_attr(feature = "bindings", derive(TS))]
12937pub struct SessionUser;
12938
12939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12941#[cfg_attr(feature = "bindings", derive(TS))]
12942pub struct JSONPathRoot;
12943
12944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12946#[cfg_attr(feature = "bindings", derive(TS))]
12947pub struct UtcTime {
12948 #[serde(default)]
12949 pub this: Option<Box<Expression>>,
12950}
12951
12952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12954#[cfg_attr(feature = "bindings", derive(TS))]
12955pub struct UtcTimestamp {
12956 #[serde(default)]
12957 pub this: Option<Box<Expression>>,
12958}
12959
12960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12962#[cfg_attr(feature = "bindings", derive(TS))]
12963pub struct TimestampFunc {
12964 #[serde(default)]
12965 pub this: Option<Box<Expression>>,
12966 #[serde(default)]
12967 pub zone: Option<Box<Expression>>,
12968 #[serde(default)]
12969 pub with_tz: Option<bool>,
12970 #[serde(default)]
12971 pub safe: Option<bool>,
12972}
12973
12974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12976#[cfg_attr(feature = "bindings", derive(TS))]
12977pub struct DateBin {
12978 pub this: Box<Expression>,
12979 pub expression: Box<Expression>,
12980 #[serde(default)]
12981 pub unit: Option<String>,
12982 #[serde(default)]
12983 pub zone: Option<Box<Expression>>,
12984 #[serde(default)]
12985 pub origin: Option<Box<Expression>>,
12986}
12987
12988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12990#[cfg_attr(feature = "bindings", derive(TS))]
12991pub struct Datetime {
12992 pub this: Box<Expression>,
12993 #[serde(default)]
12994 pub expression: Option<Box<Expression>>,
12995}
12996
12997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12999#[cfg_attr(feature = "bindings", derive(TS))]
13000pub struct DatetimeAdd {
13001 pub this: Box<Expression>,
13002 pub expression: Box<Expression>,
13003 #[serde(default)]
13004 pub unit: Option<String>,
13005}
13006
13007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13009#[cfg_attr(feature = "bindings", derive(TS))]
13010pub struct DatetimeSub {
13011 pub this: Box<Expression>,
13012 pub expression: Box<Expression>,
13013 #[serde(default)]
13014 pub unit: Option<String>,
13015}
13016
13017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13019#[cfg_attr(feature = "bindings", derive(TS))]
13020pub struct DatetimeDiff {
13021 pub this: Box<Expression>,
13022 pub expression: Box<Expression>,
13023 #[serde(default)]
13024 pub unit: Option<String>,
13025}
13026
13027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13029#[cfg_attr(feature = "bindings", derive(TS))]
13030pub struct DatetimeTrunc {
13031 pub this: Box<Expression>,
13032 pub unit: String,
13033 #[serde(default)]
13034 pub zone: Option<Box<Expression>>,
13035}
13036
13037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13039#[cfg_attr(feature = "bindings", derive(TS))]
13040pub struct Dayname {
13041 pub this: Box<Expression>,
13042 #[serde(default)]
13043 pub abbreviated: Option<Box<Expression>>,
13044}
13045
13046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13048#[cfg_attr(feature = "bindings", derive(TS))]
13049pub struct MakeInterval {
13050 #[serde(default)]
13051 pub year: Option<Box<Expression>>,
13052 #[serde(default)]
13053 pub month: Option<Box<Expression>>,
13054 #[serde(default)]
13055 pub week: Option<Box<Expression>>,
13056 #[serde(default)]
13057 pub day: Option<Box<Expression>>,
13058 #[serde(default)]
13059 pub hour: Option<Box<Expression>>,
13060 #[serde(default)]
13061 pub minute: Option<Box<Expression>>,
13062 #[serde(default)]
13063 pub second: Option<Box<Expression>>,
13064}
13065
13066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13068#[cfg_attr(feature = "bindings", derive(TS))]
13069pub struct PreviousDay {
13070 pub this: Box<Expression>,
13071 pub expression: Box<Expression>,
13072}
13073
13074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13076#[cfg_attr(feature = "bindings", derive(TS))]
13077pub struct Elt {
13078 pub this: Box<Expression>,
13079 #[serde(default)]
13080 pub expressions: Vec<Expression>,
13081}
13082
13083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13085#[cfg_attr(feature = "bindings", derive(TS))]
13086pub struct TimestampAdd {
13087 pub this: Box<Expression>,
13088 pub expression: Box<Expression>,
13089 #[serde(default)]
13090 pub unit: Option<String>,
13091}
13092
13093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13095#[cfg_attr(feature = "bindings", derive(TS))]
13096pub struct TimestampSub {
13097 pub this: Box<Expression>,
13098 pub expression: Box<Expression>,
13099 #[serde(default)]
13100 pub unit: Option<String>,
13101}
13102
13103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13105#[cfg_attr(feature = "bindings", derive(TS))]
13106pub struct TimestampDiff {
13107 pub this: Box<Expression>,
13108 pub expression: Box<Expression>,
13109 #[serde(default)]
13110 pub unit: Option<String>,
13111}
13112
13113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13115#[cfg_attr(feature = "bindings", derive(TS))]
13116pub struct TimeSlice {
13117 pub this: Box<Expression>,
13118 pub expression: Box<Expression>,
13119 pub unit: String,
13120 #[serde(default)]
13121 pub kind: Option<String>,
13122}
13123
13124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13126#[cfg_attr(feature = "bindings", derive(TS))]
13127pub struct TimeAdd {
13128 pub this: Box<Expression>,
13129 pub expression: Box<Expression>,
13130 #[serde(default)]
13131 pub unit: Option<String>,
13132}
13133
13134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13136#[cfg_attr(feature = "bindings", derive(TS))]
13137pub struct TimeSub {
13138 pub this: Box<Expression>,
13139 pub expression: Box<Expression>,
13140 #[serde(default)]
13141 pub unit: Option<String>,
13142}
13143
13144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13146#[cfg_attr(feature = "bindings", derive(TS))]
13147pub struct TimeDiff {
13148 pub this: Box<Expression>,
13149 pub expression: Box<Expression>,
13150 #[serde(default)]
13151 pub unit: Option<String>,
13152}
13153
13154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13156#[cfg_attr(feature = "bindings", derive(TS))]
13157pub struct TimeTrunc {
13158 pub this: Box<Expression>,
13159 pub unit: String,
13160 #[serde(default)]
13161 pub zone: Option<Box<Expression>>,
13162}
13163
13164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13166#[cfg_attr(feature = "bindings", derive(TS))]
13167pub struct DateFromParts {
13168 #[serde(default)]
13169 pub year: Option<Box<Expression>>,
13170 #[serde(default)]
13171 pub month: Option<Box<Expression>>,
13172 #[serde(default)]
13173 pub day: Option<Box<Expression>>,
13174 #[serde(default)]
13175 pub allow_overflow: Option<Box<Expression>>,
13176}
13177
13178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13180#[cfg_attr(feature = "bindings", derive(TS))]
13181pub struct TimeFromParts {
13182 #[serde(default)]
13183 pub hour: Option<Box<Expression>>,
13184 #[serde(default)]
13185 pub min: Option<Box<Expression>>,
13186 #[serde(default)]
13187 pub sec: Option<Box<Expression>>,
13188 #[serde(default)]
13189 pub nano: Option<Box<Expression>>,
13190 #[serde(default)]
13191 pub fractions: Option<Box<Expression>>,
13192 #[serde(default)]
13193 pub precision: Option<i64>,
13194}
13195
13196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13198#[cfg_attr(feature = "bindings", derive(TS))]
13199pub struct DecodeCase {
13200 #[serde(default)]
13201 pub expressions: Vec<Expression>,
13202}
13203
13204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13206#[cfg_attr(feature = "bindings", derive(TS))]
13207pub struct Decrypt {
13208 pub this: Box<Expression>,
13209 #[serde(default)]
13210 pub passphrase: Option<Box<Expression>>,
13211 #[serde(default)]
13212 pub aad: Option<Box<Expression>>,
13213 #[serde(default)]
13214 pub encryption_method: Option<Box<Expression>>,
13215 #[serde(default)]
13216 pub safe: Option<Box<Expression>>,
13217}
13218
13219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13221#[cfg_attr(feature = "bindings", derive(TS))]
13222pub struct DecryptRaw {
13223 pub this: Box<Expression>,
13224 #[serde(default)]
13225 pub key: Option<Box<Expression>>,
13226 #[serde(default)]
13227 pub iv: Option<Box<Expression>>,
13228 #[serde(default)]
13229 pub aad: Option<Box<Expression>>,
13230 #[serde(default)]
13231 pub encryption_method: Option<Box<Expression>>,
13232 #[serde(default)]
13233 pub aead: Option<Box<Expression>>,
13234 #[serde(default)]
13235 pub safe: Option<Box<Expression>>,
13236}
13237
13238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13240#[cfg_attr(feature = "bindings", derive(TS))]
13241pub struct Encode {
13242 pub this: Box<Expression>,
13243 #[serde(default)]
13244 pub charset: Option<Box<Expression>>,
13245}
13246
13247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13249#[cfg_attr(feature = "bindings", derive(TS))]
13250pub struct Encrypt {
13251 pub this: Box<Expression>,
13252 #[serde(default)]
13253 pub passphrase: Option<Box<Expression>>,
13254 #[serde(default)]
13255 pub aad: Option<Box<Expression>>,
13256 #[serde(default)]
13257 pub encryption_method: Option<Box<Expression>>,
13258}
13259
13260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13262#[cfg_attr(feature = "bindings", derive(TS))]
13263pub struct EncryptRaw {
13264 pub this: Box<Expression>,
13265 #[serde(default)]
13266 pub key: Option<Box<Expression>>,
13267 #[serde(default)]
13268 pub iv: Option<Box<Expression>>,
13269 #[serde(default)]
13270 pub aad: Option<Box<Expression>>,
13271 #[serde(default)]
13272 pub encryption_method: Option<Box<Expression>>,
13273}
13274
13275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13277#[cfg_attr(feature = "bindings", derive(TS))]
13278pub struct EqualNull {
13279 pub this: Box<Expression>,
13280 pub expression: Box<Expression>,
13281}
13282
13283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13285#[cfg_attr(feature = "bindings", derive(TS))]
13286pub struct ToBinary {
13287 pub this: Box<Expression>,
13288 #[serde(default)]
13289 pub format: Option<String>,
13290 #[serde(default)]
13291 pub safe: Option<Box<Expression>>,
13292}
13293
13294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13296#[cfg_attr(feature = "bindings", derive(TS))]
13297pub struct Base64DecodeBinary {
13298 pub this: Box<Expression>,
13299 #[serde(default)]
13300 pub alphabet: Option<Box<Expression>>,
13301}
13302
13303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13305#[cfg_attr(feature = "bindings", derive(TS))]
13306pub struct Base64DecodeString {
13307 pub this: Box<Expression>,
13308 #[serde(default)]
13309 pub alphabet: Option<Box<Expression>>,
13310}
13311
13312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13314#[cfg_attr(feature = "bindings", derive(TS))]
13315pub struct Base64Encode {
13316 pub this: Box<Expression>,
13317 #[serde(default)]
13318 pub max_line_length: Option<Box<Expression>>,
13319 #[serde(default)]
13320 pub alphabet: Option<Box<Expression>>,
13321}
13322
13323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13325#[cfg_attr(feature = "bindings", derive(TS))]
13326pub struct TryBase64DecodeBinary {
13327 pub this: Box<Expression>,
13328 #[serde(default)]
13329 pub alphabet: Option<Box<Expression>>,
13330}
13331
13332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13334#[cfg_attr(feature = "bindings", derive(TS))]
13335pub struct TryBase64DecodeString {
13336 pub this: Box<Expression>,
13337 #[serde(default)]
13338 pub alphabet: Option<Box<Expression>>,
13339}
13340
13341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13343#[cfg_attr(feature = "bindings", derive(TS))]
13344pub struct GapFill {
13345 pub this: Box<Expression>,
13346 #[serde(default)]
13347 pub ts_column: Option<Box<Expression>>,
13348 #[serde(default)]
13349 pub bucket_width: Option<Box<Expression>>,
13350 #[serde(default)]
13351 pub partitioning_columns: Option<Box<Expression>>,
13352 #[serde(default)]
13353 pub value_columns: Option<Box<Expression>>,
13354 #[serde(default)]
13355 pub origin: Option<Box<Expression>>,
13356 #[serde(default)]
13357 pub ignore_nulls: Option<Box<Expression>>,
13358}
13359
13360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13362#[cfg_attr(feature = "bindings", derive(TS))]
13363pub struct GenerateDateArray {
13364 #[serde(default)]
13365 pub start: Option<Box<Expression>>,
13366 #[serde(default)]
13367 pub end: Option<Box<Expression>>,
13368 #[serde(default)]
13369 pub step: Option<Box<Expression>>,
13370}
13371
13372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13374#[cfg_attr(feature = "bindings", derive(TS))]
13375pub struct GenerateTimestampArray {
13376 #[serde(default)]
13377 pub start: Option<Box<Expression>>,
13378 #[serde(default)]
13379 pub end: Option<Box<Expression>>,
13380 #[serde(default)]
13381 pub step: Option<Box<Expression>>,
13382}
13383
13384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13386#[cfg_attr(feature = "bindings", derive(TS))]
13387pub struct GetExtract {
13388 pub this: Box<Expression>,
13389 pub expression: Box<Expression>,
13390}
13391
13392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13394#[cfg_attr(feature = "bindings", derive(TS))]
13395pub struct Getbit {
13396 pub this: Box<Expression>,
13397 pub expression: Box<Expression>,
13398 #[serde(default)]
13399 pub zero_is_msb: Option<Box<Expression>>,
13400}
13401
13402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13404#[cfg_attr(feature = "bindings", derive(TS))]
13405pub struct OverflowTruncateBehavior {
13406 #[serde(default)]
13407 pub this: Option<Box<Expression>>,
13408 #[serde(default)]
13409 pub with_count: Option<Box<Expression>>,
13410}
13411
13412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13414#[cfg_attr(feature = "bindings", derive(TS))]
13415pub struct HexEncode {
13416 pub this: Box<Expression>,
13417 #[serde(default)]
13418 pub case: Option<Box<Expression>>,
13419}
13420
13421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13423#[cfg_attr(feature = "bindings", derive(TS))]
13424pub struct Compress {
13425 pub this: Box<Expression>,
13426 #[serde(default)]
13427 pub method: Option<String>,
13428}
13429
13430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13432#[cfg_attr(feature = "bindings", derive(TS))]
13433pub struct DecompressBinary {
13434 pub this: Box<Expression>,
13435 pub method: String,
13436}
13437
13438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13440#[cfg_attr(feature = "bindings", derive(TS))]
13441pub struct DecompressString {
13442 pub this: Box<Expression>,
13443 pub method: String,
13444}
13445
13446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13448#[cfg_attr(feature = "bindings", derive(TS))]
13449pub struct Xor {
13450 #[serde(default)]
13451 pub this: Option<Box<Expression>>,
13452 #[serde(default)]
13453 pub expression: Option<Box<Expression>>,
13454 #[serde(default)]
13455 pub expressions: Vec<Expression>,
13456}
13457
13458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13460#[cfg_attr(feature = "bindings", derive(TS))]
13461pub struct Nullif {
13462 pub this: Box<Expression>,
13463 pub expression: Box<Expression>,
13464}
13465
13466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13468#[cfg_attr(feature = "bindings", derive(TS))]
13469pub struct JSON {
13470 #[serde(default)]
13471 pub this: Option<Box<Expression>>,
13472 #[serde(default)]
13473 pub with_: Option<Box<Expression>>,
13474 #[serde(default)]
13475 pub unique: bool,
13476}
13477
13478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13480#[cfg_attr(feature = "bindings", derive(TS))]
13481pub struct JSONPath {
13482 #[serde(default)]
13483 pub expressions: Vec<Expression>,
13484 #[serde(default)]
13485 pub escape: Option<Box<Expression>>,
13486}
13487
13488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13490#[cfg_attr(feature = "bindings", derive(TS))]
13491pub struct JSONPathFilter {
13492 pub this: Box<Expression>,
13493}
13494
13495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13497#[cfg_attr(feature = "bindings", derive(TS))]
13498pub struct JSONPathKey {
13499 pub this: Box<Expression>,
13500}
13501
13502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13504#[cfg_attr(feature = "bindings", derive(TS))]
13505pub struct JSONPathRecursive {
13506 #[serde(default)]
13507 pub this: Option<Box<Expression>>,
13508}
13509
13510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13512#[cfg_attr(feature = "bindings", derive(TS))]
13513pub struct JSONPathScript {
13514 pub this: Box<Expression>,
13515}
13516
13517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13519#[cfg_attr(feature = "bindings", derive(TS))]
13520pub struct JSONPathSlice {
13521 #[serde(default)]
13522 pub start: Option<Box<Expression>>,
13523 #[serde(default)]
13524 pub end: Option<Box<Expression>>,
13525 #[serde(default)]
13526 pub step: Option<Box<Expression>>,
13527}
13528
13529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13531#[cfg_attr(feature = "bindings", derive(TS))]
13532pub struct JSONPathSelector {
13533 pub this: Box<Expression>,
13534}
13535
13536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13538#[cfg_attr(feature = "bindings", derive(TS))]
13539pub struct JSONPathSubscript {
13540 pub this: Box<Expression>,
13541}
13542
13543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13545#[cfg_attr(feature = "bindings", derive(TS))]
13546pub struct JSONPathUnion {
13547 #[serde(default)]
13548 pub expressions: Vec<Expression>,
13549}
13550
13551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13553#[cfg_attr(feature = "bindings", derive(TS))]
13554pub struct Format {
13555 pub this: Box<Expression>,
13556 #[serde(default)]
13557 pub expressions: Vec<Expression>,
13558}
13559
13560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13562#[cfg_attr(feature = "bindings", derive(TS))]
13563pub struct JSONKeys {
13564 pub this: Box<Expression>,
13565 #[serde(default)]
13566 pub expression: Option<Box<Expression>>,
13567 #[serde(default)]
13568 pub expressions: Vec<Expression>,
13569}
13570
13571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13573#[cfg_attr(feature = "bindings", derive(TS))]
13574pub struct JSONKeyValue {
13575 pub this: Box<Expression>,
13576 pub expression: Box<Expression>,
13577}
13578
13579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13581#[cfg_attr(feature = "bindings", derive(TS))]
13582pub struct JSONKeysAtDepth {
13583 pub this: Box<Expression>,
13584 #[serde(default)]
13585 pub expression: Option<Box<Expression>>,
13586 #[serde(default)]
13587 pub mode: Option<Box<Expression>>,
13588}
13589
13590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13592#[cfg_attr(feature = "bindings", derive(TS))]
13593pub struct JSONObject {
13594 #[serde(default)]
13595 pub expressions: Vec<Expression>,
13596 #[serde(default)]
13597 pub null_handling: Option<Box<Expression>>,
13598 #[serde(default)]
13599 pub unique_keys: Option<Box<Expression>>,
13600 #[serde(default)]
13601 pub return_type: Option<Box<Expression>>,
13602 #[serde(default)]
13603 pub encoding: Option<Box<Expression>>,
13604}
13605
13606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13608#[cfg_attr(feature = "bindings", derive(TS))]
13609pub struct JSONObjectAgg {
13610 #[serde(default)]
13611 pub expressions: Vec<Expression>,
13612 #[serde(default)]
13613 pub null_handling: Option<Box<Expression>>,
13614 #[serde(default)]
13615 pub unique_keys: Option<Box<Expression>>,
13616 #[serde(default)]
13617 pub return_type: Option<Box<Expression>>,
13618 #[serde(default)]
13619 pub encoding: Option<Box<Expression>>,
13620}
13621
13622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13624#[cfg_attr(feature = "bindings", derive(TS))]
13625pub struct JSONBObjectAgg {
13626 pub this: Box<Expression>,
13627 pub expression: Box<Expression>,
13628}
13629
13630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13632#[cfg_attr(feature = "bindings", derive(TS))]
13633pub struct JSONArray {
13634 #[serde(default)]
13635 pub expressions: Vec<Expression>,
13636 #[serde(default)]
13637 pub null_handling: Option<Box<Expression>>,
13638 #[serde(default)]
13639 pub return_type: Option<Box<Expression>>,
13640 #[serde(default)]
13641 pub strict: Option<Box<Expression>>,
13642}
13643
13644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13646#[cfg_attr(feature = "bindings", derive(TS))]
13647pub struct JSONArrayAgg {
13648 pub this: Box<Expression>,
13649 #[serde(default)]
13650 pub order: Option<Box<Expression>>,
13651 #[serde(default)]
13652 pub null_handling: Option<Box<Expression>>,
13653 #[serde(default)]
13654 pub return_type: Option<Box<Expression>>,
13655 #[serde(default)]
13656 pub strict: Option<Box<Expression>>,
13657}
13658
13659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13661#[cfg_attr(feature = "bindings", derive(TS))]
13662pub struct JSONExists {
13663 pub this: Box<Expression>,
13664 #[serde(default)]
13665 pub path: Option<Box<Expression>>,
13666 #[serde(default)]
13667 pub passing: Option<Box<Expression>>,
13668 #[serde(default)]
13669 pub on_condition: Option<Box<Expression>>,
13670 #[serde(default)]
13671 pub from_dcolonqmark: Option<Box<Expression>>,
13672}
13673
13674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13676#[cfg_attr(feature = "bindings", derive(TS))]
13677pub struct JSONColumnDef {
13678 #[serde(default)]
13679 pub this: Option<Box<Expression>>,
13680 #[serde(default)]
13681 pub kind: Option<String>,
13682 #[serde(default)]
13683 pub format_json: bool,
13684 #[serde(default)]
13685 pub path: Option<Box<Expression>>,
13686 #[serde(default)]
13687 pub nested_schema: Option<Box<Expression>>,
13688 #[serde(default)]
13689 pub ordinality: Option<Box<Expression>>,
13690}
13691
13692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13694#[cfg_attr(feature = "bindings", derive(TS))]
13695pub struct JSONSchema {
13696 #[serde(default)]
13697 pub expressions: Vec<Expression>,
13698}
13699
13700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13702#[cfg_attr(feature = "bindings", derive(TS))]
13703pub struct JSONSet {
13704 pub this: Box<Expression>,
13705 #[serde(default)]
13706 pub expressions: Vec<Expression>,
13707}
13708
13709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13711#[cfg_attr(feature = "bindings", derive(TS))]
13712pub struct JSONStripNulls {
13713 pub this: Box<Expression>,
13714 #[serde(default)]
13715 pub expression: Option<Box<Expression>>,
13716 #[serde(default)]
13717 pub include_arrays: Option<Box<Expression>>,
13718 #[serde(default)]
13719 pub remove_empty: Option<Box<Expression>>,
13720}
13721
13722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13724#[cfg_attr(feature = "bindings", derive(TS))]
13725pub struct JSONValue {
13726 pub this: Box<Expression>,
13727 #[serde(default)]
13728 pub path: Option<Box<Expression>>,
13729 #[serde(default)]
13730 pub returning: Option<Box<Expression>>,
13731 #[serde(default)]
13732 pub on_condition: Option<Box<Expression>>,
13733}
13734
13735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13737#[cfg_attr(feature = "bindings", derive(TS))]
13738pub struct JSONValueArray {
13739 pub this: Box<Expression>,
13740 #[serde(default)]
13741 pub expression: Option<Box<Expression>>,
13742}
13743
13744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13746#[cfg_attr(feature = "bindings", derive(TS))]
13747pub struct JSONRemove {
13748 pub this: Box<Expression>,
13749 #[serde(default)]
13750 pub expressions: Vec<Expression>,
13751}
13752
13753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13755#[cfg_attr(feature = "bindings", derive(TS))]
13756pub struct JSONTable {
13757 pub this: Box<Expression>,
13758 #[serde(default)]
13759 pub schema: Option<Box<Expression>>,
13760 #[serde(default)]
13761 pub path: Option<Box<Expression>>,
13762 #[serde(default)]
13763 pub error_handling: Option<Box<Expression>>,
13764 #[serde(default)]
13765 pub empty_handling: Option<Box<Expression>>,
13766}
13767
13768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13770#[cfg_attr(feature = "bindings", derive(TS))]
13771pub struct JSONType {
13772 pub this: Box<Expression>,
13773 #[serde(default)]
13774 pub expression: Option<Box<Expression>>,
13775}
13776
13777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13779#[cfg_attr(feature = "bindings", derive(TS))]
13780pub struct ObjectInsert {
13781 pub this: Box<Expression>,
13782 #[serde(default)]
13783 pub key: Option<Box<Expression>>,
13784 #[serde(default)]
13785 pub value: Option<Box<Expression>>,
13786 #[serde(default)]
13787 pub update_flag: Option<Box<Expression>>,
13788}
13789
13790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13792#[cfg_attr(feature = "bindings", derive(TS))]
13793pub struct OpenJSONColumnDef {
13794 pub this: Box<Expression>,
13795 pub kind: String,
13796 #[serde(default)]
13797 pub path: Option<Box<Expression>>,
13798 #[serde(default)]
13799 pub as_json: Option<Box<Expression>>,
13800 #[serde(default, skip_serializing_if = "Option::is_none")]
13802 pub data_type: Option<DataType>,
13803}
13804
13805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13807#[cfg_attr(feature = "bindings", derive(TS))]
13808pub struct OpenJSON {
13809 pub this: Box<Expression>,
13810 #[serde(default)]
13811 pub path: Option<Box<Expression>>,
13812 #[serde(default)]
13813 pub expressions: Vec<Expression>,
13814}
13815
13816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13818#[cfg_attr(feature = "bindings", derive(TS))]
13819pub struct JSONBExists {
13820 pub this: Box<Expression>,
13821 #[serde(default)]
13822 pub path: Option<Box<Expression>>,
13823}
13824
13825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13827#[cfg_attr(feature = "bindings", derive(TS))]
13828pub struct JSONCast {
13829 pub this: Box<Expression>,
13830 pub to: DataType,
13831}
13832
13833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13835#[cfg_attr(feature = "bindings", derive(TS))]
13836pub struct JSONExtract {
13837 pub this: Box<Expression>,
13838 pub expression: Box<Expression>,
13839 #[serde(default)]
13840 pub only_json_types: Option<Box<Expression>>,
13841 #[serde(default)]
13842 pub expressions: Vec<Expression>,
13843 #[serde(default)]
13844 pub variant_extract: Option<Box<Expression>>,
13845 #[serde(default)]
13846 pub json_query: Option<Box<Expression>>,
13847 #[serde(default)]
13848 pub option: Option<Box<Expression>>,
13849 #[serde(default)]
13850 pub quote: Option<Box<Expression>>,
13851 #[serde(default)]
13852 pub on_condition: Option<Box<Expression>>,
13853 #[serde(default)]
13854 pub requires_json: Option<Box<Expression>>,
13855}
13856
13857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13859#[cfg_attr(feature = "bindings", derive(TS))]
13860pub struct JSONExtractQuote {
13861 #[serde(default)]
13862 pub option: Option<Box<Expression>>,
13863 #[serde(default)]
13864 pub scalar: Option<Box<Expression>>,
13865}
13866
13867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13869#[cfg_attr(feature = "bindings", derive(TS))]
13870pub struct JSONExtractArray {
13871 pub this: Box<Expression>,
13872 #[serde(default)]
13873 pub expression: Option<Box<Expression>>,
13874}
13875
13876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13878#[cfg_attr(feature = "bindings", derive(TS))]
13879pub struct JSONExtractScalar {
13880 pub this: Box<Expression>,
13881 pub expression: Box<Expression>,
13882 #[serde(default)]
13883 pub only_json_types: Option<Box<Expression>>,
13884 #[serde(default)]
13885 pub expressions: Vec<Expression>,
13886 #[serde(default)]
13887 pub json_type: Option<Box<Expression>>,
13888 #[serde(default)]
13889 pub scalar_only: Option<Box<Expression>>,
13890}
13891
13892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13894#[cfg_attr(feature = "bindings", derive(TS))]
13895pub struct JSONBExtractScalar {
13896 pub this: Box<Expression>,
13897 pub expression: Box<Expression>,
13898 #[serde(default)]
13899 pub json_type: Option<Box<Expression>>,
13900}
13901
13902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13904#[cfg_attr(feature = "bindings", derive(TS))]
13905pub struct JSONFormat {
13906 #[serde(default)]
13907 pub this: Option<Box<Expression>>,
13908 #[serde(default)]
13909 pub options: Vec<Expression>,
13910 #[serde(default)]
13911 pub is_json: Option<Box<Expression>>,
13912 #[serde(default)]
13913 pub to_json: Option<Box<Expression>>,
13914}
13915
13916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13918#[cfg_attr(feature = "bindings", derive(TS))]
13919pub struct JSONArrayAppend {
13920 pub this: Box<Expression>,
13921 #[serde(default)]
13922 pub expressions: Vec<Expression>,
13923}
13924
13925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13927#[cfg_attr(feature = "bindings", derive(TS))]
13928pub struct JSONArrayContains {
13929 pub this: Box<Expression>,
13930 pub expression: Box<Expression>,
13931 #[serde(default)]
13932 pub json_type: Option<Box<Expression>>,
13933}
13934
13935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13937#[cfg_attr(feature = "bindings", derive(TS))]
13938pub struct JSONArrayInsert {
13939 pub this: Box<Expression>,
13940 #[serde(default)]
13941 pub expressions: Vec<Expression>,
13942}
13943
13944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13946#[cfg_attr(feature = "bindings", derive(TS))]
13947pub struct ParseJSON {
13948 pub this: Box<Expression>,
13949 #[serde(default)]
13950 pub expression: Option<Box<Expression>>,
13951 #[serde(default)]
13952 pub safe: Option<Box<Expression>>,
13953}
13954
13955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13957#[cfg_attr(feature = "bindings", derive(TS))]
13958pub struct ParseUrl {
13959 pub this: Box<Expression>,
13960 #[serde(default)]
13961 pub part_to_extract: Option<Box<Expression>>,
13962 #[serde(default)]
13963 pub key: Option<Box<Expression>>,
13964 #[serde(default)]
13965 pub permissive: Option<Box<Expression>>,
13966}
13967
13968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13970#[cfg_attr(feature = "bindings", derive(TS))]
13971pub struct ParseIp {
13972 pub this: Box<Expression>,
13973 #[serde(default)]
13974 pub type_: Option<Box<Expression>>,
13975 #[serde(default)]
13976 pub permissive: Option<Box<Expression>>,
13977}
13978
13979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13981#[cfg_attr(feature = "bindings", derive(TS))]
13982pub struct ParseTime {
13983 pub this: Box<Expression>,
13984 pub format: String,
13985}
13986
13987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13989#[cfg_attr(feature = "bindings", derive(TS))]
13990pub struct ParseDatetime {
13991 pub this: Box<Expression>,
13992 #[serde(default)]
13993 pub format: Option<String>,
13994 #[serde(default)]
13995 pub zone: Option<Box<Expression>>,
13996}
13997
13998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14000#[cfg_attr(feature = "bindings", derive(TS))]
14001pub struct Map {
14002 #[serde(default)]
14003 pub keys: Vec<Expression>,
14004 #[serde(default)]
14005 pub values: Vec<Expression>,
14006}
14007
14008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14010#[cfg_attr(feature = "bindings", derive(TS))]
14011pub struct MapCat {
14012 pub this: Box<Expression>,
14013 pub expression: Box<Expression>,
14014}
14015
14016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14018#[cfg_attr(feature = "bindings", derive(TS))]
14019pub struct MapDelete {
14020 pub this: Box<Expression>,
14021 #[serde(default)]
14022 pub expressions: Vec<Expression>,
14023}
14024
14025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14027#[cfg_attr(feature = "bindings", derive(TS))]
14028pub struct MapInsert {
14029 pub this: Box<Expression>,
14030 #[serde(default)]
14031 pub key: Option<Box<Expression>>,
14032 #[serde(default)]
14033 pub value: Option<Box<Expression>>,
14034 #[serde(default)]
14035 pub update_flag: Option<Box<Expression>>,
14036}
14037
14038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14040#[cfg_attr(feature = "bindings", derive(TS))]
14041pub struct MapPick {
14042 pub this: Box<Expression>,
14043 #[serde(default)]
14044 pub expressions: Vec<Expression>,
14045}
14046
14047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14049#[cfg_attr(feature = "bindings", derive(TS))]
14050pub struct ScopeResolution {
14051 #[serde(default)]
14052 pub this: Option<Box<Expression>>,
14053 pub expression: Box<Expression>,
14054}
14055
14056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14058#[cfg_attr(feature = "bindings", derive(TS))]
14059pub struct Slice {
14060 #[serde(default)]
14061 pub this: Option<Box<Expression>>,
14062 #[serde(default)]
14063 pub expression: Option<Box<Expression>>,
14064 #[serde(default)]
14065 pub step: Option<Box<Expression>>,
14066}
14067
14068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14070#[cfg_attr(feature = "bindings", derive(TS))]
14071pub struct VarMap {
14072 #[serde(default)]
14073 pub keys: Vec<Expression>,
14074 #[serde(default)]
14075 pub values: Vec<Expression>,
14076}
14077
14078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14080#[cfg_attr(feature = "bindings", derive(TS))]
14081pub struct MatchAgainst {
14082 pub this: Box<Expression>,
14083 #[serde(default)]
14084 pub expressions: Vec<Expression>,
14085 #[serde(default)]
14086 pub modifier: Option<Box<Expression>>,
14087}
14088
14089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14091#[cfg_attr(feature = "bindings", derive(TS))]
14092pub struct MD5Digest {
14093 pub this: Box<Expression>,
14094 #[serde(default)]
14095 pub expressions: Vec<Expression>,
14096}
14097
14098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14100#[cfg_attr(feature = "bindings", derive(TS))]
14101pub struct Monthname {
14102 pub this: Box<Expression>,
14103 #[serde(default)]
14104 pub abbreviated: Option<Box<Expression>>,
14105}
14106
14107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14109#[cfg_attr(feature = "bindings", derive(TS))]
14110pub struct Ntile {
14111 #[serde(default)]
14112 pub this: Option<Box<Expression>>,
14113}
14114
14115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14117#[cfg_attr(feature = "bindings", derive(TS))]
14118pub struct Normalize {
14119 pub this: Box<Expression>,
14120 #[serde(default)]
14121 pub form: Option<Box<Expression>>,
14122 #[serde(default)]
14123 pub is_casefold: Option<Box<Expression>>,
14124}
14125
14126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14128#[cfg_attr(feature = "bindings", derive(TS))]
14129pub struct Normal {
14130 pub this: Box<Expression>,
14131 #[serde(default)]
14132 pub stddev: Option<Box<Expression>>,
14133 #[serde(default)]
14134 pub gen: Option<Box<Expression>>,
14135}
14136
14137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14139#[cfg_attr(feature = "bindings", derive(TS))]
14140pub struct Predict {
14141 pub this: Box<Expression>,
14142 pub expression: Box<Expression>,
14143 #[serde(default)]
14144 pub params_struct: Option<Box<Expression>>,
14145}
14146
14147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14149#[cfg_attr(feature = "bindings", derive(TS))]
14150pub struct MLTranslate {
14151 pub this: Box<Expression>,
14152 pub expression: Box<Expression>,
14153 #[serde(default)]
14154 pub params_struct: Option<Box<Expression>>,
14155}
14156
14157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14159#[cfg_attr(feature = "bindings", derive(TS))]
14160pub struct FeaturesAtTime {
14161 pub this: Box<Expression>,
14162 #[serde(default)]
14163 pub time: Option<Box<Expression>>,
14164 #[serde(default)]
14165 pub num_rows: Option<Box<Expression>>,
14166 #[serde(default)]
14167 pub ignore_feature_nulls: Option<Box<Expression>>,
14168}
14169
14170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14172#[cfg_attr(feature = "bindings", derive(TS))]
14173pub struct GenerateEmbedding {
14174 pub this: Box<Expression>,
14175 pub expression: Box<Expression>,
14176 #[serde(default)]
14177 pub params_struct: Option<Box<Expression>>,
14178 #[serde(default)]
14179 pub is_text: Option<Box<Expression>>,
14180}
14181
14182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14184#[cfg_attr(feature = "bindings", derive(TS))]
14185pub struct MLForecast {
14186 pub this: Box<Expression>,
14187 #[serde(default)]
14188 pub expression: Option<Box<Expression>>,
14189 #[serde(default)]
14190 pub params_struct: Option<Box<Expression>>,
14191}
14192
14193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14195#[cfg_attr(feature = "bindings", derive(TS))]
14196pub struct ModelAttribute {
14197 pub this: Box<Expression>,
14198 pub expression: Box<Expression>,
14199}
14200
14201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14203#[cfg_attr(feature = "bindings", derive(TS))]
14204pub struct VectorSearch {
14205 pub this: Box<Expression>,
14206 #[serde(default)]
14207 pub column_to_search: Option<Box<Expression>>,
14208 #[serde(default)]
14209 pub query_table: Option<Box<Expression>>,
14210 #[serde(default)]
14211 pub query_column_to_search: Option<Box<Expression>>,
14212 #[serde(default)]
14213 pub top_k: Option<Box<Expression>>,
14214 #[serde(default)]
14215 pub distance_type: Option<Box<Expression>>,
14216 #[serde(default)]
14217 pub options: Vec<Expression>,
14218}
14219
14220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14222#[cfg_attr(feature = "bindings", derive(TS))]
14223pub struct Quantile {
14224 pub this: Box<Expression>,
14225 #[serde(default)]
14226 pub quantile: Option<Box<Expression>>,
14227}
14228
14229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14231#[cfg_attr(feature = "bindings", derive(TS))]
14232pub struct ApproxQuantile {
14233 pub this: Box<Expression>,
14234 #[serde(default)]
14235 pub quantile: Option<Box<Expression>>,
14236 #[serde(default)]
14237 pub accuracy: Option<Box<Expression>>,
14238 #[serde(default)]
14239 pub weight: Option<Box<Expression>>,
14240 #[serde(default)]
14241 pub error_tolerance: Option<Box<Expression>>,
14242}
14243
14244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14246#[cfg_attr(feature = "bindings", derive(TS))]
14247pub struct ApproxPercentileEstimate {
14248 pub this: Box<Expression>,
14249 #[serde(default)]
14250 pub percentile: Option<Box<Expression>>,
14251}
14252
14253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14255#[cfg_attr(feature = "bindings", derive(TS))]
14256pub struct Randn {
14257 #[serde(default)]
14258 pub this: Option<Box<Expression>>,
14259}
14260
14261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14263#[cfg_attr(feature = "bindings", derive(TS))]
14264pub struct Randstr {
14265 pub this: Box<Expression>,
14266 #[serde(default)]
14267 pub generator: Option<Box<Expression>>,
14268}
14269
14270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14272#[cfg_attr(feature = "bindings", derive(TS))]
14273pub struct RangeN {
14274 pub this: Box<Expression>,
14275 #[serde(default)]
14276 pub expressions: Vec<Expression>,
14277 #[serde(default)]
14278 pub each: Option<Box<Expression>>,
14279}
14280
14281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14283#[cfg_attr(feature = "bindings", derive(TS))]
14284pub struct RangeBucket {
14285 pub this: Box<Expression>,
14286 pub expression: Box<Expression>,
14287}
14288
14289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14291#[cfg_attr(feature = "bindings", derive(TS))]
14292pub struct ReadCSV {
14293 pub this: Box<Expression>,
14294 #[serde(default)]
14295 pub expressions: Vec<Expression>,
14296}
14297
14298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14300#[cfg_attr(feature = "bindings", derive(TS))]
14301pub struct ReadParquet {
14302 #[serde(default)]
14303 pub expressions: Vec<Expression>,
14304}
14305
14306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14308#[cfg_attr(feature = "bindings", derive(TS))]
14309pub struct Reduce {
14310 pub this: Box<Expression>,
14311 #[serde(default)]
14312 pub initial: Option<Box<Expression>>,
14313 #[serde(default)]
14314 pub merge: Option<Box<Expression>>,
14315 #[serde(default)]
14316 pub finish: Option<Box<Expression>>,
14317}
14318
14319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14321#[cfg_attr(feature = "bindings", derive(TS))]
14322pub struct RegexpExtractAll {
14323 pub this: Box<Expression>,
14324 pub expression: Box<Expression>,
14325 #[serde(default)]
14326 pub group: Option<Box<Expression>>,
14327 #[serde(default)]
14328 pub parameters: Option<Box<Expression>>,
14329 #[serde(default)]
14330 pub position: Option<Box<Expression>>,
14331 #[serde(default)]
14332 pub occurrence: Option<Box<Expression>>,
14333}
14334
14335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14337#[cfg_attr(feature = "bindings", derive(TS))]
14338pub struct RegexpILike {
14339 pub this: Box<Expression>,
14340 pub expression: Box<Expression>,
14341 #[serde(default)]
14342 pub flag: Option<Box<Expression>>,
14343}
14344
14345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14347#[cfg_attr(feature = "bindings", derive(TS))]
14348pub struct RegexpFullMatch {
14349 pub this: Box<Expression>,
14350 pub expression: Box<Expression>,
14351 #[serde(default)]
14352 pub options: Vec<Expression>,
14353}
14354
14355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14357#[cfg_attr(feature = "bindings", derive(TS))]
14358pub struct RegexpInstr {
14359 pub this: Box<Expression>,
14360 pub expression: Box<Expression>,
14361 #[serde(default)]
14362 pub position: Option<Box<Expression>>,
14363 #[serde(default)]
14364 pub occurrence: Option<Box<Expression>>,
14365 #[serde(default)]
14366 pub option: Option<Box<Expression>>,
14367 #[serde(default)]
14368 pub parameters: Option<Box<Expression>>,
14369 #[serde(default)]
14370 pub group: Option<Box<Expression>>,
14371}
14372
14373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14375#[cfg_attr(feature = "bindings", derive(TS))]
14376pub struct RegexpSplit {
14377 pub this: Box<Expression>,
14378 pub expression: Box<Expression>,
14379 #[serde(default)]
14380 pub limit: Option<Box<Expression>>,
14381}
14382
14383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14385#[cfg_attr(feature = "bindings", derive(TS))]
14386pub struct RegexpCount {
14387 pub this: Box<Expression>,
14388 pub expression: Box<Expression>,
14389 #[serde(default)]
14390 pub position: Option<Box<Expression>>,
14391 #[serde(default)]
14392 pub parameters: Option<Box<Expression>>,
14393}
14394
14395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14397#[cfg_attr(feature = "bindings", derive(TS))]
14398pub struct RegrValx {
14399 pub this: Box<Expression>,
14400 pub expression: Box<Expression>,
14401}
14402
14403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14405#[cfg_attr(feature = "bindings", derive(TS))]
14406pub struct RegrValy {
14407 pub this: Box<Expression>,
14408 pub expression: Box<Expression>,
14409}
14410
14411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14413#[cfg_attr(feature = "bindings", derive(TS))]
14414pub struct RegrAvgy {
14415 pub this: Box<Expression>,
14416 pub expression: Box<Expression>,
14417}
14418
14419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14421#[cfg_attr(feature = "bindings", derive(TS))]
14422pub struct RegrAvgx {
14423 pub this: Box<Expression>,
14424 pub expression: Box<Expression>,
14425}
14426
14427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14429#[cfg_attr(feature = "bindings", derive(TS))]
14430pub struct RegrCount {
14431 pub this: Box<Expression>,
14432 pub expression: Box<Expression>,
14433}
14434
14435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14437#[cfg_attr(feature = "bindings", derive(TS))]
14438pub struct RegrIntercept {
14439 pub this: Box<Expression>,
14440 pub expression: Box<Expression>,
14441}
14442
14443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14445#[cfg_attr(feature = "bindings", derive(TS))]
14446pub struct RegrR2 {
14447 pub this: Box<Expression>,
14448 pub expression: Box<Expression>,
14449}
14450
14451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14453#[cfg_attr(feature = "bindings", derive(TS))]
14454pub struct RegrSxx {
14455 pub this: Box<Expression>,
14456 pub expression: Box<Expression>,
14457}
14458
14459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14461#[cfg_attr(feature = "bindings", derive(TS))]
14462pub struct RegrSxy {
14463 pub this: Box<Expression>,
14464 pub expression: Box<Expression>,
14465}
14466
14467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14469#[cfg_attr(feature = "bindings", derive(TS))]
14470pub struct RegrSyy {
14471 pub this: Box<Expression>,
14472 pub expression: Box<Expression>,
14473}
14474
14475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14477#[cfg_attr(feature = "bindings", derive(TS))]
14478pub struct RegrSlope {
14479 pub this: Box<Expression>,
14480 pub expression: Box<Expression>,
14481}
14482
14483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14485#[cfg_attr(feature = "bindings", derive(TS))]
14486pub struct SafeAdd {
14487 pub this: Box<Expression>,
14488 pub expression: Box<Expression>,
14489}
14490
14491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14493#[cfg_attr(feature = "bindings", derive(TS))]
14494pub struct SafeDivide {
14495 pub this: Box<Expression>,
14496 pub expression: Box<Expression>,
14497}
14498
14499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14501#[cfg_attr(feature = "bindings", derive(TS))]
14502pub struct SafeMultiply {
14503 pub this: Box<Expression>,
14504 pub expression: Box<Expression>,
14505}
14506
14507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14509#[cfg_attr(feature = "bindings", derive(TS))]
14510pub struct SafeSubtract {
14511 pub this: Box<Expression>,
14512 pub expression: Box<Expression>,
14513}
14514
14515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14517#[cfg_attr(feature = "bindings", derive(TS))]
14518pub struct SHA2 {
14519 pub this: Box<Expression>,
14520 #[serde(default)]
14521 pub length: Option<i64>,
14522}
14523
14524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14526#[cfg_attr(feature = "bindings", derive(TS))]
14527pub struct SHA2Digest {
14528 pub this: Box<Expression>,
14529 #[serde(default)]
14530 pub length: Option<i64>,
14531}
14532
14533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14535#[cfg_attr(feature = "bindings", derive(TS))]
14536pub struct SortArray {
14537 pub this: Box<Expression>,
14538 #[serde(default)]
14539 pub asc: Option<Box<Expression>>,
14540 #[serde(default)]
14541 pub nulls_first: Option<Box<Expression>>,
14542}
14543
14544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14546#[cfg_attr(feature = "bindings", derive(TS))]
14547pub struct SplitPart {
14548 pub this: Box<Expression>,
14549 #[serde(default)]
14550 pub delimiter: Option<Box<Expression>>,
14551 #[serde(default)]
14552 pub part_index: Option<Box<Expression>>,
14553}
14554
14555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14557#[cfg_attr(feature = "bindings", derive(TS))]
14558pub struct SubstringIndex {
14559 pub this: Box<Expression>,
14560 #[serde(default)]
14561 pub delimiter: Option<Box<Expression>>,
14562 #[serde(default)]
14563 pub count: Option<Box<Expression>>,
14564}
14565
14566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14568#[cfg_attr(feature = "bindings", derive(TS))]
14569pub struct StandardHash {
14570 pub this: Box<Expression>,
14571 #[serde(default)]
14572 pub expression: Option<Box<Expression>>,
14573}
14574
14575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14577#[cfg_attr(feature = "bindings", derive(TS))]
14578pub struct StrPosition {
14579 pub this: Box<Expression>,
14580 #[serde(default)]
14581 pub substr: Option<Box<Expression>>,
14582 #[serde(default)]
14583 pub position: Option<Box<Expression>>,
14584 #[serde(default)]
14585 pub occurrence: Option<Box<Expression>>,
14586}
14587
14588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14590#[cfg_attr(feature = "bindings", derive(TS))]
14591pub struct Search {
14592 pub this: Box<Expression>,
14593 pub expression: Box<Expression>,
14594 #[serde(default)]
14595 pub json_scope: Option<Box<Expression>>,
14596 #[serde(default)]
14597 pub analyzer: Option<Box<Expression>>,
14598 #[serde(default)]
14599 pub analyzer_options: Option<Box<Expression>>,
14600 #[serde(default)]
14601 pub search_mode: Option<Box<Expression>>,
14602}
14603
14604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14606#[cfg_attr(feature = "bindings", derive(TS))]
14607pub struct SearchIp {
14608 pub this: Box<Expression>,
14609 pub expression: Box<Expression>,
14610}
14611
14612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14614#[cfg_attr(feature = "bindings", derive(TS))]
14615pub struct StrToDate {
14616 pub this: Box<Expression>,
14617 #[serde(default)]
14618 pub format: Option<String>,
14619 #[serde(default)]
14620 pub safe: Option<Box<Expression>>,
14621}
14622
14623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14625#[cfg_attr(feature = "bindings", derive(TS))]
14626pub struct StrToTime {
14627 pub this: Box<Expression>,
14628 pub format: String,
14629 #[serde(default)]
14630 pub zone: Option<Box<Expression>>,
14631 #[serde(default)]
14632 pub safe: Option<Box<Expression>>,
14633 #[serde(default)]
14634 pub target_type: Option<Box<Expression>>,
14635}
14636
14637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14639#[cfg_attr(feature = "bindings", derive(TS))]
14640pub struct StrToUnix {
14641 #[serde(default)]
14642 pub this: Option<Box<Expression>>,
14643 #[serde(default)]
14644 pub format: Option<String>,
14645}
14646
14647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14649#[cfg_attr(feature = "bindings", derive(TS))]
14650pub struct StrToMap {
14651 pub this: Box<Expression>,
14652 #[serde(default)]
14653 pub pair_delim: Option<Box<Expression>>,
14654 #[serde(default)]
14655 pub key_value_delim: Option<Box<Expression>>,
14656 #[serde(default)]
14657 pub duplicate_resolution_callback: Option<Box<Expression>>,
14658}
14659
14660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14662#[cfg_attr(feature = "bindings", derive(TS))]
14663pub struct NumberToStr {
14664 pub this: Box<Expression>,
14665 pub format: String,
14666 #[serde(default)]
14667 pub culture: Option<Box<Expression>>,
14668}
14669
14670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14672#[cfg_attr(feature = "bindings", derive(TS))]
14673pub struct FromBase {
14674 pub this: Box<Expression>,
14675 pub expression: Box<Expression>,
14676}
14677
14678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14680#[cfg_attr(feature = "bindings", derive(TS))]
14681pub struct Stuff {
14682 pub this: Box<Expression>,
14683 #[serde(default)]
14684 pub start: Option<Box<Expression>>,
14685 #[serde(default)]
14686 pub length: Option<i64>,
14687 pub expression: Box<Expression>,
14688}
14689
14690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14692#[cfg_attr(feature = "bindings", derive(TS))]
14693pub struct TimeToStr {
14694 pub this: Box<Expression>,
14695 pub format: String,
14696 #[serde(default)]
14697 pub culture: Option<Box<Expression>>,
14698 #[serde(default)]
14699 pub zone: Option<Box<Expression>>,
14700}
14701
14702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14704#[cfg_attr(feature = "bindings", derive(TS))]
14705pub struct TimeStrToTime {
14706 pub this: Box<Expression>,
14707 #[serde(default)]
14708 pub zone: Option<Box<Expression>>,
14709}
14710
14711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14713#[cfg_attr(feature = "bindings", derive(TS))]
14714pub struct TsOrDsAdd {
14715 pub this: Box<Expression>,
14716 pub expression: Box<Expression>,
14717 #[serde(default)]
14718 pub unit: Option<String>,
14719 #[serde(default)]
14720 pub return_type: Option<Box<Expression>>,
14721}
14722
14723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14725#[cfg_attr(feature = "bindings", derive(TS))]
14726pub struct TsOrDsDiff {
14727 pub this: Box<Expression>,
14728 pub expression: Box<Expression>,
14729 #[serde(default)]
14730 pub unit: Option<String>,
14731}
14732
14733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14735#[cfg_attr(feature = "bindings", derive(TS))]
14736pub struct TsOrDsToDate {
14737 pub this: Box<Expression>,
14738 #[serde(default)]
14739 pub format: Option<String>,
14740 #[serde(default)]
14741 pub safe: Option<Box<Expression>>,
14742}
14743
14744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14746#[cfg_attr(feature = "bindings", derive(TS))]
14747pub struct TsOrDsToTime {
14748 pub this: Box<Expression>,
14749 #[serde(default)]
14750 pub format: Option<String>,
14751 #[serde(default)]
14752 pub safe: Option<Box<Expression>>,
14753}
14754
14755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14757#[cfg_attr(feature = "bindings", derive(TS))]
14758pub struct Unhex {
14759 pub this: Box<Expression>,
14760 #[serde(default)]
14761 pub expression: Option<Box<Expression>>,
14762}
14763
14764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14766#[cfg_attr(feature = "bindings", derive(TS))]
14767pub struct Uniform {
14768 pub this: Box<Expression>,
14769 pub expression: Box<Expression>,
14770 #[serde(default)]
14771 pub gen: Option<Box<Expression>>,
14772 #[serde(default)]
14773 pub seed: Option<Box<Expression>>,
14774}
14775
14776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14778#[cfg_attr(feature = "bindings", derive(TS))]
14779pub struct UnixToStr {
14780 pub this: Box<Expression>,
14781 #[serde(default)]
14782 pub format: Option<String>,
14783}
14784
14785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14787#[cfg_attr(feature = "bindings", derive(TS))]
14788pub struct UnixToTime {
14789 pub this: Box<Expression>,
14790 #[serde(default)]
14791 pub scale: Option<i64>,
14792 #[serde(default)]
14793 pub zone: Option<Box<Expression>>,
14794 #[serde(default)]
14795 pub hours: Option<Box<Expression>>,
14796 #[serde(default)]
14797 pub minutes: Option<Box<Expression>>,
14798 #[serde(default)]
14799 pub format: Option<String>,
14800 #[serde(default)]
14801 pub target_type: Option<Box<Expression>>,
14802}
14803
14804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14806#[cfg_attr(feature = "bindings", derive(TS))]
14807pub struct Uuid {
14808 #[serde(default)]
14809 pub this: Option<Box<Expression>>,
14810 #[serde(default)]
14811 pub name: Option<String>,
14812 #[serde(default)]
14813 pub is_string: Option<Box<Expression>>,
14814}
14815
14816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14818#[cfg_attr(feature = "bindings", derive(TS))]
14819pub struct TimestampFromParts {
14820 #[serde(default)]
14821 pub zone: Option<Box<Expression>>,
14822 #[serde(default)]
14823 pub milli: Option<Box<Expression>>,
14824 #[serde(default)]
14825 pub this: Option<Box<Expression>>,
14826 #[serde(default)]
14827 pub expression: Option<Box<Expression>>,
14828}
14829
14830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14832#[cfg_attr(feature = "bindings", derive(TS))]
14833pub struct TimestampTzFromParts {
14834 #[serde(default)]
14835 pub zone: Option<Box<Expression>>,
14836}
14837
14838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14840#[cfg_attr(feature = "bindings", derive(TS))]
14841pub struct Corr {
14842 pub this: Box<Expression>,
14843 pub expression: Box<Expression>,
14844 #[serde(default)]
14845 pub null_on_zero_variance: Option<Box<Expression>>,
14846}
14847
14848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14850#[cfg_attr(feature = "bindings", derive(TS))]
14851pub struct WidthBucket {
14852 pub this: Box<Expression>,
14853 #[serde(default)]
14854 pub min_value: Option<Box<Expression>>,
14855 #[serde(default)]
14856 pub max_value: Option<Box<Expression>>,
14857 #[serde(default)]
14858 pub num_buckets: Option<Box<Expression>>,
14859 #[serde(default)]
14860 pub threshold: Option<Box<Expression>>,
14861}
14862
14863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14865#[cfg_attr(feature = "bindings", derive(TS))]
14866pub struct CovarSamp {
14867 pub this: Box<Expression>,
14868 pub expression: Box<Expression>,
14869}
14870
14871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14873#[cfg_attr(feature = "bindings", derive(TS))]
14874pub struct CovarPop {
14875 pub this: Box<Expression>,
14876 pub expression: Box<Expression>,
14877}
14878
14879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14881#[cfg_attr(feature = "bindings", derive(TS))]
14882pub struct Week {
14883 pub this: Box<Expression>,
14884 #[serde(default)]
14885 pub mode: Option<Box<Expression>>,
14886}
14887
14888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14890#[cfg_attr(feature = "bindings", derive(TS))]
14891pub struct XMLElement {
14892 pub this: Box<Expression>,
14893 #[serde(default)]
14894 pub expressions: Vec<Expression>,
14895 #[serde(default)]
14896 pub evalname: Option<Box<Expression>>,
14897}
14898
14899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14901#[cfg_attr(feature = "bindings", derive(TS))]
14902pub struct XMLGet {
14903 pub this: Box<Expression>,
14904 pub expression: Box<Expression>,
14905 #[serde(default)]
14906 pub instance: Option<Box<Expression>>,
14907}
14908
14909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14911#[cfg_attr(feature = "bindings", derive(TS))]
14912pub struct XMLTable {
14913 pub this: Box<Expression>,
14914 #[serde(default)]
14915 pub namespaces: Option<Box<Expression>>,
14916 #[serde(default)]
14917 pub passing: Option<Box<Expression>>,
14918 #[serde(default)]
14919 pub columns: Vec<Expression>,
14920 #[serde(default)]
14921 pub by_ref: Option<Box<Expression>>,
14922}
14923
14924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14926#[cfg_attr(feature = "bindings", derive(TS))]
14927pub struct XMLKeyValueOption {
14928 pub this: Box<Expression>,
14929 #[serde(default)]
14930 pub expression: Option<Box<Expression>>,
14931}
14932
14933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14935#[cfg_attr(feature = "bindings", derive(TS))]
14936pub struct Zipf {
14937 pub this: Box<Expression>,
14938 #[serde(default)]
14939 pub elementcount: Option<Box<Expression>>,
14940 #[serde(default)]
14941 pub gen: Option<Box<Expression>>,
14942}
14943
14944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14946#[cfg_attr(feature = "bindings", derive(TS))]
14947pub struct Merge {
14948 pub this: Box<Expression>,
14949 pub using: Box<Expression>,
14950 #[serde(default)]
14951 pub on: Option<Box<Expression>>,
14952 #[serde(default)]
14953 pub using_cond: Option<Box<Expression>>,
14954 #[serde(default)]
14955 pub whens: Option<Box<Expression>>,
14956 #[serde(default)]
14957 pub with_: Option<Box<Expression>>,
14958 #[serde(default)]
14959 pub returning: Option<Box<Expression>>,
14960}
14961
14962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14964#[cfg_attr(feature = "bindings", derive(TS))]
14965pub struct When {
14966 #[serde(default)]
14967 pub matched: Option<Box<Expression>>,
14968 #[serde(default)]
14969 pub source: Option<Box<Expression>>,
14970 #[serde(default)]
14971 pub condition: Option<Box<Expression>>,
14972 pub then: Box<Expression>,
14973}
14974
14975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14977#[cfg_attr(feature = "bindings", derive(TS))]
14978pub struct Whens {
14979 #[serde(default)]
14980 pub expressions: Vec<Expression>,
14981}
14982
14983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14985#[cfg_attr(feature = "bindings", derive(TS))]
14986pub struct NextValueFor {
14987 pub this: Box<Expression>,
14988 #[serde(default)]
14989 pub order: Option<Box<Expression>>,
14990}
14991
14992#[cfg(test)]
14993mod tests {
14994 use super::*;
14995
14996 #[test]
14997 #[cfg(feature = "bindings")]
14998 fn export_typescript_types() {
14999 Expression::export_all(&ts_rs::Config::default())
15002 .expect("Failed to export Expression types");
15003 }
15004
15005 #[test]
15006 fn test_simple_select_builder() {
15007 let select = Select::new()
15008 .column(Expression::star())
15009 .from(Expression::Table(Box::new(TableRef::new("users"))));
15010
15011 assert_eq!(select.expressions.len(), 1);
15012 assert!(select.from.is_some());
15013 }
15014
15015 #[test]
15016 fn test_expression_alias() {
15017 let expr = Expression::column("id").alias("user_id");
15018
15019 match expr {
15020 Expression::Alias(a) => {
15021 assert_eq!(a.alias.name, "user_id");
15022 }
15023 _ => panic!("Expected Alias"),
15024 }
15025 }
15026
15027 #[test]
15028 fn test_literal_creation() {
15029 let num = Expression::number(42);
15030 let str = Expression::string("hello");
15031
15032 match num {
15033 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
15034 let Literal::Number(n) = lit.as_ref() else {
15035 unreachable!()
15036 };
15037 assert_eq!(n, "42")
15038 }
15039 _ => panic!("Expected Number"),
15040 }
15041
15042 match str {
15043 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
15044 let Literal::String(s) = lit.as_ref() else {
15045 unreachable!()
15046 };
15047 assert_eq!(s, "hello")
15048 }
15049 _ => panic!("Expected String"),
15050 }
15051 }
15052
15053 #[test]
15054 fn test_expression_sql() {
15055 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
15056 assert_eq!(expr.sql(), "SELECT 1 + 2");
15057 }
15058
15059 #[test]
15060 fn test_expression_sql_for() {
15061 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
15062 let sql = expr.sql_for(crate::DialectType::Generic);
15063 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15065 }
15066}