1use crate::tokens::Span;
34use serde::{Deserialize, Serialize};
35use std::fmt;
36#[cfg(feature = "bindings")]
37use ts_rs::TS;
38
39fn default_true() -> bool {
41 true
42}
43
44fn is_true(v: &bool) -> bool {
45 *v
46}
47
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[cfg_attr(feature = "bindings", derive(TS))]
78#[serde(rename_all = "snake_case")]
79#[cfg_attr(feature = "bindings", ts(export))]
80pub enum Expression {
81 Literal(Box<Literal>),
83 Boolean(BooleanLiteral),
84 Null(Null),
85
86 Identifier(Identifier),
88 Column(Box<Column>),
89 Table(Box<TableRef>),
90 Star(Star),
91 BracedWildcard(Box<Expression>),
93
94 Select(Box<Select>),
96 Union(Box<Union>),
97 Intersect(Box<Intersect>),
98 Except(Box<Except>),
99 Subquery(Box<Subquery>),
100 PipeOperator(Box<PipeOperator>),
101 Pivot(Box<Pivot>),
102 PivotAlias(Box<PivotAlias>),
103 Unpivot(Box<Unpivot>),
104 Values(Box<Values>),
105 PreWhere(Box<PreWhere>),
106 Stream(Box<Stream>),
107 UsingData(Box<UsingData>),
108 XmlNamespace(Box<XmlNamespace>),
109
110 Insert(Box<Insert>),
112 Update(Box<Update>),
113 Delete(Box<Delete>),
114 Copy(Box<CopyStmt>),
115 Put(Box<PutStmt>),
116 StageReference(Box<StageReference>),
117
118 Alias(Box<Alias>),
120 Cast(Box<Cast>),
121 Collation(Box<CollationExpr>),
122 Case(Box<Case>),
123
124 And(Box<BinaryOp>),
126 Or(Box<BinaryOp>),
127 Add(Box<BinaryOp>),
128 Sub(Box<BinaryOp>),
129 Mul(Box<BinaryOp>),
130 Div(Box<BinaryOp>),
131 Mod(Box<BinaryOp>),
132 Eq(Box<BinaryOp>),
133 Neq(Box<BinaryOp>),
134 Lt(Box<BinaryOp>),
135 Lte(Box<BinaryOp>),
136 Gt(Box<BinaryOp>),
137 Gte(Box<BinaryOp>),
138 Like(Box<LikeOp>),
139 ILike(Box<LikeOp>),
140 Match(Box<BinaryOp>),
142 BitwiseAnd(Box<BinaryOp>),
143 BitwiseOr(Box<BinaryOp>),
144 BitwiseXor(Box<BinaryOp>),
145 Concat(Box<BinaryOp>),
146 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
162 Neg(Box<UnaryOp>),
163 BitwiseNot(Box<UnaryOp>),
164
165 In(Box<In>),
167 Between(Box<Between>),
168 IsNull(Box<IsNull>),
169 IsTrue(Box<IsTrueFalse>),
170 IsFalse(Box<IsTrueFalse>),
171 IsJson(Box<IsJson>),
172 Is(Box<BinaryOp>), Exists(Box<Exists>),
174 MemberOf(Box<BinaryOp>),
176
177 Function(Box<Function>),
179 AggregateFunction(Box<AggregateFunction>),
180 WindowFunction(Box<WindowFunction>),
181
182 From(Box<From>),
184 Join(Box<Join>),
185 JoinedTable(Box<JoinedTable>),
186 Where(Box<Where>),
187 GroupBy(Box<GroupBy>),
188 Having(Box<Having>),
189 OrderBy(Box<OrderBy>),
190 Limit(Box<Limit>),
191 Offset(Box<Offset>),
192 Qualify(Box<Qualify>),
193 With(Box<With>),
194 Cte(Box<Cte>),
195 DistributeBy(Box<DistributeBy>),
196 ClusterBy(Box<ClusterBy>),
197 SortBy(Box<SortBy>),
198 LateralView(Box<LateralView>),
199 Hint(Box<Hint>),
200 Pseudocolumn(Pseudocolumn),
201
202 Connect(Box<Connect>),
204 Prior(Box<Prior>),
205 ConnectByRoot(Box<ConnectByRoot>),
206
207 MatchRecognize(Box<MatchRecognize>),
209
210 Ordered(Box<Ordered>),
212
213 Window(Box<WindowSpec>),
215 Over(Box<Over>),
216 WithinGroup(Box<WithinGroup>),
217
218 DataType(DataType),
220
221 Array(Box<Array>),
223 Struct(Box<Struct>),
224 Tuple(Box<Tuple>),
225
226 Interval(Box<Interval>),
228
229 ConcatWs(Box<ConcatWs>),
231 Substring(Box<SubstringFunc>),
232 Upper(Box<UnaryFunc>),
233 Lower(Box<UnaryFunc>),
234 Length(Box<UnaryFunc>),
235 Trim(Box<TrimFunc>),
236 LTrim(Box<UnaryFunc>),
237 RTrim(Box<UnaryFunc>),
238 Replace(Box<ReplaceFunc>),
239 Reverse(Box<UnaryFunc>),
240 Left(Box<LeftRightFunc>),
241 Right(Box<LeftRightFunc>),
242 Repeat(Box<RepeatFunc>),
243 Lpad(Box<PadFunc>),
244 Rpad(Box<PadFunc>),
245 Split(Box<SplitFunc>),
246 RegexpLike(Box<RegexpFunc>),
247 RegexpReplace(Box<RegexpReplaceFunc>),
248 RegexpExtract(Box<RegexpExtractFunc>),
249 Overlay(Box<OverlayFunc>),
250
251 Abs(Box<UnaryFunc>),
253 Round(Box<RoundFunc>),
254 Floor(Box<FloorFunc>),
255 Ceil(Box<CeilFunc>),
256 Power(Box<BinaryFunc>),
257 Sqrt(Box<UnaryFunc>),
258 Cbrt(Box<UnaryFunc>),
259 Ln(Box<UnaryFunc>),
260 Log(Box<LogFunc>),
261 Exp(Box<UnaryFunc>),
262 Sign(Box<UnaryFunc>),
263 Greatest(Box<VarArgFunc>),
264 Least(Box<VarArgFunc>),
265
266 CurrentDate(CurrentDate),
268 CurrentTime(CurrentTime),
269 CurrentTimestamp(CurrentTimestamp),
270 CurrentTimestampLTZ(CurrentTimestampLTZ),
271 AtTimeZone(Box<AtTimeZone>),
272 DateAdd(Box<DateAddFunc>),
273 DateSub(Box<DateAddFunc>),
274 DateDiff(Box<DateDiffFunc>),
275 DateTrunc(Box<DateTruncFunc>),
276 Extract(Box<ExtractFunc>),
277 ToDate(Box<ToDateFunc>),
278 ToTimestamp(Box<ToTimestampFunc>),
279 Date(Box<UnaryFunc>),
280 Time(Box<UnaryFunc>),
281 DateFromUnixDate(Box<UnaryFunc>),
282 UnixDate(Box<UnaryFunc>),
283 UnixSeconds(Box<UnaryFunc>),
284 UnixMillis(Box<UnaryFunc>),
285 UnixMicros(Box<UnaryFunc>),
286 UnixToTimeStr(Box<BinaryFunc>),
287 TimeStrToDate(Box<UnaryFunc>),
288 DateToDi(Box<UnaryFunc>),
289 DiToDate(Box<UnaryFunc>),
290 TsOrDiToDi(Box<UnaryFunc>),
291 TsOrDsToDatetime(Box<UnaryFunc>),
292 TsOrDsToTimestamp(Box<UnaryFunc>),
293 YearOfWeek(Box<UnaryFunc>),
294 YearOfWeekIso(Box<UnaryFunc>),
295
296 Coalesce(Box<VarArgFunc>),
298 NullIf(Box<BinaryFunc>),
299 IfFunc(Box<IfFunc>),
300 IfNull(Box<BinaryFunc>),
301 Nvl(Box<BinaryFunc>),
302 Nvl2(Box<Nvl2Func>),
303
304 TryCast(Box<Cast>),
306 SafeCast(Box<Cast>),
307
308 Count(Box<CountFunc>),
310 Sum(Box<AggFunc>),
311 Avg(Box<AggFunc>),
312 Min(Box<AggFunc>),
313 Max(Box<AggFunc>),
314 GroupConcat(Box<GroupConcatFunc>),
315 StringAgg(Box<StringAggFunc>),
316 ListAgg(Box<ListAggFunc>),
317 ArrayAgg(Box<AggFunc>),
318 CountIf(Box<AggFunc>),
319 SumIf(Box<SumIfFunc>),
320 Stddev(Box<AggFunc>),
321 StddevPop(Box<AggFunc>),
322 StddevSamp(Box<AggFunc>),
323 Variance(Box<AggFunc>),
324 VarPop(Box<AggFunc>),
325 VarSamp(Box<AggFunc>),
326 Median(Box<AggFunc>),
327 Mode(Box<AggFunc>),
328 First(Box<AggFunc>),
329 Last(Box<AggFunc>),
330 AnyValue(Box<AggFunc>),
331 ApproxDistinct(Box<AggFunc>),
332 ApproxCountDistinct(Box<AggFunc>),
333 ApproxPercentile(Box<ApproxPercentileFunc>),
334 Percentile(Box<PercentileFunc>),
335 LogicalAnd(Box<AggFunc>),
336 LogicalOr(Box<AggFunc>),
337 Skewness(Box<AggFunc>),
338 BitwiseCount(Box<UnaryFunc>),
339 ArrayConcatAgg(Box<AggFunc>),
340 ArrayUniqueAgg(Box<AggFunc>),
341 BoolXorAgg(Box<AggFunc>),
342
343 RowNumber(RowNumber),
345 Rank(Rank),
346 DenseRank(DenseRank),
347 NTile(Box<NTileFunc>),
348 Lead(Box<LeadLagFunc>),
349 Lag(Box<LeadLagFunc>),
350 FirstValue(Box<ValueFunc>),
351 LastValue(Box<ValueFunc>),
352 NthValue(Box<NthValueFunc>),
353 PercentRank(PercentRank),
354 CumeDist(CumeDist),
355 PercentileCont(Box<PercentileFunc>),
356 PercentileDisc(Box<PercentileFunc>),
357
358 Contains(Box<BinaryFunc>),
360 StartsWith(Box<BinaryFunc>),
361 EndsWith(Box<BinaryFunc>),
362 Position(Box<PositionFunc>),
363 Initcap(Box<UnaryFunc>),
364 Ascii(Box<UnaryFunc>),
365 Chr(Box<UnaryFunc>),
366 CharFunc(Box<CharFunc>),
368 Soundex(Box<UnaryFunc>),
369 Levenshtein(Box<BinaryFunc>),
370 ByteLength(Box<UnaryFunc>),
371 Hex(Box<UnaryFunc>),
372 LowerHex(Box<UnaryFunc>),
373 Unicode(Box<UnaryFunc>),
374
375 ModFunc(Box<BinaryFunc>),
377 Random(Random),
378 Rand(Box<Rand>),
379 TruncFunc(Box<TruncateFunc>),
380 Pi(Pi),
381 Radians(Box<UnaryFunc>),
382 Degrees(Box<UnaryFunc>),
383 Sin(Box<UnaryFunc>),
384 Cos(Box<UnaryFunc>),
385 Tan(Box<UnaryFunc>),
386 Asin(Box<UnaryFunc>),
387 Acos(Box<UnaryFunc>),
388 Atan(Box<UnaryFunc>),
389 Atan2(Box<BinaryFunc>),
390 IsNan(Box<UnaryFunc>),
391 IsInf(Box<UnaryFunc>),
392 IntDiv(Box<BinaryFunc>),
393
394 Decode(Box<DecodeFunc>),
396
397 DateFormat(Box<DateFormatFunc>),
399 FormatDate(Box<DateFormatFunc>),
400 Year(Box<UnaryFunc>),
401 Month(Box<UnaryFunc>),
402 Day(Box<UnaryFunc>),
403 Hour(Box<UnaryFunc>),
404 Minute(Box<UnaryFunc>),
405 Second(Box<UnaryFunc>),
406 DayOfWeek(Box<UnaryFunc>),
407 DayOfWeekIso(Box<UnaryFunc>),
408 DayOfMonth(Box<UnaryFunc>),
409 DayOfYear(Box<UnaryFunc>),
410 WeekOfYear(Box<UnaryFunc>),
411 Quarter(Box<UnaryFunc>),
412 AddMonths(Box<BinaryFunc>),
413 MonthsBetween(Box<BinaryFunc>),
414 LastDay(Box<LastDayFunc>),
415 NextDay(Box<BinaryFunc>),
416 Epoch(Box<UnaryFunc>),
417 EpochMs(Box<UnaryFunc>),
418 FromUnixtime(Box<FromUnixtimeFunc>),
419 UnixTimestamp(Box<UnixTimestampFunc>),
420 MakeDate(Box<MakeDateFunc>),
421 MakeTimestamp(Box<MakeTimestampFunc>),
422 TimestampTrunc(Box<DateTruncFunc>),
423 TimeStrToUnix(Box<UnaryFunc>),
424
425 SessionUser(SessionUser),
427
428 SHA(Box<UnaryFunc>),
430 SHA1Digest(Box<UnaryFunc>),
431
432 TimeToUnix(Box<UnaryFunc>),
434
435 ArrayFunc(Box<ArrayConstructor>),
437 ArrayLength(Box<UnaryFunc>),
438 ArraySize(Box<UnaryFunc>),
439 Cardinality(Box<UnaryFunc>),
440 ArrayContains(Box<BinaryFunc>),
441 ArrayPosition(Box<BinaryFunc>),
442 ArrayAppend(Box<BinaryFunc>),
443 ArrayPrepend(Box<BinaryFunc>),
444 ArrayConcat(Box<VarArgFunc>),
445 ArraySort(Box<ArraySortFunc>),
446 ArrayReverse(Box<UnaryFunc>),
447 ArrayDistinct(Box<UnaryFunc>),
448 ArrayJoin(Box<ArrayJoinFunc>),
449 ArrayToString(Box<ArrayJoinFunc>),
450 Unnest(Box<UnnestFunc>),
451 Explode(Box<UnaryFunc>),
452 ExplodeOuter(Box<UnaryFunc>),
453 ArrayFilter(Box<ArrayFilterFunc>),
454 ArrayTransform(Box<ArrayTransformFunc>),
455 ArrayFlatten(Box<UnaryFunc>),
456 ArrayCompact(Box<UnaryFunc>),
457 ArrayIntersect(Box<VarArgFunc>),
458 ArrayUnion(Box<BinaryFunc>),
459 ArrayExcept(Box<BinaryFunc>),
460 ArrayRemove(Box<BinaryFunc>),
461 ArrayZip(Box<VarArgFunc>),
462 Sequence(Box<SequenceFunc>),
463 Generate(Box<SequenceFunc>),
464 ExplodingGenerateSeries(Box<SequenceFunc>),
465 ToArray(Box<UnaryFunc>),
466 StarMap(Box<BinaryFunc>),
467
468 StructFunc(Box<StructConstructor>),
470 StructExtract(Box<StructExtractFunc>),
471 NamedStruct(Box<NamedStructFunc>),
472
473 MapFunc(Box<MapConstructor>),
475 MapFromEntries(Box<UnaryFunc>),
476 MapFromArrays(Box<BinaryFunc>),
477 MapKeys(Box<UnaryFunc>),
478 MapValues(Box<UnaryFunc>),
479 MapContainsKey(Box<BinaryFunc>),
480 MapConcat(Box<VarArgFunc>),
481 ElementAt(Box<BinaryFunc>),
482 TransformKeys(Box<TransformFunc>),
483 TransformValues(Box<TransformFunc>),
484
485 FunctionEmits(Box<FunctionEmits>),
487
488 JsonExtract(Box<JsonExtractFunc>),
490 JsonExtractScalar(Box<JsonExtractFunc>),
491 JsonExtractPath(Box<JsonPathFunc>),
492 JsonArray(Box<VarArgFunc>),
493 JsonObject(Box<JsonObjectFunc>),
494 JsonQuery(Box<JsonExtractFunc>),
495 JsonValue(Box<JsonExtractFunc>),
496 JsonArrayLength(Box<UnaryFunc>),
497 JsonKeys(Box<UnaryFunc>),
498 JsonType(Box<UnaryFunc>),
499 ParseJson(Box<UnaryFunc>),
500 ToJson(Box<UnaryFunc>),
501 JsonSet(Box<JsonModifyFunc>),
502 JsonInsert(Box<JsonModifyFunc>),
503 JsonRemove(Box<JsonPathFunc>),
504 JsonMergePatch(Box<BinaryFunc>),
505 JsonArrayAgg(Box<JsonArrayAggFunc>),
506 JsonObjectAgg(Box<JsonObjectAggFunc>),
507
508 Convert(Box<ConvertFunc>),
510 Typeof(Box<UnaryFunc>),
511
512 Lambda(Box<LambdaExpr>),
514 Parameter(Box<Parameter>),
515 Placeholder(Placeholder),
516 NamedArgument(Box<NamedArgument>),
517 TableArgument(Box<TableArgument>),
520 SqlComment(Box<SqlComment>),
521
522 NullSafeEq(Box<BinaryOp>),
524 NullSafeNeq(Box<BinaryOp>),
525 Glob(Box<BinaryOp>),
526 SimilarTo(Box<SimilarToExpr>),
527 Any(Box<QuantifiedExpr>),
528 All(Box<QuantifiedExpr>),
529 Overlaps(Box<OverlapsExpr>),
530
531 BitwiseLeftShift(Box<BinaryOp>),
533 BitwiseRightShift(Box<BinaryOp>),
534 BitwiseAndAgg(Box<AggFunc>),
535 BitwiseOrAgg(Box<AggFunc>),
536 BitwiseXorAgg(Box<AggFunc>),
537
538 Subscript(Box<Subscript>),
540 Dot(Box<DotAccess>),
541 MethodCall(Box<MethodCall>),
542 ArraySlice(Box<ArraySlice>),
543
544 CreateTable(Box<CreateTable>),
546 DropTable(Box<DropTable>),
547 Undrop(Box<Undrop>),
548 AlterTable(Box<AlterTable>),
549 CreateIndex(Box<CreateIndex>),
550 DropIndex(Box<DropIndex>),
551 CreateView(Box<CreateView>),
552 DropView(Box<DropView>),
553 AlterView(Box<AlterView>),
554 AlterIndex(Box<AlterIndex>),
555 Truncate(Box<Truncate>),
556 Use(Box<Use>),
557 Cache(Box<Cache>),
558 Uncache(Box<Uncache>),
559 LoadData(Box<LoadData>),
560 Pragma(Box<Pragma>),
561 Grant(Box<Grant>),
562 Revoke(Box<Revoke>),
563 Comment(Box<Comment>),
564 SetStatement(Box<SetStatement>),
565 CreateSchema(Box<CreateSchema>),
567 DropSchema(Box<DropSchema>),
568 DropNamespace(Box<DropNamespace>),
569 CreateDatabase(Box<CreateDatabase>),
570 DropDatabase(Box<DropDatabase>),
571 CreateFunction(Box<CreateFunction>),
572 DropFunction(Box<DropFunction>),
573 CreateProcedure(Box<CreateProcedure>),
574 DropProcedure(Box<DropProcedure>),
575 CreateSequence(Box<CreateSequence>),
576 CreateSynonym(Box<CreateSynonym>),
577 DropSequence(Box<DropSequence>),
578 AlterSequence(Box<AlterSequence>),
579 CreateTrigger(Box<CreateTrigger>),
580 DropTrigger(Box<DropTrigger>),
581 CreateType(Box<CreateType>),
582 DropType(Box<DropType>),
583 Describe(Box<Describe>),
584 Show(Box<Show>),
585
586 Command(Box<Command>),
588 Kill(Box<Kill>),
589 Execute(Box<ExecuteStatement>),
591
592 CreateTask(Box<CreateTask>),
594
595 Raw(Raw),
597
598 Paren(Box<Paren>),
600
601 Annotated(Box<Annotated>),
603
604 Refresh(Box<Refresh>),
607 LockingStatement(Box<LockingStatement>),
608 SequenceProperties(Box<SequenceProperties>),
609 TruncateTable(Box<TruncateTable>),
610 Clone(Box<Clone>),
611 Attach(Box<Attach>),
612 Detach(Box<Detach>),
613 Install(Box<Install>),
614 Summarize(Box<Summarize>),
615 Declare(Box<Declare>),
616 DeclareItem(Box<DeclareItem>),
617 Set(Box<Set>),
618 Heredoc(Box<Heredoc>),
619 SetItem(Box<SetItem>),
620 QueryBand(Box<QueryBand>),
621 UserDefinedFunction(Box<UserDefinedFunction>),
622 RecursiveWithSearch(Box<RecursiveWithSearch>),
623 ProjectionDef(Box<ProjectionDef>),
624 TableAlias(Box<TableAlias>),
625 ByteString(Box<ByteString>),
626 HexStringExpr(Box<HexStringExpr>),
627 UnicodeString(Box<UnicodeString>),
628 ColumnPosition(Box<ColumnPosition>),
629 ColumnDef(Box<ColumnDef>),
630 AlterColumn(Box<AlterColumn>),
631 AlterSortKey(Box<AlterSortKey>),
632 AlterSet(Box<AlterSet>),
633 RenameColumn(Box<RenameColumn>),
634 Comprehension(Box<Comprehension>),
635 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
636 MergeTreeTTL(Box<MergeTreeTTL>),
637 IndexConstraintOption(Box<IndexConstraintOption>),
638 ColumnConstraint(Box<ColumnConstraint>),
639 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
640 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
641 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
642 CheckColumnConstraint(Box<CheckColumnConstraint>),
643 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
644 CompressColumnConstraint(Box<CompressColumnConstraint>),
645 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
646 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
647 WithOperator(Box<WithOperator>),
648 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
649 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
650 CommentColumnConstraint(CommentColumnConstraint),
651 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
652 IndexColumnConstraint(Box<IndexColumnConstraint>),
653 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
654 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
655 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
656 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
657 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
658 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
659 InOutColumnConstraint(Box<InOutColumnConstraint>),
660 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
661 PathColumnConstraint(Box<PathColumnConstraint>),
662 Constraint(Box<Constraint>),
663 Export(Box<Export>),
664 Filter(Box<Filter>),
665 Changes(Box<Changes>),
666 CopyParameter(Box<CopyParameter>),
667 Credentials(Box<Credentials>),
668 Directory(Box<Directory>),
669 ForeignKey(Box<ForeignKey>),
670 ColumnPrefix(Box<ColumnPrefix>),
671 PrimaryKey(Box<PrimaryKey>),
672 IntoClause(Box<IntoClause>),
673 JoinHint(Box<JoinHint>),
674 Opclass(Box<Opclass>),
675 Index(Box<Index>),
676 IndexParameters(Box<IndexParameters>),
677 ConditionalInsert(Box<ConditionalInsert>),
678 MultitableInserts(Box<MultitableInserts>),
679 OnConflict(Box<OnConflict>),
680 OnCondition(Box<OnCondition>),
681 Returning(Box<Returning>),
682 Introducer(Box<Introducer>),
683 PartitionRange(Box<PartitionRange>),
684 Fetch(Box<Fetch>),
685 Group(Box<Group>),
686 Cube(Box<Cube>),
687 Rollup(Box<Rollup>),
688 GroupingSets(Box<GroupingSets>),
689 LimitOptions(Box<LimitOptions>),
690 Lateral(Box<Lateral>),
691 TableFromRows(Box<TableFromRows>),
692 RowsFrom(Box<RowsFrom>),
693 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
694 WithFill(Box<WithFill>),
695 Property(Box<Property>),
696 GrantPrivilege(Box<GrantPrivilege>),
697 GrantPrincipal(Box<GrantPrincipal>),
698 AllowedValuesProperty(Box<AllowedValuesProperty>),
699 AlgorithmProperty(Box<AlgorithmProperty>),
700 AutoIncrementProperty(Box<AutoIncrementProperty>),
701 AutoRefreshProperty(Box<AutoRefreshProperty>),
702 BackupProperty(Box<BackupProperty>),
703 BuildProperty(Box<BuildProperty>),
704 BlockCompressionProperty(Box<BlockCompressionProperty>),
705 CharacterSetProperty(Box<CharacterSetProperty>),
706 ChecksumProperty(Box<ChecksumProperty>),
707 CollateProperty(Box<CollateProperty>),
708 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
709 DataDeletionProperty(Box<DataDeletionProperty>),
710 DefinerProperty(Box<DefinerProperty>),
711 DistKeyProperty(Box<DistKeyProperty>),
712 DistributedByProperty(Box<DistributedByProperty>),
713 DistStyleProperty(Box<DistStyleProperty>),
714 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
715 EngineProperty(Box<EngineProperty>),
716 ToTableProperty(Box<ToTableProperty>),
717 ExecuteAsProperty(Box<ExecuteAsProperty>),
718 ExternalProperty(Box<ExternalProperty>),
719 FallbackProperty(Box<FallbackProperty>),
720 FileFormatProperty(Box<FileFormatProperty>),
721 CredentialsProperty(Box<CredentialsProperty>),
722 FreespaceProperty(Box<FreespaceProperty>),
723 InheritsProperty(Box<InheritsProperty>),
724 InputModelProperty(Box<InputModelProperty>),
725 OutputModelProperty(Box<OutputModelProperty>),
726 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
727 JournalProperty(Box<JournalProperty>),
728 LanguageProperty(Box<LanguageProperty>),
729 EnviromentProperty(Box<EnviromentProperty>),
730 ClusteredByProperty(Box<ClusteredByProperty>),
731 DictProperty(Box<DictProperty>),
732 DictRange(Box<DictRange>),
733 OnCluster(Box<OnCluster>),
734 LikeProperty(Box<LikeProperty>),
735 LocationProperty(Box<LocationProperty>),
736 LockProperty(Box<LockProperty>),
737 LockingProperty(Box<LockingProperty>),
738 LogProperty(Box<LogProperty>),
739 MaterializedProperty(Box<MaterializedProperty>),
740 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
741 OnProperty(Box<OnProperty>),
742 OnCommitProperty(Box<OnCommitProperty>),
743 PartitionedByProperty(Box<PartitionedByProperty>),
744 PartitionByProperty(Box<PartitionByProperty>),
745 PartitionedByBucket(Box<PartitionedByBucket>),
746 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
747 PartitionByTruncate(Box<PartitionByTruncate>),
748 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
749 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
750 PartitionByListProperty(Box<PartitionByListProperty>),
751 PartitionList(Box<PartitionList>),
752 Partition(Box<Partition>),
753 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
754 UniqueKeyProperty(Box<UniqueKeyProperty>),
755 RollupProperty(Box<RollupProperty>),
756 PartitionBoundSpec(Box<PartitionBoundSpec>),
757 PartitionedOfProperty(Box<PartitionedOfProperty>),
758 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
759 ReturnsProperty(Box<ReturnsProperty>),
760 RowFormatProperty(Box<RowFormatProperty>),
761 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
762 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
763 QueryTransform(Box<QueryTransform>),
764 SampleProperty(Box<SampleProperty>),
765 SecurityProperty(Box<SecurityProperty>),
766 SchemaCommentProperty(Box<SchemaCommentProperty>),
767 SemanticView(Box<SemanticView>),
768 SerdeProperties(Box<SerdeProperties>),
769 SetProperty(Box<SetProperty>),
770 SharingProperty(Box<SharingProperty>),
771 SetConfigProperty(Box<SetConfigProperty>),
772 SettingsProperty(Box<SettingsProperty>),
773 SortKeyProperty(Box<SortKeyProperty>),
774 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
775 SqlSecurityProperty(Box<SqlSecurityProperty>),
776 StabilityProperty(Box<StabilityProperty>),
777 StorageHandlerProperty(Box<StorageHandlerProperty>),
778 TemporaryProperty(Box<TemporaryProperty>),
779 Tags(Box<Tags>),
780 TransformModelProperty(Box<TransformModelProperty>),
781 TransientProperty(Box<TransientProperty>),
782 UsingTemplateProperty(Box<UsingTemplateProperty>),
783 ViewAttributeProperty(Box<ViewAttributeProperty>),
784 VolatileProperty(Box<VolatileProperty>),
785 WithDataProperty(Box<WithDataProperty>),
786 WithJournalTableProperty(Box<WithJournalTableProperty>),
787 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
788 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
789 WithProcedureOptions(Box<WithProcedureOptions>),
790 EncodeProperty(Box<EncodeProperty>),
791 IncludeProperty(Box<IncludeProperty>),
792 Properties(Box<Properties>),
793 OptionsProperty(Box<OptionsProperty>),
794 InputOutputFormat(Box<InputOutputFormat>),
795 Reference(Box<Reference>),
796 QueryOption(Box<QueryOption>),
797 WithTableHint(Box<WithTableHint>),
798 IndexTableHint(Box<IndexTableHint>),
799 HistoricalData(Box<HistoricalData>),
800 Get(Box<Get>),
801 SetOperation(Box<SetOperation>),
802 Var(Box<Var>),
803 Variadic(Box<Variadic>),
804 Version(Box<Version>),
805 Schema(Box<Schema>),
806 Lock(Box<Lock>),
807 TableSample(Box<TableSample>),
808 Tag(Box<Tag>),
809 UnpivotColumns(Box<UnpivotColumns>),
810 WindowSpec(Box<WindowSpec>),
811 SessionParameter(Box<SessionParameter>),
812 PseudoType(Box<PseudoType>),
813 ObjectIdentifier(Box<ObjectIdentifier>),
814 Transaction(Box<Transaction>),
815 Commit(Box<Commit>),
816 Rollback(Box<Rollback>),
817 AlterSession(Box<AlterSession>),
818 Analyze(Box<Analyze>),
819 AnalyzeStatistics(Box<AnalyzeStatistics>),
820 AnalyzeHistogram(Box<AnalyzeHistogram>),
821 AnalyzeSample(Box<AnalyzeSample>),
822 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
823 AnalyzeDelete(Box<AnalyzeDelete>),
824 AnalyzeWith(Box<AnalyzeWith>),
825 AnalyzeValidate(Box<AnalyzeValidate>),
826 AddPartition(Box<AddPartition>),
827 AttachOption(Box<AttachOption>),
828 DropPartition(Box<DropPartition>),
829 ReplacePartition(Box<ReplacePartition>),
830 DPipe(Box<DPipe>),
831 Operator(Box<Operator>),
832 PivotAny(Box<PivotAny>),
833 Aliases(Box<Aliases>),
834 AtIndex(Box<AtIndex>),
835 FromTimeZone(Box<FromTimeZone>),
836 FormatPhrase(Box<FormatPhrase>),
837 ForIn(Box<ForIn>),
838 TimeUnit(Box<TimeUnit>),
839 IntervalOp(Box<IntervalOp>),
840 IntervalSpan(Box<IntervalSpan>),
841 HavingMax(Box<HavingMax>),
842 CosineDistance(Box<CosineDistance>),
843 DotProduct(Box<DotProduct>),
844 EuclideanDistance(Box<EuclideanDistance>),
845 ManhattanDistance(Box<ManhattanDistance>),
846 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
847 Booland(Box<Booland>),
848 Boolor(Box<Boolor>),
849 ParameterizedAgg(Box<ParameterizedAgg>),
850 ArgMax(Box<ArgMax>),
851 ArgMin(Box<ArgMin>),
852 ApproxTopK(Box<ApproxTopK>),
853 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
854 ApproxTopKCombine(Box<ApproxTopKCombine>),
855 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
856 ApproxTopSum(Box<ApproxTopSum>),
857 ApproxQuantiles(Box<ApproxQuantiles>),
858 Minhash(Box<Minhash>),
859 FarmFingerprint(Box<FarmFingerprint>),
860 Float64(Box<Float64>),
861 Transform(Box<Transform>),
862 Translate(Box<Translate>),
863 Grouping(Box<Grouping>),
864 GroupingId(Box<GroupingId>),
865 Anonymous(Box<Anonymous>),
866 AnonymousAggFunc(Box<AnonymousAggFunc>),
867 CombinedAggFunc(Box<CombinedAggFunc>),
868 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
869 HashAgg(Box<HashAgg>),
870 Hll(Box<Hll>),
871 Apply(Box<Apply>),
872 ToBoolean(Box<ToBoolean>),
873 List(Box<List>),
874 ToMap(Box<ToMap>),
875 Pad(Box<Pad>),
876 ToChar(Box<ToChar>),
877 ToNumber(Box<ToNumber>),
878 ToDouble(Box<ToDouble>),
879 Int64(Box<UnaryFunc>),
880 StringFunc(Box<StringFunc>),
881 ToDecfloat(Box<ToDecfloat>),
882 TryToDecfloat(Box<TryToDecfloat>),
883 ToFile(Box<ToFile>),
884 Columns(Box<Columns>),
885 ConvertToCharset(Box<ConvertToCharset>),
886 ConvertTimezone(Box<ConvertTimezone>),
887 GenerateSeries(Box<GenerateSeries>),
888 AIAgg(Box<AIAgg>),
889 AIClassify(Box<AIClassify>),
890 ArrayAll(Box<ArrayAll>),
891 ArrayAny(Box<ArrayAny>),
892 ArrayConstructCompact(Box<ArrayConstructCompact>),
893 StPoint(Box<StPoint>),
894 StDistance(Box<StDistance>),
895 StringToArray(Box<StringToArray>),
896 ArraySum(Box<ArraySum>),
897 ObjectAgg(Box<ObjectAgg>),
898 CastToStrType(Box<CastToStrType>),
899 CheckJson(Box<CheckJson>),
900 CheckXml(Box<CheckXml>),
901 TranslateCharacters(Box<TranslateCharacters>),
902 CurrentSchemas(Box<CurrentSchemas>),
903 CurrentDatetime(Box<CurrentDatetime>),
904 Localtime(Box<Localtime>),
905 Localtimestamp(Box<Localtimestamp>),
906 Systimestamp(Box<Systimestamp>),
907 CurrentSchema(Box<CurrentSchema>),
908 CurrentUser(Box<CurrentUser>),
909 UtcTime(Box<UtcTime>),
910 UtcTimestamp(Box<UtcTimestamp>),
911 Timestamp(Box<TimestampFunc>),
912 DateBin(Box<DateBin>),
913 Datetime(Box<Datetime>),
914 DatetimeAdd(Box<DatetimeAdd>),
915 DatetimeSub(Box<DatetimeSub>),
916 DatetimeDiff(Box<DatetimeDiff>),
917 DatetimeTrunc(Box<DatetimeTrunc>),
918 Dayname(Box<Dayname>),
919 MakeInterval(Box<MakeInterval>),
920 PreviousDay(Box<PreviousDay>),
921 Elt(Box<Elt>),
922 TimestampAdd(Box<TimestampAdd>),
923 TimestampSub(Box<TimestampSub>),
924 TimestampDiff(Box<TimestampDiff>),
925 TimeSlice(Box<TimeSlice>),
926 TimeAdd(Box<TimeAdd>),
927 TimeSub(Box<TimeSub>),
928 TimeDiff(Box<TimeDiff>),
929 TimeTrunc(Box<TimeTrunc>),
930 DateFromParts(Box<DateFromParts>),
931 TimeFromParts(Box<TimeFromParts>),
932 DecodeCase(Box<DecodeCase>),
933 Decrypt(Box<Decrypt>),
934 DecryptRaw(Box<DecryptRaw>),
935 Encode(Box<Encode>),
936 Encrypt(Box<Encrypt>),
937 EncryptRaw(Box<EncryptRaw>),
938 EqualNull(Box<EqualNull>),
939 ToBinary(Box<ToBinary>),
940 Base64DecodeBinary(Box<Base64DecodeBinary>),
941 Base64DecodeString(Box<Base64DecodeString>),
942 Base64Encode(Box<Base64Encode>),
943 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
944 TryBase64DecodeString(Box<TryBase64DecodeString>),
945 GapFill(Box<GapFill>),
946 GenerateDateArray(Box<GenerateDateArray>),
947 GenerateTimestampArray(Box<GenerateTimestampArray>),
948 GetExtract(Box<GetExtract>),
949 Getbit(Box<Getbit>),
950 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
951 HexEncode(Box<HexEncode>),
952 Compress(Box<Compress>),
953 DecompressBinary(Box<DecompressBinary>),
954 DecompressString(Box<DecompressString>),
955 Xor(Box<Xor>),
956 Nullif(Box<Nullif>),
957 JSON(Box<JSON>),
958 JSONPath(Box<JSONPath>),
959 JSONPathFilter(Box<JSONPathFilter>),
960 JSONPathKey(Box<JSONPathKey>),
961 JSONPathRecursive(Box<JSONPathRecursive>),
962 JSONPathScript(Box<JSONPathScript>),
963 JSONPathSlice(Box<JSONPathSlice>),
964 JSONPathSelector(Box<JSONPathSelector>),
965 JSONPathSubscript(Box<JSONPathSubscript>),
966 JSONPathUnion(Box<JSONPathUnion>),
967 Format(Box<Format>),
968 JSONKeys(Box<JSONKeys>),
969 JSONKeyValue(Box<JSONKeyValue>),
970 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
971 JSONObject(Box<JSONObject>),
972 JSONObjectAgg(Box<JSONObjectAgg>),
973 JSONBObjectAgg(Box<JSONBObjectAgg>),
974 JSONArray(Box<JSONArray>),
975 JSONArrayAgg(Box<JSONArrayAgg>),
976 JSONExists(Box<JSONExists>),
977 JSONColumnDef(Box<JSONColumnDef>),
978 JSONSchema(Box<JSONSchema>),
979 JSONSet(Box<JSONSet>),
980 JSONStripNulls(Box<JSONStripNulls>),
981 JSONValue(Box<JSONValue>),
982 JSONValueArray(Box<JSONValueArray>),
983 JSONRemove(Box<JSONRemove>),
984 JSONTable(Box<JSONTable>),
985 JSONType(Box<JSONType>),
986 ObjectInsert(Box<ObjectInsert>),
987 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
988 OpenJSON(Box<OpenJSON>),
989 JSONBExists(Box<JSONBExists>),
990 JSONBContains(Box<BinaryFunc>),
991 JSONBExtract(Box<BinaryFunc>),
992 JSONCast(Box<JSONCast>),
993 JSONExtract(Box<JSONExtract>),
994 JSONExtractQuote(Box<JSONExtractQuote>),
995 JSONExtractArray(Box<JSONExtractArray>),
996 JSONExtractScalar(Box<JSONExtractScalar>),
997 JSONBExtractScalar(Box<JSONBExtractScalar>),
998 JSONFormat(Box<JSONFormat>),
999 JSONBool(Box<UnaryFunc>),
1000 JSONPathRoot(JSONPathRoot),
1001 JSONArrayAppend(Box<JSONArrayAppend>),
1002 JSONArrayContains(Box<JSONArrayContains>),
1003 JSONArrayInsert(Box<JSONArrayInsert>),
1004 ParseJSON(Box<ParseJSON>),
1005 ParseUrl(Box<ParseUrl>),
1006 ParseIp(Box<ParseIp>),
1007 ParseTime(Box<ParseTime>),
1008 ParseDatetime(Box<ParseDatetime>),
1009 Map(Box<Map>),
1010 MapCat(Box<MapCat>),
1011 MapDelete(Box<MapDelete>),
1012 MapInsert(Box<MapInsert>),
1013 MapPick(Box<MapPick>),
1014 ScopeResolution(Box<ScopeResolution>),
1015 Slice(Box<Slice>),
1016 VarMap(Box<VarMap>),
1017 MatchAgainst(Box<MatchAgainst>),
1018 MD5Digest(Box<MD5Digest>),
1019 MD5NumberLower64(Box<UnaryFunc>),
1020 MD5NumberUpper64(Box<UnaryFunc>),
1021 Monthname(Box<Monthname>),
1022 Ntile(Box<Ntile>),
1023 Normalize(Box<Normalize>),
1024 Normal(Box<Normal>),
1025 Predict(Box<Predict>),
1026 MLTranslate(Box<MLTranslate>),
1027 FeaturesAtTime(Box<FeaturesAtTime>),
1028 GenerateEmbedding(Box<GenerateEmbedding>),
1029 MLForecast(Box<MLForecast>),
1030 ModelAttribute(Box<ModelAttribute>),
1031 VectorSearch(Box<VectorSearch>),
1032 Quantile(Box<Quantile>),
1033 ApproxQuantile(Box<ApproxQuantile>),
1034 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1035 Randn(Box<Randn>),
1036 Randstr(Box<Randstr>),
1037 RangeN(Box<RangeN>),
1038 RangeBucket(Box<RangeBucket>),
1039 ReadCSV(Box<ReadCSV>),
1040 ReadParquet(Box<ReadParquet>),
1041 Reduce(Box<Reduce>),
1042 RegexpExtractAll(Box<RegexpExtractAll>),
1043 RegexpILike(Box<RegexpILike>),
1044 RegexpFullMatch(Box<RegexpFullMatch>),
1045 RegexpInstr(Box<RegexpInstr>),
1046 RegexpSplit(Box<RegexpSplit>),
1047 RegexpCount(Box<RegexpCount>),
1048 RegrValx(Box<RegrValx>),
1049 RegrValy(Box<RegrValy>),
1050 RegrAvgy(Box<RegrAvgy>),
1051 RegrAvgx(Box<RegrAvgx>),
1052 RegrCount(Box<RegrCount>),
1053 RegrIntercept(Box<RegrIntercept>),
1054 RegrR2(Box<RegrR2>),
1055 RegrSxx(Box<RegrSxx>),
1056 RegrSxy(Box<RegrSxy>),
1057 RegrSyy(Box<RegrSyy>),
1058 RegrSlope(Box<RegrSlope>),
1059 SafeAdd(Box<SafeAdd>),
1060 SafeDivide(Box<SafeDivide>),
1061 SafeMultiply(Box<SafeMultiply>),
1062 SafeSubtract(Box<SafeSubtract>),
1063 SHA2(Box<SHA2>),
1064 SHA2Digest(Box<SHA2Digest>),
1065 SortArray(Box<SortArray>),
1066 SplitPart(Box<SplitPart>),
1067 SubstringIndex(Box<SubstringIndex>),
1068 StandardHash(Box<StandardHash>),
1069 StrPosition(Box<StrPosition>),
1070 Search(Box<Search>),
1071 SearchIp(Box<SearchIp>),
1072 StrToDate(Box<StrToDate>),
1073 DateStrToDate(Box<UnaryFunc>),
1074 DateToDateStr(Box<UnaryFunc>),
1075 StrToTime(Box<StrToTime>),
1076 StrToUnix(Box<StrToUnix>),
1077 StrToMap(Box<StrToMap>),
1078 NumberToStr(Box<NumberToStr>),
1079 FromBase(Box<FromBase>),
1080 Stuff(Box<Stuff>),
1081 TimeToStr(Box<TimeToStr>),
1082 TimeStrToTime(Box<TimeStrToTime>),
1083 TsOrDsAdd(Box<TsOrDsAdd>),
1084 TsOrDsDiff(Box<TsOrDsDiff>),
1085 TsOrDsToDate(Box<TsOrDsToDate>),
1086 TsOrDsToTime(Box<TsOrDsToTime>),
1087 Unhex(Box<Unhex>),
1088 Uniform(Box<Uniform>),
1089 UnixToStr(Box<UnixToStr>),
1090 UnixToTime(Box<UnixToTime>),
1091 Uuid(Box<Uuid>),
1092 TimestampFromParts(Box<TimestampFromParts>),
1093 TimestampTzFromParts(Box<TimestampTzFromParts>),
1094 Corr(Box<Corr>),
1095 WidthBucket(Box<WidthBucket>),
1096 CovarSamp(Box<CovarSamp>),
1097 CovarPop(Box<CovarPop>),
1098 Week(Box<Week>),
1099 XMLElement(Box<XMLElement>),
1100 XMLGet(Box<XMLGet>),
1101 XMLTable(Box<XMLTable>),
1102 XMLKeyValueOption(Box<XMLKeyValueOption>),
1103 Zipf(Box<Zipf>),
1104 Merge(Box<Merge>),
1105 When(Box<When>),
1106 Whens(Box<Whens>),
1107 NextValueFor(Box<NextValueFor>),
1108 ReturnStmt(Box<Expression>),
1110}
1111
1112impl Expression {
1113 #[inline]
1115 pub fn boxed_column(col: Column) -> Self {
1116 Expression::Column(Box::new(col))
1117 }
1118
1119 #[inline]
1121 pub fn boxed_table(t: TableRef) -> Self {
1122 Expression::Table(Box::new(t))
1123 }
1124
1125 pub fn is_statement(&self) -> bool {
1132 match self {
1133 Expression::Select(_)
1135 | Expression::Union(_)
1136 | Expression::Intersect(_)
1137 | Expression::Except(_)
1138 | Expression::Subquery(_)
1139 | Expression::Values(_)
1140 | Expression::PipeOperator(_)
1141
1142 | Expression::Insert(_)
1144 | Expression::Update(_)
1145 | Expression::Delete(_)
1146 | Expression::Copy(_)
1147 | Expression::Put(_)
1148 | Expression::Merge(_)
1149
1150 | Expression::CreateTable(_)
1152 | Expression::DropTable(_)
1153 | Expression::Undrop(_)
1154 | Expression::AlterTable(_)
1155 | Expression::CreateIndex(_)
1156 | Expression::DropIndex(_)
1157 | Expression::CreateView(_)
1158 | Expression::DropView(_)
1159 | Expression::AlterView(_)
1160 | Expression::AlterIndex(_)
1161 | Expression::Truncate(_)
1162 | Expression::TruncateTable(_)
1163 | Expression::CreateSchema(_)
1164 | Expression::DropSchema(_)
1165 | Expression::DropNamespace(_)
1166 | Expression::CreateDatabase(_)
1167 | Expression::DropDatabase(_)
1168 | Expression::CreateFunction(_)
1169 | Expression::DropFunction(_)
1170 | Expression::CreateProcedure(_)
1171 | Expression::DropProcedure(_)
1172 | Expression::CreateSequence(_)
1173 | Expression::CreateSynonym(_)
1174 | Expression::DropSequence(_)
1175 | Expression::AlterSequence(_)
1176 | Expression::CreateTrigger(_)
1177 | Expression::DropTrigger(_)
1178 | Expression::CreateType(_)
1179 | Expression::DropType(_)
1180 | Expression::Comment(_)
1181
1182 | Expression::Use(_)
1184 | Expression::Set(_)
1185 | Expression::SetStatement(_)
1186 | Expression::Transaction(_)
1187 | Expression::Commit(_)
1188 | Expression::Rollback(_)
1189 | Expression::Grant(_)
1190 | Expression::Revoke(_)
1191 | Expression::Cache(_)
1192 | Expression::Uncache(_)
1193 | Expression::LoadData(_)
1194 | Expression::Pragma(_)
1195 | Expression::Describe(_)
1196 | Expression::Show(_)
1197 | Expression::Kill(_)
1198 | Expression::Execute(_)
1199 | Expression::Declare(_)
1200 | Expression::Refresh(_)
1201 | Expression::AlterSession(_)
1202 | Expression::LockingStatement(_)
1203
1204 | Expression::Analyze(_)
1206 | Expression::AnalyzeStatistics(_)
1207 | Expression::AnalyzeHistogram(_)
1208 | Expression::AnalyzeSample(_)
1209 | Expression::AnalyzeListChainedRows(_)
1210 | Expression::AnalyzeDelete(_)
1211
1212 | Expression::Attach(_)
1214 | Expression::Detach(_)
1215 | Expression::Install(_)
1216 | Expression::Summarize(_)
1217
1218 | Expression::Pivot(_)
1220 | Expression::Unpivot(_)
1221
1222 | Expression::Command(_)
1224 | Expression::Raw(_)
1225 | Expression::CreateTask(_)
1226
1227 | Expression::ReturnStmt(_) => true,
1229
1230 Expression::Annotated(a) => a.this.is_statement(),
1232
1233 Expression::Alias(a) => a.this.is_statement(),
1235
1236 _ => false,
1238 }
1239 }
1240
1241 pub fn number(n: i64) -> Self {
1243 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1244 }
1245
1246 pub fn string(s: impl Into<String>) -> Self {
1248 Expression::Literal(Box::new(Literal::String(s.into())))
1249 }
1250
1251 pub fn float(f: f64) -> Self {
1253 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1254 }
1255
1256 pub fn inferred_type(&self) -> Option<&DataType> {
1262 match self {
1263 Expression::And(op)
1265 | Expression::Or(op)
1266 | Expression::Add(op)
1267 | Expression::Sub(op)
1268 | Expression::Mul(op)
1269 | Expression::Div(op)
1270 | Expression::Mod(op)
1271 | Expression::Eq(op)
1272 | Expression::Neq(op)
1273 | Expression::Lt(op)
1274 | Expression::Lte(op)
1275 | Expression::Gt(op)
1276 | Expression::Gte(op)
1277 | Expression::Concat(op)
1278 | Expression::BitwiseAnd(op)
1279 | Expression::BitwiseOr(op)
1280 | Expression::BitwiseXor(op)
1281 | Expression::Adjacent(op)
1282 | Expression::TsMatch(op)
1283 | Expression::PropertyEQ(op)
1284 | Expression::ArrayContainsAll(op)
1285 | Expression::ArrayContainedBy(op)
1286 | Expression::ArrayOverlaps(op)
1287 | Expression::JSONBContainsAllTopKeys(op)
1288 | Expression::JSONBContainsAnyTopKeys(op)
1289 | Expression::JSONBDeleteAtPath(op)
1290 | Expression::ExtendsLeft(op)
1291 | Expression::ExtendsRight(op)
1292 | Expression::Is(op)
1293 | Expression::MemberOf(op)
1294 | Expression::Match(op)
1295 | Expression::NullSafeEq(op)
1296 | Expression::NullSafeNeq(op)
1297 | Expression::Glob(op)
1298 | Expression::BitwiseLeftShift(op)
1299 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1300
1301 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1302 op.inferred_type.as_ref()
1303 }
1304
1305 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1306
1307 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1308 c.inferred_type.as_ref()
1309 }
1310
1311 Expression::Column(c) => c.inferred_type.as_ref(),
1312 Expression::Function(f) => f.inferred_type.as_ref(),
1313 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1314 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1315 Expression::Case(c) => c.inferred_type.as_ref(),
1316 Expression::Subquery(s) => s.inferred_type.as_ref(),
1317 Expression::Alias(a) => a.inferred_type.as_ref(),
1318 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1319 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1320 Expression::Count(f) => f.inferred_type.as_ref(),
1321 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1322 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1323 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1324 Expression::SumIf(f) => f.inferred_type.as_ref(),
1325
1326 Expression::Upper(f)
1328 | Expression::Lower(f)
1329 | Expression::Length(f)
1330 | Expression::LTrim(f)
1331 | Expression::RTrim(f)
1332 | Expression::Reverse(f)
1333 | Expression::Abs(f)
1334 | Expression::Sqrt(f)
1335 | Expression::Cbrt(f)
1336 | Expression::Ln(f)
1337 | Expression::Exp(f)
1338 | Expression::Sign(f)
1339 | Expression::Date(f)
1340 | Expression::Time(f)
1341 | Expression::Initcap(f)
1342 | Expression::Ascii(f)
1343 | Expression::Chr(f)
1344 | Expression::Soundex(f)
1345 | Expression::ByteLength(f)
1346 | Expression::Hex(f)
1347 | Expression::LowerHex(f)
1348 | Expression::Unicode(f)
1349 | Expression::Typeof(f)
1350 | Expression::Explode(f)
1351 | Expression::ExplodeOuter(f)
1352 | Expression::MapFromEntries(f)
1353 | Expression::MapKeys(f)
1354 | Expression::MapValues(f)
1355 | Expression::ArrayLength(f)
1356 | Expression::ArraySize(f)
1357 | Expression::Cardinality(f)
1358 | Expression::ArrayReverse(f)
1359 | Expression::ArrayDistinct(f)
1360 | Expression::ArrayFlatten(f)
1361 | Expression::ArrayCompact(f)
1362 | Expression::ToArray(f)
1363 | Expression::JsonArrayLength(f)
1364 | Expression::JsonKeys(f)
1365 | Expression::JsonType(f)
1366 | Expression::ParseJson(f)
1367 | Expression::ToJson(f)
1368 | Expression::Radians(f)
1369 | Expression::Degrees(f)
1370 | Expression::Sin(f)
1371 | Expression::Cos(f)
1372 | Expression::Tan(f)
1373 | Expression::Asin(f)
1374 | Expression::Acos(f)
1375 | Expression::Atan(f)
1376 | Expression::IsNan(f)
1377 | Expression::IsInf(f)
1378 | Expression::Year(f)
1379 | Expression::Month(f)
1380 | Expression::Day(f)
1381 | Expression::Hour(f)
1382 | Expression::Minute(f)
1383 | Expression::Second(f)
1384 | Expression::DayOfWeek(f)
1385 | Expression::DayOfWeekIso(f)
1386 | Expression::DayOfMonth(f)
1387 | Expression::DayOfYear(f)
1388 | Expression::WeekOfYear(f)
1389 | Expression::Quarter(f)
1390 | Expression::Epoch(f)
1391 | Expression::EpochMs(f)
1392 | Expression::BitwiseCount(f)
1393 | Expression::DateFromUnixDate(f)
1394 | Expression::UnixDate(f)
1395 | Expression::UnixSeconds(f)
1396 | Expression::UnixMillis(f)
1397 | Expression::UnixMicros(f)
1398 | Expression::TimeStrToDate(f)
1399 | Expression::DateToDi(f)
1400 | Expression::DiToDate(f)
1401 | Expression::TsOrDiToDi(f)
1402 | Expression::TsOrDsToDatetime(f)
1403 | Expression::TsOrDsToTimestamp(f)
1404 | Expression::YearOfWeek(f)
1405 | Expression::YearOfWeekIso(f)
1406 | Expression::SHA(f)
1407 | Expression::SHA1Digest(f)
1408 | Expression::TimeToUnix(f)
1409 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1410
1411 Expression::Power(f)
1413 | Expression::NullIf(f)
1414 | Expression::IfNull(f)
1415 | Expression::Nvl(f)
1416 | Expression::Contains(f)
1417 | Expression::StartsWith(f)
1418 | Expression::EndsWith(f)
1419 | Expression::Levenshtein(f)
1420 | Expression::ModFunc(f)
1421 | Expression::IntDiv(f)
1422 | Expression::Atan2(f)
1423 | Expression::AddMonths(f)
1424 | Expression::MonthsBetween(f)
1425 | Expression::NextDay(f)
1426 | Expression::UnixToTimeStr(f)
1427 | Expression::ArrayContains(f)
1428 | Expression::ArrayPosition(f)
1429 | Expression::ArrayAppend(f)
1430 | Expression::ArrayPrepend(f)
1431 | Expression::ArrayUnion(f)
1432 | Expression::ArrayExcept(f)
1433 | Expression::ArrayRemove(f)
1434 | Expression::StarMap(f)
1435 | Expression::MapFromArrays(f)
1436 | Expression::MapContainsKey(f)
1437 | Expression::ElementAt(f)
1438 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1439
1440 Expression::Coalesce(f)
1442 | Expression::Greatest(f)
1443 | Expression::Least(f)
1444 | Expression::ArrayConcat(f)
1445 | Expression::ArrayIntersect(f)
1446 | Expression::ArrayZip(f)
1447 | Expression::MapConcat(f)
1448 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1449
1450 Expression::Sum(f)
1452 | Expression::Avg(f)
1453 | Expression::Min(f)
1454 | Expression::Max(f)
1455 | Expression::ArrayAgg(f)
1456 | Expression::CountIf(f)
1457 | Expression::Stddev(f)
1458 | Expression::StddevPop(f)
1459 | Expression::StddevSamp(f)
1460 | Expression::Variance(f)
1461 | Expression::VarPop(f)
1462 | Expression::VarSamp(f)
1463 | Expression::Median(f)
1464 | Expression::Mode(f)
1465 | Expression::First(f)
1466 | Expression::Last(f)
1467 | Expression::AnyValue(f)
1468 | Expression::ApproxDistinct(f)
1469 | Expression::ApproxCountDistinct(f)
1470 | Expression::LogicalAnd(f)
1471 | Expression::LogicalOr(f)
1472 | Expression::Skewness(f)
1473 | Expression::ArrayConcatAgg(f)
1474 | Expression::ArrayUniqueAgg(f)
1475 | Expression::BoolXorAgg(f)
1476 | Expression::BitwiseAndAgg(f)
1477 | Expression::BitwiseOrAgg(f)
1478 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1479
1480 _ => None,
1482 }
1483 }
1484
1485 pub fn set_inferred_type(&mut self, dt: DataType) {
1490 match self {
1491 Expression::And(op)
1492 | Expression::Or(op)
1493 | Expression::Add(op)
1494 | Expression::Sub(op)
1495 | Expression::Mul(op)
1496 | Expression::Div(op)
1497 | Expression::Mod(op)
1498 | Expression::Eq(op)
1499 | Expression::Neq(op)
1500 | Expression::Lt(op)
1501 | Expression::Lte(op)
1502 | Expression::Gt(op)
1503 | Expression::Gte(op)
1504 | Expression::Concat(op)
1505 | Expression::BitwiseAnd(op)
1506 | Expression::BitwiseOr(op)
1507 | Expression::BitwiseXor(op)
1508 | Expression::Adjacent(op)
1509 | Expression::TsMatch(op)
1510 | Expression::PropertyEQ(op)
1511 | Expression::ArrayContainsAll(op)
1512 | Expression::ArrayContainedBy(op)
1513 | Expression::ArrayOverlaps(op)
1514 | Expression::JSONBContainsAllTopKeys(op)
1515 | Expression::JSONBContainsAnyTopKeys(op)
1516 | Expression::JSONBDeleteAtPath(op)
1517 | Expression::ExtendsLeft(op)
1518 | Expression::ExtendsRight(op)
1519 | Expression::Is(op)
1520 | Expression::MemberOf(op)
1521 | Expression::Match(op)
1522 | Expression::NullSafeEq(op)
1523 | Expression::NullSafeNeq(op)
1524 | Expression::Glob(op)
1525 | Expression::BitwiseLeftShift(op)
1526 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1527
1528 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1529 op.inferred_type = Some(dt)
1530 }
1531
1532 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1533
1534 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1535 c.inferred_type = Some(dt)
1536 }
1537
1538 Expression::Column(c) => c.inferred_type = Some(dt),
1539 Expression::Function(f) => f.inferred_type = Some(dt),
1540 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1541 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1542 Expression::Case(c) => c.inferred_type = Some(dt),
1543 Expression::Subquery(s) => s.inferred_type = Some(dt),
1544 Expression::Alias(a) => a.inferred_type = Some(dt),
1545 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1546 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1547 Expression::Count(f) => f.inferred_type = Some(dt),
1548 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1549 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1550 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1551 Expression::SumIf(f) => f.inferred_type = Some(dt),
1552
1553 Expression::Upper(f)
1555 | Expression::Lower(f)
1556 | Expression::Length(f)
1557 | Expression::LTrim(f)
1558 | Expression::RTrim(f)
1559 | Expression::Reverse(f)
1560 | Expression::Abs(f)
1561 | Expression::Sqrt(f)
1562 | Expression::Cbrt(f)
1563 | Expression::Ln(f)
1564 | Expression::Exp(f)
1565 | Expression::Sign(f)
1566 | Expression::Date(f)
1567 | Expression::Time(f)
1568 | Expression::Initcap(f)
1569 | Expression::Ascii(f)
1570 | Expression::Chr(f)
1571 | Expression::Soundex(f)
1572 | Expression::ByteLength(f)
1573 | Expression::Hex(f)
1574 | Expression::LowerHex(f)
1575 | Expression::Unicode(f)
1576 | Expression::Typeof(f)
1577 | Expression::Explode(f)
1578 | Expression::ExplodeOuter(f)
1579 | Expression::MapFromEntries(f)
1580 | Expression::MapKeys(f)
1581 | Expression::MapValues(f)
1582 | Expression::ArrayLength(f)
1583 | Expression::ArraySize(f)
1584 | Expression::Cardinality(f)
1585 | Expression::ArrayReverse(f)
1586 | Expression::ArrayDistinct(f)
1587 | Expression::ArrayFlatten(f)
1588 | Expression::ArrayCompact(f)
1589 | Expression::ToArray(f)
1590 | Expression::JsonArrayLength(f)
1591 | Expression::JsonKeys(f)
1592 | Expression::JsonType(f)
1593 | Expression::ParseJson(f)
1594 | Expression::ToJson(f)
1595 | Expression::Radians(f)
1596 | Expression::Degrees(f)
1597 | Expression::Sin(f)
1598 | Expression::Cos(f)
1599 | Expression::Tan(f)
1600 | Expression::Asin(f)
1601 | Expression::Acos(f)
1602 | Expression::Atan(f)
1603 | Expression::IsNan(f)
1604 | Expression::IsInf(f)
1605 | Expression::Year(f)
1606 | Expression::Month(f)
1607 | Expression::Day(f)
1608 | Expression::Hour(f)
1609 | Expression::Minute(f)
1610 | Expression::Second(f)
1611 | Expression::DayOfWeek(f)
1612 | Expression::DayOfWeekIso(f)
1613 | Expression::DayOfMonth(f)
1614 | Expression::DayOfYear(f)
1615 | Expression::WeekOfYear(f)
1616 | Expression::Quarter(f)
1617 | Expression::Epoch(f)
1618 | Expression::EpochMs(f)
1619 | Expression::BitwiseCount(f)
1620 | Expression::DateFromUnixDate(f)
1621 | Expression::UnixDate(f)
1622 | Expression::UnixSeconds(f)
1623 | Expression::UnixMillis(f)
1624 | Expression::UnixMicros(f)
1625 | Expression::TimeStrToDate(f)
1626 | Expression::DateToDi(f)
1627 | Expression::DiToDate(f)
1628 | Expression::TsOrDiToDi(f)
1629 | Expression::TsOrDsToDatetime(f)
1630 | Expression::TsOrDsToTimestamp(f)
1631 | Expression::YearOfWeek(f)
1632 | Expression::YearOfWeekIso(f)
1633 | Expression::SHA(f)
1634 | Expression::SHA1Digest(f)
1635 | Expression::TimeToUnix(f)
1636 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1637
1638 Expression::Power(f)
1640 | Expression::NullIf(f)
1641 | Expression::IfNull(f)
1642 | Expression::Nvl(f)
1643 | Expression::Contains(f)
1644 | Expression::StartsWith(f)
1645 | Expression::EndsWith(f)
1646 | Expression::Levenshtein(f)
1647 | Expression::ModFunc(f)
1648 | Expression::IntDiv(f)
1649 | Expression::Atan2(f)
1650 | Expression::AddMonths(f)
1651 | Expression::MonthsBetween(f)
1652 | Expression::NextDay(f)
1653 | Expression::UnixToTimeStr(f)
1654 | Expression::ArrayContains(f)
1655 | Expression::ArrayPosition(f)
1656 | Expression::ArrayAppend(f)
1657 | Expression::ArrayPrepend(f)
1658 | Expression::ArrayUnion(f)
1659 | Expression::ArrayExcept(f)
1660 | Expression::ArrayRemove(f)
1661 | Expression::StarMap(f)
1662 | Expression::MapFromArrays(f)
1663 | Expression::MapContainsKey(f)
1664 | Expression::ElementAt(f)
1665 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1666
1667 Expression::Coalesce(f)
1669 | Expression::Greatest(f)
1670 | Expression::Least(f)
1671 | Expression::ArrayConcat(f)
1672 | Expression::ArrayIntersect(f)
1673 | Expression::ArrayZip(f)
1674 | Expression::MapConcat(f)
1675 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1676
1677 Expression::Sum(f)
1679 | Expression::Avg(f)
1680 | Expression::Min(f)
1681 | Expression::Max(f)
1682 | Expression::ArrayAgg(f)
1683 | Expression::CountIf(f)
1684 | Expression::Stddev(f)
1685 | Expression::StddevPop(f)
1686 | Expression::StddevSamp(f)
1687 | Expression::Variance(f)
1688 | Expression::VarPop(f)
1689 | Expression::VarSamp(f)
1690 | Expression::Median(f)
1691 | Expression::Mode(f)
1692 | Expression::First(f)
1693 | Expression::Last(f)
1694 | Expression::AnyValue(f)
1695 | Expression::ApproxDistinct(f)
1696 | Expression::ApproxCountDistinct(f)
1697 | Expression::LogicalAnd(f)
1698 | Expression::LogicalOr(f)
1699 | Expression::Skewness(f)
1700 | Expression::ArrayConcatAgg(f)
1701 | Expression::ArrayUniqueAgg(f)
1702 | Expression::BoolXorAgg(f)
1703 | Expression::BitwiseAndAgg(f)
1704 | Expression::BitwiseOrAgg(f)
1705 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1706
1707 _ => {}
1709 }
1710 }
1711
1712 pub fn column(name: impl Into<String>) -> Self {
1714 Expression::Column(Box::new(Column {
1715 name: Identifier::new(name),
1716 table: None,
1717 join_mark: false,
1718 trailing_comments: Vec::new(),
1719 span: None,
1720 inferred_type: None,
1721 }))
1722 }
1723
1724 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1726 Expression::Column(Box::new(Column {
1727 name: Identifier::new(column),
1728 table: Some(Identifier::new(table)),
1729 join_mark: false,
1730 trailing_comments: Vec::new(),
1731 span: None,
1732 inferred_type: None,
1733 }))
1734 }
1735
1736 pub fn identifier(name: impl Into<String>) -> Self {
1738 Expression::Identifier(Identifier::new(name))
1739 }
1740
1741 pub fn null() -> Self {
1743 Expression::Null(Null)
1744 }
1745
1746 pub fn true_() -> Self {
1748 Expression::Boolean(BooleanLiteral { value: true })
1749 }
1750
1751 pub fn false_() -> Self {
1753 Expression::Boolean(BooleanLiteral { value: false })
1754 }
1755
1756 pub fn star() -> Self {
1758 Expression::Star(Star {
1759 table: None,
1760 except: None,
1761 replace: None,
1762 rename: None,
1763 trailing_comments: Vec::new(),
1764 span: None,
1765 })
1766 }
1767
1768 pub fn alias(self, name: impl Into<String>) -> Self {
1770 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1771 }
1772
1773 pub fn is_select(&self) -> bool {
1775 matches!(self, Expression::Select(_))
1776 }
1777
1778 pub fn as_select(&self) -> Option<&Select> {
1780 match self {
1781 Expression::Select(s) => Some(s),
1782 _ => None,
1783 }
1784 }
1785
1786 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1788 match self {
1789 Expression::Select(s) => Some(s),
1790 _ => None,
1791 }
1792 }
1793
1794 pub fn sql(&self) -> String {
1799 crate::generator::Generator::sql(self).unwrap_or_default()
1800 }
1801
1802 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1808 crate::generate(self, dialect).unwrap_or_default()
1809 }
1810}
1811
1812impl Expression {
1815 pub fn variant_name(&self) -> &'static str {
1818 match self {
1819 Expression::Literal(_) => "literal",
1820 Expression::Boolean(_) => "boolean",
1821 Expression::Null(_) => "null",
1822 Expression::Identifier(_) => "identifier",
1823 Expression::Column(_) => "column",
1824 Expression::Table(_) => "table",
1825 Expression::Star(_) => "star",
1826 Expression::BracedWildcard(_) => "braced_wildcard",
1827 Expression::Select(_) => "select",
1828 Expression::Union(_) => "union",
1829 Expression::Intersect(_) => "intersect",
1830 Expression::Except(_) => "except",
1831 Expression::Subquery(_) => "subquery",
1832 Expression::PipeOperator(_) => "pipe_operator",
1833 Expression::Pivot(_) => "pivot",
1834 Expression::PivotAlias(_) => "pivot_alias",
1835 Expression::Unpivot(_) => "unpivot",
1836 Expression::Values(_) => "values",
1837 Expression::PreWhere(_) => "pre_where",
1838 Expression::Stream(_) => "stream",
1839 Expression::UsingData(_) => "using_data",
1840 Expression::XmlNamespace(_) => "xml_namespace",
1841 Expression::Insert(_) => "insert",
1842 Expression::Update(_) => "update",
1843 Expression::Delete(_) => "delete",
1844 Expression::Copy(_) => "copy",
1845 Expression::Put(_) => "put",
1846 Expression::StageReference(_) => "stage_reference",
1847 Expression::Alias(_) => "alias",
1848 Expression::Cast(_) => "cast",
1849 Expression::Collation(_) => "collation",
1850 Expression::Case(_) => "case",
1851 Expression::And(_) => "and",
1852 Expression::Or(_) => "or",
1853 Expression::Add(_) => "add",
1854 Expression::Sub(_) => "sub",
1855 Expression::Mul(_) => "mul",
1856 Expression::Div(_) => "div",
1857 Expression::Mod(_) => "mod",
1858 Expression::Eq(_) => "eq",
1859 Expression::Neq(_) => "neq",
1860 Expression::Lt(_) => "lt",
1861 Expression::Lte(_) => "lte",
1862 Expression::Gt(_) => "gt",
1863 Expression::Gte(_) => "gte",
1864 Expression::Like(_) => "like",
1865 Expression::ILike(_) => "i_like",
1866 Expression::Match(_) => "match",
1867 Expression::BitwiseAnd(_) => "bitwise_and",
1868 Expression::BitwiseOr(_) => "bitwise_or",
1869 Expression::BitwiseXor(_) => "bitwise_xor",
1870 Expression::Concat(_) => "concat",
1871 Expression::Adjacent(_) => "adjacent",
1872 Expression::TsMatch(_) => "ts_match",
1873 Expression::PropertyEQ(_) => "property_e_q",
1874 Expression::ArrayContainsAll(_) => "array_contains_all",
1875 Expression::ArrayContainedBy(_) => "array_contained_by",
1876 Expression::ArrayOverlaps(_) => "array_overlaps",
1877 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1878 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1879 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1880 Expression::ExtendsLeft(_) => "extends_left",
1881 Expression::ExtendsRight(_) => "extends_right",
1882 Expression::Not(_) => "not",
1883 Expression::Neg(_) => "neg",
1884 Expression::BitwiseNot(_) => "bitwise_not",
1885 Expression::In(_) => "in",
1886 Expression::Between(_) => "between",
1887 Expression::IsNull(_) => "is_null",
1888 Expression::IsTrue(_) => "is_true",
1889 Expression::IsFalse(_) => "is_false",
1890 Expression::IsJson(_) => "is_json",
1891 Expression::Is(_) => "is",
1892 Expression::Exists(_) => "exists",
1893 Expression::MemberOf(_) => "member_of",
1894 Expression::Function(_) => "function",
1895 Expression::AggregateFunction(_) => "aggregate_function",
1896 Expression::WindowFunction(_) => "window_function",
1897 Expression::From(_) => "from",
1898 Expression::Join(_) => "join",
1899 Expression::JoinedTable(_) => "joined_table",
1900 Expression::Where(_) => "where",
1901 Expression::GroupBy(_) => "group_by",
1902 Expression::Having(_) => "having",
1903 Expression::OrderBy(_) => "order_by",
1904 Expression::Limit(_) => "limit",
1905 Expression::Offset(_) => "offset",
1906 Expression::Qualify(_) => "qualify",
1907 Expression::With(_) => "with",
1908 Expression::Cte(_) => "cte",
1909 Expression::DistributeBy(_) => "distribute_by",
1910 Expression::ClusterBy(_) => "cluster_by",
1911 Expression::SortBy(_) => "sort_by",
1912 Expression::LateralView(_) => "lateral_view",
1913 Expression::Hint(_) => "hint",
1914 Expression::Pseudocolumn(_) => "pseudocolumn",
1915 Expression::Connect(_) => "connect",
1916 Expression::Prior(_) => "prior",
1917 Expression::ConnectByRoot(_) => "connect_by_root",
1918 Expression::MatchRecognize(_) => "match_recognize",
1919 Expression::Ordered(_) => "ordered",
1920 Expression::Window(_) => "window",
1921 Expression::Over(_) => "over",
1922 Expression::WithinGroup(_) => "within_group",
1923 Expression::DataType(_) => "data_type",
1924 Expression::Array(_) => "array",
1925 Expression::Struct(_) => "struct",
1926 Expression::Tuple(_) => "tuple",
1927 Expression::Interval(_) => "interval",
1928 Expression::ConcatWs(_) => "concat_ws",
1929 Expression::Substring(_) => "substring",
1930 Expression::Upper(_) => "upper",
1931 Expression::Lower(_) => "lower",
1932 Expression::Length(_) => "length",
1933 Expression::Trim(_) => "trim",
1934 Expression::LTrim(_) => "l_trim",
1935 Expression::RTrim(_) => "r_trim",
1936 Expression::Replace(_) => "replace",
1937 Expression::Reverse(_) => "reverse",
1938 Expression::Left(_) => "left",
1939 Expression::Right(_) => "right",
1940 Expression::Repeat(_) => "repeat",
1941 Expression::Lpad(_) => "lpad",
1942 Expression::Rpad(_) => "rpad",
1943 Expression::Split(_) => "split",
1944 Expression::RegexpLike(_) => "regexp_like",
1945 Expression::RegexpReplace(_) => "regexp_replace",
1946 Expression::RegexpExtract(_) => "regexp_extract",
1947 Expression::Overlay(_) => "overlay",
1948 Expression::Abs(_) => "abs",
1949 Expression::Round(_) => "round",
1950 Expression::Floor(_) => "floor",
1951 Expression::Ceil(_) => "ceil",
1952 Expression::Power(_) => "power",
1953 Expression::Sqrt(_) => "sqrt",
1954 Expression::Cbrt(_) => "cbrt",
1955 Expression::Ln(_) => "ln",
1956 Expression::Log(_) => "log",
1957 Expression::Exp(_) => "exp",
1958 Expression::Sign(_) => "sign",
1959 Expression::Greatest(_) => "greatest",
1960 Expression::Least(_) => "least",
1961 Expression::CurrentDate(_) => "current_date",
1962 Expression::CurrentTime(_) => "current_time",
1963 Expression::CurrentTimestamp(_) => "current_timestamp",
1964 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1965 Expression::AtTimeZone(_) => "at_time_zone",
1966 Expression::DateAdd(_) => "date_add",
1967 Expression::DateSub(_) => "date_sub",
1968 Expression::DateDiff(_) => "date_diff",
1969 Expression::DateTrunc(_) => "date_trunc",
1970 Expression::Extract(_) => "extract",
1971 Expression::ToDate(_) => "to_date",
1972 Expression::ToTimestamp(_) => "to_timestamp",
1973 Expression::Date(_) => "date",
1974 Expression::Time(_) => "time",
1975 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1976 Expression::UnixDate(_) => "unix_date",
1977 Expression::UnixSeconds(_) => "unix_seconds",
1978 Expression::UnixMillis(_) => "unix_millis",
1979 Expression::UnixMicros(_) => "unix_micros",
1980 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1981 Expression::TimeStrToDate(_) => "time_str_to_date",
1982 Expression::DateToDi(_) => "date_to_di",
1983 Expression::DiToDate(_) => "di_to_date",
1984 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1985 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1986 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1987 Expression::YearOfWeek(_) => "year_of_week",
1988 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1989 Expression::Coalesce(_) => "coalesce",
1990 Expression::NullIf(_) => "null_if",
1991 Expression::IfFunc(_) => "if_func",
1992 Expression::IfNull(_) => "if_null",
1993 Expression::Nvl(_) => "nvl",
1994 Expression::Nvl2(_) => "nvl2",
1995 Expression::TryCast(_) => "try_cast",
1996 Expression::SafeCast(_) => "safe_cast",
1997 Expression::Count(_) => "count",
1998 Expression::Sum(_) => "sum",
1999 Expression::Avg(_) => "avg",
2000 Expression::Min(_) => "min",
2001 Expression::Max(_) => "max",
2002 Expression::GroupConcat(_) => "group_concat",
2003 Expression::StringAgg(_) => "string_agg",
2004 Expression::ListAgg(_) => "list_agg",
2005 Expression::ArrayAgg(_) => "array_agg",
2006 Expression::CountIf(_) => "count_if",
2007 Expression::SumIf(_) => "sum_if",
2008 Expression::Stddev(_) => "stddev",
2009 Expression::StddevPop(_) => "stddev_pop",
2010 Expression::StddevSamp(_) => "stddev_samp",
2011 Expression::Variance(_) => "variance",
2012 Expression::VarPop(_) => "var_pop",
2013 Expression::VarSamp(_) => "var_samp",
2014 Expression::Median(_) => "median",
2015 Expression::Mode(_) => "mode",
2016 Expression::First(_) => "first",
2017 Expression::Last(_) => "last",
2018 Expression::AnyValue(_) => "any_value",
2019 Expression::ApproxDistinct(_) => "approx_distinct",
2020 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2021 Expression::ApproxPercentile(_) => "approx_percentile",
2022 Expression::Percentile(_) => "percentile",
2023 Expression::LogicalAnd(_) => "logical_and",
2024 Expression::LogicalOr(_) => "logical_or",
2025 Expression::Skewness(_) => "skewness",
2026 Expression::BitwiseCount(_) => "bitwise_count",
2027 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2028 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2029 Expression::BoolXorAgg(_) => "bool_xor_agg",
2030 Expression::RowNumber(_) => "row_number",
2031 Expression::Rank(_) => "rank",
2032 Expression::DenseRank(_) => "dense_rank",
2033 Expression::NTile(_) => "n_tile",
2034 Expression::Lead(_) => "lead",
2035 Expression::Lag(_) => "lag",
2036 Expression::FirstValue(_) => "first_value",
2037 Expression::LastValue(_) => "last_value",
2038 Expression::NthValue(_) => "nth_value",
2039 Expression::PercentRank(_) => "percent_rank",
2040 Expression::CumeDist(_) => "cume_dist",
2041 Expression::PercentileCont(_) => "percentile_cont",
2042 Expression::PercentileDisc(_) => "percentile_disc",
2043 Expression::Contains(_) => "contains",
2044 Expression::StartsWith(_) => "starts_with",
2045 Expression::EndsWith(_) => "ends_with",
2046 Expression::Position(_) => "position",
2047 Expression::Initcap(_) => "initcap",
2048 Expression::Ascii(_) => "ascii",
2049 Expression::Chr(_) => "chr",
2050 Expression::CharFunc(_) => "char_func",
2051 Expression::Soundex(_) => "soundex",
2052 Expression::Levenshtein(_) => "levenshtein",
2053 Expression::ByteLength(_) => "byte_length",
2054 Expression::Hex(_) => "hex",
2055 Expression::LowerHex(_) => "lower_hex",
2056 Expression::Unicode(_) => "unicode",
2057 Expression::ModFunc(_) => "mod_func",
2058 Expression::Random(_) => "random",
2059 Expression::Rand(_) => "rand",
2060 Expression::TruncFunc(_) => "trunc_func",
2061 Expression::Pi(_) => "pi",
2062 Expression::Radians(_) => "radians",
2063 Expression::Degrees(_) => "degrees",
2064 Expression::Sin(_) => "sin",
2065 Expression::Cos(_) => "cos",
2066 Expression::Tan(_) => "tan",
2067 Expression::Asin(_) => "asin",
2068 Expression::Acos(_) => "acos",
2069 Expression::Atan(_) => "atan",
2070 Expression::Atan2(_) => "atan2",
2071 Expression::IsNan(_) => "is_nan",
2072 Expression::IsInf(_) => "is_inf",
2073 Expression::IntDiv(_) => "int_div",
2074 Expression::Decode(_) => "decode",
2075 Expression::DateFormat(_) => "date_format",
2076 Expression::FormatDate(_) => "format_date",
2077 Expression::Year(_) => "year",
2078 Expression::Month(_) => "month",
2079 Expression::Day(_) => "day",
2080 Expression::Hour(_) => "hour",
2081 Expression::Minute(_) => "minute",
2082 Expression::Second(_) => "second",
2083 Expression::DayOfWeek(_) => "day_of_week",
2084 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2085 Expression::DayOfMonth(_) => "day_of_month",
2086 Expression::DayOfYear(_) => "day_of_year",
2087 Expression::WeekOfYear(_) => "week_of_year",
2088 Expression::Quarter(_) => "quarter",
2089 Expression::AddMonths(_) => "add_months",
2090 Expression::MonthsBetween(_) => "months_between",
2091 Expression::LastDay(_) => "last_day",
2092 Expression::NextDay(_) => "next_day",
2093 Expression::Epoch(_) => "epoch",
2094 Expression::EpochMs(_) => "epoch_ms",
2095 Expression::FromUnixtime(_) => "from_unixtime",
2096 Expression::UnixTimestamp(_) => "unix_timestamp",
2097 Expression::MakeDate(_) => "make_date",
2098 Expression::MakeTimestamp(_) => "make_timestamp",
2099 Expression::TimestampTrunc(_) => "timestamp_trunc",
2100 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2101 Expression::SessionUser(_) => "session_user",
2102 Expression::SHA(_) => "s_h_a",
2103 Expression::SHA1Digest(_) => "s_h_a1_digest",
2104 Expression::TimeToUnix(_) => "time_to_unix",
2105 Expression::ArrayFunc(_) => "array_func",
2106 Expression::ArrayLength(_) => "array_length",
2107 Expression::ArraySize(_) => "array_size",
2108 Expression::Cardinality(_) => "cardinality",
2109 Expression::ArrayContains(_) => "array_contains",
2110 Expression::ArrayPosition(_) => "array_position",
2111 Expression::ArrayAppend(_) => "array_append",
2112 Expression::ArrayPrepend(_) => "array_prepend",
2113 Expression::ArrayConcat(_) => "array_concat",
2114 Expression::ArraySort(_) => "array_sort",
2115 Expression::ArrayReverse(_) => "array_reverse",
2116 Expression::ArrayDistinct(_) => "array_distinct",
2117 Expression::ArrayJoin(_) => "array_join",
2118 Expression::ArrayToString(_) => "array_to_string",
2119 Expression::Unnest(_) => "unnest",
2120 Expression::Explode(_) => "explode",
2121 Expression::ExplodeOuter(_) => "explode_outer",
2122 Expression::ArrayFilter(_) => "array_filter",
2123 Expression::ArrayTransform(_) => "array_transform",
2124 Expression::ArrayFlatten(_) => "array_flatten",
2125 Expression::ArrayCompact(_) => "array_compact",
2126 Expression::ArrayIntersect(_) => "array_intersect",
2127 Expression::ArrayUnion(_) => "array_union",
2128 Expression::ArrayExcept(_) => "array_except",
2129 Expression::ArrayRemove(_) => "array_remove",
2130 Expression::ArrayZip(_) => "array_zip",
2131 Expression::Sequence(_) => "sequence",
2132 Expression::Generate(_) => "generate",
2133 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2134 Expression::ToArray(_) => "to_array",
2135 Expression::StarMap(_) => "star_map",
2136 Expression::StructFunc(_) => "struct_func",
2137 Expression::StructExtract(_) => "struct_extract",
2138 Expression::NamedStruct(_) => "named_struct",
2139 Expression::MapFunc(_) => "map_func",
2140 Expression::MapFromEntries(_) => "map_from_entries",
2141 Expression::MapFromArrays(_) => "map_from_arrays",
2142 Expression::MapKeys(_) => "map_keys",
2143 Expression::MapValues(_) => "map_values",
2144 Expression::MapContainsKey(_) => "map_contains_key",
2145 Expression::MapConcat(_) => "map_concat",
2146 Expression::ElementAt(_) => "element_at",
2147 Expression::TransformKeys(_) => "transform_keys",
2148 Expression::TransformValues(_) => "transform_values",
2149 Expression::FunctionEmits(_) => "function_emits",
2150 Expression::JsonExtract(_) => "json_extract",
2151 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2152 Expression::JsonExtractPath(_) => "json_extract_path",
2153 Expression::JsonArray(_) => "json_array",
2154 Expression::JsonObject(_) => "json_object",
2155 Expression::JsonQuery(_) => "json_query",
2156 Expression::JsonValue(_) => "json_value",
2157 Expression::JsonArrayLength(_) => "json_array_length",
2158 Expression::JsonKeys(_) => "json_keys",
2159 Expression::JsonType(_) => "json_type",
2160 Expression::ParseJson(_) => "parse_json",
2161 Expression::ToJson(_) => "to_json",
2162 Expression::JsonSet(_) => "json_set",
2163 Expression::JsonInsert(_) => "json_insert",
2164 Expression::JsonRemove(_) => "json_remove",
2165 Expression::JsonMergePatch(_) => "json_merge_patch",
2166 Expression::JsonArrayAgg(_) => "json_array_agg",
2167 Expression::JsonObjectAgg(_) => "json_object_agg",
2168 Expression::Convert(_) => "convert",
2169 Expression::Typeof(_) => "typeof",
2170 Expression::Lambda(_) => "lambda",
2171 Expression::Parameter(_) => "parameter",
2172 Expression::Placeholder(_) => "placeholder",
2173 Expression::NamedArgument(_) => "named_argument",
2174 Expression::TableArgument(_) => "table_argument",
2175 Expression::SqlComment(_) => "sql_comment",
2176 Expression::NullSafeEq(_) => "null_safe_eq",
2177 Expression::NullSafeNeq(_) => "null_safe_neq",
2178 Expression::Glob(_) => "glob",
2179 Expression::SimilarTo(_) => "similar_to",
2180 Expression::Any(_) => "any",
2181 Expression::All(_) => "all",
2182 Expression::Overlaps(_) => "overlaps",
2183 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2184 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2185 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2186 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2187 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2188 Expression::Subscript(_) => "subscript",
2189 Expression::Dot(_) => "dot",
2190 Expression::MethodCall(_) => "method_call",
2191 Expression::ArraySlice(_) => "array_slice",
2192 Expression::CreateTable(_) => "create_table",
2193 Expression::DropTable(_) => "drop_table",
2194 Expression::Undrop(_) => "undrop",
2195 Expression::AlterTable(_) => "alter_table",
2196 Expression::CreateIndex(_) => "create_index",
2197 Expression::DropIndex(_) => "drop_index",
2198 Expression::CreateView(_) => "create_view",
2199 Expression::DropView(_) => "drop_view",
2200 Expression::AlterView(_) => "alter_view",
2201 Expression::AlterIndex(_) => "alter_index",
2202 Expression::Truncate(_) => "truncate",
2203 Expression::Use(_) => "use",
2204 Expression::Cache(_) => "cache",
2205 Expression::Uncache(_) => "uncache",
2206 Expression::LoadData(_) => "load_data",
2207 Expression::Pragma(_) => "pragma",
2208 Expression::Grant(_) => "grant",
2209 Expression::Revoke(_) => "revoke",
2210 Expression::Comment(_) => "comment",
2211 Expression::SetStatement(_) => "set_statement",
2212 Expression::CreateSchema(_) => "create_schema",
2213 Expression::DropSchema(_) => "drop_schema",
2214 Expression::DropNamespace(_) => "drop_namespace",
2215 Expression::CreateDatabase(_) => "create_database",
2216 Expression::DropDatabase(_) => "drop_database",
2217 Expression::CreateFunction(_) => "create_function",
2218 Expression::DropFunction(_) => "drop_function",
2219 Expression::CreateProcedure(_) => "create_procedure",
2220 Expression::DropProcedure(_) => "drop_procedure",
2221 Expression::CreateSequence(_) => "create_sequence",
2222 Expression::CreateSynonym(_) => "create_synonym",
2223 Expression::DropSequence(_) => "drop_sequence",
2224 Expression::AlterSequence(_) => "alter_sequence",
2225 Expression::CreateTrigger(_) => "create_trigger",
2226 Expression::DropTrigger(_) => "drop_trigger",
2227 Expression::CreateType(_) => "create_type",
2228 Expression::DropType(_) => "drop_type",
2229 Expression::Describe(_) => "describe",
2230 Expression::Show(_) => "show",
2231 Expression::Command(_) => "command",
2232 Expression::Kill(_) => "kill",
2233 Expression::Execute(_) => "execute",
2234 Expression::Raw(_) => "raw",
2235 Expression::CreateTask(_) => "create_task",
2236 Expression::Paren(_) => "paren",
2237 Expression::Annotated(_) => "annotated",
2238 Expression::Refresh(_) => "refresh",
2239 Expression::LockingStatement(_) => "locking_statement",
2240 Expression::SequenceProperties(_) => "sequence_properties",
2241 Expression::TruncateTable(_) => "truncate_table",
2242 Expression::Clone(_) => "clone",
2243 Expression::Attach(_) => "attach",
2244 Expression::Detach(_) => "detach",
2245 Expression::Install(_) => "install",
2246 Expression::Summarize(_) => "summarize",
2247 Expression::Declare(_) => "declare",
2248 Expression::DeclareItem(_) => "declare_item",
2249 Expression::Set(_) => "set",
2250 Expression::Heredoc(_) => "heredoc",
2251 Expression::SetItem(_) => "set_item",
2252 Expression::QueryBand(_) => "query_band",
2253 Expression::UserDefinedFunction(_) => "user_defined_function",
2254 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2255 Expression::ProjectionDef(_) => "projection_def",
2256 Expression::TableAlias(_) => "table_alias",
2257 Expression::ByteString(_) => "byte_string",
2258 Expression::HexStringExpr(_) => "hex_string_expr",
2259 Expression::UnicodeString(_) => "unicode_string",
2260 Expression::ColumnPosition(_) => "column_position",
2261 Expression::ColumnDef(_) => "column_def",
2262 Expression::AlterColumn(_) => "alter_column",
2263 Expression::AlterSortKey(_) => "alter_sort_key",
2264 Expression::AlterSet(_) => "alter_set",
2265 Expression::RenameColumn(_) => "rename_column",
2266 Expression::Comprehension(_) => "comprehension",
2267 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2268 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2269 Expression::IndexConstraintOption(_) => "index_constraint_option",
2270 Expression::ColumnConstraint(_) => "column_constraint",
2271 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2272 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2273 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2274 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2275 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2276 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2277 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2278 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2279 Expression::WithOperator(_) => "with_operator",
2280 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2281 "generated_as_identity_column_constraint"
2282 }
2283 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2284 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2285 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2286 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2287 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2288 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2289 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2290 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2291 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2292 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2293 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2294 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2295 Expression::PathColumnConstraint(_) => "path_column_constraint",
2296 Expression::Constraint(_) => "constraint",
2297 Expression::Export(_) => "export",
2298 Expression::Filter(_) => "filter",
2299 Expression::Changes(_) => "changes",
2300 Expression::CopyParameter(_) => "copy_parameter",
2301 Expression::Credentials(_) => "credentials",
2302 Expression::Directory(_) => "directory",
2303 Expression::ForeignKey(_) => "foreign_key",
2304 Expression::ColumnPrefix(_) => "column_prefix",
2305 Expression::PrimaryKey(_) => "primary_key",
2306 Expression::IntoClause(_) => "into_clause",
2307 Expression::JoinHint(_) => "join_hint",
2308 Expression::Opclass(_) => "opclass",
2309 Expression::Index(_) => "index",
2310 Expression::IndexParameters(_) => "index_parameters",
2311 Expression::ConditionalInsert(_) => "conditional_insert",
2312 Expression::MultitableInserts(_) => "multitable_inserts",
2313 Expression::OnConflict(_) => "on_conflict",
2314 Expression::OnCondition(_) => "on_condition",
2315 Expression::Returning(_) => "returning",
2316 Expression::Introducer(_) => "introducer",
2317 Expression::PartitionRange(_) => "partition_range",
2318 Expression::Fetch(_) => "fetch",
2319 Expression::Group(_) => "group",
2320 Expression::Cube(_) => "cube",
2321 Expression::Rollup(_) => "rollup",
2322 Expression::GroupingSets(_) => "grouping_sets",
2323 Expression::LimitOptions(_) => "limit_options",
2324 Expression::Lateral(_) => "lateral",
2325 Expression::TableFromRows(_) => "table_from_rows",
2326 Expression::RowsFrom(_) => "rows_from",
2327 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2328 Expression::WithFill(_) => "with_fill",
2329 Expression::Property(_) => "property",
2330 Expression::GrantPrivilege(_) => "grant_privilege",
2331 Expression::GrantPrincipal(_) => "grant_principal",
2332 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2333 Expression::AlgorithmProperty(_) => "algorithm_property",
2334 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2335 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2336 Expression::BackupProperty(_) => "backup_property",
2337 Expression::BuildProperty(_) => "build_property",
2338 Expression::BlockCompressionProperty(_) => "block_compression_property",
2339 Expression::CharacterSetProperty(_) => "character_set_property",
2340 Expression::ChecksumProperty(_) => "checksum_property",
2341 Expression::CollateProperty(_) => "collate_property",
2342 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2343 Expression::DataDeletionProperty(_) => "data_deletion_property",
2344 Expression::DefinerProperty(_) => "definer_property",
2345 Expression::DistKeyProperty(_) => "dist_key_property",
2346 Expression::DistributedByProperty(_) => "distributed_by_property",
2347 Expression::DistStyleProperty(_) => "dist_style_property",
2348 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2349 Expression::EngineProperty(_) => "engine_property",
2350 Expression::ToTableProperty(_) => "to_table_property",
2351 Expression::ExecuteAsProperty(_) => "execute_as_property",
2352 Expression::ExternalProperty(_) => "external_property",
2353 Expression::FallbackProperty(_) => "fallback_property",
2354 Expression::FileFormatProperty(_) => "file_format_property",
2355 Expression::CredentialsProperty(_) => "credentials_property",
2356 Expression::FreespaceProperty(_) => "freespace_property",
2357 Expression::InheritsProperty(_) => "inherits_property",
2358 Expression::InputModelProperty(_) => "input_model_property",
2359 Expression::OutputModelProperty(_) => "output_model_property",
2360 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2361 Expression::JournalProperty(_) => "journal_property",
2362 Expression::LanguageProperty(_) => "language_property",
2363 Expression::EnviromentProperty(_) => "enviroment_property",
2364 Expression::ClusteredByProperty(_) => "clustered_by_property",
2365 Expression::DictProperty(_) => "dict_property",
2366 Expression::DictRange(_) => "dict_range",
2367 Expression::OnCluster(_) => "on_cluster",
2368 Expression::LikeProperty(_) => "like_property",
2369 Expression::LocationProperty(_) => "location_property",
2370 Expression::LockProperty(_) => "lock_property",
2371 Expression::LockingProperty(_) => "locking_property",
2372 Expression::LogProperty(_) => "log_property",
2373 Expression::MaterializedProperty(_) => "materialized_property",
2374 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2375 Expression::OnProperty(_) => "on_property",
2376 Expression::OnCommitProperty(_) => "on_commit_property",
2377 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2378 Expression::PartitionByProperty(_) => "partition_by_property",
2379 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2380 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2381 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2382 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2383 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2384 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2385 Expression::PartitionList(_) => "partition_list",
2386 Expression::Partition(_) => "partition",
2387 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2388 Expression::UniqueKeyProperty(_) => "unique_key_property",
2389 Expression::RollupProperty(_) => "rollup_property",
2390 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2391 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2392 Expression::RemoteWithConnectionModelProperty(_) => {
2393 "remote_with_connection_model_property"
2394 }
2395 Expression::ReturnsProperty(_) => "returns_property",
2396 Expression::RowFormatProperty(_) => "row_format_property",
2397 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2398 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2399 Expression::QueryTransform(_) => "query_transform",
2400 Expression::SampleProperty(_) => "sample_property",
2401 Expression::SecurityProperty(_) => "security_property",
2402 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2403 Expression::SemanticView(_) => "semantic_view",
2404 Expression::SerdeProperties(_) => "serde_properties",
2405 Expression::SetProperty(_) => "set_property",
2406 Expression::SharingProperty(_) => "sharing_property",
2407 Expression::SetConfigProperty(_) => "set_config_property",
2408 Expression::SettingsProperty(_) => "settings_property",
2409 Expression::SortKeyProperty(_) => "sort_key_property",
2410 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2411 Expression::SqlSecurityProperty(_) => "sql_security_property",
2412 Expression::StabilityProperty(_) => "stability_property",
2413 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2414 Expression::TemporaryProperty(_) => "temporary_property",
2415 Expression::Tags(_) => "tags",
2416 Expression::TransformModelProperty(_) => "transform_model_property",
2417 Expression::TransientProperty(_) => "transient_property",
2418 Expression::UsingTemplateProperty(_) => "using_template_property",
2419 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2420 Expression::VolatileProperty(_) => "volatile_property",
2421 Expression::WithDataProperty(_) => "with_data_property",
2422 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2423 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2424 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2425 Expression::WithProcedureOptions(_) => "with_procedure_options",
2426 Expression::EncodeProperty(_) => "encode_property",
2427 Expression::IncludeProperty(_) => "include_property",
2428 Expression::Properties(_) => "properties",
2429 Expression::OptionsProperty(_) => "options_property",
2430 Expression::InputOutputFormat(_) => "input_output_format",
2431 Expression::Reference(_) => "reference",
2432 Expression::QueryOption(_) => "query_option",
2433 Expression::WithTableHint(_) => "with_table_hint",
2434 Expression::IndexTableHint(_) => "index_table_hint",
2435 Expression::HistoricalData(_) => "historical_data",
2436 Expression::Get(_) => "get",
2437 Expression::SetOperation(_) => "set_operation",
2438 Expression::Var(_) => "var",
2439 Expression::Variadic(_) => "variadic",
2440 Expression::Version(_) => "version",
2441 Expression::Schema(_) => "schema",
2442 Expression::Lock(_) => "lock",
2443 Expression::TableSample(_) => "table_sample",
2444 Expression::Tag(_) => "tag",
2445 Expression::UnpivotColumns(_) => "unpivot_columns",
2446 Expression::WindowSpec(_) => "window_spec",
2447 Expression::SessionParameter(_) => "session_parameter",
2448 Expression::PseudoType(_) => "pseudo_type",
2449 Expression::ObjectIdentifier(_) => "object_identifier",
2450 Expression::Transaction(_) => "transaction",
2451 Expression::Commit(_) => "commit",
2452 Expression::Rollback(_) => "rollback",
2453 Expression::AlterSession(_) => "alter_session",
2454 Expression::Analyze(_) => "analyze",
2455 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2456 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2457 Expression::AnalyzeSample(_) => "analyze_sample",
2458 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2459 Expression::AnalyzeDelete(_) => "analyze_delete",
2460 Expression::AnalyzeWith(_) => "analyze_with",
2461 Expression::AnalyzeValidate(_) => "analyze_validate",
2462 Expression::AddPartition(_) => "add_partition",
2463 Expression::AttachOption(_) => "attach_option",
2464 Expression::DropPartition(_) => "drop_partition",
2465 Expression::ReplacePartition(_) => "replace_partition",
2466 Expression::DPipe(_) => "d_pipe",
2467 Expression::Operator(_) => "operator",
2468 Expression::PivotAny(_) => "pivot_any",
2469 Expression::Aliases(_) => "aliases",
2470 Expression::AtIndex(_) => "at_index",
2471 Expression::FromTimeZone(_) => "from_time_zone",
2472 Expression::FormatPhrase(_) => "format_phrase",
2473 Expression::ForIn(_) => "for_in",
2474 Expression::TimeUnit(_) => "time_unit",
2475 Expression::IntervalOp(_) => "interval_op",
2476 Expression::IntervalSpan(_) => "interval_span",
2477 Expression::HavingMax(_) => "having_max",
2478 Expression::CosineDistance(_) => "cosine_distance",
2479 Expression::DotProduct(_) => "dot_product",
2480 Expression::EuclideanDistance(_) => "euclidean_distance",
2481 Expression::ManhattanDistance(_) => "manhattan_distance",
2482 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2483 Expression::Booland(_) => "booland",
2484 Expression::Boolor(_) => "boolor",
2485 Expression::ParameterizedAgg(_) => "parameterized_agg",
2486 Expression::ArgMax(_) => "arg_max",
2487 Expression::ArgMin(_) => "arg_min",
2488 Expression::ApproxTopK(_) => "approx_top_k",
2489 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2490 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2491 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2492 Expression::ApproxTopSum(_) => "approx_top_sum",
2493 Expression::ApproxQuantiles(_) => "approx_quantiles",
2494 Expression::Minhash(_) => "minhash",
2495 Expression::FarmFingerprint(_) => "farm_fingerprint",
2496 Expression::Float64(_) => "float64",
2497 Expression::Transform(_) => "transform",
2498 Expression::Translate(_) => "translate",
2499 Expression::Grouping(_) => "grouping",
2500 Expression::GroupingId(_) => "grouping_id",
2501 Expression::Anonymous(_) => "anonymous",
2502 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2503 Expression::CombinedAggFunc(_) => "combined_agg_func",
2504 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2505 Expression::HashAgg(_) => "hash_agg",
2506 Expression::Hll(_) => "hll",
2507 Expression::Apply(_) => "apply",
2508 Expression::ToBoolean(_) => "to_boolean",
2509 Expression::List(_) => "list",
2510 Expression::ToMap(_) => "to_map",
2511 Expression::Pad(_) => "pad",
2512 Expression::ToChar(_) => "to_char",
2513 Expression::ToNumber(_) => "to_number",
2514 Expression::ToDouble(_) => "to_double",
2515 Expression::Int64(_) => "int64",
2516 Expression::StringFunc(_) => "string_func",
2517 Expression::ToDecfloat(_) => "to_decfloat",
2518 Expression::TryToDecfloat(_) => "try_to_decfloat",
2519 Expression::ToFile(_) => "to_file",
2520 Expression::Columns(_) => "columns",
2521 Expression::ConvertToCharset(_) => "convert_to_charset",
2522 Expression::ConvertTimezone(_) => "convert_timezone",
2523 Expression::GenerateSeries(_) => "generate_series",
2524 Expression::AIAgg(_) => "a_i_agg",
2525 Expression::AIClassify(_) => "a_i_classify",
2526 Expression::ArrayAll(_) => "array_all",
2527 Expression::ArrayAny(_) => "array_any",
2528 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2529 Expression::StPoint(_) => "st_point",
2530 Expression::StDistance(_) => "st_distance",
2531 Expression::StringToArray(_) => "string_to_array",
2532 Expression::ArraySum(_) => "array_sum",
2533 Expression::ObjectAgg(_) => "object_agg",
2534 Expression::CastToStrType(_) => "cast_to_str_type",
2535 Expression::CheckJson(_) => "check_json",
2536 Expression::CheckXml(_) => "check_xml",
2537 Expression::TranslateCharacters(_) => "translate_characters",
2538 Expression::CurrentSchemas(_) => "current_schemas",
2539 Expression::CurrentDatetime(_) => "current_datetime",
2540 Expression::Localtime(_) => "localtime",
2541 Expression::Localtimestamp(_) => "localtimestamp",
2542 Expression::Systimestamp(_) => "systimestamp",
2543 Expression::CurrentSchema(_) => "current_schema",
2544 Expression::CurrentUser(_) => "current_user",
2545 Expression::UtcTime(_) => "utc_time",
2546 Expression::UtcTimestamp(_) => "utc_timestamp",
2547 Expression::Timestamp(_) => "timestamp",
2548 Expression::DateBin(_) => "date_bin",
2549 Expression::Datetime(_) => "datetime",
2550 Expression::DatetimeAdd(_) => "datetime_add",
2551 Expression::DatetimeSub(_) => "datetime_sub",
2552 Expression::DatetimeDiff(_) => "datetime_diff",
2553 Expression::DatetimeTrunc(_) => "datetime_trunc",
2554 Expression::Dayname(_) => "dayname",
2555 Expression::MakeInterval(_) => "make_interval",
2556 Expression::PreviousDay(_) => "previous_day",
2557 Expression::Elt(_) => "elt",
2558 Expression::TimestampAdd(_) => "timestamp_add",
2559 Expression::TimestampSub(_) => "timestamp_sub",
2560 Expression::TimestampDiff(_) => "timestamp_diff",
2561 Expression::TimeSlice(_) => "time_slice",
2562 Expression::TimeAdd(_) => "time_add",
2563 Expression::TimeSub(_) => "time_sub",
2564 Expression::TimeDiff(_) => "time_diff",
2565 Expression::TimeTrunc(_) => "time_trunc",
2566 Expression::DateFromParts(_) => "date_from_parts",
2567 Expression::TimeFromParts(_) => "time_from_parts",
2568 Expression::DecodeCase(_) => "decode_case",
2569 Expression::Decrypt(_) => "decrypt",
2570 Expression::DecryptRaw(_) => "decrypt_raw",
2571 Expression::Encode(_) => "encode",
2572 Expression::Encrypt(_) => "encrypt",
2573 Expression::EncryptRaw(_) => "encrypt_raw",
2574 Expression::EqualNull(_) => "equal_null",
2575 Expression::ToBinary(_) => "to_binary",
2576 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2577 Expression::Base64DecodeString(_) => "base64_decode_string",
2578 Expression::Base64Encode(_) => "base64_encode",
2579 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2580 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2581 Expression::GapFill(_) => "gap_fill",
2582 Expression::GenerateDateArray(_) => "generate_date_array",
2583 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2584 Expression::GetExtract(_) => "get_extract",
2585 Expression::Getbit(_) => "getbit",
2586 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2587 Expression::HexEncode(_) => "hex_encode",
2588 Expression::Compress(_) => "compress",
2589 Expression::DecompressBinary(_) => "decompress_binary",
2590 Expression::DecompressString(_) => "decompress_string",
2591 Expression::Xor(_) => "xor",
2592 Expression::Nullif(_) => "nullif",
2593 Expression::JSON(_) => "j_s_o_n",
2594 Expression::JSONPath(_) => "j_s_o_n_path",
2595 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2596 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2597 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2598 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2599 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2600 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2601 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2602 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2603 Expression::Format(_) => "format",
2604 Expression::JSONKeys(_) => "j_s_o_n_keys",
2605 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2606 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2607 Expression::JSONObject(_) => "j_s_o_n_object",
2608 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2609 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2610 Expression::JSONArray(_) => "j_s_o_n_array",
2611 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2612 Expression::JSONExists(_) => "j_s_o_n_exists",
2613 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2614 Expression::JSONSchema(_) => "j_s_o_n_schema",
2615 Expression::JSONSet(_) => "j_s_o_n_set",
2616 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2617 Expression::JSONValue(_) => "j_s_o_n_value",
2618 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2619 Expression::JSONRemove(_) => "j_s_o_n_remove",
2620 Expression::JSONTable(_) => "j_s_o_n_table",
2621 Expression::JSONType(_) => "j_s_o_n_type",
2622 Expression::ObjectInsert(_) => "object_insert",
2623 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2624 Expression::OpenJSON(_) => "open_j_s_o_n",
2625 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2626 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2627 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2628 Expression::JSONCast(_) => "j_s_o_n_cast",
2629 Expression::JSONExtract(_) => "j_s_o_n_extract",
2630 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2631 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2632 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2633 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2634 Expression::JSONFormat(_) => "j_s_o_n_format",
2635 Expression::JSONBool(_) => "j_s_o_n_bool",
2636 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2637 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2638 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2639 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2640 Expression::ParseJSON(_) => "parse_j_s_o_n",
2641 Expression::ParseUrl(_) => "parse_url",
2642 Expression::ParseIp(_) => "parse_ip",
2643 Expression::ParseTime(_) => "parse_time",
2644 Expression::ParseDatetime(_) => "parse_datetime",
2645 Expression::Map(_) => "map",
2646 Expression::MapCat(_) => "map_cat",
2647 Expression::MapDelete(_) => "map_delete",
2648 Expression::MapInsert(_) => "map_insert",
2649 Expression::MapPick(_) => "map_pick",
2650 Expression::ScopeResolution(_) => "scope_resolution",
2651 Expression::Slice(_) => "slice",
2652 Expression::VarMap(_) => "var_map",
2653 Expression::MatchAgainst(_) => "match_against",
2654 Expression::MD5Digest(_) => "m_d5_digest",
2655 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2656 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2657 Expression::Monthname(_) => "monthname",
2658 Expression::Ntile(_) => "ntile",
2659 Expression::Normalize(_) => "normalize",
2660 Expression::Normal(_) => "normal",
2661 Expression::Predict(_) => "predict",
2662 Expression::MLTranslate(_) => "m_l_translate",
2663 Expression::FeaturesAtTime(_) => "features_at_time",
2664 Expression::GenerateEmbedding(_) => "generate_embedding",
2665 Expression::MLForecast(_) => "m_l_forecast",
2666 Expression::ModelAttribute(_) => "model_attribute",
2667 Expression::VectorSearch(_) => "vector_search",
2668 Expression::Quantile(_) => "quantile",
2669 Expression::ApproxQuantile(_) => "approx_quantile",
2670 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2671 Expression::Randn(_) => "randn",
2672 Expression::Randstr(_) => "randstr",
2673 Expression::RangeN(_) => "range_n",
2674 Expression::RangeBucket(_) => "range_bucket",
2675 Expression::ReadCSV(_) => "read_c_s_v",
2676 Expression::ReadParquet(_) => "read_parquet",
2677 Expression::Reduce(_) => "reduce",
2678 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2679 Expression::RegexpILike(_) => "regexp_i_like",
2680 Expression::RegexpFullMatch(_) => "regexp_full_match",
2681 Expression::RegexpInstr(_) => "regexp_instr",
2682 Expression::RegexpSplit(_) => "regexp_split",
2683 Expression::RegexpCount(_) => "regexp_count",
2684 Expression::RegrValx(_) => "regr_valx",
2685 Expression::RegrValy(_) => "regr_valy",
2686 Expression::RegrAvgy(_) => "regr_avgy",
2687 Expression::RegrAvgx(_) => "regr_avgx",
2688 Expression::RegrCount(_) => "regr_count",
2689 Expression::RegrIntercept(_) => "regr_intercept",
2690 Expression::RegrR2(_) => "regr_r2",
2691 Expression::RegrSxx(_) => "regr_sxx",
2692 Expression::RegrSxy(_) => "regr_sxy",
2693 Expression::RegrSyy(_) => "regr_syy",
2694 Expression::RegrSlope(_) => "regr_slope",
2695 Expression::SafeAdd(_) => "safe_add",
2696 Expression::SafeDivide(_) => "safe_divide",
2697 Expression::SafeMultiply(_) => "safe_multiply",
2698 Expression::SafeSubtract(_) => "safe_subtract",
2699 Expression::SHA2(_) => "s_h_a2",
2700 Expression::SHA2Digest(_) => "s_h_a2_digest",
2701 Expression::SortArray(_) => "sort_array",
2702 Expression::SplitPart(_) => "split_part",
2703 Expression::SubstringIndex(_) => "substring_index",
2704 Expression::StandardHash(_) => "standard_hash",
2705 Expression::StrPosition(_) => "str_position",
2706 Expression::Search(_) => "search",
2707 Expression::SearchIp(_) => "search_ip",
2708 Expression::StrToDate(_) => "str_to_date",
2709 Expression::DateStrToDate(_) => "date_str_to_date",
2710 Expression::DateToDateStr(_) => "date_to_date_str",
2711 Expression::StrToTime(_) => "str_to_time",
2712 Expression::StrToUnix(_) => "str_to_unix",
2713 Expression::StrToMap(_) => "str_to_map",
2714 Expression::NumberToStr(_) => "number_to_str",
2715 Expression::FromBase(_) => "from_base",
2716 Expression::Stuff(_) => "stuff",
2717 Expression::TimeToStr(_) => "time_to_str",
2718 Expression::TimeStrToTime(_) => "time_str_to_time",
2719 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2720 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2721 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2722 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2723 Expression::Unhex(_) => "unhex",
2724 Expression::Uniform(_) => "uniform",
2725 Expression::UnixToStr(_) => "unix_to_str",
2726 Expression::UnixToTime(_) => "unix_to_time",
2727 Expression::Uuid(_) => "uuid",
2728 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2729 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2730 Expression::Corr(_) => "corr",
2731 Expression::WidthBucket(_) => "width_bucket",
2732 Expression::CovarSamp(_) => "covar_samp",
2733 Expression::CovarPop(_) => "covar_pop",
2734 Expression::Week(_) => "week",
2735 Expression::XMLElement(_) => "x_m_l_element",
2736 Expression::XMLGet(_) => "x_m_l_get",
2737 Expression::XMLTable(_) => "x_m_l_table",
2738 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2739 Expression::Zipf(_) => "zipf",
2740 Expression::Merge(_) => "merge",
2741 Expression::When(_) => "when",
2742 Expression::Whens(_) => "whens",
2743 Expression::NextValueFor(_) => "next_value_for",
2744 Expression::ReturnStmt(_) => "return_stmt",
2745 }
2746 }
2747
2748 pub fn get_this(&self) -> Option<&Expression> {
2750 match self {
2751 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2753 Expression::Upper(f)
2755 | Expression::Lower(f)
2756 | Expression::Length(f)
2757 | Expression::LTrim(f)
2758 | Expression::RTrim(f)
2759 | Expression::Reverse(f)
2760 | Expression::Abs(f)
2761 | Expression::Sqrt(f)
2762 | Expression::Cbrt(f)
2763 | Expression::Ln(f)
2764 | Expression::Exp(f)
2765 | Expression::Sign(f)
2766 | Expression::Date(f)
2767 | Expression::Time(f)
2768 | Expression::Initcap(f)
2769 | Expression::Ascii(f)
2770 | Expression::Chr(f)
2771 | Expression::Soundex(f)
2772 | Expression::ByteLength(f)
2773 | Expression::Hex(f)
2774 | Expression::LowerHex(f)
2775 | Expression::Unicode(f)
2776 | Expression::Typeof(f)
2777 | Expression::Explode(f)
2778 | Expression::ExplodeOuter(f)
2779 | Expression::MapFromEntries(f)
2780 | Expression::MapKeys(f)
2781 | Expression::MapValues(f)
2782 | Expression::ArrayLength(f)
2783 | Expression::ArraySize(f)
2784 | Expression::Cardinality(f)
2785 | Expression::ArrayReverse(f)
2786 | Expression::ArrayDistinct(f)
2787 | Expression::ArrayFlatten(f)
2788 | Expression::ArrayCompact(f)
2789 | Expression::ToArray(f)
2790 | Expression::JsonArrayLength(f)
2791 | Expression::JsonKeys(f)
2792 | Expression::JsonType(f)
2793 | Expression::ParseJson(f)
2794 | Expression::ToJson(f)
2795 | Expression::Radians(f)
2796 | Expression::Degrees(f)
2797 | Expression::Sin(f)
2798 | Expression::Cos(f)
2799 | Expression::Tan(f)
2800 | Expression::Asin(f)
2801 | Expression::Acos(f)
2802 | Expression::Atan(f)
2803 | Expression::IsNan(f)
2804 | Expression::IsInf(f)
2805 | Expression::Year(f)
2806 | Expression::Month(f)
2807 | Expression::Day(f)
2808 | Expression::Hour(f)
2809 | Expression::Minute(f)
2810 | Expression::Second(f)
2811 | Expression::DayOfWeek(f)
2812 | Expression::DayOfWeekIso(f)
2813 | Expression::DayOfMonth(f)
2814 | Expression::DayOfYear(f)
2815 | Expression::WeekOfYear(f)
2816 | Expression::Quarter(f)
2817 | Expression::Epoch(f)
2818 | Expression::EpochMs(f)
2819 | Expression::BitwiseCount(f)
2820 | Expression::DateFromUnixDate(f)
2821 | Expression::UnixDate(f)
2822 | Expression::UnixSeconds(f)
2823 | Expression::UnixMillis(f)
2824 | Expression::UnixMicros(f)
2825 | Expression::TimeStrToDate(f)
2826 | Expression::DateToDi(f)
2827 | Expression::DiToDate(f)
2828 | Expression::TsOrDiToDi(f)
2829 | Expression::TsOrDsToDatetime(f)
2830 | Expression::TsOrDsToTimestamp(f)
2831 | Expression::YearOfWeek(f)
2832 | Expression::YearOfWeekIso(f)
2833 | Expression::SHA(f)
2834 | Expression::SHA1Digest(f)
2835 | Expression::TimeToUnix(f)
2836 | Expression::TimeStrToUnix(f)
2837 | Expression::Int64(f)
2838 | Expression::JSONBool(f)
2839 | Expression::MD5NumberLower64(f)
2840 | Expression::MD5NumberUpper64(f)
2841 | Expression::DateStrToDate(f)
2842 | Expression::DateToDateStr(f) => Some(&f.this),
2843 Expression::Power(f)
2845 | Expression::NullIf(f)
2846 | Expression::IfNull(f)
2847 | Expression::Nvl(f)
2848 | Expression::Contains(f)
2849 | Expression::StartsWith(f)
2850 | Expression::EndsWith(f)
2851 | Expression::Levenshtein(f)
2852 | Expression::ModFunc(f)
2853 | Expression::IntDiv(f)
2854 | Expression::Atan2(f)
2855 | Expression::AddMonths(f)
2856 | Expression::MonthsBetween(f)
2857 | Expression::NextDay(f)
2858 | Expression::UnixToTimeStr(f)
2859 | Expression::ArrayContains(f)
2860 | Expression::ArrayPosition(f)
2861 | Expression::ArrayAppend(f)
2862 | Expression::ArrayPrepend(f)
2863 | Expression::ArrayUnion(f)
2864 | Expression::ArrayExcept(f)
2865 | Expression::ArrayRemove(f)
2866 | Expression::StarMap(f)
2867 | Expression::MapFromArrays(f)
2868 | Expression::MapContainsKey(f)
2869 | Expression::ElementAt(f)
2870 | Expression::JsonMergePatch(f)
2871 | Expression::JSONBContains(f)
2872 | Expression::JSONBExtract(f) => Some(&f.this),
2873 Expression::Sum(af)
2875 | Expression::Avg(af)
2876 | Expression::Min(af)
2877 | Expression::Max(af)
2878 | Expression::ArrayAgg(af)
2879 | Expression::CountIf(af)
2880 | Expression::Stddev(af)
2881 | Expression::StddevPop(af)
2882 | Expression::StddevSamp(af)
2883 | Expression::Variance(af)
2884 | Expression::VarPop(af)
2885 | Expression::VarSamp(af)
2886 | Expression::Median(af)
2887 | Expression::Mode(af)
2888 | Expression::First(af)
2889 | Expression::Last(af)
2890 | Expression::AnyValue(af)
2891 | Expression::ApproxDistinct(af)
2892 | Expression::ApproxCountDistinct(af)
2893 | Expression::LogicalAnd(af)
2894 | Expression::LogicalOr(af)
2895 | Expression::Skewness(af)
2896 | Expression::ArrayConcatAgg(af)
2897 | Expression::ArrayUniqueAgg(af)
2898 | Expression::BoolXorAgg(af)
2899 | Expression::BitwiseAndAgg(af)
2900 | Expression::BitwiseOrAgg(af)
2901 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2902 Expression::And(op)
2904 | Expression::Or(op)
2905 | Expression::Add(op)
2906 | Expression::Sub(op)
2907 | Expression::Mul(op)
2908 | Expression::Div(op)
2909 | Expression::Mod(op)
2910 | Expression::Eq(op)
2911 | Expression::Neq(op)
2912 | Expression::Lt(op)
2913 | Expression::Lte(op)
2914 | Expression::Gt(op)
2915 | Expression::Gte(op)
2916 | Expression::BitwiseAnd(op)
2917 | Expression::BitwiseOr(op)
2918 | Expression::BitwiseXor(op)
2919 | Expression::Concat(op)
2920 | Expression::Adjacent(op)
2921 | Expression::TsMatch(op)
2922 | Expression::PropertyEQ(op)
2923 | Expression::ArrayContainsAll(op)
2924 | Expression::ArrayContainedBy(op)
2925 | Expression::ArrayOverlaps(op)
2926 | Expression::JSONBContainsAllTopKeys(op)
2927 | Expression::JSONBContainsAnyTopKeys(op)
2928 | Expression::JSONBDeleteAtPath(op)
2929 | Expression::ExtendsLeft(op)
2930 | Expression::ExtendsRight(op)
2931 | Expression::Is(op)
2932 | Expression::MemberOf(op)
2933 | Expression::Match(op)
2934 | Expression::NullSafeEq(op)
2935 | Expression::NullSafeNeq(op)
2936 | Expression::Glob(op)
2937 | Expression::BitwiseLeftShift(op)
2938 | Expression::BitwiseRightShift(op) => Some(&op.left),
2939 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2941 Expression::Alias(a) => Some(&a.this),
2943 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2944 Expression::Paren(p) => Some(&p.this),
2945 Expression::Annotated(a) => Some(&a.this),
2946 Expression::Subquery(s) => Some(&s.this),
2947 Expression::Where(w) => Some(&w.this),
2948 Expression::Having(h) => Some(&h.this),
2949 Expression::Qualify(q) => Some(&q.this),
2950 Expression::IsNull(i) => Some(&i.this),
2951 Expression::Exists(e) => Some(&e.this),
2952 Expression::Ordered(o) => Some(&o.this),
2953 Expression::WindowFunction(wf) => Some(&wf.this),
2954 Expression::Cte(cte) => Some(&cte.this),
2955 Expression::Between(b) => Some(&b.this),
2956 Expression::In(i) => Some(&i.this),
2957 Expression::ReturnStmt(e) => Some(e),
2958 _ => None,
2959 }
2960 }
2961
2962 pub fn get_expression(&self) -> Option<&Expression> {
2964 match self {
2965 Expression::And(op)
2967 | Expression::Or(op)
2968 | Expression::Add(op)
2969 | Expression::Sub(op)
2970 | Expression::Mul(op)
2971 | Expression::Div(op)
2972 | Expression::Mod(op)
2973 | Expression::Eq(op)
2974 | Expression::Neq(op)
2975 | Expression::Lt(op)
2976 | Expression::Lte(op)
2977 | Expression::Gt(op)
2978 | Expression::Gte(op)
2979 | Expression::BitwiseAnd(op)
2980 | Expression::BitwiseOr(op)
2981 | Expression::BitwiseXor(op)
2982 | Expression::Concat(op)
2983 | Expression::Adjacent(op)
2984 | Expression::TsMatch(op)
2985 | Expression::PropertyEQ(op)
2986 | Expression::ArrayContainsAll(op)
2987 | Expression::ArrayContainedBy(op)
2988 | Expression::ArrayOverlaps(op)
2989 | Expression::JSONBContainsAllTopKeys(op)
2990 | Expression::JSONBContainsAnyTopKeys(op)
2991 | Expression::JSONBDeleteAtPath(op)
2992 | Expression::ExtendsLeft(op)
2993 | Expression::ExtendsRight(op)
2994 | Expression::Is(op)
2995 | Expression::MemberOf(op)
2996 | Expression::Match(op)
2997 | Expression::NullSafeEq(op)
2998 | Expression::NullSafeNeq(op)
2999 | Expression::Glob(op)
3000 | Expression::BitwiseLeftShift(op)
3001 | Expression::BitwiseRightShift(op) => Some(&op.right),
3002 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3004 Expression::Power(f)
3006 | Expression::NullIf(f)
3007 | Expression::IfNull(f)
3008 | Expression::Nvl(f)
3009 | Expression::Contains(f)
3010 | Expression::StartsWith(f)
3011 | Expression::EndsWith(f)
3012 | Expression::Levenshtein(f)
3013 | Expression::ModFunc(f)
3014 | Expression::IntDiv(f)
3015 | Expression::Atan2(f)
3016 | Expression::AddMonths(f)
3017 | Expression::MonthsBetween(f)
3018 | Expression::NextDay(f)
3019 | Expression::UnixToTimeStr(f)
3020 | Expression::ArrayContains(f)
3021 | Expression::ArrayPosition(f)
3022 | Expression::ArrayAppend(f)
3023 | Expression::ArrayPrepend(f)
3024 | Expression::ArrayUnion(f)
3025 | Expression::ArrayExcept(f)
3026 | Expression::ArrayRemove(f)
3027 | Expression::StarMap(f)
3028 | Expression::MapFromArrays(f)
3029 | Expression::MapContainsKey(f)
3030 | Expression::ElementAt(f)
3031 | Expression::JsonMergePatch(f)
3032 | Expression::JSONBContains(f)
3033 | Expression::JSONBExtract(f) => Some(&f.expression),
3034 _ => None,
3035 }
3036 }
3037
3038 pub fn get_expressions(&self) -> &[Expression] {
3040 match self {
3041 Expression::Select(s) => &s.expressions,
3042 Expression::Function(f) => &f.args,
3043 Expression::AggregateFunction(f) => &f.args,
3044 Expression::From(f) => &f.expressions,
3045 Expression::GroupBy(g) => &g.expressions,
3046 Expression::In(i) => &i.expressions,
3047 Expression::Array(a) => &a.expressions,
3048 Expression::Tuple(t) => &t.expressions,
3049 Expression::Coalesce(f)
3050 | Expression::Greatest(f)
3051 | Expression::Least(f)
3052 | Expression::ArrayConcat(f)
3053 | Expression::ArrayIntersect(f)
3054 | Expression::ArrayZip(f)
3055 | Expression::MapConcat(f)
3056 | Expression::JsonArray(f) => &f.expressions,
3057 _ => &[],
3058 }
3059 }
3060
3061 pub fn get_name(&self) -> &str {
3063 match self {
3064 Expression::Identifier(id) => &id.name,
3065 Expression::Column(col) => &col.name.name,
3066 Expression::Table(t) => &t.name.name,
3067 Expression::Literal(lit) => lit.value_str(),
3068 Expression::Star(_) => "*",
3069 Expression::Function(f) => &f.name,
3070 Expression::AggregateFunction(f) => &f.name,
3071 Expression::Alias(a) => a.this.get_name(),
3072 Expression::Boolean(b) => {
3073 if b.value {
3074 "TRUE"
3075 } else {
3076 "FALSE"
3077 }
3078 }
3079 Expression::Null(_) => "NULL",
3080 _ => "",
3081 }
3082 }
3083
3084 pub fn get_alias(&self) -> &str {
3086 match self {
3087 Expression::Alias(a) => &a.alias.name,
3088 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3089 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3090 _ => "",
3091 }
3092 }
3093
3094 pub fn get_output_name(&self) -> &str {
3096 match self {
3097 Expression::Alias(a) => &a.alias.name,
3098 Expression::Column(c) => &c.name.name,
3099 Expression::Identifier(id) => &id.name,
3100 Expression::Literal(lit) => lit.value_str(),
3101 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3102 Expression::Star(_) => "*",
3103 _ => "",
3104 }
3105 }
3106
3107 pub fn get_comments(&self) -> Vec<&str> {
3109 match self {
3110 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3111 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3112 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3113 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3114 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3115 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3116 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3117 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3118 }
3119 Expression::And(op)
3120 | Expression::Or(op)
3121 | Expression::Add(op)
3122 | Expression::Sub(op)
3123 | Expression::Mul(op)
3124 | Expression::Div(op)
3125 | Expression::Mod(op)
3126 | Expression::Eq(op)
3127 | Expression::Neq(op)
3128 | Expression::Lt(op)
3129 | Expression::Lte(op)
3130 | Expression::Gt(op)
3131 | Expression::Gte(op)
3132 | Expression::Concat(op)
3133 | Expression::BitwiseAnd(op)
3134 | Expression::BitwiseOr(op)
3135 | Expression::BitwiseXor(op) => {
3136 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3137 }
3138 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3139 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3140 _ => Vec::new(),
3141 }
3142 }
3143}
3144
3145impl fmt::Display for Expression {
3146 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3147 match self {
3149 Expression::Literal(lit) => write!(f, "{}", lit),
3150 Expression::Identifier(id) => write!(f, "{}", id),
3151 Expression::Column(col) => write!(f, "{}", col),
3152 Expression::Star(_) => write!(f, "*"),
3153 Expression::Null(_) => write!(f, "NULL"),
3154 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3155 Expression::Select(_) => write!(f, "SELECT ..."),
3156 _ => write!(f, "{:?}", self),
3157 }
3158 }
3159}
3160
3161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3171#[cfg_attr(feature = "bindings", derive(TS))]
3172#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3173pub enum Literal {
3174 String(String),
3176 Number(String),
3178 HexString(String),
3180 HexNumber(String),
3182 BitString(String),
3183 ByteString(String),
3185 NationalString(String),
3187 Date(String),
3189 Time(String),
3191 Timestamp(String),
3193 Datetime(String),
3195 TripleQuotedString(String, char),
3198 EscapeString(String),
3200 DollarString(String),
3202 RawString(String),
3206}
3207
3208impl Literal {
3209 pub fn value_str(&self) -> &str {
3211 match self {
3212 Literal::String(s)
3213 | Literal::Number(s)
3214 | Literal::HexString(s)
3215 | Literal::HexNumber(s)
3216 | Literal::BitString(s)
3217 | Literal::ByteString(s)
3218 | Literal::NationalString(s)
3219 | Literal::Date(s)
3220 | Literal::Time(s)
3221 | Literal::Timestamp(s)
3222 | Literal::Datetime(s)
3223 | Literal::EscapeString(s)
3224 | Literal::DollarString(s)
3225 | Literal::RawString(s) => s.as_str(),
3226 Literal::TripleQuotedString(s, _) => s.as_str(),
3227 }
3228 }
3229
3230 pub fn is_string(&self) -> bool {
3232 matches!(
3233 self,
3234 Literal::String(_)
3235 | Literal::NationalString(_)
3236 | Literal::EscapeString(_)
3237 | Literal::DollarString(_)
3238 | Literal::RawString(_)
3239 | Literal::TripleQuotedString(_, _)
3240 )
3241 }
3242
3243 pub fn is_number(&self) -> bool {
3245 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3246 }
3247}
3248
3249impl fmt::Display for Literal {
3250 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3251 match self {
3252 Literal::String(s) => write!(f, "'{}'", s),
3253 Literal::Number(n) => write!(f, "{}", n),
3254 Literal::HexString(h) => write!(f, "X'{}'", h),
3255 Literal::HexNumber(h) => write!(f, "0x{}", h),
3256 Literal::BitString(b) => write!(f, "B'{}'", b),
3257 Literal::ByteString(b) => write!(f, "b'{}'", b),
3258 Literal::NationalString(s) => write!(f, "N'{}'", s),
3259 Literal::Date(d) => write!(f, "DATE '{}'", d),
3260 Literal::Time(t) => write!(f, "TIME '{}'", t),
3261 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3262 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3263 Literal::TripleQuotedString(s, q) => {
3264 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3265 }
3266 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3267 Literal::DollarString(s) => write!(f, "$${}$$", s),
3268 Literal::RawString(s) => write!(f, "r'{}'", s),
3269 }
3270 }
3271}
3272
3273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3275#[cfg_attr(feature = "bindings", derive(TS))]
3276pub struct BooleanLiteral {
3277 pub value: bool,
3278}
3279
3280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3282#[cfg_attr(feature = "bindings", derive(TS))]
3283pub struct Null;
3284
3285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3292#[cfg_attr(feature = "bindings", derive(TS))]
3293pub struct Identifier {
3294 pub name: String,
3296 pub quoted: bool,
3298 #[serde(default)]
3299 pub trailing_comments: Vec<String>,
3300 #[serde(default, skip_serializing_if = "Option::is_none")]
3302 pub span: Option<Span>,
3303}
3304
3305impl Identifier {
3306 pub fn new(name: impl Into<String>) -> Self {
3307 Self {
3308 name: name.into(),
3309 quoted: false,
3310 trailing_comments: Vec::new(),
3311 span: None,
3312 }
3313 }
3314
3315 pub fn quoted(name: impl Into<String>) -> Self {
3316 Self {
3317 name: name.into(),
3318 quoted: true,
3319 trailing_comments: Vec::new(),
3320 span: None,
3321 }
3322 }
3323
3324 pub fn empty() -> Self {
3325 Self {
3326 name: String::new(),
3327 quoted: false,
3328 trailing_comments: Vec::new(),
3329 span: None,
3330 }
3331 }
3332
3333 pub fn is_empty(&self) -> bool {
3334 self.name.is_empty()
3335 }
3336
3337 pub fn with_span(mut self, span: Span) -> Self {
3339 self.span = Some(span);
3340 self
3341 }
3342}
3343
3344impl fmt::Display for Identifier {
3345 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3346 if self.quoted {
3347 write!(f, "\"{}\"", self.name)
3348 } else {
3349 write!(f, "{}", self.name)
3350 }
3351 }
3352}
3353
3354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3360#[cfg_attr(feature = "bindings", derive(TS))]
3361pub struct Column {
3362 pub name: Identifier,
3364 pub table: Option<Identifier>,
3366 #[serde(default)]
3368 pub join_mark: bool,
3369 #[serde(default)]
3371 pub trailing_comments: Vec<String>,
3372 #[serde(default, skip_serializing_if = "Option::is_none")]
3374 pub span: Option<Span>,
3375 #[serde(default, skip_serializing_if = "Option::is_none")]
3377 pub inferred_type: Option<DataType>,
3378}
3379
3380impl fmt::Display for Column {
3381 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3382 if let Some(table) = &self.table {
3383 write!(f, "{}.{}", table, self.name)
3384 } else {
3385 write!(f, "{}", self.name)
3386 }
3387 }
3388}
3389
3390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3397#[cfg_attr(feature = "bindings", derive(TS))]
3398pub struct TableRef {
3399 pub name: Identifier,
3401 pub schema: Option<Identifier>,
3403 pub catalog: Option<Identifier>,
3405 pub alias: Option<Identifier>,
3407 #[serde(default)]
3409 pub alias_explicit_as: bool,
3410 #[serde(default)]
3412 pub column_aliases: Vec<Identifier>,
3413 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3415 pub leading_comments: Vec<String>,
3416 #[serde(default)]
3418 pub trailing_comments: Vec<String>,
3419 #[serde(default)]
3421 pub when: Option<Box<HistoricalData>>,
3422 #[serde(default)]
3424 pub only: bool,
3425 #[serde(default)]
3427 pub final_: bool,
3428 #[serde(default, skip_serializing_if = "Option::is_none")]
3430 pub table_sample: Option<Box<Sample>>,
3431 #[serde(default)]
3433 pub hints: Vec<Expression>,
3434 #[serde(default, skip_serializing_if = "Option::is_none")]
3437 pub system_time: Option<String>,
3438 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3440 pub partitions: Vec<Identifier>,
3441 #[serde(default, skip_serializing_if = "Option::is_none")]
3444 pub identifier_func: Option<Box<Expression>>,
3445 #[serde(default, skip_serializing_if = "Option::is_none")]
3447 pub changes: Option<Box<Changes>>,
3448 #[serde(default, skip_serializing_if = "Option::is_none")]
3450 pub version: Option<Box<Version>>,
3451 #[serde(default, skip_serializing_if = "Option::is_none")]
3453 pub span: Option<Span>,
3454}
3455
3456impl TableRef {
3457 pub fn new(name: impl Into<String>) -> Self {
3458 Self {
3459 name: Identifier::new(name),
3460 schema: None,
3461 catalog: None,
3462 alias: None,
3463 alias_explicit_as: false,
3464 column_aliases: Vec::new(),
3465 leading_comments: Vec::new(),
3466 trailing_comments: Vec::new(),
3467 when: None,
3468 only: false,
3469 final_: false,
3470 table_sample: None,
3471 hints: Vec::new(),
3472 system_time: None,
3473 partitions: Vec::new(),
3474 identifier_func: None,
3475 changes: None,
3476 version: None,
3477 span: None,
3478 }
3479 }
3480
3481 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3483 let mut t = Self::new(name);
3484 t.schema = Some(Identifier::new(schema));
3485 t
3486 }
3487
3488 pub fn new_with_catalog(
3490 name: impl Into<String>,
3491 schema: impl Into<String>,
3492 catalog: impl Into<String>,
3493 ) -> Self {
3494 let mut t = Self::new(name);
3495 t.schema = Some(Identifier::new(schema));
3496 t.catalog = Some(Identifier::new(catalog));
3497 t
3498 }
3499
3500 pub fn from_identifier(name: Identifier) -> Self {
3502 Self {
3503 name,
3504 schema: None,
3505 catalog: None,
3506 alias: None,
3507 alias_explicit_as: false,
3508 column_aliases: Vec::new(),
3509 leading_comments: Vec::new(),
3510 trailing_comments: Vec::new(),
3511 when: None,
3512 only: false,
3513 final_: false,
3514 table_sample: None,
3515 hints: Vec::new(),
3516 system_time: None,
3517 partitions: Vec::new(),
3518 identifier_func: None,
3519 changes: None,
3520 version: None,
3521 span: None,
3522 }
3523 }
3524
3525 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3526 self.alias = Some(Identifier::new(alias));
3527 self
3528 }
3529
3530 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3531 self.schema = Some(Identifier::new(schema));
3532 self
3533 }
3534}
3535
3536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3541#[cfg_attr(feature = "bindings", derive(TS))]
3542pub struct Star {
3543 pub table: Option<Identifier>,
3545 pub except: Option<Vec<Identifier>>,
3547 pub replace: Option<Vec<Alias>>,
3549 pub rename: Option<Vec<(Identifier, Identifier)>>,
3551 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3553 pub trailing_comments: Vec<String>,
3554 #[serde(default, skip_serializing_if = "Option::is_none")]
3556 pub span: Option<Span>,
3557}
3558
3559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3583#[cfg_attr(feature = "bindings", derive(TS))]
3584pub struct Select {
3585 pub expressions: Vec<Expression>,
3587 pub from: Option<From>,
3589 pub joins: Vec<Join>,
3591 pub lateral_views: Vec<LateralView>,
3592 #[serde(default, skip_serializing_if = "Option::is_none")]
3594 pub prewhere: Option<Expression>,
3595 pub where_clause: Option<Where>,
3596 pub group_by: Option<GroupBy>,
3597 pub having: Option<Having>,
3598 pub qualify: Option<Qualify>,
3599 pub order_by: Option<OrderBy>,
3600 pub distribute_by: Option<DistributeBy>,
3601 pub cluster_by: Option<ClusterBy>,
3602 pub sort_by: Option<SortBy>,
3603 pub limit: Option<Limit>,
3604 pub offset: Option<Offset>,
3605 #[serde(default, skip_serializing_if = "Option::is_none")]
3607 pub limit_by: Option<Vec<Expression>>,
3608 pub fetch: Option<Fetch>,
3609 pub distinct: bool,
3610 pub distinct_on: Option<Vec<Expression>>,
3611 pub top: Option<Top>,
3612 pub with: Option<With>,
3613 pub sample: Option<Sample>,
3614 #[serde(default, skip_serializing_if = "Option::is_none")]
3616 pub settings: Option<Vec<Expression>>,
3617 #[serde(default, skip_serializing_if = "Option::is_none")]
3619 pub format: Option<Expression>,
3620 pub windows: Option<Vec<NamedWindow>>,
3621 pub hint: Option<Hint>,
3622 pub connect: Option<Connect>,
3624 pub into: Option<SelectInto>,
3626 #[serde(default)]
3628 pub locks: Vec<Lock>,
3629 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3631 pub for_xml: Vec<Expression>,
3632 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub for_json: Vec<Expression>,
3635 #[serde(default)]
3637 pub leading_comments: Vec<String>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3641 pub post_select_comments: Vec<String>,
3642 #[serde(default, skip_serializing_if = "Option::is_none")]
3644 pub kind: Option<String>,
3645 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3647 pub operation_modifiers: Vec<String>,
3648 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3650 pub qualify_after_window: bool,
3651 #[serde(default, skip_serializing_if = "Option::is_none")]
3653 pub option: Option<String>,
3654 #[serde(default, skip_serializing_if = "Option::is_none")]
3657 pub exclude: Option<Vec<Expression>>,
3658}
3659
3660impl Select {
3661 pub fn new() -> Self {
3662 Self {
3663 expressions: Vec::new(),
3664 from: None,
3665 joins: Vec::new(),
3666 lateral_views: Vec::new(),
3667 prewhere: None,
3668 where_clause: None,
3669 group_by: None,
3670 having: None,
3671 qualify: None,
3672 order_by: None,
3673 distribute_by: None,
3674 cluster_by: None,
3675 sort_by: None,
3676 limit: None,
3677 offset: None,
3678 limit_by: None,
3679 fetch: None,
3680 distinct: false,
3681 distinct_on: None,
3682 top: None,
3683 with: None,
3684 sample: None,
3685 settings: None,
3686 format: None,
3687 windows: None,
3688 hint: None,
3689 connect: None,
3690 into: None,
3691 locks: Vec::new(),
3692 for_xml: Vec::new(),
3693 for_json: Vec::new(),
3694 leading_comments: Vec::new(),
3695 post_select_comments: Vec::new(),
3696 kind: None,
3697 operation_modifiers: Vec::new(),
3698 qualify_after_window: false,
3699 option: None,
3700 exclude: None,
3701 }
3702 }
3703
3704 pub fn column(mut self, expr: Expression) -> Self {
3706 self.expressions.push(expr);
3707 self
3708 }
3709
3710 pub fn from(mut self, table: Expression) -> Self {
3712 self.from = Some(From {
3713 expressions: vec![table],
3714 });
3715 self
3716 }
3717
3718 pub fn where_(mut self, condition: Expression) -> Self {
3720 self.where_clause = Some(Where { this: condition });
3721 self
3722 }
3723
3724 pub fn distinct(mut self) -> Self {
3726 self.distinct = true;
3727 self
3728 }
3729
3730 pub fn join(mut self, join: Join) -> Self {
3732 self.joins.push(join);
3733 self
3734 }
3735
3736 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3738 self.order_by = Some(OrderBy {
3739 expressions,
3740 siblings: false,
3741 comments: Vec::new(),
3742 });
3743 self
3744 }
3745
3746 pub fn limit(mut self, n: Expression) -> Self {
3748 self.limit = Some(Limit {
3749 this: n,
3750 percent: false,
3751 comments: Vec::new(),
3752 });
3753 self
3754 }
3755
3756 pub fn offset(mut self, n: Expression) -> Self {
3758 self.offset = Some(Offset {
3759 this: n,
3760 rows: None,
3761 });
3762 self
3763 }
3764}
3765
3766impl Default for Select {
3767 fn default() -> Self {
3768 Self::new()
3769 }
3770}
3771
3772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3778#[cfg_attr(feature = "bindings", derive(TS))]
3779pub struct Union {
3780 pub left: Expression,
3782 pub right: Expression,
3784 pub all: bool,
3786 #[serde(default)]
3788 pub distinct: bool,
3789 pub with: Option<With>,
3791 pub order_by: Option<OrderBy>,
3793 pub limit: Option<Box<Expression>>,
3795 pub offset: Option<Box<Expression>>,
3797 #[serde(default, skip_serializing_if = "Option::is_none")]
3799 pub distribute_by: Option<DistributeBy>,
3800 #[serde(default, skip_serializing_if = "Option::is_none")]
3802 pub sort_by: Option<SortBy>,
3803 #[serde(default, skip_serializing_if = "Option::is_none")]
3805 pub cluster_by: Option<ClusterBy>,
3806 #[serde(default)]
3808 pub by_name: bool,
3809 #[serde(default, skip_serializing_if = "Option::is_none")]
3811 pub side: Option<String>,
3812 #[serde(default, skip_serializing_if = "Option::is_none")]
3814 pub kind: Option<String>,
3815 #[serde(default)]
3817 pub corresponding: bool,
3818 #[serde(default)]
3820 pub strict: bool,
3821 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3823 pub on_columns: Vec<Expression>,
3824}
3825
3826impl Drop for Union {
3829 fn drop(&mut self) {
3830 loop {
3831 if let Expression::Union(ref mut inner) = self.left {
3832 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3833 let old_left = std::mem::replace(&mut self.left, next_left);
3834 drop(old_left);
3835 } else {
3836 break;
3837 }
3838 }
3839 }
3840}
3841
3842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3847#[cfg_attr(feature = "bindings", derive(TS))]
3848pub struct Intersect {
3849 pub left: Expression,
3851 pub right: Expression,
3853 pub all: bool,
3855 #[serde(default)]
3857 pub distinct: bool,
3858 pub with: Option<With>,
3860 pub order_by: Option<OrderBy>,
3862 pub limit: Option<Box<Expression>>,
3864 pub offset: Option<Box<Expression>>,
3866 #[serde(default, skip_serializing_if = "Option::is_none")]
3868 pub distribute_by: Option<DistributeBy>,
3869 #[serde(default, skip_serializing_if = "Option::is_none")]
3871 pub sort_by: Option<SortBy>,
3872 #[serde(default, skip_serializing_if = "Option::is_none")]
3874 pub cluster_by: Option<ClusterBy>,
3875 #[serde(default)]
3877 pub by_name: bool,
3878 #[serde(default, skip_serializing_if = "Option::is_none")]
3880 pub side: Option<String>,
3881 #[serde(default, skip_serializing_if = "Option::is_none")]
3883 pub kind: Option<String>,
3884 #[serde(default)]
3886 pub corresponding: bool,
3887 #[serde(default)]
3889 pub strict: bool,
3890 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3892 pub on_columns: Vec<Expression>,
3893}
3894
3895impl Drop for Intersect {
3896 fn drop(&mut self) {
3897 loop {
3898 if let Expression::Intersect(ref mut inner) = self.left {
3899 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3900 let old_left = std::mem::replace(&mut self.left, next_left);
3901 drop(old_left);
3902 } else {
3903 break;
3904 }
3905 }
3906 }
3907}
3908
3909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3914#[cfg_attr(feature = "bindings", derive(TS))]
3915pub struct Except {
3916 pub left: Expression,
3918 pub right: Expression,
3920 pub all: bool,
3922 #[serde(default)]
3924 pub distinct: bool,
3925 pub with: Option<With>,
3927 pub order_by: Option<OrderBy>,
3929 pub limit: Option<Box<Expression>>,
3931 pub offset: Option<Box<Expression>>,
3933 #[serde(default, skip_serializing_if = "Option::is_none")]
3935 pub distribute_by: Option<DistributeBy>,
3936 #[serde(default, skip_serializing_if = "Option::is_none")]
3938 pub sort_by: Option<SortBy>,
3939 #[serde(default, skip_serializing_if = "Option::is_none")]
3941 pub cluster_by: Option<ClusterBy>,
3942 #[serde(default)]
3944 pub by_name: bool,
3945 #[serde(default, skip_serializing_if = "Option::is_none")]
3947 pub side: Option<String>,
3948 #[serde(default, skip_serializing_if = "Option::is_none")]
3950 pub kind: Option<String>,
3951 #[serde(default)]
3953 pub corresponding: bool,
3954 #[serde(default)]
3956 pub strict: bool,
3957 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3959 pub on_columns: Vec<Expression>,
3960}
3961
3962impl Drop for Except {
3963 fn drop(&mut self) {
3964 loop {
3965 if let Expression::Except(ref mut inner) = self.left {
3966 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3967 let old_left = std::mem::replace(&mut self.left, next_left);
3968 drop(old_left);
3969 } else {
3970 break;
3971 }
3972 }
3973 }
3974}
3975
3976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3978#[cfg_attr(feature = "bindings", derive(TS))]
3979pub struct SelectInto {
3980 pub this: Expression,
3982 #[serde(default)]
3984 pub temporary: bool,
3985 #[serde(default)]
3987 pub unlogged: bool,
3988 #[serde(default)]
3990 pub bulk_collect: bool,
3991 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3993 pub expressions: Vec<Expression>,
3994}
3995
3996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4006#[cfg_attr(feature = "bindings", derive(TS))]
4007pub struct Subquery {
4008 pub this: Expression,
4010 pub alias: Option<Identifier>,
4012 pub column_aliases: Vec<Identifier>,
4014 pub order_by: Option<OrderBy>,
4016 pub limit: Option<Limit>,
4018 pub offset: Option<Offset>,
4020 #[serde(default, skip_serializing_if = "Option::is_none")]
4022 pub distribute_by: Option<DistributeBy>,
4023 #[serde(default, skip_serializing_if = "Option::is_none")]
4025 pub sort_by: Option<SortBy>,
4026 #[serde(default, skip_serializing_if = "Option::is_none")]
4028 pub cluster_by: Option<ClusterBy>,
4029 #[serde(default)]
4031 pub lateral: bool,
4032 #[serde(default)]
4036 pub modifiers_inside: bool,
4037 #[serde(default)]
4039 pub trailing_comments: Vec<String>,
4040 #[serde(default, skip_serializing_if = "Option::is_none")]
4042 pub inferred_type: Option<DataType>,
4043}
4044
4045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4050#[cfg_attr(feature = "bindings", derive(TS))]
4051pub struct PipeOperator {
4052 pub this: Expression,
4054 pub expression: Expression,
4056}
4057
4058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4060#[cfg_attr(feature = "bindings", derive(TS))]
4061pub struct Values {
4062 pub expressions: Vec<Tuple>,
4064 pub alias: Option<Identifier>,
4066 pub column_aliases: Vec<Identifier>,
4068}
4069
4070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4080#[cfg_attr(feature = "bindings", derive(TS))]
4081pub struct Pivot {
4082 pub this: Expression,
4084 #[serde(default)]
4087 pub expressions: Vec<Expression>,
4088 #[serde(default)]
4090 pub fields: Vec<Expression>,
4091 #[serde(default)]
4093 pub using: Vec<Expression>,
4094 #[serde(default)]
4096 pub group: Option<Box<Expression>>,
4097 #[serde(default)]
4099 pub unpivot: bool,
4100 #[serde(default)]
4102 pub into: Option<Box<Expression>>,
4103 #[serde(default)]
4105 pub alias: Option<Identifier>,
4106 #[serde(default)]
4108 pub include_nulls: Option<bool>,
4109 #[serde(default)]
4111 pub default_on_null: Option<Box<Expression>>,
4112 #[serde(default, skip_serializing_if = "Option::is_none")]
4114 pub with: Option<With>,
4115}
4116
4117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4119#[cfg_attr(feature = "bindings", derive(TS))]
4120pub struct Unpivot {
4121 pub this: Expression,
4122 pub value_column: Identifier,
4123 pub name_column: Identifier,
4124 pub columns: Vec<Expression>,
4125 pub alias: Option<Identifier>,
4126 #[serde(default)]
4128 pub value_column_parenthesized: bool,
4129 #[serde(default)]
4131 pub include_nulls: Option<bool>,
4132 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4134 pub extra_value_columns: Vec<Identifier>,
4135}
4136
4137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4140#[cfg_attr(feature = "bindings", derive(TS))]
4141pub struct PivotAlias {
4142 pub this: Expression,
4143 pub alias: Expression,
4144}
4145
4146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4148#[cfg_attr(feature = "bindings", derive(TS))]
4149pub struct PreWhere {
4150 pub this: Expression,
4151}
4152
4153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4155#[cfg_attr(feature = "bindings", derive(TS))]
4156pub struct Stream {
4157 pub this: Expression,
4158 #[serde(skip_serializing_if = "Option::is_none")]
4159 pub on: Option<Expression>,
4160 #[serde(skip_serializing_if = "Option::is_none")]
4161 pub show_initial_rows: Option<bool>,
4162}
4163
4164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4166#[cfg_attr(feature = "bindings", derive(TS))]
4167pub struct UsingData {
4168 pub this: Expression,
4169}
4170
4171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4173#[cfg_attr(feature = "bindings", derive(TS))]
4174pub struct XmlNamespace {
4175 pub this: Expression,
4176 #[serde(skip_serializing_if = "Option::is_none")]
4177 pub alias: Option<Identifier>,
4178}
4179
4180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4182#[cfg_attr(feature = "bindings", derive(TS))]
4183pub struct RowFormat {
4184 pub delimited: bool,
4185 pub fields_terminated_by: Option<String>,
4186 pub collection_items_terminated_by: Option<String>,
4187 pub map_keys_terminated_by: Option<String>,
4188 pub lines_terminated_by: Option<String>,
4189 pub null_defined_as: Option<String>,
4190}
4191
4192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4194#[cfg_attr(feature = "bindings", derive(TS))]
4195pub struct DirectoryInsert {
4196 pub local: bool,
4197 pub path: String,
4198 pub row_format: Option<RowFormat>,
4199 #[serde(default)]
4201 pub stored_as: Option<String>,
4202}
4203
4204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4206#[cfg_attr(feature = "bindings", derive(TS))]
4207pub struct Insert {
4208 pub table: TableRef,
4209 pub columns: Vec<Identifier>,
4210 pub values: Vec<Vec<Expression>>,
4211 pub query: Option<Expression>,
4212 pub overwrite: bool,
4214 pub partition: Vec<(Identifier, Option<Expression>)>,
4216 #[serde(default)]
4218 pub directory: Option<DirectoryInsert>,
4219 #[serde(default)]
4221 pub returning: Vec<Expression>,
4222 #[serde(default)]
4224 pub output: Option<OutputClause>,
4225 #[serde(default)]
4227 pub on_conflict: Option<Box<Expression>>,
4228 #[serde(default)]
4230 pub leading_comments: Vec<String>,
4231 #[serde(default)]
4233 pub if_exists: bool,
4234 #[serde(default)]
4236 pub with: Option<With>,
4237 #[serde(default)]
4239 pub ignore: bool,
4240 #[serde(default)]
4242 pub source_alias: Option<Identifier>,
4243 #[serde(default)]
4245 pub alias: Option<Identifier>,
4246 #[serde(default)]
4248 pub alias_explicit_as: bool,
4249 #[serde(default)]
4251 pub default_values: bool,
4252 #[serde(default)]
4254 pub by_name: bool,
4255 #[serde(default, skip_serializing_if = "Option::is_none")]
4257 pub conflict_action: Option<String>,
4258 #[serde(default)]
4260 pub is_replace: bool,
4261 #[serde(default, skip_serializing_if = "Option::is_none")]
4263 pub hint: Option<Hint>,
4264 #[serde(default)]
4266 pub replace_where: Option<Box<Expression>>,
4267 #[serde(default)]
4269 pub source: Option<Box<Expression>>,
4270 #[serde(default, skip_serializing_if = "Option::is_none")]
4272 pub function_target: Option<Box<Expression>>,
4273 #[serde(default, skip_serializing_if = "Option::is_none")]
4275 pub partition_by: Option<Box<Expression>>,
4276 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4278 pub settings: Vec<Expression>,
4279}
4280
4281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4283#[cfg_attr(feature = "bindings", derive(TS))]
4284pub struct OutputClause {
4285 pub columns: Vec<Expression>,
4287 #[serde(default)]
4289 pub into_table: Option<Expression>,
4290}
4291
4292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4294#[cfg_attr(feature = "bindings", derive(TS))]
4295pub struct Update {
4296 pub table: TableRef,
4297 #[serde(default)]
4299 pub extra_tables: Vec<TableRef>,
4300 #[serde(default)]
4302 pub table_joins: Vec<Join>,
4303 pub set: Vec<(Identifier, Expression)>,
4304 pub from_clause: Option<From>,
4305 #[serde(default)]
4307 pub from_joins: Vec<Join>,
4308 pub where_clause: Option<Where>,
4309 #[serde(default)]
4311 pub returning: Vec<Expression>,
4312 #[serde(default)]
4314 pub output: Option<OutputClause>,
4315 #[serde(default)]
4317 pub with: Option<With>,
4318 #[serde(default)]
4320 pub leading_comments: Vec<String>,
4321 #[serde(default)]
4323 pub limit: Option<Expression>,
4324 #[serde(default)]
4326 pub order_by: Option<OrderBy>,
4327 #[serde(default)]
4329 pub from_before_set: bool,
4330}
4331
4332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4334#[cfg_attr(feature = "bindings", derive(TS))]
4335pub struct Delete {
4336 pub table: TableRef,
4337 #[serde(default, skip_serializing_if = "Option::is_none")]
4339 pub on_cluster: Option<OnCluster>,
4340 pub alias: Option<Identifier>,
4342 #[serde(default)]
4344 pub alias_explicit_as: bool,
4345 pub using: Vec<TableRef>,
4347 pub where_clause: Option<Where>,
4348 #[serde(default)]
4350 pub output: Option<OutputClause>,
4351 #[serde(default)]
4353 pub leading_comments: Vec<String>,
4354 #[serde(default)]
4356 pub with: Option<With>,
4357 #[serde(default)]
4359 pub limit: Option<Expression>,
4360 #[serde(default)]
4362 pub order_by: Option<OrderBy>,
4363 #[serde(default)]
4365 pub returning: Vec<Expression>,
4366 #[serde(default)]
4369 pub tables: Vec<TableRef>,
4370 #[serde(default)]
4373 pub tables_from_using: bool,
4374 #[serde(default)]
4376 pub joins: Vec<Join>,
4377 #[serde(default)]
4379 pub force_index: Option<String>,
4380 #[serde(default)]
4382 pub no_from: bool,
4383}
4384
4385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4387#[cfg_attr(feature = "bindings", derive(TS))]
4388pub struct CopyStmt {
4389 pub this: Expression,
4391 pub kind: bool,
4393 pub files: Vec<Expression>,
4395 #[serde(default)]
4397 pub params: Vec<CopyParameter>,
4398 #[serde(default)]
4400 pub credentials: Option<Box<Credentials>>,
4401 #[serde(default)]
4403 pub is_into: bool,
4404 #[serde(default)]
4406 pub with_wrapped: bool,
4407}
4408
4409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4411#[cfg_attr(feature = "bindings", derive(TS))]
4412pub struct CopyParameter {
4413 pub name: String,
4414 pub value: Option<Expression>,
4415 pub values: Vec<Expression>,
4416 #[serde(default)]
4418 pub eq: bool,
4419}
4420
4421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4423#[cfg_attr(feature = "bindings", derive(TS))]
4424pub struct Credentials {
4425 pub credentials: Vec<(String, String)>,
4426 pub encryption: Option<String>,
4427 pub storage: Option<String>,
4428}
4429
4430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4432#[cfg_attr(feature = "bindings", derive(TS))]
4433pub struct PutStmt {
4434 pub source: String,
4436 #[serde(default)]
4438 pub source_quoted: bool,
4439 pub target: Expression,
4441 #[serde(default)]
4443 pub params: Vec<CopyParameter>,
4444}
4445
4446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4448#[cfg_attr(feature = "bindings", derive(TS))]
4449pub struct StageReference {
4450 pub name: String,
4452 #[serde(default)]
4454 pub path: Option<String>,
4455 #[serde(default)]
4457 pub file_format: Option<Expression>,
4458 #[serde(default)]
4460 pub pattern: Option<String>,
4461 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4463 pub quoted: bool,
4464}
4465
4466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4468#[cfg_attr(feature = "bindings", derive(TS))]
4469pub struct HistoricalData {
4470 pub this: Box<Expression>,
4472 pub kind: String,
4474 pub expression: Box<Expression>,
4476}
4477
4478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4483#[cfg_attr(feature = "bindings", derive(TS))]
4484pub struct Alias {
4485 pub this: Expression,
4487 pub alias: Identifier,
4489 #[serde(default)]
4491 pub column_aliases: Vec<Identifier>,
4492 #[serde(default)]
4494 pub pre_alias_comments: Vec<String>,
4495 #[serde(default)]
4497 pub trailing_comments: Vec<String>,
4498 #[serde(default, skip_serializing_if = "Option::is_none")]
4500 pub inferred_type: Option<DataType>,
4501}
4502
4503impl Alias {
4504 pub fn new(this: Expression, alias: Identifier) -> Self {
4506 Self {
4507 this,
4508 alias,
4509 column_aliases: Vec::new(),
4510 pre_alias_comments: Vec::new(),
4511 trailing_comments: Vec::new(),
4512 inferred_type: None,
4513 }
4514 }
4515
4516 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4518 Self {
4519 this,
4520 alias: Identifier::empty(),
4521 column_aliases,
4522 pre_alias_comments: Vec::new(),
4523 trailing_comments: Vec::new(),
4524 inferred_type: None,
4525 }
4526 }
4527}
4528
4529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4536#[cfg_attr(feature = "bindings", derive(TS))]
4537pub struct Cast {
4538 pub this: Expression,
4540 pub to: DataType,
4542 #[serde(default)]
4543 pub trailing_comments: Vec<String>,
4544 #[serde(default)]
4546 pub double_colon_syntax: bool,
4547 #[serde(skip_serializing_if = "Option::is_none", default)]
4549 pub format: Option<Box<Expression>>,
4550 #[serde(skip_serializing_if = "Option::is_none", default)]
4552 pub default: Option<Box<Expression>>,
4553 #[serde(default, skip_serializing_if = "Option::is_none")]
4555 pub inferred_type: Option<DataType>,
4556}
4557
4558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4560#[cfg_attr(feature = "bindings", derive(TS))]
4561pub struct CollationExpr {
4562 pub this: Expression,
4563 pub collation: String,
4564 #[serde(default)]
4566 pub quoted: bool,
4567 #[serde(default)]
4569 pub double_quoted: bool,
4570}
4571
4572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4578#[cfg_attr(feature = "bindings", derive(TS))]
4579pub struct Case {
4580 pub operand: Option<Expression>,
4582 pub whens: Vec<(Expression, Expression)>,
4584 pub else_: Option<Expression>,
4586 #[serde(default)]
4588 #[serde(skip_serializing_if = "Vec::is_empty")]
4589 pub comments: Vec<String>,
4590 #[serde(default, skip_serializing_if = "Option::is_none")]
4592 pub inferred_type: Option<DataType>,
4593}
4594
4595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4603#[cfg_attr(feature = "bindings", derive(TS))]
4604pub struct BinaryOp {
4605 pub left: Expression,
4606 pub right: Expression,
4607 #[serde(default)]
4609 pub left_comments: Vec<String>,
4610 #[serde(default)]
4612 pub operator_comments: Vec<String>,
4613 #[serde(default)]
4615 pub trailing_comments: Vec<String>,
4616 #[serde(default, skip_serializing_if = "Option::is_none")]
4618 pub inferred_type: Option<DataType>,
4619}
4620
4621impl BinaryOp {
4622 pub fn new(left: Expression, right: Expression) -> Self {
4623 Self {
4624 left,
4625 right,
4626 left_comments: Vec::new(),
4627 operator_comments: Vec::new(),
4628 trailing_comments: Vec::new(),
4629 inferred_type: None,
4630 }
4631 }
4632}
4633
4634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4636#[cfg_attr(feature = "bindings", derive(TS))]
4637pub struct LikeOp {
4638 pub left: Expression,
4639 pub right: Expression,
4640 #[serde(default)]
4642 pub escape: Option<Expression>,
4643 #[serde(default)]
4645 pub quantifier: Option<String>,
4646 #[serde(default, skip_serializing_if = "Option::is_none")]
4648 pub inferred_type: Option<DataType>,
4649}
4650
4651impl LikeOp {
4652 pub fn new(left: Expression, right: Expression) -> Self {
4653 Self {
4654 left,
4655 right,
4656 escape: None,
4657 quantifier: None,
4658 inferred_type: None,
4659 }
4660 }
4661
4662 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4663 Self {
4664 left,
4665 right,
4666 escape: Some(escape),
4667 quantifier: None,
4668 inferred_type: None,
4669 }
4670 }
4671}
4672
4673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4677#[cfg_attr(feature = "bindings", derive(TS))]
4678pub struct UnaryOp {
4679 pub this: Expression,
4681 #[serde(default, skip_serializing_if = "Option::is_none")]
4683 pub inferred_type: Option<DataType>,
4684}
4685
4686impl UnaryOp {
4687 pub fn new(this: Expression) -> Self {
4688 Self {
4689 this,
4690 inferred_type: None,
4691 }
4692 }
4693}
4694
4695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4700#[cfg_attr(feature = "bindings", derive(TS))]
4701pub struct In {
4702 pub this: Expression,
4704 pub expressions: Vec<Expression>,
4706 pub query: Option<Expression>,
4708 pub not: bool,
4710 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4711 pub global: bool,
4712 #[serde(default, skip_serializing_if = "Option::is_none")]
4714 pub unnest: Option<Box<Expression>>,
4715 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4719 pub is_field: bool,
4720}
4721
4722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4724#[cfg_attr(feature = "bindings", derive(TS))]
4725pub struct Between {
4726 pub this: Expression,
4728 pub low: Expression,
4730 pub high: Expression,
4732 pub not: bool,
4734 #[serde(default)]
4736 pub symmetric: Option<bool>,
4737}
4738
4739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4741#[cfg_attr(feature = "bindings", derive(TS))]
4742pub struct IsNull {
4743 pub this: Expression,
4744 pub not: bool,
4745 #[serde(default)]
4747 pub postfix_form: bool,
4748}
4749
4750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4752#[cfg_attr(feature = "bindings", derive(TS))]
4753pub struct IsTrueFalse {
4754 pub this: Expression,
4755 pub not: bool,
4756}
4757
4758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4761#[cfg_attr(feature = "bindings", derive(TS))]
4762pub struct IsJson {
4763 pub this: Expression,
4764 pub json_type: Option<String>,
4766 pub unique_keys: Option<JsonUniqueKeys>,
4768 pub negated: bool,
4770}
4771
4772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4774#[cfg_attr(feature = "bindings", derive(TS))]
4775pub enum JsonUniqueKeys {
4776 With,
4778 Without,
4780 Shorthand,
4782}
4783
4784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4786#[cfg_attr(feature = "bindings", derive(TS))]
4787pub struct Exists {
4788 pub this: Expression,
4790 pub not: bool,
4792}
4793
4794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4801#[cfg_attr(feature = "bindings", derive(TS))]
4802pub struct Function {
4803 pub name: String,
4805 pub args: Vec<Expression>,
4807 pub distinct: bool,
4809 #[serde(default)]
4810 pub trailing_comments: Vec<String>,
4811 #[serde(default)]
4813 pub use_bracket_syntax: bool,
4814 #[serde(default)]
4816 pub no_parens: bool,
4817 #[serde(default)]
4819 pub quoted: bool,
4820 #[serde(default, skip_serializing_if = "Option::is_none")]
4822 pub span: Option<Span>,
4823 #[serde(default, skip_serializing_if = "Option::is_none")]
4825 pub inferred_type: Option<DataType>,
4826}
4827
4828impl Default for Function {
4829 fn default() -> Self {
4830 Self {
4831 name: String::new(),
4832 args: Vec::new(),
4833 distinct: false,
4834 trailing_comments: Vec::new(),
4835 use_bracket_syntax: false,
4836 no_parens: false,
4837 quoted: false,
4838 span: None,
4839 inferred_type: None,
4840 }
4841 }
4842}
4843
4844impl Function {
4845 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4846 Self {
4847 name: name.into(),
4848 args,
4849 distinct: false,
4850 trailing_comments: Vec::new(),
4851 use_bracket_syntax: false,
4852 no_parens: false,
4853 quoted: false,
4854 span: None,
4855 inferred_type: None,
4856 }
4857 }
4858}
4859
4860#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4867#[cfg_attr(feature = "bindings", derive(TS))]
4868pub struct AggregateFunction {
4869 pub name: String,
4871 pub args: Vec<Expression>,
4873 pub distinct: bool,
4875 pub filter: Option<Expression>,
4877 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4879 pub order_by: Vec<Ordered>,
4880 #[serde(default, skip_serializing_if = "Option::is_none")]
4882 pub limit: Option<Box<Expression>>,
4883 #[serde(default, skip_serializing_if = "Option::is_none")]
4885 pub ignore_nulls: Option<bool>,
4886 #[serde(default, skip_serializing_if = "Option::is_none")]
4888 pub inferred_type: Option<DataType>,
4889}
4890
4891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4898#[cfg_attr(feature = "bindings", derive(TS))]
4899pub struct WindowFunction {
4900 pub this: Expression,
4902 pub over: Over,
4904 #[serde(default, skip_serializing_if = "Option::is_none")]
4906 pub keep: Option<Keep>,
4907 #[serde(default, skip_serializing_if = "Option::is_none")]
4909 pub inferred_type: Option<DataType>,
4910}
4911
4912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4915#[cfg_attr(feature = "bindings", derive(TS))]
4916pub struct Keep {
4917 pub first: bool,
4919 pub order_by: Vec<Ordered>,
4921}
4922
4923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4925#[cfg_attr(feature = "bindings", derive(TS))]
4926pub struct WithinGroup {
4927 pub this: Expression,
4929 pub order_by: Vec<Ordered>,
4931}
4932
4933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4938#[cfg_attr(feature = "bindings", derive(TS))]
4939pub struct From {
4940 pub expressions: Vec<Expression>,
4942}
4943
4944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4950#[cfg_attr(feature = "bindings", derive(TS))]
4951pub struct Join {
4952 pub this: Expression,
4954 pub on: Option<Expression>,
4956 pub using: Vec<Identifier>,
4958 pub kind: JoinKind,
4960 pub use_inner_keyword: bool,
4962 pub use_outer_keyword: bool,
4964 pub deferred_condition: bool,
4966 #[serde(default, skip_serializing_if = "Option::is_none")]
4968 pub join_hint: Option<String>,
4969 #[serde(default, skip_serializing_if = "Option::is_none")]
4971 pub match_condition: Option<Expression>,
4972 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4974 pub pivots: Vec<Expression>,
4975 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4977 pub comments: Vec<String>,
4978 #[serde(default)]
4982 pub nesting_group: usize,
4983 #[serde(default)]
4985 pub directed: bool,
4986}
4987
4988#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4995#[cfg_attr(feature = "bindings", derive(TS))]
4996pub enum JoinKind {
4997 Inner,
4998 Left,
4999 Right,
5000 Full,
5001 Outer, Cross,
5003 Natural,
5004 NaturalLeft,
5005 NaturalRight,
5006 NaturalFull,
5007 Semi,
5008 Anti,
5009 LeftSemi,
5011 LeftAnti,
5012 RightSemi,
5013 RightAnti,
5014 CrossApply,
5016 OuterApply,
5017 AsOf,
5019 AsOfLeft,
5020 AsOfRight,
5021 Lateral,
5023 LeftLateral,
5024 Straight,
5026 Implicit,
5028 Array,
5030 LeftArray,
5031 Paste,
5033 Positional,
5035}
5036
5037impl Default for JoinKind {
5038 fn default() -> Self {
5039 JoinKind::Inner
5040 }
5041}
5042
5043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5046#[cfg_attr(feature = "bindings", derive(TS))]
5047pub struct JoinedTable {
5048 pub left: Expression,
5050 pub joins: Vec<Join>,
5052 pub lateral_views: Vec<LateralView>,
5054 pub alias: Option<Identifier>,
5056}
5057
5058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5060#[cfg_attr(feature = "bindings", derive(TS))]
5061pub struct Where {
5062 pub this: Expression,
5064}
5065
5066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5071#[cfg_attr(feature = "bindings", derive(TS))]
5072pub struct GroupBy {
5073 pub expressions: Vec<Expression>,
5075 #[serde(default)]
5077 pub all: Option<bool>,
5078 #[serde(default)]
5080 pub totals: bool,
5081 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5083 pub comments: Vec<String>,
5084}
5085
5086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5088#[cfg_attr(feature = "bindings", derive(TS))]
5089pub struct Having {
5090 pub this: Expression,
5092 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5094 pub comments: Vec<String>,
5095}
5096
5097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5099#[cfg_attr(feature = "bindings", derive(TS))]
5100pub struct OrderBy {
5101 pub expressions: Vec<Ordered>,
5103 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5105 pub siblings: bool,
5106 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5108 pub comments: Vec<String>,
5109}
5110
5111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5118#[cfg_attr(feature = "bindings", derive(TS))]
5119pub struct Ordered {
5120 pub this: Expression,
5122 pub desc: bool,
5124 pub nulls_first: Option<bool>,
5126 #[serde(default)]
5128 pub explicit_asc: bool,
5129 #[serde(default, skip_serializing_if = "Option::is_none")]
5131 pub with_fill: Option<Box<WithFill>>,
5132}
5133
5134impl Ordered {
5135 pub fn asc(expr: Expression) -> Self {
5136 Self {
5137 this: expr,
5138 desc: false,
5139 nulls_first: None,
5140 explicit_asc: false,
5141 with_fill: None,
5142 }
5143 }
5144
5145 pub fn desc(expr: Expression) -> Self {
5146 Self {
5147 this: expr,
5148 desc: true,
5149 nulls_first: None,
5150 explicit_asc: false,
5151 with_fill: None,
5152 }
5153 }
5154}
5155
5156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5159#[cfg_attr(feature = "bindings", derive(TS))]
5160#[cfg_attr(feature = "bindings", ts(export))]
5161pub struct DistributeBy {
5162 pub expressions: Vec<Expression>,
5163}
5164
5165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5168#[cfg_attr(feature = "bindings", derive(TS))]
5169#[cfg_attr(feature = "bindings", ts(export))]
5170pub struct ClusterBy {
5171 pub expressions: Vec<Ordered>,
5172}
5173
5174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5177#[cfg_attr(feature = "bindings", derive(TS))]
5178#[cfg_attr(feature = "bindings", ts(export))]
5179pub struct SortBy {
5180 pub expressions: Vec<Ordered>,
5181}
5182
5183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5186#[cfg_attr(feature = "bindings", derive(TS))]
5187#[cfg_attr(feature = "bindings", ts(export))]
5188pub struct LateralView {
5189 pub this: Expression,
5191 pub table_alias: Option<Identifier>,
5193 pub column_aliases: Vec<Identifier>,
5195 pub outer: bool,
5197}
5198
5199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5201#[cfg_attr(feature = "bindings", derive(TS))]
5202#[cfg_attr(feature = "bindings", ts(export))]
5203pub struct Hint {
5204 pub expressions: Vec<HintExpression>,
5205}
5206
5207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5209#[cfg_attr(feature = "bindings", derive(TS))]
5210#[cfg_attr(feature = "bindings", ts(export))]
5211pub enum HintExpression {
5212 Function { name: String, args: Vec<Expression> },
5214 Identifier(String),
5216 Raw(String),
5218}
5219
5220#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5222#[cfg_attr(feature = "bindings", derive(TS))]
5223#[cfg_attr(feature = "bindings", ts(export))]
5224pub enum PseudocolumnType {
5225 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5232
5233impl PseudocolumnType {
5234 pub fn as_str(&self) -> &'static str {
5235 match self {
5236 PseudocolumnType::Rownum => "ROWNUM",
5237 PseudocolumnType::Rowid => "ROWID",
5238 PseudocolumnType::Level => "LEVEL",
5239 PseudocolumnType::Sysdate => "SYSDATE",
5240 PseudocolumnType::ObjectId => "OBJECT_ID",
5241 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5242 }
5243 }
5244
5245 pub fn from_str(s: &str) -> Option<Self> {
5246 match s.to_uppercase().as_str() {
5247 "ROWNUM" => Some(PseudocolumnType::Rownum),
5248 "ROWID" => Some(PseudocolumnType::Rowid),
5249 "LEVEL" => Some(PseudocolumnType::Level),
5250 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5251 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5252 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5253 _ => None,
5254 }
5255 }
5256}
5257
5258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5261#[cfg_attr(feature = "bindings", derive(TS))]
5262#[cfg_attr(feature = "bindings", ts(export))]
5263pub struct Pseudocolumn {
5264 pub kind: PseudocolumnType,
5265}
5266
5267impl Pseudocolumn {
5268 pub fn rownum() -> Self {
5269 Self {
5270 kind: PseudocolumnType::Rownum,
5271 }
5272 }
5273
5274 pub fn rowid() -> Self {
5275 Self {
5276 kind: PseudocolumnType::Rowid,
5277 }
5278 }
5279
5280 pub fn level() -> Self {
5281 Self {
5282 kind: PseudocolumnType::Level,
5283 }
5284 }
5285}
5286
5287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5289#[cfg_attr(feature = "bindings", derive(TS))]
5290#[cfg_attr(feature = "bindings", ts(export))]
5291pub struct Connect {
5292 pub start: Option<Expression>,
5294 pub connect: Expression,
5296 pub nocycle: bool,
5298}
5299
5300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5302#[cfg_attr(feature = "bindings", derive(TS))]
5303#[cfg_attr(feature = "bindings", ts(export))]
5304pub struct Prior {
5305 pub this: Expression,
5306}
5307
5308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5310#[cfg_attr(feature = "bindings", derive(TS))]
5311#[cfg_attr(feature = "bindings", ts(export))]
5312pub struct ConnectByRoot {
5313 pub this: Expression,
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 MatchRecognize {
5321 pub this: Option<Box<Expression>>,
5323 pub partition_by: Option<Vec<Expression>>,
5325 pub order_by: Option<Vec<Ordered>>,
5327 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5329 pub rows: Option<MatchRecognizeRows>,
5331 pub after: Option<MatchRecognizeAfter>,
5333 pub pattern: Option<String>,
5335 pub define: Option<Vec<(Identifier, Expression)>>,
5337 pub alias: Option<Identifier>,
5339 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5341 pub alias_explicit_as: bool,
5342}
5343
5344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5346#[cfg_attr(feature = "bindings", derive(TS))]
5347#[cfg_attr(feature = "bindings", ts(export))]
5348pub struct MatchRecognizeMeasure {
5349 pub this: Expression,
5351 pub window_frame: Option<MatchRecognizeSemantics>,
5353}
5354
5355#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5357#[cfg_attr(feature = "bindings", derive(TS))]
5358#[cfg_attr(feature = "bindings", ts(export))]
5359pub enum MatchRecognizeSemantics {
5360 Running,
5361 Final,
5362}
5363
5364#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5366#[cfg_attr(feature = "bindings", derive(TS))]
5367#[cfg_attr(feature = "bindings", ts(export))]
5368pub enum MatchRecognizeRows {
5369 OneRowPerMatch,
5370 AllRowsPerMatch,
5371 AllRowsPerMatchShowEmptyMatches,
5372 AllRowsPerMatchOmitEmptyMatches,
5373 AllRowsPerMatchWithUnmatchedRows,
5374}
5375
5376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5378#[cfg_attr(feature = "bindings", derive(TS))]
5379#[cfg_attr(feature = "bindings", ts(export))]
5380pub enum MatchRecognizeAfter {
5381 PastLastRow,
5382 ToNextRow,
5383 ToFirst(Identifier),
5384 ToLast(Identifier),
5385}
5386
5387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5389#[cfg_attr(feature = "bindings", derive(TS))]
5390pub struct Limit {
5391 pub this: Expression,
5393 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5395 pub percent: bool,
5396 #[serde(default)]
5398 #[serde(skip_serializing_if = "Vec::is_empty")]
5399 pub comments: Vec<String>,
5400}
5401
5402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5404#[cfg_attr(feature = "bindings", derive(TS))]
5405pub struct Offset {
5406 pub this: Expression,
5407 #[serde(skip_serializing_if = "Option::is_none", default)]
5409 pub rows: Option<bool>,
5410}
5411
5412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5414#[cfg_attr(feature = "bindings", derive(TS))]
5415pub struct Top {
5416 pub this: Expression,
5417 pub percent: bool,
5418 pub with_ties: bool,
5419 #[serde(default)]
5421 pub parenthesized: bool,
5422}
5423
5424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5426#[cfg_attr(feature = "bindings", derive(TS))]
5427pub struct Fetch {
5428 pub direction: String,
5430 pub count: Option<Expression>,
5432 pub percent: bool,
5434 pub rows: bool,
5436 pub with_ties: bool,
5438}
5439
5440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5446#[cfg_attr(feature = "bindings", derive(TS))]
5447pub struct Qualify {
5448 pub this: Expression,
5450}
5451
5452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5454#[cfg_attr(feature = "bindings", derive(TS))]
5455pub struct Sample {
5456 pub method: SampleMethod,
5457 pub size: Expression,
5458 pub seed: Option<Expression>,
5459 #[serde(default)]
5461 pub offset: Option<Expression>,
5462 pub unit_after_size: bool,
5464 #[serde(default)]
5466 pub use_sample_keyword: bool,
5467 #[serde(default)]
5469 pub explicit_method: bool,
5470 #[serde(default)]
5472 pub method_before_size: bool,
5473 #[serde(default)]
5475 pub use_seed_keyword: bool,
5476 pub bucket_numerator: Option<Box<Expression>>,
5478 pub bucket_denominator: Option<Box<Expression>>,
5480 pub bucket_field: Option<Box<Expression>>,
5482 #[serde(default)]
5484 pub is_using_sample: bool,
5485 #[serde(default)]
5487 pub is_percent: bool,
5488 #[serde(default)]
5490 pub suppress_method_output: bool,
5491}
5492
5493#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5495#[cfg_attr(feature = "bindings", derive(TS))]
5496pub enum SampleMethod {
5497 Bernoulli,
5498 System,
5499 Block,
5500 Row,
5501 Percent,
5502 Bucket,
5504 Reservoir,
5506}
5507
5508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5510#[cfg_attr(feature = "bindings", derive(TS))]
5511pub struct NamedWindow {
5512 pub name: Identifier,
5513 pub spec: Over,
5514}
5515
5516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5522#[cfg_attr(feature = "bindings", derive(TS))]
5523pub struct With {
5524 pub ctes: Vec<Cte>,
5526 pub recursive: bool,
5528 #[serde(default)]
5530 pub leading_comments: Vec<String>,
5531 #[serde(default, skip_serializing_if = "Option::is_none")]
5533 pub search: Option<Box<Expression>>,
5534}
5535
5536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5543#[cfg_attr(feature = "bindings", derive(TS))]
5544pub struct Cte {
5545 pub alias: Identifier,
5547 pub this: Expression,
5549 pub columns: Vec<Identifier>,
5551 pub materialized: Option<bool>,
5553 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5555 pub key_expressions: Vec<Identifier>,
5556 #[serde(default)]
5558 pub alias_first: bool,
5559 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5561 pub comments: Vec<String>,
5562}
5563
5564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5566#[cfg_attr(feature = "bindings", derive(TS))]
5567pub struct WindowSpec {
5568 pub partition_by: Vec<Expression>,
5569 pub order_by: Vec<Ordered>,
5570 pub frame: Option<WindowFrame>,
5571}
5572
5573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5575#[cfg_attr(feature = "bindings", derive(TS))]
5576pub struct Over {
5577 pub window_name: Option<Identifier>,
5579 pub partition_by: Vec<Expression>,
5580 pub order_by: Vec<Ordered>,
5581 pub frame: Option<WindowFrame>,
5582 pub alias: Option<Identifier>,
5583}
5584
5585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5587#[cfg_attr(feature = "bindings", derive(TS))]
5588pub struct WindowFrame {
5589 pub kind: WindowFrameKind,
5590 pub start: WindowFrameBound,
5591 pub end: Option<WindowFrameBound>,
5592 pub exclude: Option<WindowFrameExclude>,
5593 #[serde(default, skip_serializing_if = "Option::is_none")]
5595 pub kind_text: Option<String>,
5596 #[serde(default, skip_serializing_if = "Option::is_none")]
5598 pub start_side_text: Option<String>,
5599 #[serde(default, skip_serializing_if = "Option::is_none")]
5601 pub end_side_text: Option<String>,
5602}
5603
5604#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5605#[cfg_attr(feature = "bindings", derive(TS))]
5606pub enum WindowFrameKind {
5607 Rows,
5608 Range,
5609 Groups,
5610}
5611
5612#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5614#[cfg_attr(feature = "bindings", derive(TS))]
5615pub enum WindowFrameExclude {
5616 CurrentRow,
5617 Group,
5618 Ties,
5619 NoOthers,
5620}
5621
5622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5623#[cfg_attr(feature = "bindings", derive(TS))]
5624pub enum WindowFrameBound {
5625 CurrentRow,
5626 UnboundedPreceding,
5627 UnboundedFollowing,
5628 Preceding(Box<Expression>),
5629 Following(Box<Expression>),
5630 BarePreceding,
5632 BareFollowing,
5634 Value(Box<Expression>),
5636}
5637
5638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5640#[cfg_attr(feature = "bindings", derive(TS))]
5641pub struct StructField {
5642 pub name: String,
5643 pub data_type: DataType,
5644 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5645 pub options: Vec<Expression>,
5646 #[serde(default, skip_serializing_if = "Option::is_none")]
5647 pub comment: Option<String>,
5648}
5649
5650impl StructField {
5651 pub fn new(name: String, data_type: DataType) -> Self {
5653 Self {
5654 name,
5655 data_type,
5656 options: Vec::new(),
5657 comment: None,
5658 }
5659 }
5660
5661 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5663 Self {
5664 name,
5665 data_type,
5666 options,
5667 comment: None,
5668 }
5669 }
5670
5671 pub fn with_options_and_comment(
5673 name: String,
5674 data_type: DataType,
5675 options: Vec<Expression>,
5676 comment: Option<String>,
5677 ) -> Self {
5678 Self {
5679 name,
5680 data_type,
5681 options,
5682 comment,
5683 }
5684 }
5685}
5686
5687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5699#[cfg_attr(feature = "bindings", derive(TS))]
5700#[serde(tag = "data_type", rename_all = "snake_case")]
5701pub enum DataType {
5702 Boolean,
5704 TinyInt {
5705 length: Option<u32>,
5706 },
5707 SmallInt {
5708 length: Option<u32>,
5709 },
5710 Int {
5714 length: Option<u32>,
5715 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5716 integer_spelling: bool,
5717 },
5718 BigInt {
5719 length: Option<u32>,
5720 },
5721 Float {
5725 precision: Option<u32>,
5726 scale: Option<u32>,
5727 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5728 real_spelling: bool,
5729 },
5730 Double {
5731 precision: Option<u32>,
5732 scale: Option<u32>,
5733 },
5734 Decimal {
5735 precision: Option<u32>,
5736 scale: Option<u32>,
5737 },
5738
5739 Char {
5741 length: Option<u32>,
5742 },
5743 VarChar {
5746 length: Option<u32>,
5747 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5748 parenthesized_length: bool,
5749 },
5750 String {
5752 length: Option<u32>,
5753 },
5754 Text,
5755 TextWithLength {
5757 length: u32,
5758 },
5759
5760 Binary {
5762 length: Option<u32>,
5763 },
5764 VarBinary {
5765 length: Option<u32>,
5766 },
5767 Blob,
5768
5769 Bit {
5771 length: Option<u32>,
5772 },
5773 VarBit {
5774 length: Option<u32>,
5775 },
5776
5777 Date,
5779 Time {
5780 precision: Option<u32>,
5781 #[serde(default)]
5782 timezone: bool,
5783 },
5784 Timestamp {
5785 precision: Option<u32>,
5786 timezone: bool,
5787 },
5788 Interval {
5789 unit: Option<String>,
5790 #[serde(default, skip_serializing_if = "Option::is_none")]
5792 to: Option<String>,
5793 },
5794
5795 Json,
5797 JsonB,
5798
5799 Uuid,
5801
5802 Array {
5804 element_type: Box<DataType>,
5805 #[serde(default, skip_serializing_if = "Option::is_none")]
5807 dimension: Option<u32>,
5808 },
5809
5810 List {
5813 element_type: Box<DataType>,
5814 },
5815
5816 Struct {
5820 fields: Vec<StructField>,
5821 nested: bool,
5822 },
5823 Map {
5824 key_type: Box<DataType>,
5825 value_type: Box<DataType>,
5826 },
5827
5828 Enum {
5830 values: Vec<String>,
5831 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5832 assignments: Vec<Option<String>>,
5833 },
5834
5835 Set {
5837 values: Vec<String>,
5838 },
5839
5840 Union {
5842 fields: Vec<(String, DataType)>,
5843 },
5844
5845 Vector {
5847 #[serde(default)]
5848 element_type: Option<Box<DataType>>,
5849 dimension: Option<u32>,
5850 },
5851
5852 Object {
5855 fields: Vec<(String, DataType, bool)>,
5856 modifier: Option<String>,
5857 },
5858
5859 Nullable {
5861 inner: Box<DataType>,
5862 },
5863
5864 Custom {
5866 name: String,
5867 },
5868
5869 Geometry {
5871 subtype: Option<String>,
5872 srid: Option<u32>,
5873 },
5874 Geography {
5875 subtype: Option<String>,
5876 srid: Option<u32>,
5877 },
5878
5879 CharacterSet {
5882 name: String,
5883 },
5884
5885 Unknown,
5887}
5888
5889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5891#[cfg_attr(feature = "bindings", derive(TS))]
5892#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5893pub struct Array {
5894 pub expressions: Vec<Expression>,
5895}
5896
5897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5899#[cfg_attr(feature = "bindings", derive(TS))]
5900pub struct Struct {
5901 pub fields: Vec<(Option<String>, Expression)>,
5902}
5903
5904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5906#[cfg_attr(feature = "bindings", derive(TS))]
5907pub struct Tuple {
5908 pub expressions: Vec<Expression>,
5909}
5910
5911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5913#[cfg_attr(feature = "bindings", derive(TS))]
5914pub struct Interval {
5915 pub this: Option<Expression>,
5917 pub unit: Option<IntervalUnitSpec>,
5919}
5920
5921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5923#[cfg_attr(feature = "bindings", derive(TS))]
5924#[serde(tag = "type", rename_all = "snake_case")]
5925pub enum IntervalUnitSpec {
5926 Simple {
5928 unit: IntervalUnit,
5929 use_plural: bool,
5931 },
5932 Span(IntervalSpan),
5934 ExprSpan(IntervalSpanExpr),
5937 Expr(Box<Expression>),
5939}
5940
5941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5943#[cfg_attr(feature = "bindings", derive(TS))]
5944pub struct IntervalSpan {
5945 pub this: IntervalUnit,
5947 pub expression: IntervalUnit,
5949}
5950
5951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5954#[cfg_attr(feature = "bindings", derive(TS))]
5955pub struct IntervalSpanExpr {
5956 pub this: Box<Expression>,
5958 pub expression: Box<Expression>,
5960}
5961
5962#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5963#[cfg_attr(feature = "bindings", derive(TS))]
5964pub enum IntervalUnit {
5965 Year,
5966 Quarter,
5967 Month,
5968 Week,
5969 Day,
5970 Hour,
5971 Minute,
5972 Second,
5973 Millisecond,
5974 Microsecond,
5975 Nanosecond,
5976}
5977
5978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5980#[cfg_attr(feature = "bindings", derive(TS))]
5981pub struct Command {
5982 pub this: String,
5984}
5985
5986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5989#[cfg_attr(feature = "bindings", derive(TS))]
5990pub struct ExecuteStatement {
5991 pub this: Expression,
5993 #[serde(default)]
5995 pub parameters: Vec<ExecuteParameter>,
5996 #[serde(default, skip_serializing_if = "Option::is_none")]
5998 pub suffix: Option<String>,
5999}
6000
6001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6003#[cfg_attr(feature = "bindings", derive(TS))]
6004pub struct ExecuteParameter {
6005 pub name: String,
6007 pub value: Expression,
6009 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6011 pub positional: bool,
6012 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6014 pub output: bool,
6015}
6016
6017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6020#[cfg_attr(feature = "bindings", derive(TS))]
6021pub struct Kill {
6022 pub this: Expression,
6024 pub kind: Option<String>,
6026}
6027
6028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6030#[cfg_attr(feature = "bindings", derive(TS))]
6031pub struct CreateTask {
6032 pub or_replace: bool,
6033 pub if_not_exists: bool,
6034 pub name: String,
6036 pub properties: String,
6038 pub body: Expression,
6040}
6041
6042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6044#[cfg_attr(feature = "bindings", derive(TS))]
6045pub struct Raw {
6046 pub sql: String,
6047}
6048
6049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6055#[cfg_attr(feature = "bindings", derive(TS))]
6056pub struct UnaryFunc {
6057 pub this: Expression,
6058 #[serde(skip_serializing_if = "Option::is_none", default)]
6060 pub original_name: Option<String>,
6061 #[serde(default, skip_serializing_if = "Option::is_none")]
6063 pub inferred_type: Option<DataType>,
6064}
6065
6066impl UnaryFunc {
6067 pub fn new(this: Expression) -> Self {
6069 Self {
6070 this,
6071 original_name: None,
6072 inferred_type: None,
6073 }
6074 }
6075
6076 pub fn with_name(this: Expression, name: String) -> Self {
6078 Self {
6079 this,
6080 original_name: Some(name),
6081 inferred_type: None,
6082 }
6083 }
6084}
6085
6086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6090#[cfg_attr(feature = "bindings", derive(TS))]
6091pub struct CharFunc {
6092 pub args: Vec<Expression>,
6093 #[serde(skip_serializing_if = "Option::is_none", default)]
6094 pub charset: Option<String>,
6095 #[serde(skip_serializing_if = "Option::is_none", default)]
6097 pub name: Option<String>,
6098}
6099
6100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6102#[cfg_attr(feature = "bindings", derive(TS))]
6103pub struct BinaryFunc {
6104 pub this: Expression,
6105 pub expression: Expression,
6106 #[serde(skip_serializing_if = "Option::is_none", default)]
6108 pub original_name: Option<String>,
6109 #[serde(default, skip_serializing_if = "Option::is_none")]
6111 pub inferred_type: Option<DataType>,
6112}
6113
6114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6116#[cfg_attr(feature = "bindings", derive(TS))]
6117pub struct VarArgFunc {
6118 pub expressions: Vec<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
6127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6129#[cfg_attr(feature = "bindings", derive(TS))]
6130pub struct ConcatWs {
6131 pub separator: Expression,
6132 pub expressions: Vec<Expression>,
6133}
6134
6135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6137#[cfg_attr(feature = "bindings", derive(TS))]
6138pub struct SubstringFunc {
6139 pub this: Expression,
6140 pub start: Expression,
6141 pub length: Option<Expression>,
6142 #[serde(default)]
6144 pub from_for_syntax: bool,
6145}
6146
6147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6149#[cfg_attr(feature = "bindings", derive(TS))]
6150pub struct OverlayFunc {
6151 pub this: Expression,
6152 pub replacement: Expression,
6153 pub from: Expression,
6154 pub length: Option<Expression>,
6155}
6156
6157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6159#[cfg_attr(feature = "bindings", derive(TS))]
6160pub struct TrimFunc {
6161 pub this: Expression,
6162 pub characters: Option<Expression>,
6163 pub position: TrimPosition,
6164 #[serde(default)]
6166 pub sql_standard_syntax: bool,
6167 #[serde(default)]
6169 pub position_explicit: bool,
6170}
6171
6172#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6173#[cfg_attr(feature = "bindings", derive(TS))]
6174pub enum TrimPosition {
6175 Both,
6176 Leading,
6177 Trailing,
6178}
6179
6180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6182#[cfg_attr(feature = "bindings", derive(TS))]
6183pub struct ReplaceFunc {
6184 pub this: Expression,
6185 pub old: Expression,
6186 pub new: Expression,
6187}
6188
6189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6191#[cfg_attr(feature = "bindings", derive(TS))]
6192pub struct LeftRightFunc {
6193 pub this: Expression,
6194 pub length: Expression,
6195}
6196
6197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6199#[cfg_attr(feature = "bindings", derive(TS))]
6200pub struct RepeatFunc {
6201 pub this: Expression,
6202 pub times: Expression,
6203}
6204
6205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6207#[cfg_attr(feature = "bindings", derive(TS))]
6208pub struct PadFunc {
6209 pub this: Expression,
6210 pub length: Expression,
6211 pub fill: Option<Expression>,
6212}
6213
6214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6216#[cfg_attr(feature = "bindings", derive(TS))]
6217pub struct SplitFunc {
6218 pub this: Expression,
6219 pub delimiter: Expression,
6220}
6221
6222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6224#[cfg_attr(feature = "bindings", derive(TS))]
6225pub struct RegexpFunc {
6226 pub this: Expression,
6227 pub pattern: Expression,
6228 pub flags: Option<Expression>,
6229}
6230
6231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6233#[cfg_attr(feature = "bindings", derive(TS))]
6234pub struct RegexpReplaceFunc {
6235 pub this: Expression,
6236 pub pattern: Expression,
6237 pub replacement: Expression,
6238 pub flags: Option<Expression>,
6239}
6240
6241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6243#[cfg_attr(feature = "bindings", derive(TS))]
6244pub struct RegexpExtractFunc {
6245 pub this: Expression,
6246 pub pattern: Expression,
6247 pub group: Option<Expression>,
6248}
6249
6250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6252#[cfg_attr(feature = "bindings", derive(TS))]
6253pub struct RoundFunc {
6254 pub this: Expression,
6255 pub decimals: Option<Expression>,
6256}
6257
6258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6260#[cfg_attr(feature = "bindings", derive(TS))]
6261pub struct FloorFunc {
6262 pub this: Expression,
6263 pub scale: Option<Expression>,
6264 #[serde(skip_serializing_if = "Option::is_none", default)]
6266 pub to: Option<Expression>,
6267}
6268
6269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6271#[cfg_attr(feature = "bindings", derive(TS))]
6272pub struct CeilFunc {
6273 pub this: Expression,
6274 #[serde(skip_serializing_if = "Option::is_none", default)]
6275 pub decimals: Option<Expression>,
6276 #[serde(skip_serializing_if = "Option::is_none", default)]
6278 pub to: Option<Expression>,
6279}
6280
6281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6283#[cfg_attr(feature = "bindings", derive(TS))]
6284pub struct LogFunc {
6285 pub this: Expression,
6286 pub base: Option<Expression>,
6287}
6288
6289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6291#[cfg_attr(feature = "bindings", derive(TS))]
6292pub struct CurrentDate;
6293
6294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6296#[cfg_attr(feature = "bindings", derive(TS))]
6297pub struct CurrentTime {
6298 pub precision: Option<u32>,
6299}
6300
6301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6303#[cfg_attr(feature = "bindings", derive(TS))]
6304pub struct CurrentTimestamp {
6305 pub precision: Option<u32>,
6306 #[serde(default)]
6308 pub sysdate: bool,
6309}
6310
6311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6313#[cfg_attr(feature = "bindings", derive(TS))]
6314pub struct CurrentTimestampLTZ {
6315 pub precision: Option<u32>,
6316}
6317
6318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6320#[cfg_attr(feature = "bindings", derive(TS))]
6321pub struct AtTimeZone {
6322 pub this: Expression,
6324 pub zone: Expression,
6326}
6327
6328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6330#[cfg_attr(feature = "bindings", derive(TS))]
6331pub struct DateAddFunc {
6332 pub this: Expression,
6333 pub interval: Expression,
6334 pub unit: IntervalUnit,
6335}
6336
6337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6339#[cfg_attr(feature = "bindings", derive(TS))]
6340pub struct DateDiffFunc {
6341 pub this: Expression,
6342 pub expression: Expression,
6343 pub unit: Option<IntervalUnit>,
6344}
6345
6346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6348#[cfg_attr(feature = "bindings", derive(TS))]
6349pub struct DateTruncFunc {
6350 pub this: Expression,
6351 pub unit: DateTimeField,
6352}
6353
6354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6356#[cfg_attr(feature = "bindings", derive(TS))]
6357pub struct ExtractFunc {
6358 pub this: Expression,
6359 pub field: DateTimeField,
6360}
6361
6362#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6363#[cfg_attr(feature = "bindings", derive(TS))]
6364pub enum DateTimeField {
6365 Year,
6366 Month,
6367 Day,
6368 Hour,
6369 Minute,
6370 Second,
6371 Millisecond,
6372 Microsecond,
6373 DayOfWeek,
6374 DayOfYear,
6375 Week,
6376 WeekWithModifier(String),
6378 Quarter,
6379 Epoch,
6380 Timezone,
6381 TimezoneHour,
6382 TimezoneMinute,
6383 Date,
6384 Time,
6385 Custom(String),
6387}
6388
6389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6391#[cfg_attr(feature = "bindings", derive(TS))]
6392pub struct ToDateFunc {
6393 pub this: Expression,
6394 pub format: Option<Expression>,
6395}
6396
6397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6399#[cfg_attr(feature = "bindings", derive(TS))]
6400pub struct ToTimestampFunc {
6401 pub this: Expression,
6402 pub format: Option<Expression>,
6403}
6404
6405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6407#[cfg_attr(feature = "bindings", derive(TS))]
6408pub struct IfFunc {
6409 pub condition: Expression,
6410 pub true_value: Expression,
6411 pub false_value: Option<Expression>,
6412 #[serde(skip_serializing_if = "Option::is_none", default)]
6414 pub original_name: Option<String>,
6415 #[serde(default, skip_serializing_if = "Option::is_none")]
6417 pub inferred_type: Option<DataType>,
6418}
6419
6420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6422#[cfg_attr(feature = "bindings", derive(TS))]
6423pub struct Nvl2Func {
6424 pub this: Expression,
6425 pub true_value: Expression,
6426 pub false_value: Expression,
6427 #[serde(default, skip_serializing_if = "Option::is_none")]
6429 pub inferred_type: Option<DataType>,
6430}
6431
6432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6438#[cfg_attr(feature = "bindings", derive(TS))]
6439pub struct AggFunc {
6440 pub this: Expression,
6441 pub distinct: bool,
6442 pub filter: Option<Expression>,
6443 pub order_by: Vec<Ordered>,
6444 #[serde(skip_serializing_if = "Option::is_none", default)]
6446 pub name: Option<String>,
6447 #[serde(skip_serializing_if = "Option::is_none", default)]
6449 pub ignore_nulls: Option<bool>,
6450 #[serde(skip_serializing_if = "Option::is_none", default)]
6453 pub having_max: Option<(Box<Expression>, bool)>,
6454 #[serde(skip_serializing_if = "Option::is_none", default)]
6456 pub limit: Option<Box<Expression>>,
6457 #[serde(default, skip_serializing_if = "Option::is_none")]
6459 pub inferred_type: Option<DataType>,
6460}
6461
6462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6464#[cfg_attr(feature = "bindings", derive(TS))]
6465pub struct CountFunc {
6466 pub this: Option<Expression>,
6467 pub star: bool,
6468 pub distinct: bool,
6469 pub filter: Option<Expression>,
6470 #[serde(default, skip_serializing_if = "Option::is_none")]
6472 pub ignore_nulls: Option<bool>,
6473 #[serde(default, skip_serializing_if = "Option::is_none")]
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 GroupConcatFunc {
6485 pub this: Expression,
6486 pub separator: Option<Expression>,
6487 pub order_by: Option<Vec<Ordered>>,
6488 pub distinct: bool,
6489 pub filter: Option<Expression>,
6490 #[serde(default, skip_serializing_if = "Option::is_none")]
6492 pub limit: Option<Box<Expression>>,
6493 #[serde(default, skip_serializing_if = "Option::is_none")]
6495 pub inferred_type: Option<DataType>,
6496}
6497
6498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6500#[cfg_attr(feature = "bindings", derive(TS))]
6501pub struct StringAggFunc {
6502 pub this: Expression,
6503 #[serde(default)]
6504 pub separator: Option<Expression>,
6505 #[serde(default)]
6506 pub order_by: Option<Vec<Ordered>>,
6507 #[serde(default)]
6508 pub distinct: bool,
6509 #[serde(default)]
6510 pub filter: Option<Expression>,
6511 #[serde(default, skip_serializing_if = "Option::is_none")]
6513 pub limit: Option<Box<Expression>>,
6514 #[serde(default, skip_serializing_if = "Option::is_none")]
6516 pub inferred_type: Option<DataType>,
6517}
6518
6519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6521#[cfg_attr(feature = "bindings", derive(TS))]
6522pub struct ListAggFunc {
6523 pub this: Expression,
6524 pub separator: Option<Expression>,
6525 pub on_overflow: Option<ListAggOverflow>,
6526 pub order_by: Option<Vec<Ordered>>,
6527 pub distinct: bool,
6528 pub filter: Option<Expression>,
6529 #[serde(default, skip_serializing_if = "Option::is_none")]
6531 pub inferred_type: Option<DataType>,
6532}
6533
6534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6536#[cfg_attr(feature = "bindings", derive(TS))]
6537pub enum ListAggOverflow {
6538 Error,
6539 Truncate {
6540 filler: Option<Expression>,
6541 with_count: bool,
6542 },
6543}
6544
6545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6547#[cfg_attr(feature = "bindings", derive(TS))]
6548pub struct SumIfFunc {
6549 pub this: Expression,
6550 pub condition: Expression,
6551 pub filter: Option<Expression>,
6552 #[serde(default, skip_serializing_if = "Option::is_none")]
6554 pub inferred_type: Option<DataType>,
6555}
6556
6557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6559#[cfg_attr(feature = "bindings", derive(TS))]
6560pub struct ApproxPercentileFunc {
6561 pub this: Expression,
6562 pub percentile: Expression,
6563 pub accuracy: Option<Expression>,
6564 pub filter: Option<Expression>,
6565}
6566
6567#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6569#[cfg_attr(feature = "bindings", derive(TS))]
6570pub struct PercentileFunc {
6571 pub this: Expression,
6572 pub percentile: Expression,
6573 pub order_by: Option<Vec<Ordered>>,
6574 pub filter: Option<Expression>,
6575}
6576
6577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6583#[cfg_attr(feature = "bindings", derive(TS))]
6584pub struct RowNumber;
6585
6586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6588#[cfg_attr(feature = "bindings", derive(TS))]
6589pub struct Rank {
6590 #[serde(default, skip_serializing_if = "Option::is_none")]
6592 pub order_by: Option<Vec<Ordered>>,
6593 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6595 pub args: Vec<Expression>,
6596}
6597
6598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6600#[cfg_attr(feature = "bindings", derive(TS))]
6601pub struct DenseRank {
6602 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6604 pub args: Vec<Expression>,
6605}
6606
6607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6609#[cfg_attr(feature = "bindings", derive(TS))]
6610pub struct NTileFunc {
6611 #[serde(default, skip_serializing_if = "Option::is_none")]
6613 pub num_buckets: Option<Expression>,
6614 #[serde(default, skip_serializing_if = "Option::is_none")]
6616 pub order_by: Option<Vec<Ordered>>,
6617}
6618
6619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6621#[cfg_attr(feature = "bindings", derive(TS))]
6622pub struct LeadLagFunc {
6623 pub this: Expression,
6624 pub offset: Option<Expression>,
6625 pub default: Option<Expression>,
6626 #[serde(default, skip_serializing_if = "Option::is_none")]
6628 pub ignore_nulls: Option<bool>,
6629}
6630
6631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6633#[cfg_attr(feature = "bindings", derive(TS))]
6634pub struct ValueFunc {
6635 pub this: Expression,
6636 #[serde(default, skip_serializing_if = "Option::is_none")]
6638 pub ignore_nulls: Option<bool>,
6639 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6641 pub order_by: Vec<Ordered>,
6642}
6643
6644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6646#[cfg_attr(feature = "bindings", derive(TS))]
6647pub struct NthValueFunc {
6648 pub this: Expression,
6649 pub offset: Expression,
6650 #[serde(default, skip_serializing_if = "Option::is_none")]
6652 pub ignore_nulls: Option<bool>,
6653 #[serde(default, skip_serializing_if = "Option::is_none")]
6656 pub from_first: Option<bool>,
6657}
6658
6659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6661#[cfg_attr(feature = "bindings", derive(TS))]
6662pub struct PercentRank {
6663 #[serde(default, skip_serializing_if = "Option::is_none")]
6665 pub order_by: Option<Vec<Ordered>>,
6666 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6668 pub args: Vec<Expression>,
6669}
6670
6671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6673#[cfg_attr(feature = "bindings", derive(TS))]
6674pub struct CumeDist {
6675 #[serde(default, skip_serializing_if = "Option::is_none")]
6677 pub order_by: Option<Vec<Ordered>>,
6678 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6680 pub args: Vec<Expression>,
6681}
6682
6683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6689#[cfg_attr(feature = "bindings", derive(TS))]
6690pub struct PositionFunc {
6691 pub substring: Expression,
6692 pub string: Expression,
6693 pub start: Option<Expression>,
6694}
6695
6696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6702#[cfg_attr(feature = "bindings", derive(TS))]
6703pub struct Random;
6704
6705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6707#[cfg_attr(feature = "bindings", derive(TS))]
6708pub struct Rand {
6709 pub seed: Option<Box<Expression>>,
6710 #[serde(default)]
6712 pub lower: Option<Box<Expression>>,
6713 #[serde(default)]
6715 pub upper: Option<Box<Expression>>,
6716}
6717
6718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6720#[cfg_attr(feature = "bindings", derive(TS))]
6721pub struct TruncateFunc {
6722 pub this: Expression,
6723 pub decimals: Option<Expression>,
6724}
6725
6726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6728#[cfg_attr(feature = "bindings", derive(TS))]
6729pub struct Pi;
6730
6731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6737#[cfg_attr(feature = "bindings", derive(TS))]
6738pub struct DecodeFunc {
6739 pub this: Expression,
6740 pub search_results: Vec<(Expression, Expression)>,
6741 pub default: Option<Expression>,
6742}
6743
6744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6750#[cfg_attr(feature = "bindings", derive(TS))]
6751pub struct DateFormatFunc {
6752 pub this: Expression,
6753 pub format: Expression,
6754}
6755
6756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6758#[cfg_attr(feature = "bindings", derive(TS))]
6759pub struct FromUnixtimeFunc {
6760 pub this: Expression,
6761 pub format: Option<Expression>,
6762}
6763
6764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6766#[cfg_attr(feature = "bindings", derive(TS))]
6767pub struct UnixTimestampFunc {
6768 pub this: Option<Expression>,
6769 pub format: Option<Expression>,
6770}
6771
6772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6774#[cfg_attr(feature = "bindings", derive(TS))]
6775pub struct MakeDateFunc {
6776 pub year: Expression,
6777 pub month: Expression,
6778 pub day: Expression,
6779}
6780
6781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6783#[cfg_attr(feature = "bindings", derive(TS))]
6784pub struct MakeTimestampFunc {
6785 pub year: Expression,
6786 pub month: Expression,
6787 pub day: Expression,
6788 pub hour: Expression,
6789 pub minute: Expression,
6790 pub second: Expression,
6791 pub timezone: Option<Expression>,
6792}
6793
6794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6796#[cfg_attr(feature = "bindings", derive(TS))]
6797pub struct LastDayFunc {
6798 pub this: Expression,
6799 #[serde(skip_serializing_if = "Option::is_none", default)]
6801 pub unit: Option<DateTimeField>,
6802}
6803
6804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6810#[cfg_attr(feature = "bindings", derive(TS))]
6811pub struct ArrayConstructor {
6812 pub expressions: Vec<Expression>,
6813 pub bracket_notation: bool,
6814 pub use_list_keyword: bool,
6816}
6817
6818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6820#[cfg_attr(feature = "bindings", derive(TS))]
6821pub struct ArraySortFunc {
6822 pub this: Expression,
6823 pub comparator: Option<Expression>,
6824 pub desc: bool,
6825 pub nulls_first: Option<bool>,
6826}
6827
6828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6830#[cfg_attr(feature = "bindings", derive(TS))]
6831pub struct ArrayJoinFunc {
6832 pub this: Expression,
6833 pub separator: Expression,
6834 pub null_replacement: Option<Expression>,
6835}
6836
6837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6839#[cfg_attr(feature = "bindings", derive(TS))]
6840pub struct UnnestFunc {
6841 pub this: Expression,
6842 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6844 pub expressions: Vec<Expression>,
6845 pub with_ordinality: bool,
6846 pub alias: Option<Identifier>,
6847 #[serde(default, skip_serializing_if = "Option::is_none")]
6849 pub offset_alias: Option<Identifier>,
6850}
6851
6852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6854#[cfg_attr(feature = "bindings", derive(TS))]
6855pub struct ArrayFilterFunc {
6856 pub this: Expression,
6857 pub filter: Expression,
6858}
6859
6860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6862#[cfg_attr(feature = "bindings", derive(TS))]
6863pub struct ArrayTransformFunc {
6864 pub this: Expression,
6865 pub transform: Expression,
6866}
6867
6868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6870#[cfg_attr(feature = "bindings", derive(TS))]
6871pub struct SequenceFunc {
6872 pub start: Expression,
6873 pub stop: Expression,
6874 pub step: Option<Expression>,
6875}
6876
6877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6883#[cfg_attr(feature = "bindings", derive(TS))]
6884pub struct StructConstructor {
6885 pub fields: Vec<(Option<Identifier>, Expression)>,
6886}
6887
6888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6890#[cfg_attr(feature = "bindings", derive(TS))]
6891pub struct StructExtractFunc {
6892 pub this: Expression,
6893 pub field: Identifier,
6894}
6895
6896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6898#[cfg_attr(feature = "bindings", derive(TS))]
6899pub struct NamedStructFunc {
6900 pub pairs: Vec<(Expression, Expression)>,
6901}
6902
6903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6909#[cfg_attr(feature = "bindings", derive(TS))]
6910pub struct MapConstructor {
6911 pub keys: Vec<Expression>,
6912 pub values: Vec<Expression>,
6913 #[serde(default)]
6915 pub curly_brace_syntax: bool,
6916 #[serde(default)]
6918 pub with_map_keyword: bool,
6919}
6920
6921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6923#[cfg_attr(feature = "bindings", derive(TS))]
6924pub struct TransformFunc {
6925 pub this: Expression,
6926 pub transform: Expression,
6927}
6928
6929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6932#[cfg_attr(feature = "bindings", derive(TS))]
6933pub struct FunctionEmits {
6934 pub this: Expression,
6936 pub emits: Expression,
6938}
6939
6940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6946#[cfg_attr(feature = "bindings", derive(TS))]
6947pub struct JsonExtractFunc {
6948 pub this: Expression,
6949 pub path: Expression,
6950 pub returning: Option<DataType>,
6951 #[serde(default)]
6953 pub arrow_syntax: bool,
6954 #[serde(default)]
6956 pub hash_arrow_syntax: bool,
6957 #[serde(default)]
6959 pub wrapper_option: Option<String>,
6960 #[serde(default)]
6962 pub quotes_option: Option<String>,
6963 #[serde(default)]
6965 pub on_scalar_string: bool,
6966 #[serde(default)]
6968 pub on_error: Option<String>,
6969}
6970
6971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6973#[cfg_attr(feature = "bindings", derive(TS))]
6974pub struct JsonPathFunc {
6975 pub this: Expression,
6976 pub paths: Vec<Expression>,
6977}
6978
6979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6981#[cfg_attr(feature = "bindings", derive(TS))]
6982pub struct JsonObjectFunc {
6983 pub pairs: Vec<(Expression, Expression)>,
6984 pub null_handling: Option<JsonNullHandling>,
6985 #[serde(default)]
6986 pub with_unique_keys: bool,
6987 #[serde(default)]
6988 pub returning_type: Option<DataType>,
6989 #[serde(default)]
6990 pub format_json: bool,
6991 #[serde(default)]
6992 pub encoding: Option<String>,
6993 #[serde(default)]
6995 pub star: bool,
6996}
6997
6998#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7000#[cfg_attr(feature = "bindings", derive(TS))]
7001pub enum JsonNullHandling {
7002 NullOnNull,
7003 AbsentOnNull,
7004}
7005
7006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7008#[cfg_attr(feature = "bindings", derive(TS))]
7009pub struct JsonModifyFunc {
7010 pub this: Expression,
7011 pub path_values: Vec<(Expression, Expression)>,
7012}
7013
7014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7016#[cfg_attr(feature = "bindings", derive(TS))]
7017pub struct JsonArrayAggFunc {
7018 pub this: Expression,
7019 pub order_by: Option<Vec<Ordered>>,
7020 pub null_handling: Option<JsonNullHandling>,
7021 pub filter: Option<Expression>,
7022}
7023
7024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7026#[cfg_attr(feature = "bindings", derive(TS))]
7027pub struct JsonObjectAggFunc {
7028 pub key: Expression,
7029 pub value: Expression,
7030 pub null_handling: Option<JsonNullHandling>,
7031 pub filter: Option<Expression>,
7032}
7033
7034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7040#[cfg_attr(feature = "bindings", derive(TS))]
7041pub struct ConvertFunc {
7042 pub this: Expression,
7043 pub to: DataType,
7044 pub style: Option<Expression>,
7045}
7046
7047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7053#[cfg_attr(feature = "bindings", derive(TS))]
7054pub struct LambdaExpr {
7055 pub parameters: Vec<Identifier>,
7056 pub body: Expression,
7057 #[serde(default)]
7059 pub colon: bool,
7060 #[serde(default)]
7063 pub parameter_types: Vec<Option<DataType>>,
7064}
7065
7066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7068#[cfg_attr(feature = "bindings", derive(TS))]
7069pub struct Parameter {
7070 pub name: Option<String>,
7071 pub index: Option<u32>,
7072 pub style: ParameterStyle,
7073 #[serde(default)]
7075 pub quoted: bool,
7076 #[serde(default)]
7078 pub string_quoted: bool,
7079 #[serde(default)]
7081 pub expression: Option<String>,
7082}
7083
7084#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7086#[cfg_attr(feature = "bindings", derive(TS))]
7087pub enum ParameterStyle {
7088 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7098
7099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7101#[cfg_attr(feature = "bindings", derive(TS))]
7102pub struct Placeholder {
7103 pub index: Option<u32>,
7104}
7105
7106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7108#[cfg_attr(feature = "bindings", derive(TS))]
7109pub struct NamedArgument {
7110 pub name: Identifier,
7111 pub value: Expression,
7112 pub separator: NamedArgSeparator,
7114}
7115
7116#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7118#[cfg_attr(feature = "bindings", derive(TS))]
7119pub enum NamedArgSeparator {
7120 DArrow,
7122 ColonEq,
7124 Eq,
7126}
7127
7128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7131#[cfg_attr(feature = "bindings", derive(TS))]
7132pub struct TableArgument {
7133 pub prefix: String,
7135 pub this: Expression,
7137}
7138
7139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7141#[cfg_attr(feature = "bindings", derive(TS))]
7142pub struct SqlComment {
7143 pub text: String,
7144 pub is_block: bool,
7145}
7146
7147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7153#[cfg_attr(feature = "bindings", derive(TS))]
7154pub struct SimilarToExpr {
7155 pub this: Expression,
7156 pub pattern: Expression,
7157 pub escape: Option<Expression>,
7158 pub not: bool,
7159}
7160
7161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7163#[cfg_attr(feature = "bindings", derive(TS))]
7164pub struct QuantifiedExpr {
7165 pub this: Expression,
7166 pub subquery: Expression,
7167 pub op: Option<QuantifiedOp>,
7168}
7169
7170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7172#[cfg_attr(feature = "bindings", derive(TS))]
7173pub enum QuantifiedOp {
7174 Eq,
7175 Neq,
7176 Lt,
7177 Lte,
7178 Gt,
7179 Gte,
7180}
7181
7182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7187#[cfg_attr(feature = "bindings", derive(TS))]
7188pub struct OverlapsExpr {
7189 #[serde(skip_serializing_if = "Option::is_none")]
7191 pub this: Option<Expression>,
7192 #[serde(skip_serializing_if = "Option::is_none")]
7194 pub expression: Option<Expression>,
7195 #[serde(skip_serializing_if = "Option::is_none")]
7197 pub left_start: Option<Expression>,
7198 #[serde(skip_serializing_if = "Option::is_none")]
7200 pub left_end: Option<Expression>,
7201 #[serde(skip_serializing_if = "Option::is_none")]
7203 pub right_start: Option<Expression>,
7204 #[serde(skip_serializing_if = "Option::is_none")]
7206 pub right_end: Option<Expression>,
7207}
7208
7209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7215#[cfg_attr(feature = "bindings", derive(TS))]
7216pub struct Subscript {
7217 pub this: Expression,
7218 pub index: Expression,
7219}
7220
7221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7223#[cfg_attr(feature = "bindings", derive(TS))]
7224pub struct DotAccess {
7225 pub this: Expression,
7226 pub field: Identifier,
7227}
7228
7229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7231#[cfg_attr(feature = "bindings", derive(TS))]
7232pub struct MethodCall {
7233 pub this: Expression,
7234 pub method: Identifier,
7235 pub args: Vec<Expression>,
7236}
7237
7238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7240#[cfg_attr(feature = "bindings", derive(TS))]
7241pub struct ArraySlice {
7242 pub this: Expression,
7243 pub start: Option<Expression>,
7244 pub end: Option<Expression>,
7245}
7246
7247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7253#[cfg_attr(feature = "bindings", derive(TS))]
7254pub enum OnCommit {
7255 PreserveRows,
7257 DeleteRows,
7259}
7260
7261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7263#[cfg_attr(feature = "bindings", derive(TS))]
7264pub struct CreateTable {
7265 pub name: TableRef,
7266 #[serde(default, skip_serializing_if = "Option::is_none")]
7268 pub on_cluster: Option<OnCluster>,
7269 pub columns: Vec<ColumnDef>,
7270 pub constraints: Vec<TableConstraint>,
7271 pub if_not_exists: bool,
7272 pub temporary: bool,
7273 pub or_replace: bool,
7274 #[serde(default, skip_serializing_if = "Option::is_none")]
7276 pub table_modifier: Option<String>,
7277 pub as_select: Option<Expression>,
7278 #[serde(default)]
7280 pub as_select_parenthesized: bool,
7281 #[serde(default)]
7283 pub on_commit: Option<OnCommit>,
7284 #[serde(default)]
7286 pub clone_source: Option<TableRef>,
7287 #[serde(default, skip_serializing_if = "Option::is_none")]
7289 pub clone_at_clause: Option<Expression>,
7290 #[serde(default)]
7292 pub is_copy: bool,
7293 #[serde(default)]
7295 pub shallow_clone: bool,
7296 #[serde(default)]
7298 pub leading_comments: Vec<String>,
7299 #[serde(default)]
7301 pub with_properties: Vec<(String, String)>,
7302 #[serde(default)]
7304 pub teradata_post_name_options: Vec<String>,
7305 #[serde(default)]
7307 pub with_data: Option<bool>,
7308 #[serde(default)]
7310 pub with_statistics: Option<bool>,
7311 #[serde(default)]
7313 pub teradata_indexes: Vec<TeradataIndex>,
7314 #[serde(default)]
7316 pub with_cte: Option<With>,
7317 #[serde(default)]
7319 pub properties: Vec<Expression>,
7320 #[serde(default, skip_serializing_if = "Option::is_none")]
7322 pub partition_of: Option<Expression>,
7323 #[serde(default)]
7325 pub post_table_properties: Vec<Expression>,
7326 #[serde(default)]
7328 pub mysql_table_options: Vec<(String, String)>,
7329 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7331 pub inherits: Vec<TableRef>,
7332 #[serde(default, skip_serializing_if = "Option::is_none")]
7334 pub on_property: Option<OnProperty>,
7335 #[serde(default)]
7337 pub copy_grants: bool,
7338 #[serde(default, skip_serializing_if = "Option::is_none")]
7340 pub using_template: Option<Box<Expression>>,
7341 #[serde(default, skip_serializing_if = "Option::is_none")]
7343 pub rollup: Option<RollupProperty>,
7344 #[serde(default, skip_serializing_if = "Option::is_none")]
7346 pub uuid: Option<String>,
7347}
7348
7349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7351#[cfg_attr(feature = "bindings", derive(TS))]
7352pub struct TeradataIndex {
7353 pub kind: TeradataIndexKind,
7355 pub name: Option<String>,
7357 pub columns: Vec<String>,
7359}
7360
7361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7363#[cfg_attr(feature = "bindings", derive(TS))]
7364pub enum TeradataIndexKind {
7365 NoPrimary,
7367 Primary,
7369 PrimaryAmp,
7371 Unique,
7373 UniquePrimary,
7375 Secondary,
7377}
7378
7379impl CreateTable {
7380 pub fn new(name: impl Into<String>) -> Self {
7381 Self {
7382 name: TableRef::new(name),
7383 on_cluster: None,
7384 columns: Vec::new(),
7385 constraints: Vec::new(),
7386 if_not_exists: false,
7387 temporary: false,
7388 or_replace: false,
7389 table_modifier: None,
7390 as_select: None,
7391 as_select_parenthesized: false,
7392 on_commit: None,
7393 clone_source: None,
7394 clone_at_clause: None,
7395 shallow_clone: false,
7396 is_copy: false,
7397 leading_comments: Vec::new(),
7398 with_properties: Vec::new(),
7399 teradata_post_name_options: Vec::new(),
7400 with_data: None,
7401 with_statistics: None,
7402 teradata_indexes: Vec::new(),
7403 with_cte: None,
7404 properties: Vec::new(),
7405 partition_of: None,
7406 post_table_properties: Vec::new(),
7407 mysql_table_options: Vec::new(),
7408 inherits: Vec::new(),
7409 on_property: None,
7410 copy_grants: false,
7411 using_template: None,
7412 rollup: None,
7413 uuid: None,
7414 }
7415 }
7416}
7417
7418#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7420#[cfg_attr(feature = "bindings", derive(TS))]
7421pub enum SortOrder {
7422 Asc,
7423 Desc,
7424}
7425
7426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7428#[cfg_attr(feature = "bindings", derive(TS))]
7429pub enum ConstraintType {
7430 NotNull,
7431 Null,
7432 PrimaryKey,
7433 Unique,
7434 Default,
7435 AutoIncrement,
7436 Collate,
7437 Comment,
7438 References,
7439 Check,
7440 GeneratedAsIdentity,
7441 Tags,
7443 ComputedColumn,
7445 GeneratedAsRow,
7447 OnUpdate,
7449 Path,
7451 Encode,
7453}
7454
7455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7457#[cfg_attr(feature = "bindings", derive(TS))]
7458pub struct ColumnDef {
7459 pub name: Identifier,
7460 pub data_type: DataType,
7461 pub nullable: Option<bool>,
7462 pub default: Option<Expression>,
7463 pub primary_key: bool,
7464 #[serde(default)]
7466 pub primary_key_order: Option<SortOrder>,
7467 pub unique: bool,
7468 #[serde(default)]
7470 pub unique_nulls_not_distinct: bool,
7471 pub auto_increment: bool,
7472 pub comment: Option<String>,
7473 pub constraints: Vec<ColumnConstraint>,
7474 #[serde(default)]
7476 pub constraint_order: Vec<ConstraintType>,
7477 #[serde(default)]
7479 pub format: Option<String>,
7480 #[serde(default)]
7482 pub title: Option<String>,
7483 #[serde(default)]
7485 pub inline_length: Option<u64>,
7486 #[serde(default)]
7488 pub compress: Option<Vec<Expression>>,
7489 #[serde(default)]
7491 pub character_set: Option<String>,
7492 #[serde(default)]
7494 pub uppercase: bool,
7495 #[serde(default)]
7497 pub casespecific: Option<bool>,
7498 #[serde(default)]
7500 pub auto_increment_start: Option<Box<Expression>>,
7501 #[serde(default)]
7503 pub auto_increment_increment: Option<Box<Expression>>,
7504 #[serde(default)]
7506 pub auto_increment_order: Option<bool>,
7507 #[serde(default)]
7509 pub unsigned: bool,
7510 #[serde(default)]
7512 pub zerofill: bool,
7513 #[serde(default, skip_serializing_if = "Option::is_none")]
7515 pub on_update: Option<Expression>,
7516 #[serde(default, skip_serializing_if = "Option::is_none")]
7518 pub unique_constraint_name: Option<String>,
7519 #[serde(default, skip_serializing_if = "Option::is_none")]
7521 pub not_null_constraint_name: Option<String>,
7522 #[serde(default, skip_serializing_if = "Option::is_none")]
7524 pub primary_key_constraint_name: Option<String>,
7525 #[serde(default, skip_serializing_if = "Option::is_none")]
7527 pub check_constraint_name: Option<String>,
7528 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7530 pub options: Vec<Expression>,
7531 #[serde(default)]
7533 pub no_type: bool,
7534 #[serde(default, skip_serializing_if = "Option::is_none")]
7536 pub encoding: Option<String>,
7537 #[serde(default, skip_serializing_if = "Option::is_none")]
7539 pub codec: Option<String>,
7540 #[serde(default, skip_serializing_if = "Option::is_none")]
7542 pub ephemeral: Option<Option<Box<Expression>>>,
7543 #[serde(default, skip_serializing_if = "Option::is_none")]
7545 pub materialized_expr: Option<Box<Expression>>,
7546 #[serde(default, skip_serializing_if = "Option::is_none")]
7548 pub alias_expr: Option<Box<Expression>>,
7549 #[serde(default, skip_serializing_if = "Option::is_none")]
7551 pub ttl_expr: Option<Box<Expression>>,
7552 #[serde(default)]
7554 pub not_for_replication: bool,
7555}
7556
7557impl ColumnDef {
7558 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7559 Self {
7560 name: Identifier::new(name),
7561 data_type,
7562 nullable: None,
7563 default: None,
7564 primary_key: false,
7565 primary_key_order: None,
7566 unique: false,
7567 unique_nulls_not_distinct: false,
7568 auto_increment: false,
7569 comment: None,
7570 constraints: Vec::new(),
7571 constraint_order: Vec::new(),
7572 format: None,
7573 title: None,
7574 inline_length: None,
7575 compress: None,
7576 character_set: None,
7577 uppercase: false,
7578 casespecific: None,
7579 auto_increment_start: None,
7580 auto_increment_increment: None,
7581 auto_increment_order: None,
7582 unsigned: false,
7583 zerofill: false,
7584 on_update: None,
7585 unique_constraint_name: None,
7586 not_null_constraint_name: None,
7587 primary_key_constraint_name: None,
7588 check_constraint_name: None,
7589 options: Vec::new(),
7590 no_type: false,
7591 encoding: None,
7592 codec: None,
7593 ephemeral: None,
7594 materialized_expr: None,
7595 alias_expr: None,
7596 ttl_expr: None,
7597 not_for_replication: false,
7598 }
7599 }
7600}
7601
7602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7604#[cfg_attr(feature = "bindings", derive(TS))]
7605pub enum ColumnConstraint {
7606 NotNull,
7607 Null,
7608 Unique,
7609 PrimaryKey,
7610 Default(Expression),
7611 Check(Expression),
7612 References(ForeignKeyRef),
7613 GeneratedAsIdentity(GeneratedAsIdentity),
7614 Collate(Identifier),
7615 Comment(String),
7616 Tags(Tags),
7618 ComputedColumn(ComputedColumn),
7621 GeneratedAsRow(GeneratedAsRow),
7623 Path(Expression),
7625}
7626
7627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7629#[cfg_attr(feature = "bindings", derive(TS))]
7630pub struct ComputedColumn {
7631 pub expression: Box<Expression>,
7633 #[serde(default)]
7635 pub persisted: bool,
7636 #[serde(default)]
7638 pub not_null: bool,
7639 #[serde(default)]
7642 pub persistence_kind: Option<String>,
7643 #[serde(default, skip_serializing_if = "Option::is_none")]
7645 pub data_type: Option<DataType>,
7646}
7647
7648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7650#[cfg_attr(feature = "bindings", derive(TS))]
7651pub struct GeneratedAsRow {
7652 pub start: bool,
7654 #[serde(default)]
7656 pub hidden: bool,
7657}
7658
7659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7661#[cfg_attr(feature = "bindings", derive(TS))]
7662pub struct GeneratedAsIdentity {
7663 pub always: bool,
7665 pub on_null: bool,
7667 pub start: Option<Box<Expression>>,
7669 pub increment: Option<Box<Expression>>,
7671 pub minvalue: Option<Box<Expression>>,
7673 pub maxvalue: Option<Box<Expression>>,
7675 pub cycle: Option<bool>,
7677}
7678
7679#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7681#[cfg_attr(feature = "bindings", derive(TS))]
7682pub struct ConstraintModifiers {
7683 pub enforced: Option<bool>,
7685 pub deferrable: Option<bool>,
7687 pub initially_deferred: Option<bool>,
7689 pub norely: bool,
7691 pub rely: bool,
7693 #[serde(default)]
7695 pub using: Option<String>,
7696 #[serde(default)]
7698 pub using_before_columns: bool,
7699 #[serde(default, skip_serializing_if = "Option::is_none")]
7701 pub comment: Option<String>,
7702 #[serde(default, skip_serializing_if = "Option::is_none")]
7704 pub visible: Option<bool>,
7705 #[serde(default, skip_serializing_if = "Option::is_none")]
7707 pub engine_attribute: Option<String>,
7708 #[serde(default, skip_serializing_if = "Option::is_none")]
7710 pub with_parser: Option<String>,
7711 #[serde(default)]
7713 pub not_valid: bool,
7714 #[serde(default, skip_serializing_if = "Option::is_none")]
7716 pub clustered: Option<String>,
7717 #[serde(default, skip_serializing_if = "Option::is_none")]
7719 pub on_conflict: Option<String>,
7720 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7722 pub with_options: Vec<(String, String)>,
7723 #[serde(default, skip_serializing_if = "Option::is_none")]
7725 pub on_filegroup: Option<Identifier>,
7726}
7727
7728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7730#[cfg_attr(feature = "bindings", derive(TS))]
7731pub enum TableConstraint {
7732 PrimaryKey {
7733 name: Option<Identifier>,
7734 columns: Vec<Identifier>,
7735 #[serde(default)]
7737 include_columns: Vec<Identifier>,
7738 #[serde(default)]
7739 modifiers: ConstraintModifiers,
7740 #[serde(default)]
7742 has_constraint_keyword: bool,
7743 },
7744 Unique {
7745 name: Option<Identifier>,
7746 columns: Vec<Identifier>,
7747 #[serde(default)]
7749 columns_parenthesized: bool,
7750 #[serde(default)]
7751 modifiers: ConstraintModifiers,
7752 #[serde(default)]
7754 has_constraint_keyword: bool,
7755 #[serde(default)]
7757 nulls_not_distinct: bool,
7758 },
7759 ForeignKey {
7760 name: Option<Identifier>,
7761 columns: Vec<Identifier>,
7762 #[serde(default)]
7763 references: Option<ForeignKeyRef>,
7764 #[serde(default)]
7766 on_delete: Option<ReferentialAction>,
7767 #[serde(default)]
7769 on_update: Option<ReferentialAction>,
7770 #[serde(default)]
7771 modifiers: ConstraintModifiers,
7772 },
7773 Check {
7774 name: Option<Identifier>,
7775 expression: Expression,
7776 #[serde(default)]
7777 modifiers: ConstraintModifiers,
7778 },
7779 Assume {
7781 name: Option<Identifier>,
7782 expression: Expression,
7783 },
7784 Default {
7786 name: Option<Identifier>,
7787 expression: Expression,
7788 column: Identifier,
7789 },
7790 Index {
7792 name: Option<Identifier>,
7793 columns: Vec<Identifier>,
7794 #[serde(default)]
7796 kind: Option<String>,
7797 #[serde(default)]
7798 modifiers: ConstraintModifiers,
7799 #[serde(default)]
7801 use_key_keyword: bool,
7802 #[serde(default, skip_serializing_if = "Option::is_none")]
7804 expression: Option<Box<Expression>>,
7805 #[serde(default, skip_serializing_if = "Option::is_none")]
7807 index_type: Option<Box<Expression>>,
7808 #[serde(default, skip_serializing_if = "Option::is_none")]
7810 granularity: Option<Box<Expression>>,
7811 },
7812 Projection {
7814 name: Identifier,
7815 expression: Expression,
7816 },
7817 Like {
7819 source: TableRef,
7820 options: Vec<(LikeOptionAction, String)>,
7822 },
7823 PeriodForSystemTime {
7825 start_col: Identifier,
7826 end_col: Identifier,
7827 },
7828 Exclude {
7831 name: Option<Identifier>,
7832 #[serde(default)]
7834 using: Option<String>,
7835 elements: Vec<ExcludeElement>,
7837 #[serde(default)]
7839 include_columns: Vec<Identifier>,
7840 #[serde(default)]
7842 where_clause: Option<Box<Expression>>,
7843 #[serde(default)]
7845 with_params: Vec<(String, String)>,
7846 #[serde(default)]
7848 using_index_tablespace: Option<String>,
7849 #[serde(default)]
7850 modifiers: ConstraintModifiers,
7851 },
7852 Tags(Tags),
7854 InitiallyDeferred {
7858 deferred: bool,
7860 },
7861}
7862
7863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7865#[cfg_attr(feature = "bindings", derive(TS))]
7866pub struct ExcludeElement {
7867 pub expression: String,
7869 pub operator: String,
7871}
7872
7873#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7875#[cfg_attr(feature = "bindings", derive(TS))]
7876pub enum LikeOptionAction {
7877 Including,
7878 Excluding,
7879}
7880
7881#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7883#[cfg_attr(feature = "bindings", derive(TS))]
7884pub enum MatchType {
7885 Full,
7886 Partial,
7887 Simple,
7888}
7889
7890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7892#[cfg_attr(feature = "bindings", derive(TS))]
7893pub struct ForeignKeyRef {
7894 pub table: TableRef,
7895 pub columns: Vec<Identifier>,
7896 pub on_delete: Option<ReferentialAction>,
7897 pub on_update: Option<ReferentialAction>,
7898 #[serde(default)]
7900 pub on_update_first: bool,
7901 #[serde(default)]
7903 pub match_type: Option<MatchType>,
7904 #[serde(default)]
7906 pub match_after_actions: bool,
7907 #[serde(default)]
7909 pub constraint_name: Option<String>,
7910 #[serde(default)]
7912 pub deferrable: Option<bool>,
7913 #[serde(default)]
7915 pub has_foreign_key_keywords: bool,
7916}
7917
7918#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7920#[cfg_attr(feature = "bindings", derive(TS))]
7921pub enum ReferentialAction {
7922 Cascade,
7923 SetNull,
7924 SetDefault,
7925 Restrict,
7926 NoAction,
7927}
7928
7929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7931#[cfg_attr(feature = "bindings", derive(TS))]
7932pub struct DropTable {
7933 pub names: Vec<TableRef>,
7934 pub if_exists: bool,
7935 pub cascade: bool,
7936 #[serde(default)]
7938 pub cascade_constraints: bool,
7939 #[serde(default)]
7941 pub purge: bool,
7942 #[serde(default)]
7944 pub leading_comments: Vec<String>,
7945 #[serde(default, skip_serializing_if = "Option::is_none")]
7948 pub object_id_args: Option<String>,
7949 #[serde(default)]
7951 pub sync: bool,
7952 #[serde(default)]
7954 pub iceberg: bool,
7955 #[serde(default)]
7957 pub restrict: bool,
7958}
7959
7960impl DropTable {
7961 pub fn new(name: impl Into<String>) -> Self {
7962 Self {
7963 names: vec![TableRef::new(name)],
7964 if_exists: false,
7965 cascade: false,
7966 cascade_constraints: false,
7967 purge: false,
7968 leading_comments: Vec::new(),
7969 object_id_args: None,
7970 sync: false,
7971 iceberg: false,
7972 restrict: false,
7973 }
7974 }
7975}
7976
7977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7979#[cfg_attr(feature = "bindings", derive(TS))]
7980pub struct Undrop {
7981 pub kind: String,
7983 pub name: TableRef,
7985 #[serde(default)]
7987 pub if_exists: bool,
7988}
7989
7990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7992#[cfg_attr(feature = "bindings", derive(TS))]
7993pub struct AlterTable {
7994 pub name: TableRef,
7995 pub actions: Vec<AlterTableAction>,
7996 #[serde(default)]
7998 pub if_exists: bool,
7999 #[serde(default, skip_serializing_if = "Option::is_none")]
8001 pub algorithm: Option<String>,
8002 #[serde(default, skip_serializing_if = "Option::is_none")]
8004 pub lock: Option<String>,
8005 #[serde(default, skip_serializing_if = "Option::is_none")]
8007 pub with_check: Option<String>,
8008 #[serde(default, skip_serializing_if = "Option::is_none")]
8010 pub partition: Option<Vec<(Identifier, Expression)>>,
8011 #[serde(default, skip_serializing_if = "Option::is_none")]
8013 pub on_cluster: Option<OnCluster>,
8014 #[serde(default, skip_serializing_if = "Option::is_none")]
8016 pub table_modifier: Option<String>,
8017}
8018
8019impl AlterTable {
8020 pub fn new(name: impl Into<String>) -> Self {
8021 Self {
8022 name: TableRef::new(name),
8023 actions: Vec::new(),
8024 if_exists: false,
8025 algorithm: None,
8026 lock: None,
8027 with_check: None,
8028 partition: None,
8029 on_cluster: None,
8030 table_modifier: None,
8031 }
8032 }
8033}
8034
8035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8037#[cfg_attr(feature = "bindings", derive(TS))]
8038pub enum ColumnPosition {
8039 First,
8040 After(Identifier),
8041}
8042
8043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8045#[cfg_attr(feature = "bindings", derive(TS))]
8046pub enum AlterTableAction {
8047 AddColumn {
8048 column: ColumnDef,
8049 if_not_exists: bool,
8050 position: Option<ColumnPosition>,
8051 },
8052 DropColumn {
8053 name: Identifier,
8054 if_exists: bool,
8055 cascade: bool,
8056 },
8057 RenameColumn {
8058 old_name: Identifier,
8059 new_name: Identifier,
8060 if_exists: bool,
8061 },
8062 AlterColumn {
8063 name: Identifier,
8064 action: AlterColumnAction,
8065 #[serde(default)]
8067 use_modify_keyword: bool,
8068 },
8069 RenameTable(TableRef),
8070 AddConstraint(TableConstraint),
8071 DropConstraint {
8072 name: Identifier,
8073 if_exists: bool,
8074 },
8075 DropForeignKey {
8077 name: Identifier,
8078 },
8079 DropPartition {
8081 partitions: Vec<Vec<(Identifier, Expression)>>,
8083 if_exists: bool,
8084 },
8085 AddPartition {
8087 partition: Expression,
8089 if_not_exists: bool,
8090 location: Option<Expression>,
8091 },
8092 Delete {
8094 where_clause: Expression,
8095 },
8096 SwapWith(TableRef),
8098 SetProperty {
8100 properties: Vec<(String, Expression)>,
8101 },
8102 UnsetProperty {
8104 properties: Vec<String>,
8105 },
8106 ClusterBy {
8108 expressions: Vec<Expression>,
8109 },
8110 SetTag {
8112 expressions: Vec<(String, Expression)>,
8113 },
8114 UnsetTag {
8116 names: Vec<String>,
8117 },
8118 SetOptions {
8120 expressions: Vec<Expression>,
8121 },
8122 AlterIndex {
8124 name: Identifier,
8125 visible: bool,
8126 },
8127 SetAttribute {
8129 attribute: String,
8130 },
8131 SetStageFileFormat {
8133 options: Option<Expression>,
8134 },
8135 SetStageCopyOptions {
8137 options: Option<Expression>,
8138 },
8139 AddColumns {
8141 columns: Vec<ColumnDef>,
8142 cascade: bool,
8143 },
8144 DropColumns {
8146 names: Vec<Identifier>,
8147 },
8148 ChangeColumn {
8151 old_name: Identifier,
8152 new_name: Identifier,
8153 #[serde(default, skip_serializing_if = "Option::is_none")]
8154 data_type: Option<DataType>,
8155 comment: Option<String>,
8156 #[serde(default)]
8157 cascade: bool,
8158 },
8159 AlterSortKey {
8162 this: Option<String>,
8164 expressions: Vec<Expression>,
8166 compound: bool,
8168 },
8169 AlterDistStyle {
8173 style: String,
8175 distkey: Option<Identifier>,
8177 },
8178 SetTableProperties {
8180 properties: Vec<(Expression, Expression)>,
8181 },
8182 SetLocation {
8184 location: String,
8185 },
8186 SetFileFormat {
8188 format: String,
8189 },
8190 ReplacePartition {
8192 partition: Expression,
8193 source: Option<Box<Expression>>,
8194 },
8195 Raw {
8197 sql: String,
8198 },
8199}
8200
8201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8203#[cfg_attr(feature = "bindings", derive(TS))]
8204pub enum AlterColumnAction {
8205 SetDataType {
8206 data_type: DataType,
8207 using: Option<Expression>,
8209 #[serde(default, skip_serializing_if = "Option::is_none")]
8211 collate: Option<String>,
8212 },
8213 SetDefault(Expression),
8214 DropDefault,
8215 SetNotNull,
8216 DropNotNull,
8217 Comment(String),
8219 SetVisible,
8221 SetInvisible,
8223}
8224
8225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8227#[cfg_attr(feature = "bindings", derive(TS))]
8228pub struct CreateIndex {
8229 pub name: Identifier,
8230 pub table: TableRef,
8231 pub columns: Vec<IndexColumn>,
8232 pub unique: bool,
8233 pub if_not_exists: bool,
8234 pub using: Option<String>,
8235 #[serde(default)]
8237 pub clustered: Option<String>,
8238 #[serde(default)]
8240 pub concurrently: bool,
8241 #[serde(default)]
8243 pub where_clause: Option<Box<Expression>>,
8244 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8246 pub include_columns: Vec<Identifier>,
8247 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8249 pub with_options: Vec<(String, String)>,
8250 #[serde(default)]
8252 pub on_filegroup: Option<String>,
8253}
8254
8255impl CreateIndex {
8256 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8257 Self {
8258 name: Identifier::new(name),
8259 table: TableRef::new(table),
8260 columns: Vec::new(),
8261 unique: false,
8262 if_not_exists: false,
8263 using: None,
8264 clustered: None,
8265 concurrently: false,
8266 where_clause: None,
8267 include_columns: Vec::new(),
8268 with_options: Vec::new(),
8269 on_filegroup: None,
8270 }
8271 }
8272}
8273
8274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8276#[cfg_attr(feature = "bindings", derive(TS))]
8277pub struct IndexColumn {
8278 pub column: Identifier,
8279 pub desc: bool,
8280 #[serde(default)]
8282 pub asc: bool,
8283 pub nulls_first: Option<bool>,
8284 #[serde(default, skip_serializing_if = "Option::is_none")]
8286 pub opclass: Option<String>,
8287}
8288
8289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8291#[cfg_attr(feature = "bindings", derive(TS))]
8292pub struct DropIndex {
8293 pub name: Identifier,
8294 pub table: Option<TableRef>,
8295 pub if_exists: bool,
8296 #[serde(default)]
8298 pub concurrently: bool,
8299}
8300
8301impl DropIndex {
8302 pub fn new(name: impl Into<String>) -> Self {
8303 Self {
8304 name: Identifier::new(name),
8305 table: None,
8306 if_exists: false,
8307 concurrently: false,
8308 }
8309 }
8310}
8311
8312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8314#[cfg_attr(feature = "bindings", derive(TS))]
8315pub struct ViewColumn {
8316 pub name: Identifier,
8317 pub comment: Option<String>,
8318 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8320 pub options: Vec<Expression>,
8321}
8322
8323impl ViewColumn {
8324 pub fn new(name: impl Into<String>) -> Self {
8325 Self {
8326 name: Identifier::new(name),
8327 comment: None,
8328 options: Vec::new(),
8329 }
8330 }
8331
8332 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8333 Self {
8334 name: Identifier::new(name),
8335 comment: Some(comment.into()),
8336 options: Vec::new(),
8337 }
8338 }
8339}
8340
8341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8343#[cfg_attr(feature = "bindings", derive(TS))]
8344pub struct CreateView {
8345 pub name: TableRef,
8346 pub columns: Vec<ViewColumn>,
8347 pub query: Expression,
8348 pub or_replace: bool,
8349 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8351 pub or_alter: bool,
8352 pub if_not_exists: bool,
8353 pub materialized: bool,
8354 pub temporary: bool,
8355 #[serde(default)]
8357 pub secure: bool,
8358 #[serde(skip_serializing_if = "Option::is_none")]
8360 pub algorithm: Option<String>,
8361 #[serde(skip_serializing_if = "Option::is_none")]
8363 pub definer: Option<String>,
8364 #[serde(skip_serializing_if = "Option::is_none")]
8366 pub security: Option<FunctionSecurity>,
8367 #[serde(default = "default_true")]
8369 pub security_sql_style: bool,
8370 #[serde(default)]
8372 pub security_after_name: bool,
8373 #[serde(default)]
8375 pub query_parenthesized: bool,
8376 #[serde(skip_serializing_if = "Option::is_none")]
8378 pub locking_mode: Option<String>,
8379 #[serde(skip_serializing_if = "Option::is_none")]
8381 pub locking_access: Option<String>,
8382 #[serde(default)]
8384 pub copy_grants: bool,
8385 #[serde(skip_serializing_if = "Option::is_none", default)]
8387 pub comment: Option<String>,
8388 #[serde(default)]
8390 pub tags: Vec<(String, String)>,
8391 #[serde(default)]
8393 pub options: Vec<Expression>,
8394 #[serde(skip_serializing_if = "Option::is_none", default)]
8396 pub build: Option<String>,
8397 #[serde(skip_serializing_if = "Option::is_none", default)]
8399 pub refresh: Option<Box<RefreshTriggerProperty>>,
8400 #[serde(skip_serializing_if = "Option::is_none", default)]
8403 pub schema: Option<Box<Schema>>,
8404 #[serde(skip_serializing_if = "Option::is_none", default)]
8406 pub unique_key: Option<Box<UniqueKeyProperty>>,
8407 #[serde(default)]
8409 pub no_schema_binding: bool,
8410 #[serde(skip_serializing_if = "Option::is_none", default)]
8412 pub auto_refresh: Option<bool>,
8413 #[serde(default, skip_serializing_if = "Option::is_none")]
8415 pub on_cluster: Option<OnCluster>,
8416 #[serde(default, skip_serializing_if = "Option::is_none")]
8418 pub to_table: Option<TableRef>,
8419 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8421 pub table_properties: Vec<Expression>,
8422}
8423
8424impl CreateView {
8425 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8426 Self {
8427 name: TableRef::new(name),
8428 columns: Vec::new(),
8429 query,
8430 or_replace: false,
8431 or_alter: false,
8432 if_not_exists: false,
8433 materialized: false,
8434 temporary: false,
8435 secure: false,
8436 algorithm: None,
8437 definer: None,
8438 security: None,
8439 security_sql_style: true,
8440 security_after_name: false,
8441 query_parenthesized: false,
8442 locking_mode: None,
8443 locking_access: None,
8444 copy_grants: false,
8445 comment: None,
8446 tags: Vec::new(),
8447 options: Vec::new(),
8448 build: None,
8449 refresh: None,
8450 schema: None,
8451 unique_key: None,
8452 no_schema_binding: false,
8453 auto_refresh: None,
8454 on_cluster: None,
8455 to_table: None,
8456 table_properties: Vec::new(),
8457 }
8458 }
8459}
8460
8461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8463#[cfg_attr(feature = "bindings", derive(TS))]
8464pub struct DropView {
8465 pub name: TableRef,
8466 pub if_exists: bool,
8467 pub materialized: bool,
8468}
8469
8470impl DropView {
8471 pub fn new(name: impl Into<String>) -> Self {
8472 Self {
8473 name: TableRef::new(name),
8474 if_exists: false,
8475 materialized: false,
8476 }
8477 }
8478}
8479
8480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8482#[cfg_attr(feature = "bindings", derive(TS))]
8483pub struct Truncate {
8484 #[serde(default)]
8486 pub target: TruncateTarget,
8487 #[serde(default)]
8489 pub if_exists: bool,
8490 pub table: TableRef,
8491 #[serde(default, skip_serializing_if = "Option::is_none")]
8493 pub on_cluster: Option<OnCluster>,
8494 pub cascade: bool,
8495 #[serde(default)]
8497 pub extra_tables: Vec<TruncateTableEntry>,
8498 #[serde(default)]
8500 pub identity: Option<TruncateIdentity>,
8501 #[serde(default)]
8503 pub restrict: bool,
8504 #[serde(default, skip_serializing_if = "Option::is_none")]
8506 pub partition: Option<Box<Expression>>,
8507}
8508
8509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8511#[cfg_attr(feature = "bindings", derive(TS))]
8512pub struct TruncateTableEntry {
8513 pub table: TableRef,
8514 #[serde(default)]
8516 pub star: bool,
8517}
8518
8519#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8521#[cfg_attr(feature = "bindings", derive(TS))]
8522pub enum TruncateTarget {
8523 Table,
8524 Database,
8525}
8526
8527impl Default for TruncateTarget {
8528 fn default() -> Self {
8529 TruncateTarget::Table
8530 }
8531}
8532
8533#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8535#[cfg_attr(feature = "bindings", derive(TS))]
8536pub enum TruncateIdentity {
8537 Restart,
8538 Continue,
8539}
8540
8541impl Truncate {
8542 pub fn new(table: impl Into<String>) -> Self {
8543 Self {
8544 target: TruncateTarget::Table,
8545 if_exists: false,
8546 table: TableRef::new(table),
8547 on_cluster: None,
8548 cascade: false,
8549 extra_tables: Vec::new(),
8550 identity: None,
8551 restrict: false,
8552 partition: None,
8553 }
8554 }
8555}
8556
8557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8559#[cfg_attr(feature = "bindings", derive(TS))]
8560pub struct Use {
8561 pub kind: Option<UseKind>,
8563 pub this: Identifier,
8565}
8566
8567#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8569#[cfg_attr(feature = "bindings", derive(TS))]
8570pub enum UseKind {
8571 Database,
8572 Schema,
8573 Role,
8574 Warehouse,
8575 Catalog,
8576 SecondaryRoles,
8578}
8579
8580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8582#[cfg_attr(feature = "bindings", derive(TS))]
8583pub struct SetStatement {
8584 pub items: Vec<SetItem>,
8586}
8587
8588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8590#[cfg_attr(feature = "bindings", derive(TS))]
8591pub struct SetItem {
8592 pub name: Expression,
8594 pub value: Expression,
8596 pub kind: Option<String>,
8598 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8600 pub no_equals: bool,
8601}
8602
8603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8605#[cfg_attr(feature = "bindings", derive(TS))]
8606pub struct Cache {
8607 pub table: Identifier,
8609 pub lazy: bool,
8611 pub options: Vec<(Expression, Expression)>,
8613 pub query: Option<Expression>,
8615}
8616
8617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8619#[cfg_attr(feature = "bindings", derive(TS))]
8620pub struct Uncache {
8621 pub table: Identifier,
8623 pub if_exists: bool,
8625}
8626
8627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8629#[cfg_attr(feature = "bindings", derive(TS))]
8630pub struct LoadData {
8631 pub local: bool,
8633 pub inpath: String,
8635 pub overwrite: bool,
8637 pub table: Expression,
8639 pub partition: Vec<(Identifier, Expression)>,
8641 pub input_format: Option<String>,
8643 pub serde: Option<String>,
8645}
8646
8647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8649#[cfg_attr(feature = "bindings", derive(TS))]
8650pub struct Pragma {
8651 pub schema: Option<Identifier>,
8653 pub name: Identifier,
8655 pub value: Option<Expression>,
8657 pub args: Vec<Expression>,
8659}
8660
8661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8664#[cfg_attr(feature = "bindings", derive(TS))]
8665pub struct Privilege {
8666 pub name: String,
8668 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8670 pub columns: Vec<String>,
8671}
8672
8673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8675#[cfg_attr(feature = "bindings", derive(TS))]
8676pub struct GrantPrincipal {
8677 pub name: Identifier,
8679 pub is_role: bool,
8681 #[serde(default)]
8683 pub is_group: bool,
8684 #[serde(default)]
8686 pub is_share: bool,
8687}
8688
8689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8691#[cfg_attr(feature = "bindings", derive(TS))]
8692pub struct Grant {
8693 pub privileges: Vec<Privilege>,
8695 pub kind: Option<String>,
8697 pub securable: Identifier,
8699 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8701 pub function_params: Vec<String>,
8702 pub principals: Vec<GrantPrincipal>,
8704 pub grant_option: bool,
8706 #[serde(default, skip_serializing_if = "Option::is_none")]
8708 pub as_principal: Option<Identifier>,
8709}
8710
8711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8713#[cfg_attr(feature = "bindings", derive(TS))]
8714pub struct Revoke {
8715 pub privileges: Vec<Privilege>,
8717 pub kind: Option<String>,
8719 pub securable: Identifier,
8721 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8723 pub function_params: Vec<String>,
8724 pub principals: Vec<GrantPrincipal>,
8726 pub grant_option: bool,
8728 pub cascade: bool,
8730 #[serde(default)]
8732 pub restrict: bool,
8733}
8734
8735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8737#[cfg_attr(feature = "bindings", derive(TS))]
8738pub struct Comment {
8739 pub this: Expression,
8741 pub kind: String,
8743 pub expression: Expression,
8745 pub exists: bool,
8747 pub materialized: bool,
8749}
8750
8751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8757#[cfg_attr(feature = "bindings", derive(TS))]
8758pub struct AlterView {
8759 pub name: TableRef,
8760 pub actions: Vec<AlterViewAction>,
8761 #[serde(default, skip_serializing_if = "Option::is_none")]
8763 pub algorithm: Option<String>,
8764 #[serde(default, skip_serializing_if = "Option::is_none")]
8766 pub definer: Option<String>,
8767 #[serde(default, skip_serializing_if = "Option::is_none")]
8769 pub sql_security: Option<String>,
8770 #[serde(default, skip_serializing_if = "Option::is_none")]
8772 pub with_option: Option<String>,
8773 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8775 pub columns: Vec<ViewColumn>,
8776}
8777
8778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8780#[cfg_attr(feature = "bindings", derive(TS))]
8781pub enum AlterViewAction {
8782 Rename(TableRef),
8784 OwnerTo(Identifier),
8786 SetSchema(Identifier),
8788 SetAuthorization(String),
8790 AlterColumn {
8792 name: Identifier,
8793 action: AlterColumnAction,
8794 },
8795 AsSelect(Box<Expression>),
8797 SetTblproperties(Vec<(String, String)>),
8799 UnsetTblproperties(Vec<String>),
8801}
8802
8803impl AlterView {
8804 pub fn new(name: impl Into<String>) -> Self {
8805 Self {
8806 name: TableRef::new(name),
8807 actions: Vec::new(),
8808 algorithm: None,
8809 definer: None,
8810 sql_security: None,
8811 with_option: None,
8812 columns: Vec::new(),
8813 }
8814 }
8815}
8816
8817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8819#[cfg_attr(feature = "bindings", derive(TS))]
8820pub struct AlterIndex {
8821 pub name: Identifier,
8822 pub table: Option<TableRef>,
8823 pub actions: Vec<AlterIndexAction>,
8824}
8825
8826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8828#[cfg_attr(feature = "bindings", derive(TS))]
8829pub enum AlterIndexAction {
8830 Rename(Identifier),
8832 SetTablespace(Identifier),
8834 Visible(bool),
8836}
8837
8838impl AlterIndex {
8839 pub fn new(name: impl Into<String>) -> Self {
8840 Self {
8841 name: Identifier::new(name),
8842 table: None,
8843 actions: Vec::new(),
8844 }
8845 }
8846}
8847
8848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8850#[cfg_attr(feature = "bindings", derive(TS))]
8851pub struct CreateSchema {
8852 pub name: Vec<Identifier>,
8854 pub if_not_exists: bool,
8855 pub authorization: Option<Identifier>,
8856 #[serde(default)]
8858 pub clone_from: Option<Vec<Identifier>>,
8859 #[serde(default)]
8861 pub at_clause: Option<Expression>,
8862 #[serde(default)]
8864 pub properties: Vec<Expression>,
8865 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8867 pub leading_comments: Vec<String>,
8868}
8869
8870impl CreateSchema {
8871 pub fn new(name: impl Into<String>) -> Self {
8872 Self {
8873 name: vec![Identifier::new(name)],
8874 if_not_exists: false,
8875 authorization: None,
8876 clone_from: None,
8877 at_clause: None,
8878 properties: Vec::new(),
8879 leading_comments: Vec::new(),
8880 }
8881 }
8882}
8883
8884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8886#[cfg_attr(feature = "bindings", derive(TS))]
8887pub struct DropSchema {
8888 pub name: Identifier,
8889 pub if_exists: bool,
8890 pub cascade: bool,
8891}
8892
8893impl DropSchema {
8894 pub fn new(name: impl Into<String>) -> Self {
8895 Self {
8896 name: Identifier::new(name),
8897 if_exists: false,
8898 cascade: false,
8899 }
8900 }
8901}
8902
8903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8905#[cfg_attr(feature = "bindings", derive(TS))]
8906pub struct DropNamespace {
8907 pub name: Identifier,
8908 pub if_exists: bool,
8909 pub cascade: bool,
8910}
8911
8912impl DropNamespace {
8913 pub fn new(name: impl Into<String>) -> Self {
8914 Self {
8915 name: Identifier::new(name),
8916 if_exists: false,
8917 cascade: false,
8918 }
8919 }
8920}
8921
8922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8924#[cfg_attr(feature = "bindings", derive(TS))]
8925pub struct CreateDatabase {
8926 pub name: Identifier,
8927 pub if_not_exists: bool,
8928 pub options: Vec<DatabaseOption>,
8929 #[serde(default)]
8931 pub clone_from: Option<Identifier>,
8932 #[serde(default)]
8934 pub at_clause: Option<Expression>,
8935}
8936
8937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8939#[cfg_attr(feature = "bindings", derive(TS))]
8940pub enum DatabaseOption {
8941 CharacterSet(String),
8942 Collate(String),
8943 Owner(Identifier),
8944 Template(Identifier),
8945 Encoding(String),
8946 Location(String),
8947}
8948
8949impl CreateDatabase {
8950 pub fn new(name: impl Into<String>) -> Self {
8951 Self {
8952 name: Identifier::new(name),
8953 if_not_exists: false,
8954 options: Vec::new(),
8955 clone_from: None,
8956 at_clause: None,
8957 }
8958 }
8959}
8960
8961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8963#[cfg_attr(feature = "bindings", derive(TS))]
8964pub struct DropDatabase {
8965 pub name: Identifier,
8966 pub if_exists: bool,
8967 #[serde(default)]
8969 pub sync: bool,
8970}
8971
8972impl DropDatabase {
8973 pub fn new(name: impl Into<String>) -> Self {
8974 Self {
8975 name: Identifier::new(name),
8976 if_exists: false,
8977 sync: false,
8978 }
8979 }
8980}
8981
8982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8984#[cfg_attr(feature = "bindings", derive(TS))]
8985pub struct CreateFunction {
8986 pub name: TableRef,
8987 pub parameters: Vec<FunctionParameter>,
8988 pub return_type: Option<DataType>,
8989 pub body: Option<FunctionBody>,
8990 pub or_replace: bool,
8991 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8993 pub or_alter: bool,
8994 pub if_not_exists: bool,
8995 pub temporary: bool,
8996 pub language: Option<String>,
8997 pub deterministic: Option<bool>,
8998 pub returns_null_on_null_input: Option<bool>,
8999 pub security: Option<FunctionSecurity>,
9000 #[serde(default = "default_true")]
9002 pub has_parens: bool,
9003 #[serde(default)]
9005 pub sql_data_access: Option<SqlDataAccess>,
9006 #[serde(default, skip_serializing_if = "Option::is_none")]
9008 pub returns_table_body: Option<String>,
9009 #[serde(default)]
9011 pub language_first: bool,
9012 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9014 pub set_options: Vec<FunctionSetOption>,
9015 #[serde(default)]
9017 pub strict: bool,
9018 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9020 pub options: Vec<Expression>,
9021 #[serde(default)]
9023 pub is_table_function: bool,
9024 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9026 pub property_order: Vec<FunctionPropertyKind>,
9027 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9029 pub environment: Vec<Expression>,
9030 #[serde(default, skip_serializing_if = "Option::is_none")]
9032 pub handler: Option<String>,
9033 #[serde(default, skip_serializing_if = "Option::is_none")]
9035 pub parameter_style: Option<String>,
9036}
9037
9038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9040#[cfg_attr(feature = "bindings", derive(TS))]
9041pub struct FunctionSetOption {
9042 pub name: String,
9043 pub value: FunctionSetValue,
9044}
9045
9046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9048#[cfg_attr(feature = "bindings", derive(TS))]
9049pub enum FunctionSetValue {
9050 Value { value: String, use_to: bool },
9052 FromCurrent,
9054}
9055
9056#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9058#[cfg_attr(feature = "bindings", derive(TS))]
9059pub enum SqlDataAccess {
9060 NoSql,
9062 ContainsSql,
9064 ReadsSqlData,
9066 ModifiesSqlData,
9068}
9069
9070#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9072#[cfg_attr(feature = "bindings", derive(TS))]
9073pub enum FunctionPropertyKind {
9074 Set,
9076 As,
9078 Language,
9080 Determinism,
9082 NullInput,
9084 Security,
9086 SqlDataAccess,
9088 Options,
9090 Environment,
9092 Handler,
9094 ParameterStyle,
9096}
9097
9098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9100#[cfg_attr(feature = "bindings", derive(TS))]
9101pub struct FunctionParameter {
9102 pub name: Option<Identifier>,
9103 pub data_type: DataType,
9104 pub mode: Option<ParameterMode>,
9105 pub default: Option<Expression>,
9106 #[serde(default, skip_serializing_if = "Option::is_none")]
9108 pub mode_text: Option<String>,
9109}
9110
9111#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9113#[cfg_attr(feature = "bindings", derive(TS))]
9114pub enum ParameterMode {
9115 In,
9116 Out,
9117 InOut,
9118 Variadic,
9119}
9120
9121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9123#[cfg_attr(feature = "bindings", derive(TS))]
9124pub enum FunctionBody {
9125 Block(String),
9127 StringLiteral(String),
9129 Expression(Expression),
9131 External(String),
9133 Return(Expression),
9135 Statements(Vec<Expression>),
9137 DollarQuoted {
9140 content: String,
9141 tag: Option<String>,
9142 },
9143 RawBlock(String),
9145}
9146
9147#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9149#[cfg_attr(feature = "bindings", derive(TS))]
9150pub enum FunctionSecurity {
9151 Definer,
9152 Invoker,
9153 None,
9155}
9156
9157impl CreateFunction {
9158 pub fn new(name: impl Into<String>) -> Self {
9159 Self {
9160 name: TableRef::new(name),
9161 parameters: Vec::new(),
9162 return_type: None,
9163 body: None,
9164 or_replace: false,
9165 or_alter: false,
9166 if_not_exists: false,
9167 temporary: false,
9168 language: None,
9169 deterministic: None,
9170 returns_null_on_null_input: None,
9171 security: None,
9172 has_parens: true,
9173 sql_data_access: None,
9174 returns_table_body: None,
9175 language_first: false,
9176 set_options: Vec::new(),
9177 strict: false,
9178 options: Vec::new(),
9179 is_table_function: false,
9180 property_order: Vec::new(),
9181 environment: Vec::new(),
9182 handler: None,
9183 parameter_style: None,
9184 }
9185 }
9186}
9187
9188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9190#[cfg_attr(feature = "bindings", derive(TS))]
9191pub struct DropFunction {
9192 pub name: TableRef,
9193 pub parameters: Option<Vec<DataType>>,
9194 pub if_exists: bool,
9195 pub cascade: bool,
9196}
9197
9198impl DropFunction {
9199 pub fn new(name: impl Into<String>) -> Self {
9200 Self {
9201 name: TableRef::new(name),
9202 parameters: None,
9203 if_exists: false,
9204 cascade: false,
9205 }
9206 }
9207}
9208
9209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9211#[cfg_attr(feature = "bindings", derive(TS))]
9212pub struct CreateProcedure {
9213 pub name: TableRef,
9214 pub parameters: Vec<FunctionParameter>,
9215 pub body: Option<FunctionBody>,
9216 pub or_replace: bool,
9217 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9219 pub or_alter: bool,
9220 pub if_not_exists: bool,
9221 pub language: Option<String>,
9222 pub security: Option<FunctionSecurity>,
9223 #[serde(default)]
9225 pub return_type: Option<DataType>,
9226 #[serde(default)]
9228 pub execute_as: Option<String>,
9229 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9231 pub with_options: Vec<String>,
9232 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9234 pub has_parens: bool,
9235 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9237 pub use_proc_keyword: bool,
9238}
9239
9240impl CreateProcedure {
9241 pub fn new(name: impl Into<String>) -> Self {
9242 Self {
9243 name: TableRef::new(name),
9244 parameters: Vec::new(),
9245 body: None,
9246 or_replace: false,
9247 or_alter: false,
9248 if_not_exists: false,
9249 language: None,
9250 security: None,
9251 return_type: None,
9252 execute_as: None,
9253 with_options: Vec::new(),
9254 has_parens: true,
9255 use_proc_keyword: false,
9256 }
9257 }
9258}
9259
9260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9262#[cfg_attr(feature = "bindings", derive(TS))]
9263pub struct DropProcedure {
9264 pub name: TableRef,
9265 pub parameters: Option<Vec<DataType>>,
9266 pub if_exists: bool,
9267 pub cascade: bool,
9268}
9269
9270impl DropProcedure {
9271 pub fn new(name: impl Into<String>) -> Self {
9272 Self {
9273 name: TableRef::new(name),
9274 parameters: None,
9275 if_exists: false,
9276 cascade: false,
9277 }
9278 }
9279}
9280
9281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9283#[cfg_attr(feature = "bindings", derive(TS))]
9284pub enum SeqPropKind {
9285 Start,
9286 Increment,
9287 Minvalue,
9288 Maxvalue,
9289 Cache,
9290 NoCache,
9291 Cycle,
9292 NoCycle,
9293 OwnedBy,
9294 Order,
9295 NoOrder,
9296 Comment,
9297 Sharing,
9299 Keep,
9301 NoKeep,
9303 Scale,
9305 NoScale,
9307 Shard,
9309 NoShard,
9311 Session,
9313 Global,
9315 NoCacheWord,
9317 NoCycleWord,
9319 NoMinvalueWord,
9321 NoMaxvalueWord,
9323}
9324
9325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9327#[cfg_attr(feature = "bindings", derive(TS))]
9328pub struct CreateSynonym {
9329 pub name: TableRef,
9331 pub target: TableRef,
9333}
9334
9335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9337#[cfg_attr(feature = "bindings", derive(TS))]
9338pub struct CreateSequence {
9339 pub name: TableRef,
9340 pub if_not_exists: bool,
9341 pub temporary: bool,
9342 #[serde(default)]
9343 pub or_replace: bool,
9344 #[serde(default, skip_serializing_if = "Option::is_none")]
9346 pub as_type: Option<DataType>,
9347 pub increment: Option<i64>,
9348 pub minvalue: Option<SequenceBound>,
9349 pub maxvalue: Option<SequenceBound>,
9350 pub start: Option<i64>,
9351 pub cache: Option<i64>,
9352 pub cycle: bool,
9353 pub owned_by: Option<TableRef>,
9354 #[serde(default)]
9356 pub owned_by_none: bool,
9357 #[serde(default)]
9359 pub order: Option<bool>,
9360 #[serde(default)]
9362 pub comment: Option<String>,
9363 #[serde(default, skip_serializing_if = "Option::is_none")]
9365 pub sharing: Option<String>,
9366 #[serde(default, skip_serializing_if = "Option::is_none")]
9368 pub scale_modifier: Option<String>,
9369 #[serde(default, skip_serializing_if = "Option::is_none")]
9371 pub shard_modifier: Option<String>,
9372 #[serde(default)]
9374 pub property_order: Vec<SeqPropKind>,
9375}
9376
9377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9379#[cfg_attr(feature = "bindings", derive(TS))]
9380pub enum SequenceBound {
9381 Value(i64),
9382 None,
9383}
9384
9385impl CreateSequence {
9386 pub fn new(name: impl Into<String>) -> Self {
9387 Self {
9388 name: TableRef::new(name),
9389 if_not_exists: false,
9390 temporary: false,
9391 or_replace: false,
9392 as_type: None,
9393 increment: None,
9394 minvalue: None,
9395 maxvalue: None,
9396 start: None,
9397 cache: None,
9398 cycle: false,
9399 owned_by: None,
9400 owned_by_none: false,
9401 order: None,
9402 comment: None,
9403 sharing: None,
9404 scale_modifier: None,
9405 shard_modifier: None,
9406 property_order: Vec::new(),
9407 }
9408 }
9409}
9410
9411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9413#[cfg_attr(feature = "bindings", derive(TS))]
9414pub struct DropSequence {
9415 pub name: TableRef,
9416 pub if_exists: bool,
9417 pub cascade: bool,
9418}
9419
9420impl DropSequence {
9421 pub fn new(name: impl Into<String>) -> Self {
9422 Self {
9423 name: TableRef::new(name),
9424 if_exists: false,
9425 cascade: false,
9426 }
9427 }
9428}
9429
9430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9432#[cfg_attr(feature = "bindings", derive(TS))]
9433pub struct AlterSequence {
9434 pub name: TableRef,
9435 pub if_exists: bool,
9436 pub increment: Option<i64>,
9437 pub minvalue: Option<SequenceBound>,
9438 pub maxvalue: Option<SequenceBound>,
9439 pub start: Option<i64>,
9440 pub restart: Option<Option<i64>>,
9441 pub cache: Option<i64>,
9442 pub cycle: Option<bool>,
9443 pub owned_by: Option<Option<TableRef>>,
9444}
9445
9446impl AlterSequence {
9447 pub fn new(name: impl Into<String>) -> Self {
9448 Self {
9449 name: TableRef::new(name),
9450 if_exists: false,
9451 increment: None,
9452 minvalue: None,
9453 maxvalue: None,
9454 start: None,
9455 restart: None,
9456 cache: None,
9457 cycle: None,
9458 owned_by: None,
9459 }
9460 }
9461}
9462
9463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9465#[cfg_attr(feature = "bindings", derive(TS))]
9466pub struct CreateTrigger {
9467 pub name: Identifier,
9468 pub table: TableRef,
9469 pub timing: TriggerTiming,
9470 pub events: Vec<TriggerEvent>,
9471 #[serde(default, skip_serializing_if = "Option::is_none")]
9472 pub for_each: Option<TriggerForEach>,
9473 pub when: Option<Expression>,
9474 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9476 pub when_paren: bool,
9477 pub body: TriggerBody,
9478 pub or_replace: bool,
9479 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9481 pub or_alter: bool,
9482 pub constraint: bool,
9483 pub deferrable: Option<bool>,
9484 pub initially_deferred: Option<bool>,
9485 pub referencing: Option<TriggerReferencing>,
9486}
9487
9488#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9490#[cfg_attr(feature = "bindings", derive(TS))]
9491pub enum TriggerTiming {
9492 Before,
9493 After,
9494 InsteadOf,
9495}
9496
9497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9499#[cfg_attr(feature = "bindings", derive(TS))]
9500pub enum TriggerEvent {
9501 Insert,
9502 Update(Option<Vec<Identifier>>),
9503 Delete,
9504 Truncate,
9505}
9506
9507#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9509#[cfg_attr(feature = "bindings", derive(TS))]
9510pub enum TriggerForEach {
9511 Row,
9512 Statement,
9513}
9514
9515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9517#[cfg_attr(feature = "bindings", derive(TS))]
9518pub enum TriggerBody {
9519 Execute {
9521 function: TableRef,
9522 args: Vec<Expression>,
9523 },
9524 Block(String),
9526}
9527
9528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9530#[cfg_attr(feature = "bindings", derive(TS))]
9531pub struct TriggerReferencing {
9532 pub old_table: Option<Identifier>,
9533 pub new_table: Option<Identifier>,
9534 pub old_row: Option<Identifier>,
9535 pub new_row: Option<Identifier>,
9536}
9537
9538impl CreateTrigger {
9539 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9540 Self {
9541 name: Identifier::new(name),
9542 table: TableRef::new(table),
9543 timing: TriggerTiming::Before,
9544 events: Vec::new(),
9545 for_each: Some(TriggerForEach::Row),
9546 when: None,
9547 when_paren: false,
9548 body: TriggerBody::Execute {
9549 function: TableRef::new(""),
9550 args: Vec::new(),
9551 },
9552 or_replace: false,
9553 or_alter: false,
9554 constraint: false,
9555 deferrable: None,
9556 initially_deferred: None,
9557 referencing: None,
9558 }
9559 }
9560}
9561
9562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9564#[cfg_attr(feature = "bindings", derive(TS))]
9565pub struct DropTrigger {
9566 pub name: Identifier,
9567 pub table: Option<TableRef>,
9568 pub if_exists: bool,
9569 pub cascade: bool,
9570}
9571
9572impl DropTrigger {
9573 pub fn new(name: impl Into<String>) -> Self {
9574 Self {
9575 name: Identifier::new(name),
9576 table: None,
9577 if_exists: false,
9578 cascade: false,
9579 }
9580 }
9581}
9582
9583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9585#[cfg_attr(feature = "bindings", derive(TS))]
9586pub struct CreateType {
9587 pub name: TableRef,
9588 pub definition: TypeDefinition,
9589 pub if_not_exists: bool,
9590}
9591
9592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9594#[cfg_attr(feature = "bindings", derive(TS))]
9595pub enum TypeDefinition {
9596 Enum(Vec<String>),
9598 Composite(Vec<TypeAttribute>),
9600 Range {
9602 subtype: DataType,
9603 subtype_diff: Option<String>,
9604 canonical: Option<String>,
9605 },
9606 Base {
9608 input: String,
9609 output: String,
9610 internallength: Option<i32>,
9611 },
9612 Domain {
9614 base_type: DataType,
9615 default: Option<Expression>,
9616 constraints: Vec<DomainConstraint>,
9617 },
9618}
9619
9620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9622#[cfg_attr(feature = "bindings", derive(TS))]
9623pub struct TypeAttribute {
9624 pub name: Identifier,
9625 pub data_type: DataType,
9626 pub collate: Option<Identifier>,
9627}
9628
9629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9631#[cfg_attr(feature = "bindings", derive(TS))]
9632pub struct DomainConstraint {
9633 pub name: Option<Identifier>,
9634 pub check: Expression,
9635}
9636
9637impl CreateType {
9638 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9639 Self {
9640 name: TableRef::new(name),
9641 definition: TypeDefinition::Enum(values),
9642 if_not_exists: false,
9643 }
9644 }
9645
9646 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9647 Self {
9648 name: TableRef::new(name),
9649 definition: TypeDefinition::Composite(attributes),
9650 if_not_exists: false,
9651 }
9652 }
9653}
9654
9655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9657#[cfg_attr(feature = "bindings", derive(TS))]
9658pub struct DropType {
9659 pub name: TableRef,
9660 pub if_exists: bool,
9661 pub cascade: bool,
9662}
9663
9664impl DropType {
9665 pub fn new(name: impl Into<String>) -> Self {
9666 Self {
9667 name: TableRef::new(name),
9668 if_exists: false,
9669 cascade: false,
9670 }
9671 }
9672}
9673
9674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9676#[cfg_attr(feature = "bindings", derive(TS))]
9677pub struct Describe {
9678 pub target: Expression,
9680 pub extended: bool,
9682 pub formatted: bool,
9684 #[serde(default)]
9686 pub kind: Option<String>,
9687 #[serde(default)]
9689 pub properties: Vec<(String, String)>,
9690 #[serde(default, skip_serializing_if = "Option::is_none")]
9692 pub style: Option<String>,
9693 #[serde(default)]
9695 pub partition: Option<Box<Expression>>,
9696 #[serde(default)]
9698 pub leading_comments: Vec<String>,
9699 #[serde(default)]
9701 pub as_json: bool,
9702 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9704 pub params: Vec<String>,
9705}
9706
9707impl Describe {
9708 pub fn new(target: Expression) -> Self {
9709 Self {
9710 target,
9711 extended: false,
9712 formatted: false,
9713 kind: None,
9714 properties: Vec::new(),
9715 style: None,
9716 partition: None,
9717 leading_comments: Vec::new(),
9718 as_json: false,
9719 params: Vec::new(),
9720 }
9721 }
9722}
9723
9724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9726#[cfg_attr(feature = "bindings", derive(TS))]
9727pub struct Show {
9728 pub this: String,
9730 #[serde(default)]
9732 pub terse: bool,
9733 #[serde(default)]
9735 pub history: bool,
9736 pub like: Option<Expression>,
9738 pub scope_kind: Option<String>,
9740 pub scope: Option<Expression>,
9742 pub starts_with: Option<Expression>,
9744 pub limit: Option<Box<Limit>>,
9746 pub from: Option<Expression>,
9748 #[serde(default, skip_serializing_if = "Option::is_none")]
9750 pub where_clause: Option<Expression>,
9751 #[serde(default, skip_serializing_if = "Option::is_none")]
9753 pub for_target: Option<Expression>,
9754 #[serde(default, skip_serializing_if = "Option::is_none")]
9756 pub db: Option<Expression>,
9757 #[serde(default, skip_serializing_if = "Option::is_none")]
9759 pub target: Option<Expression>,
9760 #[serde(default, skip_serializing_if = "Option::is_none")]
9762 pub mutex: Option<bool>,
9763 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9765 pub privileges: Vec<String>,
9766}
9767
9768impl Show {
9769 pub fn new(this: impl Into<String>) -> Self {
9770 Self {
9771 this: this.into(),
9772 terse: false,
9773 history: false,
9774 like: None,
9775 scope_kind: None,
9776 scope: None,
9777 starts_with: None,
9778 limit: None,
9779 from: None,
9780 where_clause: None,
9781 for_target: None,
9782 db: None,
9783 target: None,
9784 mutex: None,
9785 privileges: Vec::new(),
9786 }
9787 }
9788}
9789
9790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9795#[cfg_attr(feature = "bindings", derive(TS))]
9796pub struct Paren {
9797 pub this: Expression,
9799 #[serde(default)]
9800 pub trailing_comments: Vec<String>,
9801}
9802
9803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9805#[cfg_attr(feature = "bindings", derive(TS))]
9806pub struct Annotated {
9807 pub this: Expression,
9808 pub trailing_comments: Vec<String>,
9809}
9810
9811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9816#[cfg_attr(feature = "bindings", derive(TS))]
9817pub struct Refresh {
9818 pub this: Box<Expression>,
9819 pub kind: String,
9820}
9821
9822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9824#[cfg_attr(feature = "bindings", derive(TS))]
9825pub struct LockingStatement {
9826 pub this: Box<Expression>,
9827 pub expression: Box<Expression>,
9828}
9829
9830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9832#[cfg_attr(feature = "bindings", derive(TS))]
9833pub struct SequenceProperties {
9834 #[serde(default)]
9835 pub increment: Option<Box<Expression>>,
9836 #[serde(default)]
9837 pub minvalue: Option<Box<Expression>>,
9838 #[serde(default)]
9839 pub maxvalue: Option<Box<Expression>>,
9840 #[serde(default)]
9841 pub cache: Option<Box<Expression>>,
9842 #[serde(default)]
9843 pub start: Option<Box<Expression>>,
9844 #[serde(default)]
9845 pub owned: Option<Box<Expression>>,
9846 #[serde(default)]
9847 pub options: Vec<Expression>,
9848}
9849
9850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9852#[cfg_attr(feature = "bindings", derive(TS))]
9853pub struct TruncateTable {
9854 #[serde(default)]
9855 pub expressions: Vec<Expression>,
9856 #[serde(default)]
9857 pub is_database: Option<Box<Expression>>,
9858 #[serde(default)]
9859 pub exists: bool,
9860 #[serde(default)]
9861 pub only: Option<Box<Expression>>,
9862 #[serde(default)]
9863 pub cluster: Option<Box<Expression>>,
9864 #[serde(default)]
9865 pub identity: Option<Box<Expression>>,
9866 #[serde(default)]
9867 pub option: Option<Box<Expression>>,
9868 #[serde(default)]
9869 pub partition: Option<Box<Expression>>,
9870}
9871
9872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9874#[cfg_attr(feature = "bindings", derive(TS))]
9875pub struct Clone {
9876 pub this: Box<Expression>,
9877 #[serde(default)]
9878 pub shallow: Option<Box<Expression>>,
9879 #[serde(default)]
9880 pub copy: Option<Box<Expression>>,
9881}
9882
9883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9885#[cfg_attr(feature = "bindings", derive(TS))]
9886pub struct Attach {
9887 pub this: Box<Expression>,
9888 #[serde(default)]
9889 pub exists: bool,
9890 #[serde(default)]
9891 pub expressions: Vec<Expression>,
9892}
9893
9894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9896#[cfg_attr(feature = "bindings", derive(TS))]
9897pub struct Detach {
9898 pub this: Box<Expression>,
9899 #[serde(default)]
9900 pub exists: bool,
9901}
9902
9903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9905#[cfg_attr(feature = "bindings", derive(TS))]
9906pub struct Install {
9907 pub this: Box<Expression>,
9908 #[serde(default)]
9909 pub from_: Option<Box<Expression>>,
9910 #[serde(default)]
9911 pub force: Option<Box<Expression>>,
9912}
9913
9914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9916#[cfg_attr(feature = "bindings", derive(TS))]
9917pub struct Summarize {
9918 pub this: Box<Expression>,
9919 #[serde(default)]
9920 pub table: Option<Box<Expression>>,
9921}
9922
9923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9925#[cfg_attr(feature = "bindings", derive(TS))]
9926pub struct Declare {
9927 #[serde(default)]
9928 pub expressions: Vec<Expression>,
9929 #[serde(default)]
9930 pub replace: bool,
9931}
9932
9933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9935#[cfg_attr(feature = "bindings", derive(TS))]
9936pub struct DeclareItem {
9937 pub this: Box<Expression>,
9938 #[serde(default)]
9939 pub kind: Option<String>,
9940 #[serde(default)]
9941 pub default: Option<Box<Expression>>,
9942 #[serde(default)]
9943 pub has_as: bool,
9944 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9946 pub additional_names: Vec<Expression>,
9947}
9948
9949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9951#[cfg_attr(feature = "bindings", derive(TS))]
9952pub struct Set {
9953 #[serde(default)]
9954 pub expressions: Vec<Expression>,
9955 #[serde(default)]
9956 pub unset: Option<Box<Expression>>,
9957 #[serde(default)]
9958 pub tag: Option<Box<Expression>>,
9959}
9960
9961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9963#[cfg_attr(feature = "bindings", derive(TS))]
9964pub struct Heredoc {
9965 pub this: Box<Expression>,
9966 #[serde(default)]
9967 pub tag: Option<Box<Expression>>,
9968}
9969
9970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9972#[cfg_attr(feature = "bindings", derive(TS))]
9973pub struct QueryBand {
9974 pub this: Box<Expression>,
9975 #[serde(default)]
9976 pub scope: Option<Box<Expression>>,
9977 #[serde(default)]
9978 pub update: Option<Box<Expression>>,
9979}
9980
9981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9983#[cfg_attr(feature = "bindings", derive(TS))]
9984pub struct UserDefinedFunction {
9985 pub this: Box<Expression>,
9986 #[serde(default)]
9987 pub expressions: Vec<Expression>,
9988 #[serde(default)]
9989 pub wrapped: Option<Box<Expression>>,
9990}
9991
9992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9994#[cfg_attr(feature = "bindings", derive(TS))]
9995pub struct RecursiveWithSearch {
9996 pub kind: String,
9997 pub this: Box<Expression>,
9998 pub expression: Box<Expression>,
9999 #[serde(default)]
10000 pub using: Option<Box<Expression>>,
10001}
10002
10003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10005#[cfg_attr(feature = "bindings", derive(TS))]
10006pub struct ProjectionDef {
10007 pub this: Box<Expression>,
10008 pub expression: Box<Expression>,
10009}
10010
10011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10013#[cfg_attr(feature = "bindings", derive(TS))]
10014pub struct TableAlias {
10015 #[serde(default)]
10016 pub this: Option<Box<Expression>>,
10017 #[serde(default)]
10018 pub columns: Vec<Expression>,
10019}
10020
10021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10023#[cfg_attr(feature = "bindings", derive(TS))]
10024pub struct ByteString {
10025 pub this: Box<Expression>,
10026 #[serde(default)]
10027 pub is_bytes: Option<Box<Expression>>,
10028}
10029
10030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10033#[cfg_attr(feature = "bindings", derive(TS))]
10034pub struct HexStringExpr {
10035 pub this: Box<Expression>,
10036 #[serde(default)]
10037 pub is_integer: Option<bool>,
10038}
10039
10040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10042#[cfg_attr(feature = "bindings", derive(TS))]
10043pub struct UnicodeString {
10044 pub this: Box<Expression>,
10045 #[serde(default)]
10046 pub escape: Option<Box<Expression>>,
10047}
10048
10049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10051#[cfg_attr(feature = "bindings", derive(TS))]
10052pub struct AlterColumn {
10053 pub this: Box<Expression>,
10054 #[serde(default)]
10055 pub dtype: Option<Box<Expression>>,
10056 #[serde(default)]
10057 pub collate: Option<Box<Expression>>,
10058 #[serde(default)]
10059 pub using: Option<Box<Expression>>,
10060 #[serde(default)]
10061 pub default: Option<Box<Expression>>,
10062 #[serde(default)]
10063 pub drop: Option<Box<Expression>>,
10064 #[serde(default)]
10065 pub comment: Option<Box<Expression>>,
10066 #[serde(default)]
10067 pub allow_null: Option<Box<Expression>>,
10068 #[serde(default)]
10069 pub visible: Option<Box<Expression>>,
10070 #[serde(default)]
10071 pub rename_to: Option<Box<Expression>>,
10072}
10073
10074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10076#[cfg_attr(feature = "bindings", derive(TS))]
10077pub struct AlterSortKey {
10078 #[serde(default)]
10079 pub this: Option<Box<Expression>>,
10080 #[serde(default)]
10081 pub expressions: Vec<Expression>,
10082 #[serde(default)]
10083 pub compound: Option<Box<Expression>>,
10084}
10085
10086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10088#[cfg_attr(feature = "bindings", derive(TS))]
10089pub struct AlterSet {
10090 #[serde(default)]
10091 pub expressions: Vec<Expression>,
10092 #[serde(default)]
10093 pub option: Option<Box<Expression>>,
10094 #[serde(default)]
10095 pub tablespace: Option<Box<Expression>>,
10096 #[serde(default)]
10097 pub access_method: Option<Box<Expression>>,
10098 #[serde(default)]
10099 pub file_format: Option<Box<Expression>>,
10100 #[serde(default)]
10101 pub copy_options: Option<Box<Expression>>,
10102 #[serde(default)]
10103 pub tag: Option<Box<Expression>>,
10104 #[serde(default)]
10105 pub location: Option<Box<Expression>>,
10106 #[serde(default)]
10107 pub serde: Option<Box<Expression>>,
10108}
10109
10110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10112#[cfg_attr(feature = "bindings", derive(TS))]
10113pub struct RenameColumn {
10114 pub this: Box<Expression>,
10115 #[serde(default)]
10116 pub to: Option<Box<Expression>>,
10117 #[serde(default)]
10118 pub exists: bool,
10119}
10120
10121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10123#[cfg_attr(feature = "bindings", derive(TS))]
10124pub struct Comprehension {
10125 pub this: Box<Expression>,
10126 pub expression: Box<Expression>,
10127 #[serde(default)]
10128 pub position: Option<Box<Expression>>,
10129 #[serde(default)]
10130 pub iterator: Option<Box<Expression>>,
10131 #[serde(default)]
10132 pub condition: Option<Box<Expression>>,
10133}
10134
10135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10137#[cfg_attr(feature = "bindings", derive(TS))]
10138pub struct MergeTreeTTLAction {
10139 pub this: Box<Expression>,
10140 #[serde(default)]
10141 pub delete: Option<Box<Expression>>,
10142 #[serde(default)]
10143 pub recompress: Option<Box<Expression>>,
10144 #[serde(default)]
10145 pub to_disk: Option<Box<Expression>>,
10146 #[serde(default)]
10147 pub to_volume: Option<Box<Expression>>,
10148}
10149
10150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10152#[cfg_attr(feature = "bindings", derive(TS))]
10153pub struct MergeTreeTTL {
10154 #[serde(default)]
10155 pub expressions: Vec<Expression>,
10156 #[serde(default)]
10157 pub where_: Option<Box<Expression>>,
10158 #[serde(default)]
10159 pub group: Option<Box<Expression>>,
10160 #[serde(default)]
10161 pub aggregates: Option<Box<Expression>>,
10162}
10163
10164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10166#[cfg_attr(feature = "bindings", derive(TS))]
10167pub struct IndexConstraintOption {
10168 #[serde(default)]
10169 pub key_block_size: Option<Box<Expression>>,
10170 #[serde(default)]
10171 pub using: Option<Box<Expression>>,
10172 #[serde(default)]
10173 pub parser: Option<Box<Expression>>,
10174 #[serde(default)]
10175 pub comment: Option<Box<Expression>>,
10176 #[serde(default)]
10177 pub visible: Option<Box<Expression>>,
10178 #[serde(default)]
10179 pub engine_attr: Option<Box<Expression>>,
10180 #[serde(default)]
10181 pub secondary_engine_attr: Option<Box<Expression>>,
10182}
10183
10184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10186#[cfg_attr(feature = "bindings", derive(TS))]
10187pub struct PeriodForSystemTimeConstraint {
10188 pub this: Box<Expression>,
10189 pub expression: Box<Expression>,
10190}
10191
10192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10194#[cfg_attr(feature = "bindings", derive(TS))]
10195pub struct CaseSpecificColumnConstraint {
10196 #[serde(default)]
10197 pub not_: Option<Box<Expression>>,
10198}
10199
10200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10202#[cfg_attr(feature = "bindings", derive(TS))]
10203pub struct CharacterSetColumnConstraint {
10204 pub this: Box<Expression>,
10205}
10206
10207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10209#[cfg_attr(feature = "bindings", derive(TS))]
10210pub struct CheckColumnConstraint {
10211 pub this: Box<Expression>,
10212 #[serde(default)]
10213 pub enforced: Option<Box<Expression>>,
10214}
10215
10216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10218#[cfg_attr(feature = "bindings", derive(TS))]
10219pub struct AssumeColumnConstraint {
10220 pub this: Box<Expression>,
10221}
10222
10223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10225#[cfg_attr(feature = "bindings", derive(TS))]
10226pub struct CompressColumnConstraint {
10227 #[serde(default)]
10228 pub this: Option<Box<Expression>>,
10229}
10230
10231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10233#[cfg_attr(feature = "bindings", derive(TS))]
10234pub struct DateFormatColumnConstraint {
10235 pub this: Box<Expression>,
10236}
10237
10238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10240#[cfg_attr(feature = "bindings", derive(TS))]
10241pub struct EphemeralColumnConstraint {
10242 #[serde(default)]
10243 pub this: Option<Box<Expression>>,
10244}
10245
10246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10248#[cfg_attr(feature = "bindings", derive(TS))]
10249pub struct WithOperator {
10250 pub this: Box<Expression>,
10251 pub op: String,
10252}
10253
10254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10256#[cfg_attr(feature = "bindings", derive(TS))]
10257pub struct GeneratedAsIdentityColumnConstraint {
10258 #[serde(default)]
10259 pub this: Option<Box<Expression>>,
10260 #[serde(default)]
10261 pub expression: Option<Box<Expression>>,
10262 #[serde(default)]
10263 pub on_null: Option<Box<Expression>>,
10264 #[serde(default)]
10265 pub start: Option<Box<Expression>>,
10266 #[serde(default)]
10267 pub increment: Option<Box<Expression>>,
10268 #[serde(default)]
10269 pub minvalue: Option<Box<Expression>>,
10270 #[serde(default)]
10271 pub maxvalue: Option<Box<Expression>>,
10272 #[serde(default)]
10273 pub cycle: Option<Box<Expression>>,
10274 #[serde(default)]
10275 pub order: Option<Box<Expression>>,
10276}
10277
10278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10281#[cfg_attr(feature = "bindings", derive(TS))]
10282pub struct AutoIncrementColumnConstraint;
10283
10284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10286#[cfg_attr(feature = "bindings", derive(TS))]
10287pub struct CommentColumnConstraint;
10288
10289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10291#[cfg_attr(feature = "bindings", derive(TS))]
10292pub struct GeneratedAsRowColumnConstraint {
10293 #[serde(default)]
10294 pub start: Option<Box<Expression>>,
10295 #[serde(default)]
10296 pub hidden: Option<Box<Expression>>,
10297}
10298
10299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10301#[cfg_attr(feature = "bindings", derive(TS))]
10302pub struct IndexColumnConstraint {
10303 #[serde(default)]
10304 pub this: Option<Box<Expression>>,
10305 #[serde(default)]
10306 pub expressions: Vec<Expression>,
10307 #[serde(default)]
10308 pub kind: Option<String>,
10309 #[serde(default)]
10310 pub index_type: Option<Box<Expression>>,
10311 #[serde(default)]
10312 pub options: Vec<Expression>,
10313 #[serde(default)]
10314 pub expression: Option<Box<Expression>>,
10315 #[serde(default)]
10316 pub granularity: Option<Box<Expression>>,
10317}
10318
10319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10321#[cfg_attr(feature = "bindings", derive(TS))]
10322pub struct MaskingPolicyColumnConstraint {
10323 pub this: Box<Expression>,
10324 #[serde(default)]
10325 pub expressions: Vec<Expression>,
10326}
10327
10328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10330#[cfg_attr(feature = "bindings", derive(TS))]
10331pub struct NotNullColumnConstraint {
10332 #[serde(default)]
10333 pub allow_null: Option<Box<Expression>>,
10334}
10335
10336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10338#[cfg_attr(feature = "bindings", derive(TS))]
10339pub struct DefaultColumnConstraint {
10340 pub this: Box<Expression>,
10341 #[serde(default, skip_serializing_if = "Option::is_none")]
10343 pub for_column: Option<Identifier>,
10344}
10345
10346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10348#[cfg_attr(feature = "bindings", derive(TS))]
10349pub struct PrimaryKeyColumnConstraint {
10350 #[serde(default)]
10351 pub desc: Option<Box<Expression>>,
10352 #[serde(default)]
10353 pub options: Vec<Expression>,
10354}
10355
10356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10358#[cfg_attr(feature = "bindings", derive(TS))]
10359pub struct UniqueColumnConstraint {
10360 #[serde(default)]
10361 pub this: Option<Box<Expression>>,
10362 #[serde(default)]
10363 pub index_type: Option<Box<Expression>>,
10364 #[serde(default)]
10365 pub on_conflict: Option<Box<Expression>>,
10366 #[serde(default)]
10367 pub nulls: Option<Box<Expression>>,
10368 #[serde(default)]
10369 pub options: Vec<Expression>,
10370}
10371
10372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10374#[cfg_attr(feature = "bindings", derive(TS))]
10375pub struct WatermarkColumnConstraint {
10376 pub this: Box<Expression>,
10377 pub expression: Box<Expression>,
10378}
10379
10380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10382#[cfg_attr(feature = "bindings", derive(TS))]
10383pub struct ComputedColumnConstraint {
10384 pub this: Box<Expression>,
10385 #[serde(default)]
10386 pub persisted: Option<Box<Expression>>,
10387 #[serde(default)]
10388 pub not_null: Option<Box<Expression>>,
10389 #[serde(default)]
10390 pub data_type: Option<Box<Expression>>,
10391}
10392
10393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10395#[cfg_attr(feature = "bindings", derive(TS))]
10396pub struct InOutColumnConstraint {
10397 #[serde(default)]
10398 pub input_: Option<Box<Expression>>,
10399 #[serde(default)]
10400 pub output: Option<Box<Expression>>,
10401}
10402
10403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10405#[cfg_attr(feature = "bindings", derive(TS))]
10406pub struct PathColumnConstraint {
10407 pub this: Box<Expression>,
10408}
10409
10410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10412#[cfg_attr(feature = "bindings", derive(TS))]
10413pub struct Constraint {
10414 pub this: Box<Expression>,
10415 #[serde(default)]
10416 pub expressions: Vec<Expression>,
10417}
10418
10419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10421#[cfg_attr(feature = "bindings", derive(TS))]
10422pub struct Export {
10423 pub this: Box<Expression>,
10424 #[serde(default)]
10425 pub connection: Option<Box<Expression>>,
10426 #[serde(default)]
10427 pub options: Vec<Expression>,
10428}
10429
10430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10432#[cfg_attr(feature = "bindings", derive(TS))]
10433pub struct Filter {
10434 pub this: Box<Expression>,
10435 pub expression: Box<Expression>,
10436}
10437
10438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10440#[cfg_attr(feature = "bindings", derive(TS))]
10441pub struct Changes {
10442 #[serde(default)]
10443 pub information: Option<Box<Expression>>,
10444 #[serde(default)]
10445 pub at_before: Option<Box<Expression>>,
10446 #[serde(default)]
10447 pub end: Option<Box<Expression>>,
10448}
10449
10450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10452#[cfg_attr(feature = "bindings", derive(TS))]
10453pub struct Directory {
10454 pub this: Box<Expression>,
10455 #[serde(default)]
10456 pub local: Option<Box<Expression>>,
10457 #[serde(default)]
10458 pub row_format: Option<Box<Expression>>,
10459}
10460
10461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10463#[cfg_attr(feature = "bindings", derive(TS))]
10464pub struct ForeignKey {
10465 #[serde(default)]
10466 pub expressions: Vec<Expression>,
10467 #[serde(default)]
10468 pub reference: Option<Box<Expression>>,
10469 #[serde(default)]
10470 pub delete: Option<Box<Expression>>,
10471 #[serde(default)]
10472 pub update: 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 ColumnPrefix {
10481 pub this: Box<Expression>,
10482 pub expression: Box<Expression>,
10483}
10484
10485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10487#[cfg_attr(feature = "bindings", derive(TS))]
10488pub struct PrimaryKey {
10489 #[serde(default)]
10490 pub this: Option<Box<Expression>>,
10491 #[serde(default)]
10492 pub expressions: Vec<Expression>,
10493 #[serde(default)]
10494 pub options: Vec<Expression>,
10495 #[serde(default)]
10496 pub include: Option<Box<Expression>>,
10497}
10498
10499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10501#[cfg_attr(feature = "bindings", derive(TS))]
10502pub struct IntoClause {
10503 #[serde(default)]
10504 pub this: Option<Box<Expression>>,
10505 #[serde(default)]
10506 pub temporary: bool,
10507 #[serde(default)]
10508 pub unlogged: Option<Box<Expression>>,
10509 #[serde(default)]
10510 pub bulk_collect: Option<Box<Expression>>,
10511 #[serde(default)]
10512 pub expressions: Vec<Expression>,
10513}
10514
10515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10517#[cfg_attr(feature = "bindings", derive(TS))]
10518pub struct JoinHint {
10519 pub this: Box<Expression>,
10520 #[serde(default)]
10521 pub expressions: Vec<Expression>,
10522}
10523
10524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10526#[cfg_attr(feature = "bindings", derive(TS))]
10527pub struct Opclass {
10528 pub this: Box<Expression>,
10529 pub expression: Box<Expression>,
10530}
10531
10532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10534#[cfg_attr(feature = "bindings", derive(TS))]
10535pub struct Index {
10536 #[serde(default)]
10537 pub this: Option<Box<Expression>>,
10538 #[serde(default)]
10539 pub table: Option<Box<Expression>>,
10540 #[serde(default)]
10541 pub unique: bool,
10542 #[serde(default)]
10543 pub primary: Option<Box<Expression>>,
10544 #[serde(default)]
10545 pub amp: Option<Box<Expression>>,
10546 #[serde(default)]
10547 pub params: Vec<Expression>,
10548}
10549
10550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10552#[cfg_attr(feature = "bindings", derive(TS))]
10553pub struct IndexParameters {
10554 #[serde(default)]
10555 pub using: Option<Box<Expression>>,
10556 #[serde(default)]
10557 pub include: Option<Box<Expression>>,
10558 #[serde(default)]
10559 pub columns: Vec<Expression>,
10560 #[serde(default)]
10561 pub with_storage: Option<Box<Expression>>,
10562 #[serde(default)]
10563 pub partition_by: Option<Box<Expression>>,
10564 #[serde(default)]
10565 pub tablespace: Option<Box<Expression>>,
10566 #[serde(default)]
10567 pub where_: Option<Box<Expression>>,
10568 #[serde(default)]
10569 pub on: Option<Box<Expression>>,
10570}
10571
10572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10574#[cfg_attr(feature = "bindings", derive(TS))]
10575pub struct ConditionalInsert {
10576 pub this: Box<Expression>,
10577 #[serde(default)]
10578 pub expression: Option<Box<Expression>>,
10579 #[serde(default)]
10580 pub else_: Option<Box<Expression>>,
10581}
10582
10583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10585#[cfg_attr(feature = "bindings", derive(TS))]
10586pub struct MultitableInserts {
10587 #[serde(default)]
10588 pub expressions: Vec<Expression>,
10589 pub kind: String,
10590 #[serde(default)]
10591 pub source: Option<Box<Expression>>,
10592 #[serde(default)]
10594 pub leading_comments: Vec<String>,
10595}
10596
10597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10599#[cfg_attr(feature = "bindings", derive(TS))]
10600pub struct OnConflict {
10601 #[serde(default)]
10602 pub duplicate: Option<Box<Expression>>,
10603 #[serde(default)]
10604 pub expressions: Vec<Expression>,
10605 #[serde(default)]
10606 pub action: Option<Box<Expression>>,
10607 #[serde(default)]
10608 pub conflict_keys: Option<Box<Expression>>,
10609 #[serde(default)]
10610 pub index_predicate: Option<Box<Expression>>,
10611 #[serde(default)]
10612 pub constraint: Option<Box<Expression>>,
10613 #[serde(default)]
10614 pub where_: Option<Box<Expression>>,
10615}
10616
10617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10619#[cfg_attr(feature = "bindings", derive(TS))]
10620pub struct OnCondition {
10621 #[serde(default)]
10622 pub error: Option<Box<Expression>>,
10623 #[serde(default)]
10624 pub empty: Option<Box<Expression>>,
10625 #[serde(default)]
10626 pub null: Option<Box<Expression>>,
10627}
10628
10629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10631#[cfg_attr(feature = "bindings", derive(TS))]
10632pub struct Returning {
10633 #[serde(default)]
10634 pub expressions: Vec<Expression>,
10635 #[serde(default)]
10636 pub into: Option<Box<Expression>>,
10637}
10638
10639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10641#[cfg_attr(feature = "bindings", derive(TS))]
10642pub struct Introducer {
10643 pub this: Box<Expression>,
10644 pub expression: Box<Expression>,
10645}
10646
10647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10649#[cfg_attr(feature = "bindings", derive(TS))]
10650pub struct PartitionRange {
10651 pub this: Box<Expression>,
10652 #[serde(default)]
10653 pub expression: Option<Box<Expression>>,
10654 #[serde(default)]
10655 pub expressions: Vec<Expression>,
10656}
10657
10658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10660#[cfg_attr(feature = "bindings", derive(TS))]
10661pub struct Group {
10662 #[serde(default)]
10663 pub expressions: Vec<Expression>,
10664 #[serde(default)]
10665 pub grouping_sets: Option<Box<Expression>>,
10666 #[serde(default)]
10667 pub cube: Option<Box<Expression>>,
10668 #[serde(default)]
10669 pub rollup: Option<Box<Expression>>,
10670 #[serde(default)]
10671 pub totals: Option<Box<Expression>>,
10672 #[serde(default)]
10674 pub all: Option<bool>,
10675}
10676
10677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10679#[cfg_attr(feature = "bindings", derive(TS))]
10680pub struct Cube {
10681 #[serde(default)]
10682 pub expressions: Vec<Expression>,
10683}
10684
10685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10687#[cfg_attr(feature = "bindings", derive(TS))]
10688pub struct Rollup {
10689 #[serde(default)]
10690 pub expressions: Vec<Expression>,
10691}
10692
10693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10695#[cfg_attr(feature = "bindings", derive(TS))]
10696pub struct GroupingSets {
10697 #[serde(default)]
10698 pub expressions: Vec<Expression>,
10699}
10700
10701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10703#[cfg_attr(feature = "bindings", derive(TS))]
10704pub struct LimitOptions {
10705 #[serde(default)]
10706 pub percent: Option<Box<Expression>>,
10707 #[serde(default)]
10708 pub rows: Option<Box<Expression>>,
10709 #[serde(default)]
10710 pub with_ties: Option<Box<Expression>>,
10711}
10712
10713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10715#[cfg_attr(feature = "bindings", derive(TS))]
10716pub struct Lateral {
10717 pub this: Box<Expression>,
10718 #[serde(default)]
10719 pub view: Option<Box<Expression>>,
10720 #[serde(default)]
10721 pub outer: Option<Box<Expression>>,
10722 #[serde(default)]
10723 pub alias: Option<String>,
10724 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10726 pub alias_quoted: bool,
10727 #[serde(default)]
10728 pub cross_apply: Option<Box<Expression>>,
10729 #[serde(default)]
10730 pub ordinality: Option<Box<Expression>>,
10731 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10733 pub column_aliases: Vec<String>,
10734}
10735
10736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10738#[cfg_attr(feature = "bindings", derive(TS))]
10739pub struct TableFromRows {
10740 pub this: Box<Expression>,
10741 #[serde(default)]
10742 pub alias: Option<String>,
10743 #[serde(default)]
10744 pub joins: Vec<Expression>,
10745 #[serde(default)]
10746 pub pivots: Option<Box<Expression>>,
10747 #[serde(default)]
10748 pub sample: Option<Box<Expression>>,
10749}
10750
10751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10754#[cfg_attr(feature = "bindings", derive(TS))]
10755pub struct RowsFrom {
10756 pub expressions: Vec<Expression>,
10758 #[serde(default)]
10760 pub ordinality: bool,
10761 #[serde(default)]
10763 pub alias: Option<Box<Expression>>,
10764}
10765
10766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10768#[cfg_attr(feature = "bindings", derive(TS))]
10769pub struct WithFill {
10770 #[serde(default)]
10771 pub from_: Option<Box<Expression>>,
10772 #[serde(default)]
10773 pub to: Option<Box<Expression>>,
10774 #[serde(default)]
10775 pub step: Option<Box<Expression>>,
10776 #[serde(default)]
10777 pub staleness: Option<Box<Expression>>,
10778 #[serde(default)]
10779 pub interpolate: Option<Box<Expression>>,
10780}
10781
10782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10784#[cfg_attr(feature = "bindings", derive(TS))]
10785pub struct Property {
10786 pub this: Box<Expression>,
10787 #[serde(default)]
10788 pub value: Option<Box<Expression>>,
10789}
10790
10791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10793#[cfg_attr(feature = "bindings", derive(TS))]
10794pub struct GrantPrivilege {
10795 pub this: Box<Expression>,
10796 #[serde(default)]
10797 pub expressions: Vec<Expression>,
10798}
10799
10800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10802#[cfg_attr(feature = "bindings", derive(TS))]
10803pub struct AllowedValuesProperty {
10804 #[serde(default)]
10805 pub expressions: Vec<Expression>,
10806}
10807
10808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10810#[cfg_attr(feature = "bindings", derive(TS))]
10811pub struct AlgorithmProperty {
10812 pub this: Box<Expression>,
10813}
10814
10815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10817#[cfg_attr(feature = "bindings", derive(TS))]
10818pub struct AutoIncrementProperty {
10819 pub this: Box<Expression>,
10820}
10821
10822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10824#[cfg_attr(feature = "bindings", derive(TS))]
10825pub struct AutoRefreshProperty {
10826 pub this: Box<Expression>,
10827}
10828
10829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10831#[cfg_attr(feature = "bindings", derive(TS))]
10832pub struct BackupProperty {
10833 pub this: Box<Expression>,
10834}
10835
10836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10838#[cfg_attr(feature = "bindings", derive(TS))]
10839pub struct BuildProperty {
10840 pub this: Box<Expression>,
10841}
10842
10843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10845#[cfg_attr(feature = "bindings", derive(TS))]
10846pub struct BlockCompressionProperty {
10847 #[serde(default)]
10848 pub autotemp: Option<Box<Expression>>,
10849 #[serde(default)]
10850 pub always: Option<Box<Expression>>,
10851 #[serde(default)]
10852 pub default: Option<Box<Expression>>,
10853 #[serde(default)]
10854 pub manual: Option<Box<Expression>>,
10855 #[serde(default)]
10856 pub never: Option<Box<Expression>>,
10857}
10858
10859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10861#[cfg_attr(feature = "bindings", derive(TS))]
10862pub struct CharacterSetProperty {
10863 pub this: Box<Expression>,
10864 #[serde(default)]
10865 pub default: Option<Box<Expression>>,
10866}
10867
10868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10870#[cfg_attr(feature = "bindings", derive(TS))]
10871pub struct ChecksumProperty {
10872 #[serde(default)]
10873 pub on: Option<Box<Expression>>,
10874 #[serde(default)]
10875 pub default: Option<Box<Expression>>,
10876}
10877
10878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10880#[cfg_attr(feature = "bindings", derive(TS))]
10881pub struct CollateProperty {
10882 pub this: Box<Expression>,
10883 #[serde(default)]
10884 pub default: Option<Box<Expression>>,
10885}
10886
10887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10889#[cfg_attr(feature = "bindings", derive(TS))]
10890pub struct DataBlocksizeProperty {
10891 #[serde(default)]
10892 pub size: Option<i64>,
10893 #[serde(default)]
10894 pub units: Option<Box<Expression>>,
10895 #[serde(default)]
10896 pub minimum: Option<Box<Expression>>,
10897 #[serde(default)]
10898 pub maximum: Option<Box<Expression>>,
10899 #[serde(default)]
10900 pub default: Option<Box<Expression>>,
10901}
10902
10903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10905#[cfg_attr(feature = "bindings", derive(TS))]
10906pub struct DataDeletionProperty {
10907 pub on: Box<Expression>,
10908 #[serde(default)]
10909 pub filter_column: Option<Box<Expression>>,
10910 #[serde(default)]
10911 pub retention_period: Option<Box<Expression>>,
10912}
10913
10914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10916#[cfg_attr(feature = "bindings", derive(TS))]
10917pub struct DefinerProperty {
10918 pub this: Box<Expression>,
10919}
10920
10921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10923#[cfg_attr(feature = "bindings", derive(TS))]
10924pub struct DistKeyProperty {
10925 pub this: Box<Expression>,
10926}
10927
10928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10930#[cfg_attr(feature = "bindings", derive(TS))]
10931pub struct DistributedByProperty {
10932 #[serde(default)]
10933 pub expressions: Vec<Expression>,
10934 pub kind: String,
10935 #[serde(default)]
10936 pub buckets: Option<Box<Expression>>,
10937 #[serde(default)]
10938 pub order: Option<Box<Expression>>,
10939}
10940
10941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10943#[cfg_attr(feature = "bindings", derive(TS))]
10944pub struct DistStyleProperty {
10945 pub this: Box<Expression>,
10946}
10947
10948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10950#[cfg_attr(feature = "bindings", derive(TS))]
10951pub struct DuplicateKeyProperty {
10952 #[serde(default)]
10953 pub expressions: Vec<Expression>,
10954}
10955
10956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10958#[cfg_attr(feature = "bindings", derive(TS))]
10959pub struct EngineProperty {
10960 pub this: Box<Expression>,
10961}
10962
10963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10965#[cfg_attr(feature = "bindings", derive(TS))]
10966pub struct ToTableProperty {
10967 pub this: Box<Expression>,
10968}
10969
10970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10972#[cfg_attr(feature = "bindings", derive(TS))]
10973pub struct ExecuteAsProperty {
10974 pub this: Box<Expression>,
10975}
10976
10977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10979#[cfg_attr(feature = "bindings", derive(TS))]
10980pub struct ExternalProperty {
10981 #[serde(default)]
10982 pub this: Option<Box<Expression>>,
10983}
10984
10985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10987#[cfg_attr(feature = "bindings", derive(TS))]
10988pub struct FallbackProperty {
10989 #[serde(default)]
10990 pub no: Option<Box<Expression>>,
10991 #[serde(default)]
10992 pub protection: Option<Box<Expression>>,
10993}
10994
10995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10997#[cfg_attr(feature = "bindings", derive(TS))]
10998pub struct FileFormatProperty {
10999 #[serde(default)]
11000 pub this: Option<Box<Expression>>,
11001 #[serde(default)]
11002 pub expressions: Vec<Expression>,
11003 #[serde(default)]
11004 pub hive_format: Option<Box<Expression>>,
11005}
11006
11007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11009#[cfg_attr(feature = "bindings", derive(TS))]
11010pub struct CredentialsProperty {
11011 #[serde(default)]
11012 pub expressions: Vec<Expression>,
11013}
11014
11015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11017#[cfg_attr(feature = "bindings", derive(TS))]
11018pub struct FreespaceProperty {
11019 pub this: Box<Expression>,
11020 #[serde(default)]
11021 pub percent: Option<Box<Expression>>,
11022}
11023
11024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11026#[cfg_attr(feature = "bindings", derive(TS))]
11027pub struct InheritsProperty {
11028 #[serde(default)]
11029 pub expressions: Vec<Expression>,
11030}
11031
11032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11034#[cfg_attr(feature = "bindings", derive(TS))]
11035pub struct InputModelProperty {
11036 pub this: Box<Expression>,
11037}
11038
11039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11041#[cfg_attr(feature = "bindings", derive(TS))]
11042pub struct OutputModelProperty {
11043 pub this: Box<Expression>,
11044}
11045
11046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11048#[cfg_attr(feature = "bindings", derive(TS))]
11049pub struct IsolatedLoadingProperty {
11050 #[serde(default)]
11051 pub no: Option<Box<Expression>>,
11052 #[serde(default)]
11053 pub concurrent: Option<Box<Expression>>,
11054 #[serde(default)]
11055 pub target: Option<Box<Expression>>,
11056}
11057
11058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11060#[cfg_attr(feature = "bindings", derive(TS))]
11061pub struct JournalProperty {
11062 #[serde(default)]
11063 pub no: Option<Box<Expression>>,
11064 #[serde(default)]
11065 pub dual: Option<Box<Expression>>,
11066 #[serde(default)]
11067 pub before: Option<Box<Expression>>,
11068 #[serde(default)]
11069 pub local: Option<Box<Expression>>,
11070 #[serde(default)]
11071 pub after: Option<Box<Expression>>,
11072}
11073
11074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11076#[cfg_attr(feature = "bindings", derive(TS))]
11077pub struct LanguageProperty {
11078 pub this: Box<Expression>,
11079}
11080
11081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11083#[cfg_attr(feature = "bindings", derive(TS))]
11084pub struct EnviromentProperty {
11085 #[serde(default)]
11086 pub expressions: Vec<Expression>,
11087}
11088
11089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11091#[cfg_attr(feature = "bindings", derive(TS))]
11092pub struct ClusteredByProperty {
11093 #[serde(default)]
11094 pub expressions: Vec<Expression>,
11095 #[serde(default)]
11096 pub sorted_by: Option<Box<Expression>>,
11097 #[serde(default)]
11098 pub buckets: Option<Box<Expression>>,
11099}
11100
11101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11103#[cfg_attr(feature = "bindings", derive(TS))]
11104pub struct DictProperty {
11105 pub this: Box<Expression>,
11106 pub kind: String,
11107 #[serde(default)]
11108 pub settings: Option<Box<Expression>>,
11109}
11110
11111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11113#[cfg_attr(feature = "bindings", derive(TS))]
11114pub struct DictRange {
11115 pub this: Box<Expression>,
11116 #[serde(default)]
11117 pub min: Option<Box<Expression>>,
11118 #[serde(default)]
11119 pub max: Option<Box<Expression>>,
11120}
11121
11122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11124#[cfg_attr(feature = "bindings", derive(TS))]
11125pub struct OnCluster {
11126 pub this: Box<Expression>,
11127}
11128
11129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11131#[cfg_attr(feature = "bindings", derive(TS))]
11132pub struct LikeProperty {
11133 pub this: Box<Expression>,
11134 #[serde(default)]
11135 pub expressions: Vec<Expression>,
11136}
11137
11138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11140#[cfg_attr(feature = "bindings", derive(TS))]
11141pub struct LocationProperty {
11142 pub this: Box<Expression>,
11143}
11144
11145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11147#[cfg_attr(feature = "bindings", derive(TS))]
11148pub struct LockProperty {
11149 pub this: Box<Expression>,
11150}
11151
11152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11154#[cfg_attr(feature = "bindings", derive(TS))]
11155pub struct LockingProperty {
11156 #[serde(default)]
11157 pub this: Option<Box<Expression>>,
11158 pub kind: String,
11159 #[serde(default)]
11160 pub for_or_in: Option<Box<Expression>>,
11161 #[serde(default)]
11162 pub lock_type: Option<Box<Expression>>,
11163 #[serde(default)]
11164 pub override_: Option<Box<Expression>>,
11165}
11166
11167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11169#[cfg_attr(feature = "bindings", derive(TS))]
11170pub struct LogProperty {
11171 #[serde(default)]
11172 pub no: Option<Box<Expression>>,
11173}
11174
11175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11177#[cfg_attr(feature = "bindings", derive(TS))]
11178pub struct MaterializedProperty {
11179 #[serde(default)]
11180 pub this: Option<Box<Expression>>,
11181}
11182
11183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11185#[cfg_attr(feature = "bindings", derive(TS))]
11186pub struct MergeBlockRatioProperty {
11187 #[serde(default)]
11188 pub this: Option<Box<Expression>>,
11189 #[serde(default)]
11190 pub no: Option<Box<Expression>>,
11191 #[serde(default)]
11192 pub default: Option<Box<Expression>>,
11193 #[serde(default)]
11194 pub percent: Option<Box<Expression>>,
11195}
11196
11197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11199#[cfg_attr(feature = "bindings", derive(TS))]
11200pub struct OnProperty {
11201 pub this: Box<Expression>,
11202}
11203
11204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11206#[cfg_attr(feature = "bindings", derive(TS))]
11207pub struct OnCommitProperty {
11208 #[serde(default)]
11209 pub delete: Option<Box<Expression>>,
11210}
11211
11212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11214#[cfg_attr(feature = "bindings", derive(TS))]
11215pub struct PartitionedByProperty {
11216 pub this: Box<Expression>,
11217}
11218
11219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11221#[cfg_attr(feature = "bindings", derive(TS))]
11222pub struct PartitionByProperty {
11223 #[serde(default)]
11224 pub expressions: Vec<Expression>,
11225}
11226
11227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11229#[cfg_attr(feature = "bindings", derive(TS))]
11230pub struct PartitionedByBucket {
11231 pub this: Box<Expression>,
11232 pub expression: Box<Expression>,
11233}
11234
11235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11237#[cfg_attr(feature = "bindings", derive(TS))]
11238pub struct ClusterByColumnsProperty {
11239 #[serde(default)]
11240 pub columns: Vec<Identifier>,
11241}
11242
11243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11245#[cfg_attr(feature = "bindings", derive(TS))]
11246pub struct PartitionByTruncate {
11247 pub this: Box<Expression>,
11248 pub expression: Box<Expression>,
11249}
11250
11251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11253#[cfg_attr(feature = "bindings", derive(TS))]
11254pub struct PartitionByRangeProperty {
11255 #[serde(default)]
11256 pub partition_expressions: Option<Box<Expression>>,
11257 #[serde(default)]
11258 pub create_expressions: Option<Box<Expression>>,
11259}
11260
11261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11263#[cfg_attr(feature = "bindings", derive(TS))]
11264pub struct PartitionByRangePropertyDynamic {
11265 #[serde(default)]
11266 pub this: Option<Box<Expression>>,
11267 #[serde(default)]
11268 pub start: Option<Box<Expression>>,
11269 #[serde(default)]
11271 pub use_start_end: bool,
11272 #[serde(default)]
11273 pub end: Option<Box<Expression>>,
11274 #[serde(default)]
11275 pub every: Option<Box<Expression>>,
11276}
11277
11278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11280#[cfg_attr(feature = "bindings", derive(TS))]
11281pub struct PartitionByListProperty {
11282 #[serde(default)]
11283 pub partition_expressions: Option<Box<Expression>>,
11284 #[serde(default)]
11285 pub create_expressions: Option<Box<Expression>>,
11286}
11287
11288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11290#[cfg_attr(feature = "bindings", derive(TS))]
11291pub struct PartitionList {
11292 pub this: Box<Expression>,
11293 #[serde(default)]
11294 pub expressions: Vec<Expression>,
11295}
11296
11297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11299#[cfg_attr(feature = "bindings", derive(TS))]
11300pub struct Partition {
11301 pub expressions: Vec<Expression>,
11302 #[serde(default)]
11303 pub subpartition: bool,
11304}
11305
11306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11309#[cfg_attr(feature = "bindings", derive(TS))]
11310pub struct RefreshTriggerProperty {
11311 pub method: String,
11313 #[serde(default)]
11315 pub kind: Option<String>,
11316 #[serde(default)]
11318 pub every: Option<Box<Expression>>,
11319 #[serde(default)]
11321 pub unit: Option<String>,
11322 #[serde(default)]
11324 pub starts: Option<Box<Expression>>,
11325}
11326
11327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11329#[cfg_attr(feature = "bindings", derive(TS))]
11330pub struct UniqueKeyProperty {
11331 #[serde(default)]
11332 pub expressions: Vec<Expression>,
11333}
11334
11335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11337#[cfg_attr(feature = "bindings", derive(TS))]
11338pub struct RollupProperty {
11339 pub expressions: Vec<RollupIndex>,
11340}
11341
11342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11344#[cfg_attr(feature = "bindings", derive(TS))]
11345pub struct RollupIndex {
11346 pub name: Identifier,
11347 pub expressions: Vec<Identifier>,
11348}
11349
11350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11352#[cfg_attr(feature = "bindings", derive(TS))]
11353pub struct PartitionBoundSpec {
11354 #[serde(default)]
11355 pub this: Option<Box<Expression>>,
11356 #[serde(default)]
11357 pub expression: Option<Box<Expression>>,
11358 #[serde(default)]
11359 pub from_expressions: Option<Box<Expression>>,
11360 #[serde(default)]
11361 pub to_expressions: Option<Box<Expression>>,
11362}
11363
11364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11366#[cfg_attr(feature = "bindings", derive(TS))]
11367pub struct PartitionedOfProperty {
11368 pub this: Box<Expression>,
11369 pub expression: Box<Expression>,
11370}
11371
11372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11374#[cfg_attr(feature = "bindings", derive(TS))]
11375pub struct RemoteWithConnectionModelProperty {
11376 pub this: Box<Expression>,
11377}
11378
11379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11381#[cfg_attr(feature = "bindings", derive(TS))]
11382pub struct ReturnsProperty {
11383 #[serde(default)]
11384 pub this: Option<Box<Expression>>,
11385 #[serde(default)]
11386 pub is_table: Option<Box<Expression>>,
11387 #[serde(default)]
11388 pub table: Option<Box<Expression>>,
11389 #[serde(default)]
11390 pub null: Option<Box<Expression>>,
11391}
11392
11393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11395#[cfg_attr(feature = "bindings", derive(TS))]
11396pub struct RowFormatProperty {
11397 pub this: Box<Expression>,
11398}
11399
11400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11402#[cfg_attr(feature = "bindings", derive(TS))]
11403pub struct RowFormatDelimitedProperty {
11404 #[serde(default)]
11405 pub fields: Option<Box<Expression>>,
11406 #[serde(default)]
11407 pub escaped: Option<Box<Expression>>,
11408 #[serde(default)]
11409 pub collection_items: Option<Box<Expression>>,
11410 #[serde(default)]
11411 pub map_keys: Option<Box<Expression>>,
11412 #[serde(default)]
11413 pub lines: Option<Box<Expression>>,
11414 #[serde(default)]
11415 pub null: Option<Box<Expression>>,
11416 #[serde(default)]
11417 pub serde: Option<Box<Expression>>,
11418}
11419
11420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11422#[cfg_attr(feature = "bindings", derive(TS))]
11423pub struct RowFormatSerdeProperty {
11424 pub this: Box<Expression>,
11425 #[serde(default)]
11426 pub serde_properties: Option<Box<Expression>>,
11427}
11428
11429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11431#[cfg_attr(feature = "bindings", derive(TS))]
11432pub struct QueryTransform {
11433 #[serde(default)]
11434 pub expressions: Vec<Expression>,
11435 #[serde(default)]
11436 pub command_script: Option<Box<Expression>>,
11437 #[serde(default)]
11438 pub schema: Option<Box<Expression>>,
11439 #[serde(default)]
11440 pub row_format_before: Option<Box<Expression>>,
11441 #[serde(default)]
11442 pub record_writer: Option<Box<Expression>>,
11443 #[serde(default)]
11444 pub row_format_after: Option<Box<Expression>>,
11445 #[serde(default)]
11446 pub record_reader: Option<Box<Expression>>,
11447}
11448
11449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11451#[cfg_attr(feature = "bindings", derive(TS))]
11452pub struct SampleProperty {
11453 pub this: Box<Expression>,
11454}
11455
11456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11458#[cfg_attr(feature = "bindings", derive(TS))]
11459pub struct SecurityProperty {
11460 pub this: Box<Expression>,
11461}
11462
11463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11465#[cfg_attr(feature = "bindings", derive(TS))]
11466pub struct SchemaCommentProperty {
11467 pub this: Box<Expression>,
11468}
11469
11470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11472#[cfg_attr(feature = "bindings", derive(TS))]
11473pub struct SemanticView {
11474 pub this: Box<Expression>,
11475 #[serde(default)]
11476 pub metrics: Option<Box<Expression>>,
11477 #[serde(default)]
11478 pub dimensions: Option<Box<Expression>>,
11479 #[serde(default)]
11480 pub facts: Option<Box<Expression>>,
11481 #[serde(default)]
11482 pub where_: Option<Box<Expression>>,
11483}
11484
11485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11487#[cfg_attr(feature = "bindings", derive(TS))]
11488pub struct SerdeProperties {
11489 #[serde(default)]
11490 pub expressions: Vec<Expression>,
11491 #[serde(default)]
11492 pub with_: Option<Box<Expression>>,
11493}
11494
11495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11497#[cfg_attr(feature = "bindings", derive(TS))]
11498pub struct SetProperty {
11499 #[serde(default)]
11500 pub multi: Option<Box<Expression>>,
11501}
11502
11503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11505#[cfg_attr(feature = "bindings", derive(TS))]
11506pub struct SharingProperty {
11507 #[serde(default)]
11508 pub this: Option<Box<Expression>>,
11509}
11510
11511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11513#[cfg_attr(feature = "bindings", derive(TS))]
11514pub struct SetConfigProperty {
11515 pub this: Box<Expression>,
11516}
11517
11518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11520#[cfg_attr(feature = "bindings", derive(TS))]
11521pub struct SettingsProperty {
11522 #[serde(default)]
11523 pub expressions: Vec<Expression>,
11524}
11525
11526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11528#[cfg_attr(feature = "bindings", derive(TS))]
11529pub struct SortKeyProperty {
11530 pub this: Box<Expression>,
11531 #[serde(default)]
11532 pub compound: Option<Box<Expression>>,
11533}
11534
11535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11537#[cfg_attr(feature = "bindings", derive(TS))]
11538pub struct SqlReadWriteProperty {
11539 pub this: Box<Expression>,
11540}
11541
11542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11544#[cfg_attr(feature = "bindings", derive(TS))]
11545pub struct SqlSecurityProperty {
11546 pub this: Box<Expression>,
11547}
11548
11549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11551#[cfg_attr(feature = "bindings", derive(TS))]
11552pub struct StabilityProperty {
11553 pub this: Box<Expression>,
11554}
11555
11556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11558#[cfg_attr(feature = "bindings", derive(TS))]
11559pub struct StorageHandlerProperty {
11560 pub this: Box<Expression>,
11561}
11562
11563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11565#[cfg_attr(feature = "bindings", derive(TS))]
11566pub struct TemporaryProperty {
11567 #[serde(default)]
11568 pub this: Option<Box<Expression>>,
11569}
11570
11571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11573#[cfg_attr(feature = "bindings", derive(TS))]
11574pub struct Tags {
11575 #[serde(default)]
11576 pub expressions: Vec<Expression>,
11577}
11578
11579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11581#[cfg_attr(feature = "bindings", derive(TS))]
11582pub struct TransformModelProperty {
11583 #[serde(default)]
11584 pub expressions: Vec<Expression>,
11585}
11586
11587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11589#[cfg_attr(feature = "bindings", derive(TS))]
11590pub struct TransientProperty {
11591 #[serde(default)]
11592 pub this: Option<Box<Expression>>,
11593}
11594
11595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11597#[cfg_attr(feature = "bindings", derive(TS))]
11598pub struct UsingTemplateProperty {
11599 pub this: Box<Expression>,
11600}
11601
11602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11604#[cfg_attr(feature = "bindings", derive(TS))]
11605pub struct ViewAttributeProperty {
11606 pub this: Box<Expression>,
11607}
11608
11609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11611#[cfg_attr(feature = "bindings", derive(TS))]
11612pub struct VolatileProperty {
11613 #[serde(default)]
11614 pub this: Option<Box<Expression>>,
11615}
11616
11617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11619#[cfg_attr(feature = "bindings", derive(TS))]
11620pub struct WithDataProperty {
11621 #[serde(default)]
11622 pub no: Option<Box<Expression>>,
11623 #[serde(default)]
11624 pub statistics: Option<Box<Expression>>,
11625}
11626
11627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11629#[cfg_attr(feature = "bindings", derive(TS))]
11630pub struct WithJournalTableProperty {
11631 pub this: Box<Expression>,
11632}
11633
11634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11636#[cfg_attr(feature = "bindings", derive(TS))]
11637pub struct WithSchemaBindingProperty {
11638 pub this: Box<Expression>,
11639}
11640
11641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11643#[cfg_attr(feature = "bindings", derive(TS))]
11644pub struct WithSystemVersioningProperty {
11645 #[serde(default)]
11646 pub on: Option<Box<Expression>>,
11647 #[serde(default)]
11648 pub this: Option<Box<Expression>>,
11649 #[serde(default)]
11650 pub data_consistency: Option<Box<Expression>>,
11651 #[serde(default)]
11652 pub retention_period: Option<Box<Expression>>,
11653 #[serde(default)]
11654 pub with_: Option<Box<Expression>>,
11655}
11656
11657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11659#[cfg_attr(feature = "bindings", derive(TS))]
11660pub struct WithProcedureOptions {
11661 #[serde(default)]
11662 pub expressions: Vec<Expression>,
11663}
11664
11665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11667#[cfg_attr(feature = "bindings", derive(TS))]
11668pub struct EncodeProperty {
11669 pub this: Box<Expression>,
11670 #[serde(default)]
11671 pub properties: Vec<Expression>,
11672 #[serde(default)]
11673 pub key: Option<Box<Expression>>,
11674}
11675
11676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11678#[cfg_attr(feature = "bindings", derive(TS))]
11679pub struct IncludeProperty {
11680 pub this: Box<Expression>,
11681 #[serde(default)]
11682 pub alias: Option<String>,
11683 #[serde(default)]
11684 pub column_def: Option<Box<Expression>>,
11685}
11686
11687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11689#[cfg_attr(feature = "bindings", derive(TS))]
11690pub struct Properties {
11691 #[serde(default)]
11692 pub expressions: Vec<Expression>,
11693}
11694
11695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11697#[cfg_attr(feature = "bindings", derive(TS))]
11698pub struct OptionEntry {
11699 pub key: Identifier,
11700 pub value: Expression,
11701}
11702
11703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11705#[cfg_attr(feature = "bindings", derive(TS))]
11706pub struct OptionsProperty {
11707 #[serde(default)]
11708 pub entries: Vec<OptionEntry>,
11709}
11710
11711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11713#[cfg_attr(feature = "bindings", derive(TS))]
11714pub struct InputOutputFormat {
11715 #[serde(default)]
11716 pub input_format: Option<Box<Expression>>,
11717 #[serde(default)]
11718 pub output_format: Option<Box<Expression>>,
11719}
11720
11721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11723#[cfg_attr(feature = "bindings", derive(TS))]
11724pub struct Reference {
11725 pub this: Box<Expression>,
11726 #[serde(default)]
11727 pub expressions: Vec<Expression>,
11728 #[serde(default)]
11729 pub options: Vec<Expression>,
11730}
11731
11732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11734#[cfg_attr(feature = "bindings", derive(TS))]
11735pub struct QueryOption {
11736 pub this: Box<Expression>,
11737 #[serde(default)]
11738 pub expression: Option<Box<Expression>>,
11739}
11740
11741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11743#[cfg_attr(feature = "bindings", derive(TS))]
11744pub struct WithTableHint {
11745 #[serde(default)]
11746 pub expressions: Vec<Expression>,
11747}
11748
11749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11751#[cfg_attr(feature = "bindings", derive(TS))]
11752pub struct IndexTableHint {
11753 pub this: Box<Expression>,
11754 #[serde(default)]
11755 pub expressions: Vec<Expression>,
11756 #[serde(default)]
11757 pub target: Option<Box<Expression>>,
11758}
11759
11760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11762#[cfg_attr(feature = "bindings", derive(TS))]
11763pub struct Get {
11764 pub this: Box<Expression>,
11765 #[serde(default)]
11766 pub target: Option<Box<Expression>>,
11767 #[serde(default)]
11768 pub properties: Vec<Expression>,
11769}
11770
11771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11773#[cfg_attr(feature = "bindings", derive(TS))]
11774pub struct SetOperation {
11775 #[serde(default)]
11776 pub with_: Option<Box<Expression>>,
11777 pub this: Box<Expression>,
11778 pub expression: Box<Expression>,
11779 #[serde(default)]
11780 pub distinct: bool,
11781 #[serde(default)]
11782 pub by_name: Option<Box<Expression>>,
11783 #[serde(default)]
11784 pub side: Option<Box<Expression>>,
11785 #[serde(default)]
11786 pub kind: Option<String>,
11787 #[serde(default)]
11788 pub on: Option<Box<Expression>>,
11789}
11790
11791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11793#[cfg_attr(feature = "bindings", derive(TS))]
11794pub struct Var {
11795 pub this: String,
11796}
11797
11798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11800#[cfg_attr(feature = "bindings", derive(TS))]
11801pub struct Variadic {
11802 pub this: Box<Expression>,
11803}
11804
11805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11807#[cfg_attr(feature = "bindings", derive(TS))]
11808pub struct Version {
11809 pub this: Box<Expression>,
11810 pub kind: String,
11811 #[serde(default)]
11812 pub expression: Option<Box<Expression>>,
11813}
11814
11815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11817#[cfg_attr(feature = "bindings", derive(TS))]
11818pub struct Schema {
11819 #[serde(default)]
11820 pub this: Option<Box<Expression>>,
11821 #[serde(default)]
11822 pub expressions: Vec<Expression>,
11823}
11824
11825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11827#[cfg_attr(feature = "bindings", derive(TS))]
11828pub struct Lock {
11829 #[serde(default)]
11830 pub update: Option<Box<Expression>>,
11831 #[serde(default)]
11832 pub expressions: Vec<Expression>,
11833 #[serde(default)]
11834 pub wait: Option<Box<Expression>>,
11835 #[serde(default)]
11836 pub key: Option<Box<Expression>>,
11837}
11838
11839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11842#[cfg_attr(feature = "bindings", derive(TS))]
11843pub struct TableSample {
11844 #[serde(default, skip_serializing_if = "Option::is_none")]
11846 pub this: Option<Box<Expression>>,
11847 #[serde(default, skip_serializing_if = "Option::is_none")]
11849 pub sample: Option<Box<Sample>>,
11850 #[serde(default)]
11851 pub expressions: Vec<Expression>,
11852 #[serde(default)]
11853 pub method: Option<String>,
11854 #[serde(default)]
11855 pub bucket_numerator: Option<Box<Expression>>,
11856 #[serde(default)]
11857 pub bucket_denominator: Option<Box<Expression>>,
11858 #[serde(default)]
11859 pub bucket_field: Option<Box<Expression>>,
11860 #[serde(default)]
11861 pub percent: Option<Box<Expression>>,
11862 #[serde(default)]
11863 pub rows: Option<Box<Expression>>,
11864 #[serde(default)]
11865 pub size: Option<i64>,
11866 #[serde(default)]
11867 pub seed: Option<Box<Expression>>,
11868}
11869
11870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11872#[cfg_attr(feature = "bindings", derive(TS))]
11873pub struct Tag {
11874 #[serde(default)]
11875 pub this: Option<Box<Expression>>,
11876 #[serde(default)]
11877 pub prefix: Option<Box<Expression>>,
11878 #[serde(default)]
11879 pub postfix: Option<Box<Expression>>,
11880}
11881
11882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11884#[cfg_attr(feature = "bindings", derive(TS))]
11885pub struct UnpivotColumns {
11886 pub this: Box<Expression>,
11887 #[serde(default)]
11888 pub expressions: Vec<Expression>,
11889}
11890
11891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11893#[cfg_attr(feature = "bindings", derive(TS))]
11894pub struct SessionParameter {
11895 pub this: Box<Expression>,
11896 #[serde(default)]
11897 pub kind: Option<String>,
11898}
11899
11900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11902#[cfg_attr(feature = "bindings", derive(TS))]
11903pub struct PseudoType {
11904 pub this: Box<Expression>,
11905}
11906
11907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11909#[cfg_attr(feature = "bindings", derive(TS))]
11910pub struct ObjectIdentifier {
11911 pub this: Box<Expression>,
11912}
11913
11914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11916#[cfg_attr(feature = "bindings", derive(TS))]
11917pub struct Transaction {
11918 #[serde(default)]
11919 pub this: Option<Box<Expression>>,
11920 #[serde(default)]
11921 pub modes: Option<Box<Expression>>,
11922 #[serde(default)]
11923 pub mark: Option<Box<Expression>>,
11924}
11925
11926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11928#[cfg_attr(feature = "bindings", derive(TS))]
11929pub struct Commit {
11930 #[serde(default)]
11931 pub chain: Option<Box<Expression>>,
11932 #[serde(default)]
11933 pub this: Option<Box<Expression>>,
11934 #[serde(default)]
11935 pub durability: Option<Box<Expression>>,
11936}
11937
11938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11940#[cfg_attr(feature = "bindings", derive(TS))]
11941pub struct Rollback {
11942 #[serde(default)]
11943 pub savepoint: Option<Box<Expression>>,
11944 #[serde(default)]
11945 pub this: Option<Box<Expression>>,
11946}
11947
11948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11950#[cfg_attr(feature = "bindings", derive(TS))]
11951pub struct AlterSession {
11952 #[serde(default)]
11953 pub expressions: Vec<Expression>,
11954 #[serde(default)]
11955 pub unset: Option<Box<Expression>>,
11956}
11957
11958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11960#[cfg_attr(feature = "bindings", derive(TS))]
11961pub struct Analyze {
11962 #[serde(default)]
11963 pub kind: Option<String>,
11964 #[serde(default)]
11965 pub this: Option<Box<Expression>>,
11966 #[serde(default)]
11967 pub options: Vec<Expression>,
11968 #[serde(default)]
11969 pub mode: Option<Box<Expression>>,
11970 #[serde(default)]
11971 pub partition: Option<Box<Expression>>,
11972 #[serde(default)]
11973 pub expression: Option<Box<Expression>>,
11974 #[serde(default)]
11975 pub properties: Vec<Expression>,
11976 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11978 pub columns: Vec<String>,
11979}
11980
11981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11983#[cfg_attr(feature = "bindings", derive(TS))]
11984pub struct AnalyzeStatistics {
11985 pub kind: String,
11986 #[serde(default)]
11987 pub option: Option<Box<Expression>>,
11988 #[serde(default)]
11989 pub this: Option<Box<Expression>>,
11990 #[serde(default)]
11991 pub expressions: Vec<Expression>,
11992}
11993
11994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11996#[cfg_attr(feature = "bindings", derive(TS))]
11997pub struct AnalyzeHistogram {
11998 pub this: Box<Expression>,
11999 #[serde(default)]
12000 pub expressions: Vec<Expression>,
12001 #[serde(default)]
12002 pub expression: Option<Box<Expression>>,
12003 #[serde(default)]
12004 pub update_options: Option<Box<Expression>>,
12005}
12006
12007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12009#[cfg_attr(feature = "bindings", derive(TS))]
12010pub struct AnalyzeSample {
12011 pub kind: String,
12012 #[serde(default)]
12013 pub sample: Option<Box<Expression>>,
12014}
12015
12016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12018#[cfg_attr(feature = "bindings", derive(TS))]
12019pub struct AnalyzeListChainedRows {
12020 #[serde(default)]
12021 pub expression: Option<Box<Expression>>,
12022}
12023
12024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12026#[cfg_attr(feature = "bindings", derive(TS))]
12027pub struct AnalyzeDelete {
12028 #[serde(default)]
12029 pub kind: Option<String>,
12030}
12031
12032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12034#[cfg_attr(feature = "bindings", derive(TS))]
12035pub struct AnalyzeWith {
12036 #[serde(default)]
12037 pub expressions: Vec<Expression>,
12038}
12039
12040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12042#[cfg_attr(feature = "bindings", derive(TS))]
12043pub struct AnalyzeValidate {
12044 pub kind: String,
12045 #[serde(default)]
12046 pub this: Option<Box<Expression>>,
12047 #[serde(default)]
12048 pub expression: Option<Box<Expression>>,
12049}
12050
12051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12053#[cfg_attr(feature = "bindings", derive(TS))]
12054pub struct AddPartition {
12055 pub this: Box<Expression>,
12056 #[serde(default)]
12057 pub exists: bool,
12058 #[serde(default)]
12059 pub location: Option<Box<Expression>>,
12060}
12061
12062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12064#[cfg_attr(feature = "bindings", derive(TS))]
12065pub struct AttachOption {
12066 pub this: Box<Expression>,
12067 #[serde(default)]
12068 pub expression: Option<Box<Expression>>,
12069}
12070
12071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12073#[cfg_attr(feature = "bindings", derive(TS))]
12074pub struct DropPartition {
12075 #[serde(default)]
12076 pub expressions: Vec<Expression>,
12077 #[serde(default)]
12078 pub exists: bool,
12079}
12080
12081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12083#[cfg_attr(feature = "bindings", derive(TS))]
12084pub struct ReplacePartition {
12085 pub expression: Box<Expression>,
12086 #[serde(default)]
12087 pub source: Option<Box<Expression>>,
12088}
12089
12090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12092#[cfg_attr(feature = "bindings", derive(TS))]
12093pub struct DPipe {
12094 pub this: Box<Expression>,
12095 pub expression: Box<Expression>,
12096 #[serde(default)]
12097 pub safe: Option<Box<Expression>>,
12098}
12099
12100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12102#[cfg_attr(feature = "bindings", derive(TS))]
12103pub struct Operator {
12104 pub this: Box<Expression>,
12105 #[serde(default)]
12106 pub operator: Option<Box<Expression>>,
12107 pub expression: Box<Expression>,
12108 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12110 pub comments: Vec<String>,
12111}
12112
12113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12115#[cfg_attr(feature = "bindings", derive(TS))]
12116pub struct PivotAny {
12117 #[serde(default)]
12118 pub this: Option<Box<Expression>>,
12119}
12120
12121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12123#[cfg_attr(feature = "bindings", derive(TS))]
12124pub struct Aliases {
12125 pub this: Box<Expression>,
12126 #[serde(default)]
12127 pub expressions: Vec<Expression>,
12128}
12129
12130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12132#[cfg_attr(feature = "bindings", derive(TS))]
12133pub struct AtIndex {
12134 pub this: Box<Expression>,
12135 pub expression: Box<Expression>,
12136}
12137
12138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12140#[cfg_attr(feature = "bindings", derive(TS))]
12141pub struct FromTimeZone {
12142 pub this: Box<Expression>,
12143 #[serde(default)]
12144 pub zone: Option<Box<Expression>>,
12145}
12146
12147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12149#[cfg_attr(feature = "bindings", derive(TS))]
12150pub struct FormatPhrase {
12151 pub this: Box<Expression>,
12152 pub format: String,
12153}
12154
12155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12157#[cfg_attr(feature = "bindings", derive(TS))]
12158pub struct ForIn {
12159 pub this: Box<Expression>,
12160 pub expression: Box<Expression>,
12161}
12162
12163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12165#[cfg_attr(feature = "bindings", derive(TS))]
12166pub struct TimeUnit {
12167 #[serde(default)]
12168 pub unit: Option<String>,
12169}
12170
12171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12173#[cfg_attr(feature = "bindings", derive(TS))]
12174pub struct IntervalOp {
12175 #[serde(default)]
12176 pub unit: Option<String>,
12177 pub expression: Box<Expression>,
12178}
12179
12180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12182#[cfg_attr(feature = "bindings", derive(TS))]
12183pub struct HavingMax {
12184 pub this: Box<Expression>,
12185 pub expression: Box<Expression>,
12186 #[serde(default)]
12187 pub max: Option<Box<Expression>>,
12188}
12189
12190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12192#[cfg_attr(feature = "bindings", derive(TS))]
12193pub struct CosineDistance {
12194 pub this: Box<Expression>,
12195 pub expression: Box<Expression>,
12196}
12197
12198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12200#[cfg_attr(feature = "bindings", derive(TS))]
12201pub struct DotProduct {
12202 pub this: Box<Expression>,
12203 pub expression: Box<Expression>,
12204}
12205
12206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12208#[cfg_attr(feature = "bindings", derive(TS))]
12209pub struct EuclideanDistance {
12210 pub this: Box<Expression>,
12211 pub expression: Box<Expression>,
12212}
12213
12214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12216#[cfg_attr(feature = "bindings", derive(TS))]
12217pub struct ManhattanDistance {
12218 pub this: Box<Expression>,
12219 pub expression: Box<Expression>,
12220}
12221
12222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12224#[cfg_attr(feature = "bindings", derive(TS))]
12225pub struct JarowinklerSimilarity {
12226 pub this: Box<Expression>,
12227 pub expression: Box<Expression>,
12228}
12229
12230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12232#[cfg_attr(feature = "bindings", derive(TS))]
12233pub struct Booland {
12234 pub this: Box<Expression>,
12235 pub expression: Box<Expression>,
12236}
12237
12238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12240#[cfg_attr(feature = "bindings", derive(TS))]
12241pub struct Boolor {
12242 pub this: Box<Expression>,
12243 pub expression: Box<Expression>,
12244}
12245
12246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12248#[cfg_attr(feature = "bindings", derive(TS))]
12249pub struct ParameterizedAgg {
12250 pub this: Box<Expression>,
12251 #[serde(default)]
12252 pub expressions: Vec<Expression>,
12253 #[serde(default)]
12254 pub params: Vec<Expression>,
12255}
12256
12257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12259#[cfg_attr(feature = "bindings", derive(TS))]
12260pub struct ArgMax {
12261 pub this: Box<Expression>,
12262 pub expression: Box<Expression>,
12263 #[serde(default)]
12264 pub count: Option<Box<Expression>>,
12265}
12266
12267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12269#[cfg_attr(feature = "bindings", derive(TS))]
12270pub struct ArgMin {
12271 pub this: Box<Expression>,
12272 pub expression: Box<Expression>,
12273 #[serde(default)]
12274 pub count: Option<Box<Expression>>,
12275}
12276
12277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12279#[cfg_attr(feature = "bindings", derive(TS))]
12280pub struct ApproxTopK {
12281 pub this: Box<Expression>,
12282 #[serde(default)]
12283 pub expression: Option<Box<Expression>>,
12284 #[serde(default)]
12285 pub counters: Option<Box<Expression>>,
12286}
12287
12288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12290#[cfg_attr(feature = "bindings", derive(TS))]
12291pub struct ApproxTopKAccumulate {
12292 pub this: Box<Expression>,
12293 #[serde(default)]
12294 pub expression: Option<Box<Expression>>,
12295}
12296
12297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12299#[cfg_attr(feature = "bindings", derive(TS))]
12300pub struct ApproxTopKCombine {
12301 pub this: Box<Expression>,
12302 #[serde(default)]
12303 pub expression: Option<Box<Expression>>,
12304}
12305
12306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12308#[cfg_attr(feature = "bindings", derive(TS))]
12309pub struct ApproxTopKEstimate {
12310 pub this: Box<Expression>,
12311 #[serde(default)]
12312 pub expression: Option<Box<Expression>>,
12313}
12314
12315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12317#[cfg_attr(feature = "bindings", derive(TS))]
12318pub struct ApproxTopSum {
12319 pub this: Box<Expression>,
12320 pub expression: Box<Expression>,
12321 #[serde(default)]
12322 pub count: Option<Box<Expression>>,
12323}
12324
12325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12327#[cfg_attr(feature = "bindings", derive(TS))]
12328pub struct ApproxQuantiles {
12329 pub this: Box<Expression>,
12330 #[serde(default)]
12331 pub expression: Option<Box<Expression>>,
12332}
12333
12334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12336#[cfg_attr(feature = "bindings", derive(TS))]
12337pub struct Minhash {
12338 pub this: Box<Expression>,
12339 #[serde(default)]
12340 pub expressions: Vec<Expression>,
12341}
12342
12343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12345#[cfg_attr(feature = "bindings", derive(TS))]
12346pub struct FarmFingerprint {
12347 #[serde(default)]
12348 pub expressions: Vec<Expression>,
12349}
12350
12351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12353#[cfg_attr(feature = "bindings", derive(TS))]
12354pub struct Float64 {
12355 pub this: Box<Expression>,
12356 #[serde(default)]
12357 pub expression: Option<Box<Expression>>,
12358}
12359
12360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12362#[cfg_attr(feature = "bindings", derive(TS))]
12363pub struct Transform {
12364 pub this: Box<Expression>,
12365 pub expression: Box<Expression>,
12366}
12367
12368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12370#[cfg_attr(feature = "bindings", derive(TS))]
12371pub struct Translate {
12372 pub this: Box<Expression>,
12373 #[serde(default)]
12374 pub from_: Option<Box<Expression>>,
12375 #[serde(default)]
12376 pub to: Option<Box<Expression>>,
12377}
12378
12379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12381#[cfg_attr(feature = "bindings", derive(TS))]
12382pub struct Grouping {
12383 #[serde(default)]
12384 pub expressions: Vec<Expression>,
12385}
12386
12387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12389#[cfg_attr(feature = "bindings", derive(TS))]
12390pub struct GroupingId {
12391 #[serde(default)]
12392 pub expressions: Vec<Expression>,
12393}
12394
12395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12397#[cfg_attr(feature = "bindings", derive(TS))]
12398pub struct Anonymous {
12399 pub this: Box<Expression>,
12400 #[serde(default)]
12401 pub expressions: Vec<Expression>,
12402}
12403
12404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12406#[cfg_attr(feature = "bindings", derive(TS))]
12407pub struct AnonymousAggFunc {
12408 pub this: Box<Expression>,
12409 #[serde(default)]
12410 pub expressions: Vec<Expression>,
12411}
12412
12413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12415#[cfg_attr(feature = "bindings", derive(TS))]
12416pub struct CombinedAggFunc {
12417 pub this: Box<Expression>,
12418 #[serde(default)]
12419 pub expressions: Vec<Expression>,
12420}
12421
12422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12424#[cfg_attr(feature = "bindings", derive(TS))]
12425pub struct CombinedParameterizedAgg {
12426 pub this: Box<Expression>,
12427 #[serde(default)]
12428 pub expressions: Vec<Expression>,
12429 #[serde(default)]
12430 pub params: Vec<Expression>,
12431}
12432
12433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12435#[cfg_attr(feature = "bindings", derive(TS))]
12436pub struct HashAgg {
12437 pub this: Box<Expression>,
12438 #[serde(default)]
12439 pub expressions: Vec<Expression>,
12440}
12441
12442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12444#[cfg_attr(feature = "bindings", derive(TS))]
12445pub struct Hll {
12446 pub this: Box<Expression>,
12447 #[serde(default)]
12448 pub expressions: Vec<Expression>,
12449}
12450
12451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12453#[cfg_attr(feature = "bindings", derive(TS))]
12454pub struct Apply {
12455 pub this: Box<Expression>,
12456 pub expression: Box<Expression>,
12457}
12458
12459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12461#[cfg_attr(feature = "bindings", derive(TS))]
12462pub struct ToBoolean {
12463 pub this: Box<Expression>,
12464 #[serde(default)]
12465 pub safe: Option<Box<Expression>>,
12466}
12467
12468#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12470#[cfg_attr(feature = "bindings", derive(TS))]
12471pub struct List {
12472 #[serde(default)]
12473 pub expressions: Vec<Expression>,
12474}
12475
12476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12481#[cfg_attr(feature = "bindings", derive(TS))]
12482pub struct ToMap {
12483 pub this: Box<Expression>,
12485}
12486
12487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12489#[cfg_attr(feature = "bindings", derive(TS))]
12490pub struct Pad {
12491 pub this: Box<Expression>,
12492 pub expression: Box<Expression>,
12493 #[serde(default)]
12494 pub fill_pattern: Option<Box<Expression>>,
12495 #[serde(default)]
12496 pub is_left: Option<Box<Expression>>,
12497}
12498
12499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12501#[cfg_attr(feature = "bindings", derive(TS))]
12502pub struct ToChar {
12503 pub this: Box<Expression>,
12504 #[serde(default)]
12505 pub format: Option<String>,
12506 #[serde(default)]
12507 pub nlsparam: Option<Box<Expression>>,
12508 #[serde(default)]
12509 pub is_numeric: Option<Box<Expression>>,
12510}
12511
12512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12514#[cfg_attr(feature = "bindings", derive(TS))]
12515pub struct StringFunc {
12516 pub this: Box<Expression>,
12517 #[serde(default)]
12518 pub zone: Option<Box<Expression>>,
12519}
12520
12521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12523#[cfg_attr(feature = "bindings", derive(TS))]
12524pub struct ToNumber {
12525 pub this: Box<Expression>,
12526 #[serde(default)]
12527 pub format: Option<Box<Expression>>,
12528 #[serde(default)]
12529 pub nlsparam: Option<Box<Expression>>,
12530 #[serde(default)]
12531 pub precision: Option<Box<Expression>>,
12532 #[serde(default)]
12533 pub scale: Option<Box<Expression>>,
12534 #[serde(default)]
12535 pub safe: Option<Box<Expression>>,
12536 #[serde(default)]
12537 pub safe_name: Option<Box<Expression>>,
12538}
12539
12540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12542#[cfg_attr(feature = "bindings", derive(TS))]
12543pub struct ToDouble {
12544 pub this: Box<Expression>,
12545 #[serde(default)]
12546 pub format: Option<String>,
12547 #[serde(default)]
12548 pub safe: Option<Box<Expression>>,
12549}
12550
12551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12553#[cfg_attr(feature = "bindings", derive(TS))]
12554pub struct ToDecfloat {
12555 pub this: Box<Expression>,
12556 #[serde(default)]
12557 pub format: Option<String>,
12558}
12559
12560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12562#[cfg_attr(feature = "bindings", derive(TS))]
12563pub struct TryToDecfloat {
12564 pub this: Box<Expression>,
12565 #[serde(default)]
12566 pub format: Option<String>,
12567}
12568
12569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12571#[cfg_attr(feature = "bindings", derive(TS))]
12572pub struct ToFile {
12573 pub this: Box<Expression>,
12574 #[serde(default)]
12575 pub path: Option<Box<Expression>>,
12576 #[serde(default)]
12577 pub safe: Option<Box<Expression>>,
12578}
12579
12580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12582#[cfg_attr(feature = "bindings", derive(TS))]
12583pub struct Columns {
12584 pub this: Box<Expression>,
12585 #[serde(default)]
12586 pub unpack: Option<Box<Expression>>,
12587}
12588
12589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12591#[cfg_attr(feature = "bindings", derive(TS))]
12592pub struct ConvertToCharset {
12593 pub this: Box<Expression>,
12594 #[serde(default)]
12595 pub dest: Option<Box<Expression>>,
12596 #[serde(default)]
12597 pub source: Option<Box<Expression>>,
12598}
12599
12600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12602#[cfg_attr(feature = "bindings", derive(TS))]
12603pub struct ConvertTimezone {
12604 #[serde(default)]
12605 pub source_tz: Option<Box<Expression>>,
12606 #[serde(default)]
12607 pub target_tz: Option<Box<Expression>>,
12608 #[serde(default)]
12609 pub timestamp: Option<Box<Expression>>,
12610 #[serde(default)]
12611 pub options: Vec<Expression>,
12612}
12613
12614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12616#[cfg_attr(feature = "bindings", derive(TS))]
12617pub struct GenerateSeries {
12618 #[serde(default)]
12619 pub start: Option<Box<Expression>>,
12620 #[serde(default)]
12621 pub end: Option<Box<Expression>>,
12622 #[serde(default)]
12623 pub step: Option<Box<Expression>>,
12624 #[serde(default)]
12625 pub is_end_exclusive: Option<Box<Expression>>,
12626}
12627
12628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12630#[cfg_attr(feature = "bindings", derive(TS))]
12631pub struct AIAgg {
12632 pub this: Box<Expression>,
12633 pub expression: Box<Expression>,
12634}
12635
12636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12638#[cfg_attr(feature = "bindings", derive(TS))]
12639pub struct AIClassify {
12640 pub this: Box<Expression>,
12641 #[serde(default)]
12642 pub categories: Option<Box<Expression>>,
12643 #[serde(default)]
12644 pub config: Option<Box<Expression>>,
12645}
12646
12647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12649#[cfg_attr(feature = "bindings", derive(TS))]
12650pub struct ArrayAll {
12651 pub this: Box<Expression>,
12652 pub expression: Box<Expression>,
12653}
12654
12655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12657#[cfg_attr(feature = "bindings", derive(TS))]
12658pub struct ArrayAny {
12659 pub this: Box<Expression>,
12660 pub expression: Box<Expression>,
12661}
12662
12663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12665#[cfg_attr(feature = "bindings", derive(TS))]
12666pub struct ArrayConstructCompact {
12667 #[serde(default)]
12668 pub expressions: Vec<Expression>,
12669}
12670
12671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12673#[cfg_attr(feature = "bindings", derive(TS))]
12674pub struct StPoint {
12675 pub this: Box<Expression>,
12676 pub expression: Box<Expression>,
12677 #[serde(default)]
12678 pub null: Option<Box<Expression>>,
12679}
12680
12681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12683#[cfg_attr(feature = "bindings", derive(TS))]
12684pub struct StDistance {
12685 pub this: Box<Expression>,
12686 pub expression: Box<Expression>,
12687 #[serde(default)]
12688 pub use_spheroid: Option<Box<Expression>>,
12689}
12690
12691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12693#[cfg_attr(feature = "bindings", derive(TS))]
12694pub struct StringToArray {
12695 pub this: Box<Expression>,
12696 #[serde(default)]
12697 pub expression: Option<Box<Expression>>,
12698 #[serde(default)]
12699 pub null: Option<Box<Expression>>,
12700}
12701
12702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12704#[cfg_attr(feature = "bindings", derive(TS))]
12705pub struct ArraySum {
12706 pub this: Box<Expression>,
12707 #[serde(default)]
12708 pub expression: Option<Box<Expression>>,
12709}
12710
12711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12713#[cfg_attr(feature = "bindings", derive(TS))]
12714pub struct ObjectAgg {
12715 pub this: Box<Expression>,
12716 pub expression: Box<Expression>,
12717}
12718
12719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12721#[cfg_attr(feature = "bindings", derive(TS))]
12722pub struct CastToStrType {
12723 pub this: Box<Expression>,
12724 #[serde(default)]
12725 pub to: Option<Box<Expression>>,
12726}
12727
12728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12730#[cfg_attr(feature = "bindings", derive(TS))]
12731pub struct CheckJson {
12732 pub this: Box<Expression>,
12733}
12734
12735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12737#[cfg_attr(feature = "bindings", derive(TS))]
12738pub struct CheckXml {
12739 pub this: Box<Expression>,
12740 #[serde(default)]
12741 pub disable_auto_convert: Option<Box<Expression>>,
12742}
12743
12744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12746#[cfg_attr(feature = "bindings", derive(TS))]
12747pub struct TranslateCharacters {
12748 pub this: Box<Expression>,
12749 pub expression: Box<Expression>,
12750 #[serde(default)]
12751 pub with_error: Option<Box<Expression>>,
12752}
12753
12754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12756#[cfg_attr(feature = "bindings", derive(TS))]
12757pub struct CurrentSchemas {
12758 #[serde(default)]
12759 pub this: Option<Box<Expression>>,
12760}
12761
12762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12764#[cfg_attr(feature = "bindings", derive(TS))]
12765pub struct CurrentDatetime {
12766 #[serde(default)]
12767 pub this: Option<Box<Expression>>,
12768}
12769
12770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12772#[cfg_attr(feature = "bindings", derive(TS))]
12773pub struct Localtime {
12774 #[serde(default)]
12775 pub this: Option<Box<Expression>>,
12776}
12777
12778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12780#[cfg_attr(feature = "bindings", derive(TS))]
12781pub struct Localtimestamp {
12782 #[serde(default)]
12783 pub this: Option<Box<Expression>>,
12784}
12785
12786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12788#[cfg_attr(feature = "bindings", derive(TS))]
12789pub struct Systimestamp {
12790 #[serde(default)]
12791 pub this: Option<Box<Expression>>,
12792}
12793
12794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12796#[cfg_attr(feature = "bindings", derive(TS))]
12797pub struct CurrentSchema {
12798 #[serde(default)]
12799 pub this: Option<Box<Expression>>,
12800}
12801
12802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12804#[cfg_attr(feature = "bindings", derive(TS))]
12805pub struct CurrentUser {
12806 #[serde(default)]
12807 pub this: Option<Box<Expression>>,
12808}
12809
12810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12812#[cfg_attr(feature = "bindings", derive(TS))]
12813pub struct SessionUser;
12814
12815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12817#[cfg_attr(feature = "bindings", derive(TS))]
12818pub struct JSONPathRoot;
12819
12820#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12822#[cfg_attr(feature = "bindings", derive(TS))]
12823pub struct UtcTime {
12824 #[serde(default)]
12825 pub this: Option<Box<Expression>>,
12826}
12827
12828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12830#[cfg_attr(feature = "bindings", derive(TS))]
12831pub struct UtcTimestamp {
12832 #[serde(default)]
12833 pub this: Option<Box<Expression>>,
12834}
12835
12836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12838#[cfg_attr(feature = "bindings", derive(TS))]
12839pub struct TimestampFunc {
12840 #[serde(default)]
12841 pub this: Option<Box<Expression>>,
12842 #[serde(default)]
12843 pub zone: Option<Box<Expression>>,
12844 #[serde(default)]
12845 pub with_tz: Option<bool>,
12846 #[serde(default)]
12847 pub safe: Option<bool>,
12848}
12849
12850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12852#[cfg_attr(feature = "bindings", derive(TS))]
12853pub struct DateBin {
12854 pub this: Box<Expression>,
12855 pub expression: Box<Expression>,
12856 #[serde(default)]
12857 pub unit: Option<String>,
12858 #[serde(default)]
12859 pub zone: Option<Box<Expression>>,
12860 #[serde(default)]
12861 pub origin: Option<Box<Expression>>,
12862}
12863
12864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12866#[cfg_attr(feature = "bindings", derive(TS))]
12867pub struct Datetime {
12868 pub this: Box<Expression>,
12869 #[serde(default)]
12870 pub expression: Option<Box<Expression>>,
12871}
12872
12873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12875#[cfg_attr(feature = "bindings", derive(TS))]
12876pub struct DatetimeAdd {
12877 pub this: Box<Expression>,
12878 pub expression: Box<Expression>,
12879 #[serde(default)]
12880 pub unit: Option<String>,
12881}
12882
12883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12885#[cfg_attr(feature = "bindings", derive(TS))]
12886pub struct DatetimeSub {
12887 pub this: Box<Expression>,
12888 pub expression: Box<Expression>,
12889 #[serde(default)]
12890 pub unit: Option<String>,
12891}
12892
12893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12895#[cfg_attr(feature = "bindings", derive(TS))]
12896pub struct DatetimeDiff {
12897 pub this: Box<Expression>,
12898 pub expression: Box<Expression>,
12899 #[serde(default)]
12900 pub unit: Option<String>,
12901}
12902
12903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12905#[cfg_attr(feature = "bindings", derive(TS))]
12906pub struct DatetimeTrunc {
12907 pub this: Box<Expression>,
12908 pub unit: String,
12909 #[serde(default)]
12910 pub zone: Option<Box<Expression>>,
12911}
12912
12913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12915#[cfg_attr(feature = "bindings", derive(TS))]
12916pub struct Dayname {
12917 pub this: Box<Expression>,
12918 #[serde(default)]
12919 pub abbreviated: Option<Box<Expression>>,
12920}
12921
12922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12924#[cfg_attr(feature = "bindings", derive(TS))]
12925pub struct MakeInterval {
12926 #[serde(default)]
12927 pub year: Option<Box<Expression>>,
12928 #[serde(default)]
12929 pub month: Option<Box<Expression>>,
12930 #[serde(default)]
12931 pub week: Option<Box<Expression>>,
12932 #[serde(default)]
12933 pub day: Option<Box<Expression>>,
12934 #[serde(default)]
12935 pub hour: Option<Box<Expression>>,
12936 #[serde(default)]
12937 pub minute: Option<Box<Expression>>,
12938 #[serde(default)]
12939 pub second: Option<Box<Expression>>,
12940}
12941
12942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12944#[cfg_attr(feature = "bindings", derive(TS))]
12945pub struct PreviousDay {
12946 pub this: Box<Expression>,
12947 pub expression: Box<Expression>,
12948}
12949
12950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12952#[cfg_attr(feature = "bindings", derive(TS))]
12953pub struct Elt {
12954 pub this: Box<Expression>,
12955 #[serde(default)]
12956 pub expressions: Vec<Expression>,
12957}
12958
12959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12961#[cfg_attr(feature = "bindings", derive(TS))]
12962pub struct TimestampAdd {
12963 pub this: Box<Expression>,
12964 pub expression: Box<Expression>,
12965 #[serde(default)]
12966 pub unit: Option<String>,
12967}
12968
12969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12971#[cfg_attr(feature = "bindings", derive(TS))]
12972pub struct TimestampSub {
12973 pub this: Box<Expression>,
12974 pub expression: Box<Expression>,
12975 #[serde(default)]
12976 pub unit: Option<String>,
12977}
12978
12979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12981#[cfg_attr(feature = "bindings", derive(TS))]
12982pub struct TimestampDiff {
12983 pub this: Box<Expression>,
12984 pub expression: Box<Expression>,
12985 #[serde(default)]
12986 pub unit: Option<String>,
12987}
12988
12989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12991#[cfg_attr(feature = "bindings", derive(TS))]
12992pub struct TimeSlice {
12993 pub this: Box<Expression>,
12994 pub expression: Box<Expression>,
12995 pub unit: String,
12996 #[serde(default)]
12997 pub kind: Option<String>,
12998}
12999
13000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13002#[cfg_attr(feature = "bindings", derive(TS))]
13003pub struct TimeAdd {
13004 pub this: Box<Expression>,
13005 pub expression: Box<Expression>,
13006 #[serde(default)]
13007 pub unit: Option<String>,
13008}
13009
13010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13012#[cfg_attr(feature = "bindings", derive(TS))]
13013pub struct TimeSub {
13014 pub this: Box<Expression>,
13015 pub expression: Box<Expression>,
13016 #[serde(default)]
13017 pub unit: Option<String>,
13018}
13019
13020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13022#[cfg_attr(feature = "bindings", derive(TS))]
13023pub struct TimeDiff {
13024 pub this: Box<Expression>,
13025 pub expression: Box<Expression>,
13026 #[serde(default)]
13027 pub unit: Option<String>,
13028}
13029
13030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13032#[cfg_attr(feature = "bindings", derive(TS))]
13033pub struct TimeTrunc {
13034 pub this: Box<Expression>,
13035 pub unit: String,
13036 #[serde(default)]
13037 pub zone: Option<Box<Expression>>,
13038}
13039
13040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13042#[cfg_attr(feature = "bindings", derive(TS))]
13043pub struct DateFromParts {
13044 #[serde(default)]
13045 pub year: Option<Box<Expression>>,
13046 #[serde(default)]
13047 pub month: Option<Box<Expression>>,
13048 #[serde(default)]
13049 pub day: Option<Box<Expression>>,
13050 #[serde(default)]
13051 pub allow_overflow: Option<Box<Expression>>,
13052}
13053
13054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13056#[cfg_attr(feature = "bindings", derive(TS))]
13057pub struct TimeFromParts {
13058 #[serde(default)]
13059 pub hour: Option<Box<Expression>>,
13060 #[serde(default)]
13061 pub min: Option<Box<Expression>>,
13062 #[serde(default)]
13063 pub sec: Option<Box<Expression>>,
13064 #[serde(default)]
13065 pub nano: Option<Box<Expression>>,
13066 #[serde(default)]
13067 pub fractions: Option<Box<Expression>>,
13068 #[serde(default)]
13069 pub precision: Option<i64>,
13070}
13071
13072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13074#[cfg_attr(feature = "bindings", derive(TS))]
13075pub struct DecodeCase {
13076 #[serde(default)]
13077 pub expressions: Vec<Expression>,
13078}
13079
13080#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13082#[cfg_attr(feature = "bindings", derive(TS))]
13083pub struct Decrypt {
13084 pub this: Box<Expression>,
13085 #[serde(default)]
13086 pub passphrase: Option<Box<Expression>>,
13087 #[serde(default)]
13088 pub aad: Option<Box<Expression>>,
13089 #[serde(default)]
13090 pub encryption_method: Option<Box<Expression>>,
13091 #[serde(default)]
13092 pub safe: Option<Box<Expression>>,
13093}
13094
13095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13097#[cfg_attr(feature = "bindings", derive(TS))]
13098pub struct DecryptRaw {
13099 pub this: Box<Expression>,
13100 #[serde(default)]
13101 pub key: Option<Box<Expression>>,
13102 #[serde(default)]
13103 pub iv: Option<Box<Expression>>,
13104 #[serde(default)]
13105 pub aad: Option<Box<Expression>>,
13106 #[serde(default)]
13107 pub encryption_method: Option<Box<Expression>>,
13108 #[serde(default)]
13109 pub aead: Option<Box<Expression>>,
13110 #[serde(default)]
13111 pub safe: Option<Box<Expression>>,
13112}
13113
13114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13116#[cfg_attr(feature = "bindings", derive(TS))]
13117pub struct Encode {
13118 pub this: Box<Expression>,
13119 #[serde(default)]
13120 pub charset: Option<Box<Expression>>,
13121}
13122
13123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13125#[cfg_attr(feature = "bindings", derive(TS))]
13126pub struct Encrypt {
13127 pub this: Box<Expression>,
13128 #[serde(default)]
13129 pub passphrase: Option<Box<Expression>>,
13130 #[serde(default)]
13131 pub aad: Option<Box<Expression>>,
13132 #[serde(default)]
13133 pub encryption_method: Option<Box<Expression>>,
13134}
13135
13136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13138#[cfg_attr(feature = "bindings", derive(TS))]
13139pub struct EncryptRaw {
13140 pub this: Box<Expression>,
13141 #[serde(default)]
13142 pub key: Option<Box<Expression>>,
13143 #[serde(default)]
13144 pub iv: Option<Box<Expression>>,
13145 #[serde(default)]
13146 pub aad: Option<Box<Expression>>,
13147 #[serde(default)]
13148 pub encryption_method: Option<Box<Expression>>,
13149}
13150
13151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13153#[cfg_attr(feature = "bindings", derive(TS))]
13154pub struct EqualNull {
13155 pub this: Box<Expression>,
13156 pub expression: Box<Expression>,
13157}
13158
13159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13161#[cfg_attr(feature = "bindings", derive(TS))]
13162pub struct ToBinary {
13163 pub this: Box<Expression>,
13164 #[serde(default)]
13165 pub format: Option<String>,
13166 #[serde(default)]
13167 pub safe: Option<Box<Expression>>,
13168}
13169
13170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13172#[cfg_attr(feature = "bindings", derive(TS))]
13173pub struct Base64DecodeBinary {
13174 pub this: Box<Expression>,
13175 #[serde(default)]
13176 pub alphabet: Option<Box<Expression>>,
13177}
13178
13179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13181#[cfg_attr(feature = "bindings", derive(TS))]
13182pub struct Base64DecodeString {
13183 pub this: Box<Expression>,
13184 #[serde(default)]
13185 pub alphabet: Option<Box<Expression>>,
13186}
13187
13188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13190#[cfg_attr(feature = "bindings", derive(TS))]
13191pub struct Base64Encode {
13192 pub this: Box<Expression>,
13193 #[serde(default)]
13194 pub max_line_length: Option<Box<Expression>>,
13195 #[serde(default)]
13196 pub alphabet: Option<Box<Expression>>,
13197}
13198
13199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13201#[cfg_attr(feature = "bindings", derive(TS))]
13202pub struct TryBase64DecodeBinary {
13203 pub this: Box<Expression>,
13204 #[serde(default)]
13205 pub alphabet: Option<Box<Expression>>,
13206}
13207
13208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13210#[cfg_attr(feature = "bindings", derive(TS))]
13211pub struct TryBase64DecodeString {
13212 pub this: Box<Expression>,
13213 #[serde(default)]
13214 pub alphabet: Option<Box<Expression>>,
13215}
13216
13217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13219#[cfg_attr(feature = "bindings", derive(TS))]
13220pub struct GapFill {
13221 pub this: Box<Expression>,
13222 #[serde(default)]
13223 pub ts_column: Option<Box<Expression>>,
13224 #[serde(default)]
13225 pub bucket_width: Option<Box<Expression>>,
13226 #[serde(default)]
13227 pub partitioning_columns: Option<Box<Expression>>,
13228 #[serde(default)]
13229 pub value_columns: Option<Box<Expression>>,
13230 #[serde(default)]
13231 pub origin: Option<Box<Expression>>,
13232 #[serde(default)]
13233 pub ignore_nulls: Option<Box<Expression>>,
13234}
13235
13236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13238#[cfg_attr(feature = "bindings", derive(TS))]
13239pub struct GenerateDateArray {
13240 #[serde(default)]
13241 pub start: Option<Box<Expression>>,
13242 #[serde(default)]
13243 pub end: Option<Box<Expression>>,
13244 #[serde(default)]
13245 pub step: Option<Box<Expression>>,
13246}
13247
13248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13250#[cfg_attr(feature = "bindings", derive(TS))]
13251pub struct GenerateTimestampArray {
13252 #[serde(default)]
13253 pub start: Option<Box<Expression>>,
13254 #[serde(default)]
13255 pub end: Option<Box<Expression>>,
13256 #[serde(default)]
13257 pub step: Option<Box<Expression>>,
13258}
13259
13260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13262#[cfg_attr(feature = "bindings", derive(TS))]
13263pub struct GetExtract {
13264 pub this: Box<Expression>,
13265 pub expression: Box<Expression>,
13266}
13267
13268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13270#[cfg_attr(feature = "bindings", derive(TS))]
13271pub struct Getbit {
13272 pub this: Box<Expression>,
13273 pub expression: Box<Expression>,
13274 #[serde(default)]
13275 pub zero_is_msb: Option<Box<Expression>>,
13276}
13277
13278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13280#[cfg_attr(feature = "bindings", derive(TS))]
13281pub struct OverflowTruncateBehavior {
13282 #[serde(default)]
13283 pub this: Option<Box<Expression>>,
13284 #[serde(default)]
13285 pub with_count: Option<Box<Expression>>,
13286}
13287
13288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13290#[cfg_attr(feature = "bindings", derive(TS))]
13291pub struct HexEncode {
13292 pub this: Box<Expression>,
13293 #[serde(default)]
13294 pub case: Option<Box<Expression>>,
13295}
13296
13297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13299#[cfg_attr(feature = "bindings", derive(TS))]
13300pub struct Compress {
13301 pub this: Box<Expression>,
13302 #[serde(default)]
13303 pub method: Option<String>,
13304}
13305
13306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13308#[cfg_attr(feature = "bindings", derive(TS))]
13309pub struct DecompressBinary {
13310 pub this: Box<Expression>,
13311 pub method: String,
13312}
13313
13314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13316#[cfg_attr(feature = "bindings", derive(TS))]
13317pub struct DecompressString {
13318 pub this: Box<Expression>,
13319 pub method: String,
13320}
13321
13322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13324#[cfg_attr(feature = "bindings", derive(TS))]
13325pub struct Xor {
13326 #[serde(default)]
13327 pub this: Option<Box<Expression>>,
13328 #[serde(default)]
13329 pub expression: Option<Box<Expression>>,
13330 #[serde(default)]
13331 pub expressions: Vec<Expression>,
13332}
13333
13334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13336#[cfg_attr(feature = "bindings", derive(TS))]
13337pub struct Nullif {
13338 pub this: Box<Expression>,
13339 pub expression: Box<Expression>,
13340}
13341
13342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13344#[cfg_attr(feature = "bindings", derive(TS))]
13345pub struct JSON {
13346 #[serde(default)]
13347 pub this: Option<Box<Expression>>,
13348 #[serde(default)]
13349 pub with_: Option<Box<Expression>>,
13350 #[serde(default)]
13351 pub unique: bool,
13352}
13353
13354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13356#[cfg_attr(feature = "bindings", derive(TS))]
13357pub struct JSONPath {
13358 #[serde(default)]
13359 pub expressions: Vec<Expression>,
13360 #[serde(default)]
13361 pub escape: Option<Box<Expression>>,
13362}
13363
13364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13366#[cfg_attr(feature = "bindings", derive(TS))]
13367pub struct JSONPathFilter {
13368 pub this: Box<Expression>,
13369}
13370
13371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13373#[cfg_attr(feature = "bindings", derive(TS))]
13374pub struct JSONPathKey {
13375 pub this: Box<Expression>,
13376}
13377
13378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13380#[cfg_attr(feature = "bindings", derive(TS))]
13381pub struct JSONPathRecursive {
13382 #[serde(default)]
13383 pub this: Option<Box<Expression>>,
13384}
13385
13386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13388#[cfg_attr(feature = "bindings", derive(TS))]
13389pub struct JSONPathScript {
13390 pub this: Box<Expression>,
13391}
13392
13393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13395#[cfg_attr(feature = "bindings", derive(TS))]
13396pub struct JSONPathSlice {
13397 #[serde(default)]
13398 pub start: Option<Box<Expression>>,
13399 #[serde(default)]
13400 pub end: Option<Box<Expression>>,
13401 #[serde(default)]
13402 pub step: Option<Box<Expression>>,
13403}
13404
13405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13407#[cfg_attr(feature = "bindings", derive(TS))]
13408pub struct JSONPathSelector {
13409 pub this: Box<Expression>,
13410}
13411
13412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13414#[cfg_attr(feature = "bindings", derive(TS))]
13415pub struct JSONPathSubscript {
13416 pub this: Box<Expression>,
13417}
13418
13419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13421#[cfg_attr(feature = "bindings", derive(TS))]
13422pub struct JSONPathUnion {
13423 #[serde(default)]
13424 pub expressions: Vec<Expression>,
13425}
13426
13427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13429#[cfg_attr(feature = "bindings", derive(TS))]
13430pub struct Format {
13431 pub this: Box<Expression>,
13432 #[serde(default)]
13433 pub expressions: Vec<Expression>,
13434}
13435
13436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13438#[cfg_attr(feature = "bindings", derive(TS))]
13439pub struct JSONKeys {
13440 pub this: Box<Expression>,
13441 #[serde(default)]
13442 pub expression: Option<Box<Expression>>,
13443 #[serde(default)]
13444 pub expressions: Vec<Expression>,
13445}
13446
13447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13449#[cfg_attr(feature = "bindings", derive(TS))]
13450pub struct JSONKeyValue {
13451 pub this: Box<Expression>,
13452 pub expression: Box<Expression>,
13453}
13454
13455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13457#[cfg_attr(feature = "bindings", derive(TS))]
13458pub struct JSONKeysAtDepth {
13459 pub this: Box<Expression>,
13460 #[serde(default)]
13461 pub expression: Option<Box<Expression>>,
13462 #[serde(default)]
13463 pub mode: Option<Box<Expression>>,
13464}
13465
13466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13468#[cfg_attr(feature = "bindings", derive(TS))]
13469pub struct JSONObject {
13470 #[serde(default)]
13471 pub expressions: Vec<Expression>,
13472 #[serde(default)]
13473 pub null_handling: Option<Box<Expression>>,
13474 #[serde(default)]
13475 pub unique_keys: Option<Box<Expression>>,
13476 #[serde(default)]
13477 pub return_type: Option<Box<Expression>>,
13478 #[serde(default)]
13479 pub encoding: Option<Box<Expression>>,
13480}
13481
13482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13484#[cfg_attr(feature = "bindings", derive(TS))]
13485pub struct JSONObjectAgg {
13486 #[serde(default)]
13487 pub expressions: Vec<Expression>,
13488 #[serde(default)]
13489 pub null_handling: Option<Box<Expression>>,
13490 #[serde(default)]
13491 pub unique_keys: Option<Box<Expression>>,
13492 #[serde(default)]
13493 pub return_type: Option<Box<Expression>>,
13494 #[serde(default)]
13495 pub encoding: Option<Box<Expression>>,
13496}
13497
13498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13500#[cfg_attr(feature = "bindings", derive(TS))]
13501pub struct JSONBObjectAgg {
13502 pub this: Box<Expression>,
13503 pub expression: Box<Expression>,
13504}
13505
13506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13508#[cfg_attr(feature = "bindings", derive(TS))]
13509pub struct JSONArray {
13510 #[serde(default)]
13511 pub expressions: Vec<Expression>,
13512 #[serde(default)]
13513 pub null_handling: Option<Box<Expression>>,
13514 #[serde(default)]
13515 pub return_type: Option<Box<Expression>>,
13516 #[serde(default)]
13517 pub strict: Option<Box<Expression>>,
13518}
13519
13520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13522#[cfg_attr(feature = "bindings", derive(TS))]
13523pub struct JSONArrayAgg {
13524 pub this: Box<Expression>,
13525 #[serde(default)]
13526 pub order: Option<Box<Expression>>,
13527 #[serde(default)]
13528 pub null_handling: Option<Box<Expression>>,
13529 #[serde(default)]
13530 pub return_type: Option<Box<Expression>>,
13531 #[serde(default)]
13532 pub strict: Option<Box<Expression>>,
13533}
13534
13535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13537#[cfg_attr(feature = "bindings", derive(TS))]
13538pub struct JSONExists {
13539 pub this: Box<Expression>,
13540 #[serde(default)]
13541 pub path: Option<Box<Expression>>,
13542 #[serde(default)]
13543 pub passing: Option<Box<Expression>>,
13544 #[serde(default)]
13545 pub on_condition: Option<Box<Expression>>,
13546 #[serde(default)]
13547 pub from_dcolonqmark: Option<Box<Expression>>,
13548}
13549
13550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13552#[cfg_attr(feature = "bindings", derive(TS))]
13553pub struct JSONColumnDef {
13554 #[serde(default)]
13555 pub this: Option<Box<Expression>>,
13556 #[serde(default)]
13557 pub kind: Option<String>,
13558 #[serde(default)]
13559 pub path: Option<Box<Expression>>,
13560 #[serde(default)]
13561 pub nested_schema: Option<Box<Expression>>,
13562 #[serde(default)]
13563 pub ordinality: Option<Box<Expression>>,
13564}
13565
13566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13568#[cfg_attr(feature = "bindings", derive(TS))]
13569pub struct JSONSchema {
13570 #[serde(default)]
13571 pub expressions: Vec<Expression>,
13572}
13573
13574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13576#[cfg_attr(feature = "bindings", derive(TS))]
13577pub struct JSONSet {
13578 pub this: Box<Expression>,
13579 #[serde(default)]
13580 pub expressions: Vec<Expression>,
13581}
13582
13583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13585#[cfg_attr(feature = "bindings", derive(TS))]
13586pub struct JSONStripNulls {
13587 pub this: Box<Expression>,
13588 #[serde(default)]
13589 pub expression: Option<Box<Expression>>,
13590 #[serde(default)]
13591 pub include_arrays: Option<Box<Expression>>,
13592 #[serde(default)]
13593 pub remove_empty: Option<Box<Expression>>,
13594}
13595
13596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13598#[cfg_attr(feature = "bindings", derive(TS))]
13599pub struct JSONValue {
13600 pub this: Box<Expression>,
13601 #[serde(default)]
13602 pub path: Option<Box<Expression>>,
13603 #[serde(default)]
13604 pub returning: Option<Box<Expression>>,
13605 #[serde(default)]
13606 pub on_condition: Option<Box<Expression>>,
13607}
13608
13609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13611#[cfg_attr(feature = "bindings", derive(TS))]
13612pub struct JSONValueArray {
13613 pub this: Box<Expression>,
13614 #[serde(default)]
13615 pub expression: Option<Box<Expression>>,
13616}
13617
13618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13620#[cfg_attr(feature = "bindings", derive(TS))]
13621pub struct JSONRemove {
13622 pub this: Box<Expression>,
13623 #[serde(default)]
13624 pub expressions: Vec<Expression>,
13625}
13626
13627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13629#[cfg_attr(feature = "bindings", derive(TS))]
13630pub struct JSONTable {
13631 pub this: Box<Expression>,
13632 #[serde(default)]
13633 pub schema: Option<Box<Expression>>,
13634 #[serde(default)]
13635 pub path: Option<Box<Expression>>,
13636 #[serde(default)]
13637 pub error_handling: Option<Box<Expression>>,
13638 #[serde(default)]
13639 pub empty_handling: Option<Box<Expression>>,
13640}
13641
13642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13644#[cfg_attr(feature = "bindings", derive(TS))]
13645pub struct JSONType {
13646 pub this: Box<Expression>,
13647 #[serde(default)]
13648 pub expression: Option<Box<Expression>>,
13649}
13650
13651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13653#[cfg_attr(feature = "bindings", derive(TS))]
13654pub struct ObjectInsert {
13655 pub this: Box<Expression>,
13656 #[serde(default)]
13657 pub key: Option<Box<Expression>>,
13658 #[serde(default)]
13659 pub value: Option<Box<Expression>>,
13660 #[serde(default)]
13661 pub update_flag: Option<Box<Expression>>,
13662}
13663
13664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13666#[cfg_attr(feature = "bindings", derive(TS))]
13667pub struct OpenJSONColumnDef {
13668 pub this: Box<Expression>,
13669 pub kind: String,
13670 #[serde(default)]
13671 pub path: Option<Box<Expression>>,
13672 #[serde(default)]
13673 pub as_json: Option<Box<Expression>>,
13674 #[serde(default, skip_serializing_if = "Option::is_none")]
13676 pub data_type: Option<DataType>,
13677}
13678
13679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13681#[cfg_attr(feature = "bindings", derive(TS))]
13682pub struct OpenJSON {
13683 pub this: Box<Expression>,
13684 #[serde(default)]
13685 pub path: Option<Box<Expression>>,
13686 #[serde(default)]
13687 pub expressions: Vec<Expression>,
13688}
13689
13690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13692#[cfg_attr(feature = "bindings", derive(TS))]
13693pub struct JSONBExists {
13694 pub this: Box<Expression>,
13695 #[serde(default)]
13696 pub path: Option<Box<Expression>>,
13697}
13698
13699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13701#[cfg_attr(feature = "bindings", derive(TS))]
13702pub struct JSONCast {
13703 pub this: Box<Expression>,
13704 pub to: DataType,
13705}
13706
13707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13709#[cfg_attr(feature = "bindings", derive(TS))]
13710pub struct JSONExtract {
13711 pub this: Box<Expression>,
13712 pub expression: Box<Expression>,
13713 #[serde(default)]
13714 pub only_json_types: Option<Box<Expression>>,
13715 #[serde(default)]
13716 pub expressions: Vec<Expression>,
13717 #[serde(default)]
13718 pub variant_extract: Option<Box<Expression>>,
13719 #[serde(default)]
13720 pub json_query: Option<Box<Expression>>,
13721 #[serde(default)]
13722 pub option: Option<Box<Expression>>,
13723 #[serde(default)]
13724 pub quote: Option<Box<Expression>>,
13725 #[serde(default)]
13726 pub on_condition: Option<Box<Expression>>,
13727 #[serde(default)]
13728 pub requires_json: Option<Box<Expression>>,
13729}
13730
13731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13733#[cfg_attr(feature = "bindings", derive(TS))]
13734pub struct JSONExtractQuote {
13735 #[serde(default)]
13736 pub option: Option<Box<Expression>>,
13737 #[serde(default)]
13738 pub scalar: Option<Box<Expression>>,
13739}
13740
13741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13743#[cfg_attr(feature = "bindings", derive(TS))]
13744pub struct JSONExtractArray {
13745 pub this: Box<Expression>,
13746 #[serde(default)]
13747 pub expression: Option<Box<Expression>>,
13748}
13749
13750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13752#[cfg_attr(feature = "bindings", derive(TS))]
13753pub struct JSONExtractScalar {
13754 pub this: Box<Expression>,
13755 pub expression: Box<Expression>,
13756 #[serde(default)]
13757 pub only_json_types: Option<Box<Expression>>,
13758 #[serde(default)]
13759 pub expressions: Vec<Expression>,
13760 #[serde(default)]
13761 pub json_type: Option<Box<Expression>>,
13762 #[serde(default)]
13763 pub scalar_only: Option<Box<Expression>>,
13764}
13765
13766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13768#[cfg_attr(feature = "bindings", derive(TS))]
13769pub struct JSONBExtractScalar {
13770 pub this: Box<Expression>,
13771 pub expression: Box<Expression>,
13772 #[serde(default)]
13773 pub json_type: Option<Box<Expression>>,
13774}
13775
13776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13778#[cfg_attr(feature = "bindings", derive(TS))]
13779pub struct JSONFormat {
13780 #[serde(default)]
13781 pub this: Option<Box<Expression>>,
13782 #[serde(default)]
13783 pub options: Vec<Expression>,
13784 #[serde(default)]
13785 pub is_json: Option<Box<Expression>>,
13786 #[serde(default)]
13787 pub to_json: Option<Box<Expression>>,
13788}
13789
13790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13792#[cfg_attr(feature = "bindings", derive(TS))]
13793pub struct JSONArrayAppend {
13794 pub this: Box<Expression>,
13795 #[serde(default)]
13796 pub expressions: Vec<Expression>,
13797}
13798
13799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13801#[cfg_attr(feature = "bindings", derive(TS))]
13802pub struct JSONArrayContains {
13803 pub this: Box<Expression>,
13804 pub expression: Box<Expression>,
13805 #[serde(default)]
13806 pub json_type: Option<Box<Expression>>,
13807}
13808
13809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13811#[cfg_attr(feature = "bindings", derive(TS))]
13812pub struct JSONArrayInsert {
13813 pub this: Box<Expression>,
13814 #[serde(default)]
13815 pub expressions: Vec<Expression>,
13816}
13817
13818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13820#[cfg_attr(feature = "bindings", derive(TS))]
13821pub struct ParseJSON {
13822 pub this: Box<Expression>,
13823 #[serde(default)]
13824 pub expression: Option<Box<Expression>>,
13825 #[serde(default)]
13826 pub safe: Option<Box<Expression>>,
13827}
13828
13829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13831#[cfg_attr(feature = "bindings", derive(TS))]
13832pub struct ParseUrl {
13833 pub this: Box<Expression>,
13834 #[serde(default)]
13835 pub part_to_extract: Option<Box<Expression>>,
13836 #[serde(default)]
13837 pub key: Option<Box<Expression>>,
13838 #[serde(default)]
13839 pub permissive: Option<Box<Expression>>,
13840}
13841
13842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13844#[cfg_attr(feature = "bindings", derive(TS))]
13845pub struct ParseIp {
13846 pub this: Box<Expression>,
13847 #[serde(default)]
13848 pub type_: Option<Box<Expression>>,
13849 #[serde(default)]
13850 pub permissive: Option<Box<Expression>>,
13851}
13852
13853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13855#[cfg_attr(feature = "bindings", derive(TS))]
13856pub struct ParseTime {
13857 pub this: Box<Expression>,
13858 pub format: String,
13859}
13860
13861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13863#[cfg_attr(feature = "bindings", derive(TS))]
13864pub struct ParseDatetime {
13865 pub this: Box<Expression>,
13866 #[serde(default)]
13867 pub format: Option<String>,
13868 #[serde(default)]
13869 pub zone: Option<Box<Expression>>,
13870}
13871
13872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13874#[cfg_attr(feature = "bindings", derive(TS))]
13875pub struct Map {
13876 #[serde(default)]
13877 pub keys: Vec<Expression>,
13878 #[serde(default)]
13879 pub values: Vec<Expression>,
13880}
13881
13882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13884#[cfg_attr(feature = "bindings", derive(TS))]
13885pub struct MapCat {
13886 pub this: Box<Expression>,
13887 pub expression: Box<Expression>,
13888}
13889
13890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13892#[cfg_attr(feature = "bindings", derive(TS))]
13893pub struct MapDelete {
13894 pub this: Box<Expression>,
13895 #[serde(default)]
13896 pub expressions: Vec<Expression>,
13897}
13898
13899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13901#[cfg_attr(feature = "bindings", derive(TS))]
13902pub struct MapInsert {
13903 pub this: Box<Expression>,
13904 #[serde(default)]
13905 pub key: Option<Box<Expression>>,
13906 #[serde(default)]
13907 pub value: Option<Box<Expression>>,
13908 #[serde(default)]
13909 pub update_flag: Option<Box<Expression>>,
13910}
13911
13912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13914#[cfg_attr(feature = "bindings", derive(TS))]
13915pub struct MapPick {
13916 pub this: Box<Expression>,
13917 #[serde(default)]
13918 pub expressions: Vec<Expression>,
13919}
13920
13921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13923#[cfg_attr(feature = "bindings", derive(TS))]
13924pub struct ScopeResolution {
13925 #[serde(default)]
13926 pub this: Option<Box<Expression>>,
13927 pub expression: Box<Expression>,
13928}
13929
13930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13932#[cfg_attr(feature = "bindings", derive(TS))]
13933pub struct Slice {
13934 #[serde(default)]
13935 pub this: Option<Box<Expression>>,
13936 #[serde(default)]
13937 pub expression: Option<Box<Expression>>,
13938 #[serde(default)]
13939 pub step: Option<Box<Expression>>,
13940}
13941
13942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13944#[cfg_attr(feature = "bindings", derive(TS))]
13945pub struct VarMap {
13946 #[serde(default)]
13947 pub keys: Vec<Expression>,
13948 #[serde(default)]
13949 pub values: Vec<Expression>,
13950}
13951
13952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13954#[cfg_attr(feature = "bindings", derive(TS))]
13955pub struct MatchAgainst {
13956 pub this: Box<Expression>,
13957 #[serde(default)]
13958 pub expressions: Vec<Expression>,
13959 #[serde(default)]
13960 pub modifier: Option<Box<Expression>>,
13961}
13962
13963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13965#[cfg_attr(feature = "bindings", derive(TS))]
13966pub struct MD5Digest {
13967 pub this: Box<Expression>,
13968 #[serde(default)]
13969 pub expressions: Vec<Expression>,
13970}
13971
13972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13974#[cfg_attr(feature = "bindings", derive(TS))]
13975pub struct Monthname {
13976 pub this: Box<Expression>,
13977 #[serde(default)]
13978 pub abbreviated: Option<Box<Expression>>,
13979}
13980
13981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13983#[cfg_attr(feature = "bindings", derive(TS))]
13984pub struct Ntile {
13985 #[serde(default)]
13986 pub this: Option<Box<Expression>>,
13987}
13988
13989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13991#[cfg_attr(feature = "bindings", derive(TS))]
13992pub struct Normalize {
13993 pub this: Box<Expression>,
13994 #[serde(default)]
13995 pub form: Option<Box<Expression>>,
13996 #[serde(default)]
13997 pub is_casefold: Option<Box<Expression>>,
13998}
13999
14000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14002#[cfg_attr(feature = "bindings", derive(TS))]
14003pub struct Normal {
14004 pub this: Box<Expression>,
14005 #[serde(default)]
14006 pub stddev: Option<Box<Expression>>,
14007 #[serde(default)]
14008 pub gen: Option<Box<Expression>>,
14009}
14010
14011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14013#[cfg_attr(feature = "bindings", derive(TS))]
14014pub struct Predict {
14015 pub this: Box<Expression>,
14016 pub expression: Box<Expression>,
14017 #[serde(default)]
14018 pub params_struct: Option<Box<Expression>>,
14019}
14020
14021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14023#[cfg_attr(feature = "bindings", derive(TS))]
14024pub struct MLTranslate {
14025 pub this: Box<Expression>,
14026 pub expression: Box<Expression>,
14027 #[serde(default)]
14028 pub params_struct: Option<Box<Expression>>,
14029}
14030
14031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14033#[cfg_attr(feature = "bindings", derive(TS))]
14034pub struct FeaturesAtTime {
14035 pub this: Box<Expression>,
14036 #[serde(default)]
14037 pub time: Option<Box<Expression>>,
14038 #[serde(default)]
14039 pub num_rows: Option<Box<Expression>>,
14040 #[serde(default)]
14041 pub ignore_feature_nulls: Option<Box<Expression>>,
14042}
14043
14044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14046#[cfg_attr(feature = "bindings", derive(TS))]
14047pub struct GenerateEmbedding {
14048 pub this: Box<Expression>,
14049 pub expression: Box<Expression>,
14050 #[serde(default)]
14051 pub params_struct: Option<Box<Expression>>,
14052 #[serde(default)]
14053 pub is_text: Option<Box<Expression>>,
14054}
14055
14056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14058#[cfg_attr(feature = "bindings", derive(TS))]
14059pub struct MLForecast {
14060 pub this: Box<Expression>,
14061 #[serde(default)]
14062 pub expression: Option<Box<Expression>>,
14063 #[serde(default)]
14064 pub params_struct: Option<Box<Expression>>,
14065}
14066
14067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14069#[cfg_attr(feature = "bindings", derive(TS))]
14070pub struct ModelAttribute {
14071 pub this: Box<Expression>,
14072 pub expression: Box<Expression>,
14073}
14074
14075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14077#[cfg_attr(feature = "bindings", derive(TS))]
14078pub struct VectorSearch {
14079 pub this: Box<Expression>,
14080 #[serde(default)]
14081 pub column_to_search: Option<Box<Expression>>,
14082 #[serde(default)]
14083 pub query_table: Option<Box<Expression>>,
14084 #[serde(default)]
14085 pub query_column_to_search: Option<Box<Expression>>,
14086 #[serde(default)]
14087 pub top_k: Option<Box<Expression>>,
14088 #[serde(default)]
14089 pub distance_type: Option<Box<Expression>>,
14090 #[serde(default)]
14091 pub options: Vec<Expression>,
14092}
14093
14094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14096#[cfg_attr(feature = "bindings", derive(TS))]
14097pub struct Quantile {
14098 pub this: Box<Expression>,
14099 #[serde(default)]
14100 pub quantile: Option<Box<Expression>>,
14101}
14102
14103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14105#[cfg_attr(feature = "bindings", derive(TS))]
14106pub struct ApproxQuantile {
14107 pub this: Box<Expression>,
14108 #[serde(default)]
14109 pub quantile: Option<Box<Expression>>,
14110 #[serde(default)]
14111 pub accuracy: Option<Box<Expression>>,
14112 #[serde(default)]
14113 pub weight: Option<Box<Expression>>,
14114 #[serde(default)]
14115 pub error_tolerance: Option<Box<Expression>>,
14116}
14117
14118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14120#[cfg_attr(feature = "bindings", derive(TS))]
14121pub struct ApproxPercentileEstimate {
14122 pub this: Box<Expression>,
14123 #[serde(default)]
14124 pub percentile: Option<Box<Expression>>,
14125}
14126
14127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14129#[cfg_attr(feature = "bindings", derive(TS))]
14130pub struct Randn {
14131 #[serde(default)]
14132 pub this: Option<Box<Expression>>,
14133}
14134
14135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14137#[cfg_attr(feature = "bindings", derive(TS))]
14138pub struct Randstr {
14139 pub this: Box<Expression>,
14140 #[serde(default)]
14141 pub generator: Option<Box<Expression>>,
14142}
14143
14144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14146#[cfg_attr(feature = "bindings", derive(TS))]
14147pub struct RangeN {
14148 pub this: Box<Expression>,
14149 #[serde(default)]
14150 pub expressions: Vec<Expression>,
14151 #[serde(default)]
14152 pub each: Option<Box<Expression>>,
14153}
14154
14155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14157#[cfg_attr(feature = "bindings", derive(TS))]
14158pub struct RangeBucket {
14159 pub this: Box<Expression>,
14160 pub expression: Box<Expression>,
14161}
14162
14163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14165#[cfg_attr(feature = "bindings", derive(TS))]
14166pub struct ReadCSV {
14167 pub this: Box<Expression>,
14168 #[serde(default)]
14169 pub expressions: Vec<Expression>,
14170}
14171
14172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14174#[cfg_attr(feature = "bindings", derive(TS))]
14175pub struct ReadParquet {
14176 #[serde(default)]
14177 pub expressions: Vec<Expression>,
14178}
14179
14180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14182#[cfg_attr(feature = "bindings", derive(TS))]
14183pub struct Reduce {
14184 pub this: Box<Expression>,
14185 #[serde(default)]
14186 pub initial: Option<Box<Expression>>,
14187 #[serde(default)]
14188 pub merge: Option<Box<Expression>>,
14189 #[serde(default)]
14190 pub finish: Option<Box<Expression>>,
14191}
14192
14193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14195#[cfg_attr(feature = "bindings", derive(TS))]
14196pub struct RegexpExtractAll {
14197 pub this: Box<Expression>,
14198 pub expression: Box<Expression>,
14199 #[serde(default)]
14200 pub group: Option<Box<Expression>>,
14201 #[serde(default)]
14202 pub parameters: Option<Box<Expression>>,
14203 #[serde(default)]
14204 pub position: Option<Box<Expression>>,
14205 #[serde(default)]
14206 pub occurrence: Option<Box<Expression>>,
14207}
14208
14209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14211#[cfg_attr(feature = "bindings", derive(TS))]
14212pub struct RegexpILike {
14213 pub this: Box<Expression>,
14214 pub expression: Box<Expression>,
14215 #[serde(default)]
14216 pub flag: Option<Box<Expression>>,
14217}
14218
14219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14221#[cfg_attr(feature = "bindings", derive(TS))]
14222pub struct RegexpFullMatch {
14223 pub this: Box<Expression>,
14224 pub expression: Box<Expression>,
14225 #[serde(default)]
14226 pub options: Vec<Expression>,
14227}
14228
14229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14231#[cfg_attr(feature = "bindings", derive(TS))]
14232pub struct RegexpInstr {
14233 pub this: Box<Expression>,
14234 pub expression: Box<Expression>,
14235 #[serde(default)]
14236 pub position: Option<Box<Expression>>,
14237 #[serde(default)]
14238 pub occurrence: Option<Box<Expression>>,
14239 #[serde(default)]
14240 pub option: Option<Box<Expression>>,
14241 #[serde(default)]
14242 pub parameters: Option<Box<Expression>>,
14243 #[serde(default)]
14244 pub group: Option<Box<Expression>>,
14245}
14246
14247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14249#[cfg_attr(feature = "bindings", derive(TS))]
14250pub struct RegexpSplit {
14251 pub this: Box<Expression>,
14252 pub expression: Box<Expression>,
14253 #[serde(default)]
14254 pub limit: Option<Box<Expression>>,
14255}
14256
14257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14259#[cfg_attr(feature = "bindings", derive(TS))]
14260pub struct RegexpCount {
14261 pub this: Box<Expression>,
14262 pub expression: Box<Expression>,
14263 #[serde(default)]
14264 pub position: Option<Box<Expression>>,
14265 #[serde(default)]
14266 pub parameters: Option<Box<Expression>>,
14267}
14268
14269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14271#[cfg_attr(feature = "bindings", derive(TS))]
14272pub struct RegrValx {
14273 pub this: Box<Expression>,
14274 pub expression: Box<Expression>,
14275}
14276
14277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14279#[cfg_attr(feature = "bindings", derive(TS))]
14280pub struct RegrValy {
14281 pub this: Box<Expression>,
14282 pub expression: Box<Expression>,
14283}
14284
14285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14287#[cfg_attr(feature = "bindings", derive(TS))]
14288pub struct RegrAvgy {
14289 pub this: Box<Expression>,
14290 pub expression: Box<Expression>,
14291}
14292
14293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14295#[cfg_attr(feature = "bindings", derive(TS))]
14296pub struct RegrAvgx {
14297 pub this: Box<Expression>,
14298 pub expression: Box<Expression>,
14299}
14300
14301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14303#[cfg_attr(feature = "bindings", derive(TS))]
14304pub struct RegrCount {
14305 pub this: Box<Expression>,
14306 pub expression: Box<Expression>,
14307}
14308
14309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14311#[cfg_attr(feature = "bindings", derive(TS))]
14312pub struct RegrIntercept {
14313 pub this: Box<Expression>,
14314 pub expression: Box<Expression>,
14315}
14316
14317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14319#[cfg_attr(feature = "bindings", derive(TS))]
14320pub struct RegrR2 {
14321 pub this: Box<Expression>,
14322 pub expression: Box<Expression>,
14323}
14324
14325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14327#[cfg_attr(feature = "bindings", derive(TS))]
14328pub struct RegrSxx {
14329 pub this: Box<Expression>,
14330 pub expression: Box<Expression>,
14331}
14332
14333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14335#[cfg_attr(feature = "bindings", derive(TS))]
14336pub struct RegrSxy {
14337 pub this: Box<Expression>,
14338 pub expression: Box<Expression>,
14339}
14340
14341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14343#[cfg_attr(feature = "bindings", derive(TS))]
14344pub struct RegrSyy {
14345 pub this: Box<Expression>,
14346 pub expression: Box<Expression>,
14347}
14348
14349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14351#[cfg_attr(feature = "bindings", derive(TS))]
14352pub struct RegrSlope {
14353 pub this: Box<Expression>,
14354 pub expression: Box<Expression>,
14355}
14356
14357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14359#[cfg_attr(feature = "bindings", derive(TS))]
14360pub struct SafeAdd {
14361 pub this: Box<Expression>,
14362 pub expression: Box<Expression>,
14363}
14364
14365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14367#[cfg_attr(feature = "bindings", derive(TS))]
14368pub struct SafeDivide {
14369 pub this: Box<Expression>,
14370 pub expression: Box<Expression>,
14371}
14372
14373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14375#[cfg_attr(feature = "bindings", derive(TS))]
14376pub struct SafeMultiply {
14377 pub this: Box<Expression>,
14378 pub expression: Box<Expression>,
14379}
14380
14381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14383#[cfg_attr(feature = "bindings", derive(TS))]
14384pub struct SafeSubtract {
14385 pub this: Box<Expression>,
14386 pub expression: Box<Expression>,
14387}
14388
14389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14391#[cfg_attr(feature = "bindings", derive(TS))]
14392pub struct SHA2 {
14393 pub this: Box<Expression>,
14394 #[serde(default)]
14395 pub length: Option<i64>,
14396}
14397
14398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14400#[cfg_attr(feature = "bindings", derive(TS))]
14401pub struct SHA2Digest {
14402 pub this: Box<Expression>,
14403 #[serde(default)]
14404 pub length: Option<i64>,
14405}
14406
14407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14409#[cfg_attr(feature = "bindings", derive(TS))]
14410pub struct SortArray {
14411 pub this: Box<Expression>,
14412 #[serde(default)]
14413 pub asc: Option<Box<Expression>>,
14414 #[serde(default)]
14415 pub nulls_first: Option<Box<Expression>>,
14416}
14417
14418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14420#[cfg_attr(feature = "bindings", derive(TS))]
14421pub struct SplitPart {
14422 pub this: Box<Expression>,
14423 #[serde(default)]
14424 pub delimiter: Option<Box<Expression>>,
14425 #[serde(default)]
14426 pub part_index: Option<Box<Expression>>,
14427}
14428
14429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14431#[cfg_attr(feature = "bindings", derive(TS))]
14432pub struct SubstringIndex {
14433 pub this: Box<Expression>,
14434 #[serde(default)]
14435 pub delimiter: Option<Box<Expression>>,
14436 #[serde(default)]
14437 pub count: Option<Box<Expression>>,
14438}
14439
14440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14442#[cfg_attr(feature = "bindings", derive(TS))]
14443pub struct StandardHash {
14444 pub this: Box<Expression>,
14445 #[serde(default)]
14446 pub expression: Option<Box<Expression>>,
14447}
14448
14449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14451#[cfg_attr(feature = "bindings", derive(TS))]
14452pub struct StrPosition {
14453 pub this: Box<Expression>,
14454 #[serde(default)]
14455 pub substr: Option<Box<Expression>>,
14456 #[serde(default)]
14457 pub position: Option<Box<Expression>>,
14458 #[serde(default)]
14459 pub occurrence: Option<Box<Expression>>,
14460}
14461
14462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14464#[cfg_attr(feature = "bindings", derive(TS))]
14465pub struct Search {
14466 pub this: Box<Expression>,
14467 pub expression: Box<Expression>,
14468 #[serde(default)]
14469 pub json_scope: Option<Box<Expression>>,
14470 #[serde(default)]
14471 pub analyzer: Option<Box<Expression>>,
14472 #[serde(default)]
14473 pub analyzer_options: Option<Box<Expression>>,
14474 #[serde(default)]
14475 pub search_mode: Option<Box<Expression>>,
14476}
14477
14478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14480#[cfg_attr(feature = "bindings", derive(TS))]
14481pub struct SearchIp {
14482 pub this: Box<Expression>,
14483 pub expression: Box<Expression>,
14484}
14485
14486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14488#[cfg_attr(feature = "bindings", derive(TS))]
14489pub struct StrToDate {
14490 pub this: Box<Expression>,
14491 #[serde(default)]
14492 pub format: Option<String>,
14493 #[serde(default)]
14494 pub safe: Option<Box<Expression>>,
14495}
14496
14497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14499#[cfg_attr(feature = "bindings", derive(TS))]
14500pub struct StrToTime {
14501 pub this: Box<Expression>,
14502 pub format: String,
14503 #[serde(default)]
14504 pub zone: Option<Box<Expression>>,
14505 #[serde(default)]
14506 pub safe: Option<Box<Expression>>,
14507 #[serde(default)]
14508 pub target_type: Option<Box<Expression>>,
14509}
14510
14511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14513#[cfg_attr(feature = "bindings", derive(TS))]
14514pub struct StrToUnix {
14515 #[serde(default)]
14516 pub this: Option<Box<Expression>>,
14517 #[serde(default)]
14518 pub format: Option<String>,
14519}
14520
14521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14523#[cfg_attr(feature = "bindings", derive(TS))]
14524pub struct StrToMap {
14525 pub this: Box<Expression>,
14526 #[serde(default)]
14527 pub pair_delim: Option<Box<Expression>>,
14528 #[serde(default)]
14529 pub key_value_delim: Option<Box<Expression>>,
14530 #[serde(default)]
14531 pub duplicate_resolution_callback: Option<Box<Expression>>,
14532}
14533
14534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14536#[cfg_attr(feature = "bindings", derive(TS))]
14537pub struct NumberToStr {
14538 pub this: Box<Expression>,
14539 pub format: String,
14540 #[serde(default)]
14541 pub culture: Option<Box<Expression>>,
14542}
14543
14544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14546#[cfg_attr(feature = "bindings", derive(TS))]
14547pub struct FromBase {
14548 pub this: Box<Expression>,
14549 pub expression: Box<Expression>,
14550}
14551
14552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14554#[cfg_attr(feature = "bindings", derive(TS))]
14555pub struct Stuff {
14556 pub this: Box<Expression>,
14557 #[serde(default)]
14558 pub start: Option<Box<Expression>>,
14559 #[serde(default)]
14560 pub length: Option<i64>,
14561 pub expression: Box<Expression>,
14562}
14563
14564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14566#[cfg_attr(feature = "bindings", derive(TS))]
14567pub struct TimeToStr {
14568 pub this: Box<Expression>,
14569 pub format: String,
14570 #[serde(default)]
14571 pub culture: Option<Box<Expression>>,
14572 #[serde(default)]
14573 pub zone: Option<Box<Expression>>,
14574}
14575
14576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14578#[cfg_attr(feature = "bindings", derive(TS))]
14579pub struct TimeStrToTime {
14580 pub this: Box<Expression>,
14581 #[serde(default)]
14582 pub zone: Option<Box<Expression>>,
14583}
14584
14585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14587#[cfg_attr(feature = "bindings", derive(TS))]
14588pub struct TsOrDsAdd {
14589 pub this: Box<Expression>,
14590 pub expression: Box<Expression>,
14591 #[serde(default)]
14592 pub unit: Option<String>,
14593 #[serde(default)]
14594 pub return_type: Option<Box<Expression>>,
14595}
14596
14597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14599#[cfg_attr(feature = "bindings", derive(TS))]
14600pub struct TsOrDsDiff {
14601 pub this: Box<Expression>,
14602 pub expression: Box<Expression>,
14603 #[serde(default)]
14604 pub unit: Option<String>,
14605}
14606
14607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14609#[cfg_attr(feature = "bindings", derive(TS))]
14610pub struct TsOrDsToDate {
14611 pub this: Box<Expression>,
14612 #[serde(default)]
14613 pub format: Option<String>,
14614 #[serde(default)]
14615 pub safe: Option<Box<Expression>>,
14616}
14617
14618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14620#[cfg_attr(feature = "bindings", derive(TS))]
14621pub struct TsOrDsToTime {
14622 pub this: Box<Expression>,
14623 #[serde(default)]
14624 pub format: Option<String>,
14625 #[serde(default)]
14626 pub safe: Option<Box<Expression>>,
14627}
14628
14629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14631#[cfg_attr(feature = "bindings", derive(TS))]
14632pub struct Unhex {
14633 pub this: Box<Expression>,
14634 #[serde(default)]
14635 pub expression: Option<Box<Expression>>,
14636}
14637
14638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14640#[cfg_attr(feature = "bindings", derive(TS))]
14641pub struct Uniform {
14642 pub this: Box<Expression>,
14643 pub expression: Box<Expression>,
14644 #[serde(default)]
14645 pub gen: Option<Box<Expression>>,
14646 #[serde(default)]
14647 pub seed: Option<Box<Expression>>,
14648}
14649
14650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14652#[cfg_attr(feature = "bindings", derive(TS))]
14653pub struct UnixToStr {
14654 pub this: Box<Expression>,
14655 #[serde(default)]
14656 pub format: Option<String>,
14657}
14658
14659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14661#[cfg_attr(feature = "bindings", derive(TS))]
14662pub struct UnixToTime {
14663 pub this: Box<Expression>,
14664 #[serde(default)]
14665 pub scale: Option<i64>,
14666 #[serde(default)]
14667 pub zone: Option<Box<Expression>>,
14668 #[serde(default)]
14669 pub hours: Option<Box<Expression>>,
14670 #[serde(default)]
14671 pub minutes: Option<Box<Expression>>,
14672 #[serde(default)]
14673 pub format: Option<String>,
14674 #[serde(default)]
14675 pub target_type: Option<Box<Expression>>,
14676}
14677
14678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14680#[cfg_attr(feature = "bindings", derive(TS))]
14681pub struct Uuid {
14682 #[serde(default)]
14683 pub this: Option<Box<Expression>>,
14684 #[serde(default)]
14685 pub name: Option<String>,
14686 #[serde(default)]
14687 pub is_string: Option<Box<Expression>>,
14688}
14689
14690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14692#[cfg_attr(feature = "bindings", derive(TS))]
14693pub struct TimestampFromParts {
14694 #[serde(default)]
14695 pub zone: Option<Box<Expression>>,
14696 #[serde(default)]
14697 pub milli: Option<Box<Expression>>,
14698 #[serde(default)]
14699 pub this: Option<Box<Expression>>,
14700 #[serde(default)]
14701 pub expression: Option<Box<Expression>>,
14702}
14703
14704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14706#[cfg_attr(feature = "bindings", derive(TS))]
14707pub struct TimestampTzFromParts {
14708 #[serde(default)]
14709 pub zone: Option<Box<Expression>>,
14710}
14711
14712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14714#[cfg_attr(feature = "bindings", derive(TS))]
14715pub struct Corr {
14716 pub this: Box<Expression>,
14717 pub expression: Box<Expression>,
14718 #[serde(default)]
14719 pub null_on_zero_variance: Option<Box<Expression>>,
14720}
14721
14722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14724#[cfg_attr(feature = "bindings", derive(TS))]
14725pub struct WidthBucket {
14726 pub this: Box<Expression>,
14727 #[serde(default)]
14728 pub min_value: Option<Box<Expression>>,
14729 #[serde(default)]
14730 pub max_value: Option<Box<Expression>>,
14731 #[serde(default)]
14732 pub num_buckets: Option<Box<Expression>>,
14733 #[serde(default)]
14734 pub threshold: Option<Box<Expression>>,
14735}
14736
14737#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14739#[cfg_attr(feature = "bindings", derive(TS))]
14740pub struct CovarSamp {
14741 pub this: Box<Expression>,
14742 pub expression: Box<Expression>,
14743}
14744
14745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14747#[cfg_attr(feature = "bindings", derive(TS))]
14748pub struct CovarPop {
14749 pub this: Box<Expression>,
14750 pub expression: Box<Expression>,
14751}
14752
14753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14755#[cfg_attr(feature = "bindings", derive(TS))]
14756pub struct Week {
14757 pub this: Box<Expression>,
14758 #[serde(default)]
14759 pub mode: Option<Box<Expression>>,
14760}
14761
14762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14764#[cfg_attr(feature = "bindings", derive(TS))]
14765pub struct XMLElement {
14766 pub this: Box<Expression>,
14767 #[serde(default)]
14768 pub expressions: Vec<Expression>,
14769 #[serde(default)]
14770 pub evalname: Option<Box<Expression>>,
14771}
14772
14773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14775#[cfg_attr(feature = "bindings", derive(TS))]
14776pub struct XMLGet {
14777 pub this: Box<Expression>,
14778 pub expression: Box<Expression>,
14779 #[serde(default)]
14780 pub instance: Option<Box<Expression>>,
14781}
14782
14783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14785#[cfg_attr(feature = "bindings", derive(TS))]
14786pub struct XMLTable {
14787 pub this: Box<Expression>,
14788 #[serde(default)]
14789 pub namespaces: Option<Box<Expression>>,
14790 #[serde(default)]
14791 pub passing: Option<Box<Expression>>,
14792 #[serde(default)]
14793 pub columns: Vec<Expression>,
14794 #[serde(default)]
14795 pub by_ref: Option<Box<Expression>>,
14796}
14797
14798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14800#[cfg_attr(feature = "bindings", derive(TS))]
14801pub struct XMLKeyValueOption {
14802 pub this: Box<Expression>,
14803 #[serde(default)]
14804 pub expression: Option<Box<Expression>>,
14805}
14806
14807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14809#[cfg_attr(feature = "bindings", derive(TS))]
14810pub struct Zipf {
14811 pub this: Box<Expression>,
14812 #[serde(default)]
14813 pub elementcount: Option<Box<Expression>>,
14814 #[serde(default)]
14815 pub gen: Option<Box<Expression>>,
14816}
14817
14818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14820#[cfg_attr(feature = "bindings", derive(TS))]
14821pub struct Merge {
14822 pub this: Box<Expression>,
14823 pub using: Box<Expression>,
14824 #[serde(default)]
14825 pub on: Option<Box<Expression>>,
14826 #[serde(default)]
14827 pub using_cond: Option<Box<Expression>>,
14828 #[serde(default)]
14829 pub whens: Option<Box<Expression>>,
14830 #[serde(default)]
14831 pub with_: Option<Box<Expression>>,
14832 #[serde(default)]
14833 pub returning: Option<Box<Expression>>,
14834}
14835
14836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14838#[cfg_attr(feature = "bindings", derive(TS))]
14839pub struct When {
14840 #[serde(default)]
14841 pub matched: Option<Box<Expression>>,
14842 #[serde(default)]
14843 pub source: Option<Box<Expression>>,
14844 #[serde(default)]
14845 pub condition: Option<Box<Expression>>,
14846 pub then: Box<Expression>,
14847}
14848
14849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14851#[cfg_attr(feature = "bindings", derive(TS))]
14852pub struct Whens {
14853 #[serde(default)]
14854 pub expressions: Vec<Expression>,
14855}
14856
14857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14859#[cfg_attr(feature = "bindings", derive(TS))]
14860pub struct NextValueFor {
14861 pub this: Box<Expression>,
14862 #[serde(default)]
14863 pub order: Option<Box<Expression>>,
14864}
14865
14866#[cfg(test)]
14867mod tests {
14868 use super::*;
14869
14870 #[test]
14871 #[cfg(feature = "bindings")]
14872 fn export_typescript_types() {
14873 Expression::export_all(&ts_rs::Config::default())
14876 .expect("Failed to export Expression types");
14877 }
14878
14879 #[test]
14880 fn test_simple_select_builder() {
14881 let select = Select::new()
14882 .column(Expression::star())
14883 .from(Expression::Table(Box::new(TableRef::new("users"))));
14884
14885 assert_eq!(select.expressions.len(), 1);
14886 assert!(select.from.is_some());
14887 }
14888
14889 #[test]
14890 fn test_expression_alias() {
14891 let expr = Expression::column("id").alias("user_id");
14892
14893 match expr {
14894 Expression::Alias(a) => {
14895 assert_eq!(a.alias.name, "user_id");
14896 }
14897 _ => panic!("Expected Alias"),
14898 }
14899 }
14900
14901 #[test]
14902 fn test_literal_creation() {
14903 let num = Expression::number(42);
14904 let str = Expression::string("hello");
14905
14906 match num {
14907 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14908 let Literal::Number(n) = lit.as_ref() else {
14909 unreachable!()
14910 };
14911 assert_eq!(n, "42")
14912 }
14913 _ => panic!("Expected Number"),
14914 }
14915
14916 match str {
14917 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
14918 let Literal::String(s) = lit.as_ref() else {
14919 unreachable!()
14920 };
14921 assert_eq!(s, "hello")
14922 }
14923 _ => panic!("Expected String"),
14924 }
14925 }
14926
14927 #[test]
14928 fn test_expression_sql() {
14929 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14930 assert_eq!(expr.sql(), "SELECT 1 + 2");
14931 }
14932
14933 #[test]
14934 fn test_expression_sql_for() {
14935 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14936 let sql = expr.sql_for(crate::DialectType::Generic);
14937 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
14939 }
14940}