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 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7351 pub with_partition_columns: Vec<ColumnDef>,
7352 #[serde(default, skip_serializing_if = "Option::is_none")]
7355 pub with_connection: Option<TableRef>,
7356}
7357
7358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7360#[cfg_attr(feature = "bindings", derive(TS))]
7361pub struct TeradataIndex {
7362 pub kind: TeradataIndexKind,
7364 pub name: Option<String>,
7366 pub columns: Vec<String>,
7368}
7369
7370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7372#[cfg_attr(feature = "bindings", derive(TS))]
7373pub enum TeradataIndexKind {
7374 NoPrimary,
7376 Primary,
7378 PrimaryAmp,
7380 Unique,
7382 UniquePrimary,
7384 Secondary,
7386}
7387
7388impl CreateTable {
7389 pub fn new(name: impl Into<String>) -> Self {
7390 Self {
7391 name: TableRef::new(name),
7392 on_cluster: None,
7393 columns: Vec::new(),
7394 constraints: Vec::new(),
7395 if_not_exists: false,
7396 temporary: false,
7397 or_replace: false,
7398 table_modifier: None,
7399 as_select: None,
7400 as_select_parenthesized: false,
7401 on_commit: None,
7402 clone_source: None,
7403 clone_at_clause: None,
7404 shallow_clone: false,
7405 is_copy: false,
7406 leading_comments: Vec::new(),
7407 with_properties: Vec::new(),
7408 teradata_post_name_options: Vec::new(),
7409 with_data: None,
7410 with_statistics: None,
7411 teradata_indexes: Vec::new(),
7412 with_cte: None,
7413 properties: Vec::new(),
7414 partition_of: None,
7415 post_table_properties: Vec::new(),
7416 mysql_table_options: Vec::new(),
7417 inherits: Vec::new(),
7418 on_property: None,
7419 copy_grants: false,
7420 using_template: None,
7421 rollup: None,
7422 uuid: None,
7423 with_partition_columns: Vec::new(),
7424 with_connection: None,
7425 }
7426 }
7427}
7428
7429#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7431#[cfg_attr(feature = "bindings", derive(TS))]
7432pub enum SortOrder {
7433 Asc,
7434 Desc,
7435}
7436
7437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7439#[cfg_attr(feature = "bindings", derive(TS))]
7440pub enum ConstraintType {
7441 NotNull,
7442 Null,
7443 PrimaryKey,
7444 Unique,
7445 Default,
7446 AutoIncrement,
7447 Collate,
7448 Comment,
7449 References,
7450 Check,
7451 GeneratedAsIdentity,
7452 Tags,
7454 ComputedColumn,
7456 GeneratedAsRow,
7458 OnUpdate,
7460 Path,
7462 Encode,
7464}
7465
7466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7468#[cfg_attr(feature = "bindings", derive(TS))]
7469pub struct ColumnDef {
7470 pub name: Identifier,
7471 pub data_type: DataType,
7472 pub nullable: Option<bool>,
7473 pub default: Option<Expression>,
7474 pub primary_key: bool,
7475 #[serde(default)]
7477 pub primary_key_order: Option<SortOrder>,
7478 pub unique: bool,
7479 #[serde(default)]
7481 pub unique_nulls_not_distinct: bool,
7482 pub auto_increment: bool,
7483 pub comment: Option<String>,
7484 pub constraints: Vec<ColumnConstraint>,
7485 #[serde(default)]
7487 pub constraint_order: Vec<ConstraintType>,
7488 #[serde(default)]
7490 pub format: Option<String>,
7491 #[serde(default)]
7493 pub title: Option<String>,
7494 #[serde(default)]
7496 pub inline_length: Option<u64>,
7497 #[serde(default)]
7499 pub compress: Option<Vec<Expression>>,
7500 #[serde(default)]
7502 pub character_set: Option<String>,
7503 #[serde(default)]
7505 pub uppercase: bool,
7506 #[serde(default)]
7508 pub casespecific: Option<bool>,
7509 #[serde(default)]
7511 pub auto_increment_start: Option<Box<Expression>>,
7512 #[serde(default)]
7514 pub auto_increment_increment: Option<Box<Expression>>,
7515 #[serde(default)]
7517 pub auto_increment_order: Option<bool>,
7518 #[serde(default)]
7520 pub unsigned: bool,
7521 #[serde(default)]
7523 pub zerofill: bool,
7524 #[serde(default, skip_serializing_if = "Option::is_none")]
7526 pub on_update: Option<Expression>,
7527 #[serde(default, skip_serializing_if = "Option::is_none")]
7529 pub unique_constraint_name: Option<String>,
7530 #[serde(default, skip_serializing_if = "Option::is_none")]
7532 pub not_null_constraint_name: Option<String>,
7533 #[serde(default, skip_serializing_if = "Option::is_none")]
7535 pub primary_key_constraint_name: Option<String>,
7536 #[serde(default, skip_serializing_if = "Option::is_none")]
7538 pub check_constraint_name: Option<String>,
7539 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7541 pub options: Vec<Expression>,
7542 #[serde(default)]
7544 pub no_type: bool,
7545 #[serde(default, skip_serializing_if = "Option::is_none")]
7547 pub encoding: Option<String>,
7548 #[serde(default, skip_serializing_if = "Option::is_none")]
7550 pub codec: Option<String>,
7551 #[serde(default, skip_serializing_if = "Option::is_none")]
7553 pub ephemeral: Option<Option<Box<Expression>>>,
7554 #[serde(default, skip_serializing_if = "Option::is_none")]
7556 pub materialized_expr: Option<Box<Expression>>,
7557 #[serde(default, skip_serializing_if = "Option::is_none")]
7559 pub alias_expr: Option<Box<Expression>>,
7560 #[serde(default, skip_serializing_if = "Option::is_none")]
7562 pub ttl_expr: Option<Box<Expression>>,
7563 #[serde(default)]
7565 pub not_for_replication: bool,
7566}
7567
7568impl ColumnDef {
7569 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7570 Self {
7571 name: Identifier::new(name),
7572 data_type,
7573 nullable: None,
7574 default: None,
7575 primary_key: false,
7576 primary_key_order: None,
7577 unique: false,
7578 unique_nulls_not_distinct: false,
7579 auto_increment: false,
7580 comment: None,
7581 constraints: Vec::new(),
7582 constraint_order: Vec::new(),
7583 format: None,
7584 title: None,
7585 inline_length: None,
7586 compress: None,
7587 character_set: None,
7588 uppercase: false,
7589 casespecific: None,
7590 auto_increment_start: None,
7591 auto_increment_increment: None,
7592 auto_increment_order: None,
7593 unsigned: false,
7594 zerofill: false,
7595 on_update: None,
7596 unique_constraint_name: None,
7597 not_null_constraint_name: None,
7598 primary_key_constraint_name: None,
7599 check_constraint_name: None,
7600 options: Vec::new(),
7601 no_type: false,
7602 encoding: None,
7603 codec: None,
7604 ephemeral: None,
7605 materialized_expr: None,
7606 alias_expr: None,
7607 ttl_expr: None,
7608 not_for_replication: false,
7609 }
7610 }
7611}
7612
7613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7615#[cfg_attr(feature = "bindings", derive(TS))]
7616pub enum ColumnConstraint {
7617 NotNull,
7618 Null,
7619 Unique,
7620 PrimaryKey,
7621 Default(Expression),
7622 Check(Expression),
7623 References(ForeignKeyRef),
7624 GeneratedAsIdentity(GeneratedAsIdentity),
7625 Collate(Identifier),
7626 Comment(String),
7627 Tags(Tags),
7629 ComputedColumn(ComputedColumn),
7632 GeneratedAsRow(GeneratedAsRow),
7634 Path(Expression),
7636}
7637
7638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7640#[cfg_attr(feature = "bindings", derive(TS))]
7641pub struct ComputedColumn {
7642 pub expression: Box<Expression>,
7644 #[serde(default)]
7646 pub persisted: bool,
7647 #[serde(default)]
7649 pub not_null: bool,
7650 #[serde(default)]
7653 pub persistence_kind: Option<String>,
7654 #[serde(default, skip_serializing_if = "Option::is_none")]
7656 pub data_type: Option<DataType>,
7657}
7658
7659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7661#[cfg_attr(feature = "bindings", derive(TS))]
7662pub struct GeneratedAsRow {
7663 pub start: bool,
7665 #[serde(default)]
7667 pub hidden: bool,
7668}
7669
7670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7672#[cfg_attr(feature = "bindings", derive(TS))]
7673pub struct GeneratedAsIdentity {
7674 pub always: bool,
7676 pub on_null: bool,
7678 pub start: Option<Box<Expression>>,
7680 pub increment: Option<Box<Expression>>,
7682 pub minvalue: Option<Box<Expression>>,
7684 pub maxvalue: Option<Box<Expression>>,
7686 pub cycle: Option<bool>,
7688}
7689
7690#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7692#[cfg_attr(feature = "bindings", derive(TS))]
7693pub struct ConstraintModifiers {
7694 pub enforced: Option<bool>,
7696 pub deferrable: Option<bool>,
7698 pub initially_deferred: Option<bool>,
7700 pub norely: bool,
7702 pub rely: bool,
7704 #[serde(default)]
7706 pub using: Option<String>,
7707 #[serde(default)]
7709 pub using_before_columns: bool,
7710 #[serde(default, skip_serializing_if = "Option::is_none")]
7712 pub comment: Option<String>,
7713 #[serde(default, skip_serializing_if = "Option::is_none")]
7715 pub visible: Option<bool>,
7716 #[serde(default, skip_serializing_if = "Option::is_none")]
7718 pub engine_attribute: Option<String>,
7719 #[serde(default, skip_serializing_if = "Option::is_none")]
7721 pub with_parser: Option<String>,
7722 #[serde(default)]
7724 pub not_valid: bool,
7725 #[serde(default, skip_serializing_if = "Option::is_none")]
7727 pub clustered: Option<String>,
7728 #[serde(default, skip_serializing_if = "Option::is_none")]
7730 pub on_conflict: Option<String>,
7731 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7733 pub with_options: Vec<(String, String)>,
7734 #[serde(default, skip_serializing_if = "Option::is_none")]
7736 pub on_filegroup: Option<Identifier>,
7737}
7738
7739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7741#[cfg_attr(feature = "bindings", derive(TS))]
7742pub enum TableConstraint {
7743 PrimaryKey {
7744 name: Option<Identifier>,
7745 columns: Vec<Identifier>,
7746 #[serde(default)]
7748 include_columns: Vec<Identifier>,
7749 #[serde(default)]
7750 modifiers: ConstraintModifiers,
7751 #[serde(default)]
7753 has_constraint_keyword: bool,
7754 },
7755 Unique {
7756 name: Option<Identifier>,
7757 columns: Vec<Identifier>,
7758 #[serde(default)]
7760 columns_parenthesized: bool,
7761 #[serde(default)]
7762 modifiers: ConstraintModifiers,
7763 #[serde(default)]
7765 has_constraint_keyword: bool,
7766 #[serde(default)]
7768 nulls_not_distinct: bool,
7769 },
7770 ForeignKey {
7771 name: Option<Identifier>,
7772 columns: Vec<Identifier>,
7773 #[serde(default)]
7774 references: Option<ForeignKeyRef>,
7775 #[serde(default)]
7777 on_delete: Option<ReferentialAction>,
7778 #[serde(default)]
7780 on_update: Option<ReferentialAction>,
7781 #[serde(default)]
7782 modifiers: ConstraintModifiers,
7783 },
7784 Check {
7785 name: Option<Identifier>,
7786 expression: Expression,
7787 #[serde(default)]
7788 modifiers: ConstraintModifiers,
7789 },
7790 Assume {
7792 name: Option<Identifier>,
7793 expression: Expression,
7794 },
7795 Default {
7797 name: Option<Identifier>,
7798 expression: Expression,
7799 column: Identifier,
7800 },
7801 Index {
7803 name: Option<Identifier>,
7804 columns: Vec<Identifier>,
7805 #[serde(default)]
7807 kind: Option<String>,
7808 #[serde(default)]
7809 modifiers: ConstraintModifiers,
7810 #[serde(default)]
7812 use_key_keyword: bool,
7813 #[serde(default, skip_serializing_if = "Option::is_none")]
7815 expression: Option<Box<Expression>>,
7816 #[serde(default, skip_serializing_if = "Option::is_none")]
7818 index_type: Option<Box<Expression>>,
7819 #[serde(default, skip_serializing_if = "Option::is_none")]
7821 granularity: Option<Box<Expression>>,
7822 },
7823 Projection {
7825 name: Identifier,
7826 expression: Expression,
7827 },
7828 Like {
7830 source: TableRef,
7831 options: Vec<(LikeOptionAction, String)>,
7833 },
7834 PeriodForSystemTime {
7836 start_col: Identifier,
7837 end_col: Identifier,
7838 },
7839 Exclude {
7842 name: Option<Identifier>,
7843 #[serde(default)]
7845 using: Option<String>,
7846 elements: Vec<ExcludeElement>,
7848 #[serde(default)]
7850 include_columns: Vec<Identifier>,
7851 #[serde(default)]
7853 where_clause: Option<Box<Expression>>,
7854 #[serde(default)]
7856 with_params: Vec<(String, String)>,
7857 #[serde(default)]
7859 using_index_tablespace: Option<String>,
7860 #[serde(default)]
7861 modifiers: ConstraintModifiers,
7862 },
7863 Tags(Tags),
7865 InitiallyDeferred {
7869 deferred: bool,
7871 },
7872}
7873
7874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7876#[cfg_attr(feature = "bindings", derive(TS))]
7877pub struct ExcludeElement {
7878 pub expression: String,
7880 pub operator: String,
7882}
7883
7884#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7886#[cfg_attr(feature = "bindings", derive(TS))]
7887pub enum LikeOptionAction {
7888 Including,
7889 Excluding,
7890}
7891
7892#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7894#[cfg_attr(feature = "bindings", derive(TS))]
7895pub enum MatchType {
7896 Full,
7897 Partial,
7898 Simple,
7899}
7900
7901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7903#[cfg_attr(feature = "bindings", derive(TS))]
7904pub struct ForeignKeyRef {
7905 pub table: TableRef,
7906 pub columns: Vec<Identifier>,
7907 pub on_delete: Option<ReferentialAction>,
7908 pub on_update: Option<ReferentialAction>,
7909 #[serde(default)]
7911 pub on_update_first: bool,
7912 #[serde(default)]
7914 pub match_type: Option<MatchType>,
7915 #[serde(default)]
7917 pub match_after_actions: bool,
7918 #[serde(default)]
7920 pub constraint_name: Option<String>,
7921 #[serde(default)]
7923 pub deferrable: Option<bool>,
7924 #[serde(default)]
7926 pub has_foreign_key_keywords: bool,
7927}
7928
7929#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7931#[cfg_attr(feature = "bindings", derive(TS))]
7932pub enum ReferentialAction {
7933 Cascade,
7934 SetNull,
7935 SetDefault,
7936 Restrict,
7937 NoAction,
7938}
7939
7940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7942#[cfg_attr(feature = "bindings", derive(TS))]
7943pub struct DropTable {
7944 pub names: Vec<TableRef>,
7945 pub if_exists: bool,
7946 pub cascade: bool,
7947 #[serde(default)]
7949 pub cascade_constraints: bool,
7950 #[serde(default)]
7952 pub purge: bool,
7953 #[serde(default)]
7955 pub leading_comments: Vec<String>,
7956 #[serde(default, skip_serializing_if = "Option::is_none")]
7959 pub object_id_args: Option<String>,
7960 #[serde(default)]
7962 pub sync: bool,
7963 #[serde(default)]
7965 pub iceberg: bool,
7966 #[serde(default)]
7968 pub restrict: bool,
7969}
7970
7971impl DropTable {
7972 pub fn new(name: impl Into<String>) -> Self {
7973 Self {
7974 names: vec![TableRef::new(name)],
7975 if_exists: false,
7976 cascade: false,
7977 cascade_constraints: false,
7978 purge: false,
7979 leading_comments: Vec::new(),
7980 object_id_args: None,
7981 sync: false,
7982 iceberg: false,
7983 restrict: false,
7984 }
7985 }
7986}
7987
7988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7990#[cfg_attr(feature = "bindings", derive(TS))]
7991pub struct Undrop {
7992 pub kind: String,
7994 pub name: TableRef,
7996 #[serde(default)]
7998 pub if_exists: bool,
7999}
8000
8001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8003#[cfg_attr(feature = "bindings", derive(TS))]
8004pub struct AlterTable {
8005 pub name: TableRef,
8006 pub actions: Vec<AlterTableAction>,
8007 #[serde(default)]
8009 pub if_exists: bool,
8010 #[serde(default, skip_serializing_if = "Option::is_none")]
8012 pub algorithm: Option<String>,
8013 #[serde(default, skip_serializing_if = "Option::is_none")]
8015 pub lock: Option<String>,
8016 #[serde(default, skip_serializing_if = "Option::is_none")]
8018 pub with_check: Option<String>,
8019 #[serde(default, skip_serializing_if = "Option::is_none")]
8021 pub partition: Option<Vec<(Identifier, Expression)>>,
8022 #[serde(default, skip_serializing_if = "Option::is_none")]
8024 pub on_cluster: Option<OnCluster>,
8025 #[serde(default, skip_serializing_if = "Option::is_none")]
8027 pub table_modifier: Option<String>,
8028}
8029
8030impl AlterTable {
8031 pub fn new(name: impl Into<String>) -> Self {
8032 Self {
8033 name: TableRef::new(name),
8034 actions: Vec::new(),
8035 if_exists: false,
8036 algorithm: None,
8037 lock: None,
8038 with_check: None,
8039 partition: None,
8040 on_cluster: None,
8041 table_modifier: None,
8042 }
8043 }
8044}
8045
8046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8048#[cfg_attr(feature = "bindings", derive(TS))]
8049pub enum ColumnPosition {
8050 First,
8051 After(Identifier),
8052}
8053
8054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8056#[cfg_attr(feature = "bindings", derive(TS))]
8057pub enum AlterTableAction {
8058 AddColumn {
8059 column: ColumnDef,
8060 if_not_exists: bool,
8061 position: Option<ColumnPosition>,
8062 },
8063 DropColumn {
8064 name: Identifier,
8065 if_exists: bool,
8066 cascade: bool,
8067 },
8068 RenameColumn {
8069 old_name: Identifier,
8070 new_name: Identifier,
8071 if_exists: bool,
8072 },
8073 AlterColumn {
8074 name: Identifier,
8075 action: AlterColumnAction,
8076 #[serde(default)]
8078 use_modify_keyword: bool,
8079 },
8080 RenameTable(TableRef),
8081 AddConstraint(TableConstraint),
8082 DropConstraint {
8083 name: Identifier,
8084 if_exists: bool,
8085 },
8086 DropForeignKey {
8088 name: Identifier,
8089 },
8090 DropPartition {
8092 partitions: Vec<Vec<(Identifier, Expression)>>,
8094 if_exists: bool,
8095 },
8096 AddPartition {
8098 partition: Expression,
8100 if_not_exists: bool,
8101 location: Option<Expression>,
8102 },
8103 Delete {
8105 where_clause: Expression,
8106 },
8107 SwapWith(TableRef),
8109 SetProperty {
8111 properties: Vec<(String, Expression)>,
8112 },
8113 UnsetProperty {
8115 properties: Vec<String>,
8116 },
8117 ClusterBy {
8119 expressions: Vec<Expression>,
8120 },
8121 SetTag {
8123 expressions: Vec<(String, Expression)>,
8124 },
8125 UnsetTag {
8127 names: Vec<String>,
8128 },
8129 SetOptions {
8131 expressions: Vec<Expression>,
8132 },
8133 AlterIndex {
8135 name: Identifier,
8136 visible: bool,
8137 },
8138 SetAttribute {
8140 attribute: String,
8141 },
8142 SetStageFileFormat {
8144 options: Option<Expression>,
8145 },
8146 SetStageCopyOptions {
8148 options: Option<Expression>,
8149 },
8150 AddColumns {
8152 columns: Vec<ColumnDef>,
8153 cascade: bool,
8154 },
8155 DropColumns {
8157 names: Vec<Identifier>,
8158 },
8159 ChangeColumn {
8162 old_name: Identifier,
8163 new_name: Identifier,
8164 #[serde(default, skip_serializing_if = "Option::is_none")]
8165 data_type: Option<DataType>,
8166 comment: Option<String>,
8167 #[serde(default)]
8168 cascade: bool,
8169 },
8170 AlterSortKey {
8173 this: Option<String>,
8175 expressions: Vec<Expression>,
8177 compound: bool,
8179 },
8180 AlterDistStyle {
8184 style: String,
8186 distkey: Option<Identifier>,
8188 },
8189 SetTableProperties {
8191 properties: Vec<(Expression, Expression)>,
8192 },
8193 SetLocation {
8195 location: String,
8196 },
8197 SetFileFormat {
8199 format: String,
8200 },
8201 ReplacePartition {
8203 partition: Expression,
8204 source: Option<Box<Expression>>,
8205 },
8206 Raw {
8208 sql: String,
8209 },
8210}
8211
8212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8214#[cfg_attr(feature = "bindings", derive(TS))]
8215pub enum AlterColumnAction {
8216 SetDataType {
8217 data_type: DataType,
8218 using: Option<Expression>,
8220 #[serde(default, skip_serializing_if = "Option::is_none")]
8222 collate: Option<String>,
8223 },
8224 SetDefault(Expression),
8225 DropDefault,
8226 SetNotNull,
8227 DropNotNull,
8228 Comment(String),
8230 SetVisible,
8232 SetInvisible,
8234}
8235
8236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8238#[cfg_attr(feature = "bindings", derive(TS))]
8239pub struct CreateIndex {
8240 pub name: Identifier,
8241 pub table: TableRef,
8242 pub columns: Vec<IndexColumn>,
8243 pub unique: bool,
8244 pub if_not_exists: bool,
8245 pub using: Option<String>,
8246 #[serde(default)]
8248 pub clustered: Option<String>,
8249 #[serde(default)]
8251 pub concurrently: bool,
8252 #[serde(default)]
8254 pub where_clause: Option<Box<Expression>>,
8255 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8257 pub include_columns: Vec<Identifier>,
8258 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8260 pub with_options: Vec<(String, String)>,
8261 #[serde(default)]
8263 pub on_filegroup: Option<String>,
8264}
8265
8266impl CreateIndex {
8267 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8268 Self {
8269 name: Identifier::new(name),
8270 table: TableRef::new(table),
8271 columns: Vec::new(),
8272 unique: false,
8273 if_not_exists: false,
8274 using: None,
8275 clustered: None,
8276 concurrently: false,
8277 where_clause: None,
8278 include_columns: Vec::new(),
8279 with_options: Vec::new(),
8280 on_filegroup: None,
8281 }
8282 }
8283}
8284
8285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8287#[cfg_attr(feature = "bindings", derive(TS))]
8288pub struct IndexColumn {
8289 pub column: Identifier,
8290 pub desc: bool,
8291 #[serde(default)]
8293 pub asc: bool,
8294 pub nulls_first: Option<bool>,
8295 #[serde(default, skip_serializing_if = "Option::is_none")]
8297 pub opclass: Option<String>,
8298}
8299
8300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8302#[cfg_attr(feature = "bindings", derive(TS))]
8303pub struct DropIndex {
8304 pub name: Identifier,
8305 pub table: Option<TableRef>,
8306 pub if_exists: bool,
8307 #[serde(default)]
8309 pub concurrently: bool,
8310}
8311
8312impl DropIndex {
8313 pub fn new(name: impl Into<String>) -> Self {
8314 Self {
8315 name: Identifier::new(name),
8316 table: None,
8317 if_exists: false,
8318 concurrently: false,
8319 }
8320 }
8321}
8322
8323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8325#[cfg_attr(feature = "bindings", derive(TS))]
8326pub struct ViewColumn {
8327 pub name: Identifier,
8328 pub comment: Option<String>,
8329 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8331 pub options: Vec<Expression>,
8332}
8333
8334impl ViewColumn {
8335 pub fn new(name: impl Into<String>) -> Self {
8336 Self {
8337 name: Identifier::new(name),
8338 comment: None,
8339 options: Vec::new(),
8340 }
8341 }
8342
8343 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8344 Self {
8345 name: Identifier::new(name),
8346 comment: Some(comment.into()),
8347 options: Vec::new(),
8348 }
8349 }
8350}
8351
8352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8354#[cfg_attr(feature = "bindings", derive(TS))]
8355pub struct CreateView {
8356 pub name: TableRef,
8357 pub columns: Vec<ViewColumn>,
8358 pub query: Expression,
8359 pub or_replace: bool,
8360 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8362 pub or_alter: bool,
8363 pub if_not_exists: bool,
8364 pub materialized: bool,
8365 pub temporary: bool,
8366 #[serde(default)]
8368 pub secure: bool,
8369 #[serde(skip_serializing_if = "Option::is_none")]
8371 pub algorithm: Option<String>,
8372 #[serde(skip_serializing_if = "Option::is_none")]
8374 pub definer: Option<String>,
8375 #[serde(skip_serializing_if = "Option::is_none")]
8377 pub security: Option<FunctionSecurity>,
8378 #[serde(default = "default_true")]
8380 pub security_sql_style: bool,
8381 #[serde(default)]
8383 pub security_after_name: bool,
8384 #[serde(default)]
8386 pub query_parenthesized: bool,
8387 #[serde(skip_serializing_if = "Option::is_none")]
8389 pub locking_mode: Option<String>,
8390 #[serde(skip_serializing_if = "Option::is_none")]
8392 pub locking_access: Option<String>,
8393 #[serde(default)]
8395 pub copy_grants: bool,
8396 #[serde(skip_serializing_if = "Option::is_none", default)]
8398 pub comment: Option<String>,
8399 #[serde(default)]
8401 pub tags: Vec<(String, String)>,
8402 #[serde(default)]
8404 pub options: Vec<Expression>,
8405 #[serde(skip_serializing_if = "Option::is_none", default)]
8407 pub build: Option<String>,
8408 #[serde(skip_serializing_if = "Option::is_none", default)]
8410 pub refresh: Option<Box<RefreshTriggerProperty>>,
8411 #[serde(skip_serializing_if = "Option::is_none", default)]
8414 pub schema: Option<Box<Schema>>,
8415 #[serde(skip_serializing_if = "Option::is_none", default)]
8417 pub unique_key: Option<Box<UniqueKeyProperty>>,
8418 #[serde(default)]
8420 pub no_schema_binding: bool,
8421 #[serde(skip_serializing_if = "Option::is_none", default)]
8423 pub auto_refresh: Option<bool>,
8424 #[serde(default, skip_serializing_if = "Option::is_none")]
8426 pub on_cluster: Option<OnCluster>,
8427 #[serde(default, skip_serializing_if = "Option::is_none")]
8429 pub to_table: Option<TableRef>,
8430 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8432 pub table_properties: Vec<Expression>,
8433}
8434
8435impl CreateView {
8436 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8437 Self {
8438 name: TableRef::new(name),
8439 columns: Vec::new(),
8440 query,
8441 or_replace: false,
8442 or_alter: false,
8443 if_not_exists: false,
8444 materialized: false,
8445 temporary: false,
8446 secure: false,
8447 algorithm: None,
8448 definer: None,
8449 security: None,
8450 security_sql_style: true,
8451 security_after_name: false,
8452 query_parenthesized: false,
8453 locking_mode: None,
8454 locking_access: None,
8455 copy_grants: false,
8456 comment: None,
8457 tags: Vec::new(),
8458 options: Vec::new(),
8459 build: None,
8460 refresh: None,
8461 schema: None,
8462 unique_key: None,
8463 no_schema_binding: false,
8464 auto_refresh: None,
8465 on_cluster: None,
8466 to_table: None,
8467 table_properties: Vec::new(),
8468 }
8469 }
8470}
8471
8472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8474#[cfg_attr(feature = "bindings", derive(TS))]
8475pub struct DropView {
8476 pub name: TableRef,
8477 pub if_exists: bool,
8478 pub materialized: bool,
8479}
8480
8481impl DropView {
8482 pub fn new(name: impl Into<String>) -> Self {
8483 Self {
8484 name: TableRef::new(name),
8485 if_exists: false,
8486 materialized: false,
8487 }
8488 }
8489}
8490
8491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8493#[cfg_attr(feature = "bindings", derive(TS))]
8494pub struct Truncate {
8495 #[serde(default)]
8497 pub target: TruncateTarget,
8498 #[serde(default)]
8500 pub if_exists: bool,
8501 pub table: TableRef,
8502 #[serde(default, skip_serializing_if = "Option::is_none")]
8504 pub on_cluster: Option<OnCluster>,
8505 pub cascade: bool,
8506 #[serde(default)]
8508 pub extra_tables: Vec<TruncateTableEntry>,
8509 #[serde(default)]
8511 pub identity: Option<TruncateIdentity>,
8512 #[serde(default)]
8514 pub restrict: bool,
8515 #[serde(default, skip_serializing_if = "Option::is_none")]
8517 pub partition: Option<Box<Expression>>,
8518}
8519
8520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8522#[cfg_attr(feature = "bindings", derive(TS))]
8523pub struct TruncateTableEntry {
8524 pub table: TableRef,
8525 #[serde(default)]
8527 pub star: bool,
8528}
8529
8530#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8532#[cfg_attr(feature = "bindings", derive(TS))]
8533pub enum TruncateTarget {
8534 Table,
8535 Database,
8536}
8537
8538impl Default for TruncateTarget {
8539 fn default() -> Self {
8540 TruncateTarget::Table
8541 }
8542}
8543
8544#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8546#[cfg_attr(feature = "bindings", derive(TS))]
8547pub enum TruncateIdentity {
8548 Restart,
8549 Continue,
8550}
8551
8552impl Truncate {
8553 pub fn new(table: impl Into<String>) -> Self {
8554 Self {
8555 target: TruncateTarget::Table,
8556 if_exists: false,
8557 table: TableRef::new(table),
8558 on_cluster: None,
8559 cascade: false,
8560 extra_tables: Vec::new(),
8561 identity: None,
8562 restrict: false,
8563 partition: None,
8564 }
8565 }
8566}
8567
8568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8570#[cfg_attr(feature = "bindings", derive(TS))]
8571pub struct Use {
8572 pub kind: Option<UseKind>,
8574 pub this: Identifier,
8576}
8577
8578#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8580#[cfg_attr(feature = "bindings", derive(TS))]
8581pub enum UseKind {
8582 Database,
8583 Schema,
8584 Role,
8585 Warehouse,
8586 Catalog,
8587 SecondaryRoles,
8589}
8590
8591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8593#[cfg_attr(feature = "bindings", derive(TS))]
8594pub struct SetStatement {
8595 pub items: Vec<SetItem>,
8597}
8598
8599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8601#[cfg_attr(feature = "bindings", derive(TS))]
8602pub struct SetItem {
8603 pub name: Expression,
8605 pub value: Expression,
8607 pub kind: Option<String>,
8609 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8611 pub no_equals: bool,
8612}
8613
8614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8616#[cfg_attr(feature = "bindings", derive(TS))]
8617pub struct Cache {
8618 pub table: Identifier,
8620 pub lazy: bool,
8622 pub options: Vec<(Expression, Expression)>,
8624 pub query: Option<Expression>,
8626}
8627
8628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8630#[cfg_attr(feature = "bindings", derive(TS))]
8631pub struct Uncache {
8632 pub table: Identifier,
8634 pub if_exists: bool,
8636}
8637
8638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8640#[cfg_attr(feature = "bindings", derive(TS))]
8641pub struct LoadData {
8642 pub local: bool,
8644 pub inpath: String,
8646 pub overwrite: bool,
8648 pub table: Expression,
8650 pub partition: Vec<(Identifier, Expression)>,
8652 pub input_format: Option<String>,
8654 pub serde: Option<String>,
8656}
8657
8658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8660#[cfg_attr(feature = "bindings", derive(TS))]
8661pub struct Pragma {
8662 pub schema: Option<Identifier>,
8664 pub name: Identifier,
8666 pub value: Option<Expression>,
8668 pub args: Vec<Expression>,
8670}
8671
8672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8675#[cfg_attr(feature = "bindings", derive(TS))]
8676pub struct Privilege {
8677 pub name: String,
8679 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8681 pub columns: Vec<String>,
8682}
8683
8684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8686#[cfg_attr(feature = "bindings", derive(TS))]
8687pub struct GrantPrincipal {
8688 pub name: Identifier,
8690 pub is_role: bool,
8692 #[serde(default)]
8694 pub is_group: bool,
8695 #[serde(default)]
8697 pub is_share: bool,
8698}
8699
8700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8702#[cfg_attr(feature = "bindings", derive(TS))]
8703pub struct Grant {
8704 pub privileges: Vec<Privilege>,
8706 pub kind: Option<String>,
8708 pub securable: Identifier,
8710 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8712 pub function_params: Vec<String>,
8713 pub principals: Vec<GrantPrincipal>,
8715 pub grant_option: bool,
8717 #[serde(default, skip_serializing_if = "Option::is_none")]
8719 pub as_principal: Option<Identifier>,
8720}
8721
8722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8724#[cfg_attr(feature = "bindings", derive(TS))]
8725pub struct Revoke {
8726 pub privileges: Vec<Privilege>,
8728 pub kind: Option<String>,
8730 pub securable: Identifier,
8732 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8734 pub function_params: Vec<String>,
8735 pub principals: Vec<GrantPrincipal>,
8737 pub grant_option: bool,
8739 pub cascade: bool,
8741 #[serde(default)]
8743 pub restrict: bool,
8744}
8745
8746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8748#[cfg_attr(feature = "bindings", derive(TS))]
8749pub struct Comment {
8750 pub this: Expression,
8752 pub kind: String,
8754 pub expression: Expression,
8756 pub exists: bool,
8758 pub materialized: bool,
8760}
8761
8762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8768#[cfg_attr(feature = "bindings", derive(TS))]
8769pub struct AlterView {
8770 pub name: TableRef,
8771 pub actions: Vec<AlterViewAction>,
8772 #[serde(default, skip_serializing_if = "Option::is_none")]
8774 pub algorithm: Option<String>,
8775 #[serde(default, skip_serializing_if = "Option::is_none")]
8777 pub definer: Option<String>,
8778 #[serde(default, skip_serializing_if = "Option::is_none")]
8780 pub sql_security: Option<String>,
8781 #[serde(default, skip_serializing_if = "Option::is_none")]
8783 pub with_option: Option<String>,
8784 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8786 pub columns: Vec<ViewColumn>,
8787}
8788
8789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8791#[cfg_attr(feature = "bindings", derive(TS))]
8792pub enum AlterViewAction {
8793 Rename(TableRef),
8795 OwnerTo(Identifier),
8797 SetSchema(Identifier),
8799 SetAuthorization(String),
8801 AlterColumn {
8803 name: Identifier,
8804 action: AlterColumnAction,
8805 },
8806 AsSelect(Box<Expression>),
8808 SetTblproperties(Vec<(String, String)>),
8810 UnsetTblproperties(Vec<String>),
8812}
8813
8814impl AlterView {
8815 pub fn new(name: impl Into<String>) -> Self {
8816 Self {
8817 name: TableRef::new(name),
8818 actions: Vec::new(),
8819 algorithm: None,
8820 definer: None,
8821 sql_security: None,
8822 with_option: None,
8823 columns: Vec::new(),
8824 }
8825 }
8826}
8827
8828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8830#[cfg_attr(feature = "bindings", derive(TS))]
8831pub struct AlterIndex {
8832 pub name: Identifier,
8833 pub table: Option<TableRef>,
8834 pub actions: Vec<AlterIndexAction>,
8835}
8836
8837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8839#[cfg_attr(feature = "bindings", derive(TS))]
8840pub enum AlterIndexAction {
8841 Rename(Identifier),
8843 SetTablespace(Identifier),
8845 Visible(bool),
8847}
8848
8849impl AlterIndex {
8850 pub fn new(name: impl Into<String>) -> Self {
8851 Self {
8852 name: Identifier::new(name),
8853 table: None,
8854 actions: Vec::new(),
8855 }
8856 }
8857}
8858
8859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8861#[cfg_attr(feature = "bindings", derive(TS))]
8862pub struct CreateSchema {
8863 pub name: Vec<Identifier>,
8865 pub if_not_exists: bool,
8866 pub authorization: Option<Identifier>,
8867 #[serde(default)]
8869 pub clone_from: Option<Vec<Identifier>>,
8870 #[serde(default)]
8872 pub at_clause: Option<Expression>,
8873 #[serde(default)]
8875 pub properties: Vec<Expression>,
8876 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8878 pub leading_comments: Vec<String>,
8879}
8880
8881impl CreateSchema {
8882 pub fn new(name: impl Into<String>) -> Self {
8883 Self {
8884 name: vec![Identifier::new(name)],
8885 if_not_exists: false,
8886 authorization: None,
8887 clone_from: None,
8888 at_clause: None,
8889 properties: Vec::new(),
8890 leading_comments: Vec::new(),
8891 }
8892 }
8893}
8894
8895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8897#[cfg_attr(feature = "bindings", derive(TS))]
8898pub struct DropSchema {
8899 pub name: Identifier,
8900 pub if_exists: bool,
8901 pub cascade: bool,
8902}
8903
8904impl DropSchema {
8905 pub fn new(name: impl Into<String>) -> Self {
8906 Self {
8907 name: Identifier::new(name),
8908 if_exists: false,
8909 cascade: false,
8910 }
8911 }
8912}
8913
8914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8916#[cfg_attr(feature = "bindings", derive(TS))]
8917pub struct DropNamespace {
8918 pub name: Identifier,
8919 pub if_exists: bool,
8920 pub cascade: bool,
8921}
8922
8923impl DropNamespace {
8924 pub fn new(name: impl Into<String>) -> Self {
8925 Self {
8926 name: Identifier::new(name),
8927 if_exists: false,
8928 cascade: false,
8929 }
8930 }
8931}
8932
8933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8935#[cfg_attr(feature = "bindings", derive(TS))]
8936pub struct CreateDatabase {
8937 pub name: Identifier,
8938 pub if_not_exists: bool,
8939 pub options: Vec<DatabaseOption>,
8940 #[serde(default)]
8942 pub clone_from: Option<Identifier>,
8943 #[serde(default)]
8945 pub at_clause: Option<Expression>,
8946}
8947
8948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8950#[cfg_attr(feature = "bindings", derive(TS))]
8951pub enum DatabaseOption {
8952 CharacterSet(String),
8953 Collate(String),
8954 Owner(Identifier),
8955 Template(Identifier),
8956 Encoding(String),
8957 Location(String),
8958}
8959
8960impl CreateDatabase {
8961 pub fn new(name: impl Into<String>) -> Self {
8962 Self {
8963 name: Identifier::new(name),
8964 if_not_exists: false,
8965 options: Vec::new(),
8966 clone_from: None,
8967 at_clause: None,
8968 }
8969 }
8970}
8971
8972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8974#[cfg_attr(feature = "bindings", derive(TS))]
8975pub struct DropDatabase {
8976 pub name: Identifier,
8977 pub if_exists: bool,
8978 #[serde(default)]
8980 pub sync: bool,
8981}
8982
8983impl DropDatabase {
8984 pub fn new(name: impl Into<String>) -> Self {
8985 Self {
8986 name: Identifier::new(name),
8987 if_exists: false,
8988 sync: false,
8989 }
8990 }
8991}
8992
8993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8995#[cfg_attr(feature = "bindings", derive(TS))]
8996pub struct CreateFunction {
8997 pub name: TableRef,
8998 pub parameters: Vec<FunctionParameter>,
8999 pub return_type: Option<DataType>,
9000 pub body: Option<FunctionBody>,
9001 pub or_replace: bool,
9002 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9004 pub or_alter: bool,
9005 pub if_not_exists: bool,
9006 pub temporary: bool,
9007 pub language: Option<String>,
9008 pub deterministic: Option<bool>,
9009 pub returns_null_on_null_input: Option<bool>,
9010 pub security: Option<FunctionSecurity>,
9011 #[serde(default = "default_true")]
9013 pub has_parens: bool,
9014 #[serde(default)]
9016 pub sql_data_access: Option<SqlDataAccess>,
9017 #[serde(default, skip_serializing_if = "Option::is_none")]
9019 pub returns_table_body: Option<String>,
9020 #[serde(default)]
9022 pub language_first: bool,
9023 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9025 pub set_options: Vec<FunctionSetOption>,
9026 #[serde(default)]
9028 pub strict: bool,
9029 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9031 pub options: Vec<Expression>,
9032 #[serde(default)]
9034 pub is_table_function: bool,
9035 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9037 pub property_order: Vec<FunctionPropertyKind>,
9038 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9040 pub environment: Vec<Expression>,
9041 #[serde(default, skip_serializing_if = "Option::is_none")]
9043 pub handler: Option<String>,
9044 #[serde(default, skip_serializing_if = "Option::is_none")]
9046 pub parameter_style: Option<String>,
9047}
9048
9049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9051#[cfg_attr(feature = "bindings", derive(TS))]
9052pub struct FunctionSetOption {
9053 pub name: String,
9054 pub value: FunctionSetValue,
9055}
9056
9057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9059#[cfg_attr(feature = "bindings", derive(TS))]
9060pub enum FunctionSetValue {
9061 Value { value: String, use_to: bool },
9063 FromCurrent,
9065}
9066
9067#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9069#[cfg_attr(feature = "bindings", derive(TS))]
9070pub enum SqlDataAccess {
9071 NoSql,
9073 ContainsSql,
9075 ReadsSqlData,
9077 ModifiesSqlData,
9079}
9080
9081#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9083#[cfg_attr(feature = "bindings", derive(TS))]
9084pub enum FunctionPropertyKind {
9085 Set,
9087 As,
9089 Language,
9091 Determinism,
9093 NullInput,
9095 Security,
9097 SqlDataAccess,
9099 Options,
9101 Environment,
9103 Handler,
9105 ParameterStyle,
9107}
9108
9109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9111#[cfg_attr(feature = "bindings", derive(TS))]
9112pub struct FunctionParameter {
9113 pub name: Option<Identifier>,
9114 pub data_type: DataType,
9115 pub mode: Option<ParameterMode>,
9116 pub default: Option<Expression>,
9117 #[serde(default, skip_serializing_if = "Option::is_none")]
9119 pub mode_text: Option<String>,
9120}
9121
9122#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9124#[cfg_attr(feature = "bindings", derive(TS))]
9125pub enum ParameterMode {
9126 In,
9127 Out,
9128 InOut,
9129 Variadic,
9130}
9131
9132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9134#[cfg_attr(feature = "bindings", derive(TS))]
9135pub enum FunctionBody {
9136 Block(String),
9138 StringLiteral(String),
9140 Expression(Expression),
9142 External(String),
9144 Return(Expression),
9146 Statements(Vec<Expression>),
9148 DollarQuoted {
9151 content: String,
9152 tag: Option<String>,
9153 },
9154 RawBlock(String),
9156}
9157
9158#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9160#[cfg_attr(feature = "bindings", derive(TS))]
9161pub enum FunctionSecurity {
9162 Definer,
9163 Invoker,
9164 None,
9166}
9167
9168impl CreateFunction {
9169 pub fn new(name: impl Into<String>) -> Self {
9170 Self {
9171 name: TableRef::new(name),
9172 parameters: Vec::new(),
9173 return_type: None,
9174 body: None,
9175 or_replace: false,
9176 or_alter: false,
9177 if_not_exists: false,
9178 temporary: false,
9179 language: None,
9180 deterministic: None,
9181 returns_null_on_null_input: None,
9182 security: None,
9183 has_parens: true,
9184 sql_data_access: None,
9185 returns_table_body: None,
9186 language_first: false,
9187 set_options: Vec::new(),
9188 strict: false,
9189 options: Vec::new(),
9190 is_table_function: false,
9191 property_order: Vec::new(),
9192 environment: Vec::new(),
9193 handler: None,
9194 parameter_style: None,
9195 }
9196 }
9197}
9198
9199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9201#[cfg_attr(feature = "bindings", derive(TS))]
9202pub struct DropFunction {
9203 pub name: TableRef,
9204 pub parameters: Option<Vec<DataType>>,
9205 pub if_exists: bool,
9206 pub cascade: bool,
9207}
9208
9209impl DropFunction {
9210 pub fn new(name: impl Into<String>) -> Self {
9211 Self {
9212 name: TableRef::new(name),
9213 parameters: None,
9214 if_exists: false,
9215 cascade: false,
9216 }
9217 }
9218}
9219
9220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9222#[cfg_attr(feature = "bindings", derive(TS))]
9223pub struct CreateProcedure {
9224 pub name: TableRef,
9225 pub parameters: Vec<FunctionParameter>,
9226 pub body: Option<FunctionBody>,
9227 pub or_replace: bool,
9228 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9230 pub or_alter: bool,
9231 pub if_not_exists: bool,
9232 pub language: Option<String>,
9233 pub security: Option<FunctionSecurity>,
9234 #[serde(default)]
9236 pub return_type: Option<DataType>,
9237 #[serde(default)]
9239 pub execute_as: Option<String>,
9240 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9242 pub with_options: Vec<String>,
9243 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9245 pub has_parens: bool,
9246 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9248 pub use_proc_keyword: bool,
9249}
9250
9251impl CreateProcedure {
9252 pub fn new(name: impl Into<String>) -> Self {
9253 Self {
9254 name: TableRef::new(name),
9255 parameters: Vec::new(),
9256 body: None,
9257 or_replace: false,
9258 or_alter: false,
9259 if_not_exists: false,
9260 language: None,
9261 security: None,
9262 return_type: None,
9263 execute_as: None,
9264 with_options: Vec::new(),
9265 has_parens: true,
9266 use_proc_keyword: false,
9267 }
9268 }
9269}
9270
9271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9273#[cfg_attr(feature = "bindings", derive(TS))]
9274pub struct DropProcedure {
9275 pub name: TableRef,
9276 pub parameters: Option<Vec<DataType>>,
9277 pub if_exists: bool,
9278 pub cascade: bool,
9279}
9280
9281impl DropProcedure {
9282 pub fn new(name: impl Into<String>) -> Self {
9283 Self {
9284 name: TableRef::new(name),
9285 parameters: None,
9286 if_exists: false,
9287 cascade: false,
9288 }
9289 }
9290}
9291
9292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9294#[cfg_attr(feature = "bindings", derive(TS))]
9295pub enum SeqPropKind {
9296 Start,
9297 Increment,
9298 Minvalue,
9299 Maxvalue,
9300 Cache,
9301 NoCache,
9302 Cycle,
9303 NoCycle,
9304 OwnedBy,
9305 Order,
9306 NoOrder,
9307 Comment,
9308 Sharing,
9310 Keep,
9312 NoKeep,
9314 Scale,
9316 NoScale,
9318 Shard,
9320 NoShard,
9322 Session,
9324 Global,
9326 NoCacheWord,
9328 NoCycleWord,
9330 NoMinvalueWord,
9332 NoMaxvalueWord,
9334}
9335
9336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9338#[cfg_attr(feature = "bindings", derive(TS))]
9339pub struct CreateSynonym {
9340 pub name: TableRef,
9342 pub target: TableRef,
9344}
9345
9346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9348#[cfg_attr(feature = "bindings", derive(TS))]
9349pub struct CreateSequence {
9350 pub name: TableRef,
9351 pub if_not_exists: bool,
9352 pub temporary: bool,
9353 #[serde(default)]
9354 pub or_replace: bool,
9355 #[serde(default, skip_serializing_if = "Option::is_none")]
9357 pub as_type: Option<DataType>,
9358 pub increment: Option<i64>,
9359 pub minvalue: Option<SequenceBound>,
9360 pub maxvalue: Option<SequenceBound>,
9361 pub start: Option<i64>,
9362 pub cache: Option<i64>,
9363 pub cycle: bool,
9364 pub owned_by: Option<TableRef>,
9365 #[serde(default)]
9367 pub owned_by_none: bool,
9368 #[serde(default)]
9370 pub order: Option<bool>,
9371 #[serde(default)]
9373 pub comment: Option<String>,
9374 #[serde(default, skip_serializing_if = "Option::is_none")]
9376 pub sharing: Option<String>,
9377 #[serde(default, skip_serializing_if = "Option::is_none")]
9379 pub scale_modifier: Option<String>,
9380 #[serde(default, skip_serializing_if = "Option::is_none")]
9382 pub shard_modifier: Option<String>,
9383 #[serde(default)]
9385 pub property_order: Vec<SeqPropKind>,
9386}
9387
9388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9390#[cfg_attr(feature = "bindings", derive(TS))]
9391pub enum SequenceBound {
9392 Value(i64),
9393 None,
9394}
9395
9396impl CreateSequence {
9397 pub fn new(name: impl Into<String>) -> Self {
9398 Self {
9399 name: TableRef::new(name),
9400 if_not_exists: false,
9401 temporary: false,
9402 or_replace: false,
9403 as_type: None,
9404 increment: None,
9405 minvalue: None,
9406 maxvalue: None,
9407 start: None,
9408 cache: None,
9409 cycle: false,
9410 owned_by: None,
9411 owned_by_none: false,
9412 order: None,
9413 comment: None,
9414 sharing: None,
9415 scale_modifier: None,
9416 shard_modifier: None,
9417 property_order: Vec::new(),
9418 }
9419 }
9420}
9421
9422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9424#[cfg_attr(feature = "bindings", derive(TS))]
9425pub struct DropSequence {
9426 pub name: TableRef,
9427 pub if_exists: bool,
9428 pub cascade: bool,
9429}
9430
9431impl DropSequence {
9432 pub fn new(name: impl Into<String>) -> Self {
9433 Self {
9434 name: TableRef::new(name),
9435 if_exists: false,
9436 cascade: false,
9437 }
9438 }
9439}
9440
9441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9443#[cfg_attr(feature = "bindings", derive(TS))]
9444pub struct AlterSequence {
9445 pub name: TableRef,
9446 pub if_exists: bool,
9447 pub increment: Option<i64>,
9448 pub minvalue: Option<SequenceBound>,
9449 pub maxvalue: Option<SequenceBound>,
9450 pub start: Option<i64>,
9451 pub restart: Option<Option<i64>>,
9452 pub cache: Option<i64>,
9453 pub cycle: Option<bool>,
9454 pub owned_by: Option<Option<TableRef>>,
9455}
9456
9457impl AlterSequence {
9458 pub fn new(name: impl Into<String>) -> Self {
9459 Self {
9460 name: TableRef::new(name),
9461 if_exists: false,
9462 increment: None,
9463 minvalue: None,
9464 maxvalue: None,
9465 start: None,
9466 restart: None,
9467 cache: None,
9468 cycle: None,
9469 owned_by: None,
9470 }
9471 }
9472}
9473
9474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9476#[cfg_attr(feature = "bindings", derive(TS))]
9477pub struct CreateTrigger {
9478 pub name: Identifier,
9479 pub table: TableRef,
9480 pub timing: TriggerTiming,
9481 pub events: Vec<TriggerEvent>,
9482 #[serde(default, skip_serializing_if = "Option::is_none")]
9483 pub for_each: Option<TriggerForEach>,
9484 pub when: Option<Expression>,
9485 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9487 pub when_paren: bool,
9488 pub body: TriggerBody,
9489 pub or_replace: bool,
9490 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9492 pub or_alter: bool,
9493 pub constraint: bool,
9494 pub deferrable: Option<bool>,
9495 pub initially_deferred: Option<bool>,
9496 pub referencing: Option<TriggerReferencing>,
9497}
9498
9499#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9501#[cfg_attr(feature = "bindings", derive(TS))]
9502pub enum TriggerTiming {
9503 Before,
9504 After,
9505 InsteadOf,
9506}
9507
9508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9510#[cfg_attr(feature = "bindings", derive(TS))]
9511pub enum TriggerEvent {
9512 Insert,
9513 Update(Option<Vec<Identifier>>),
9514 Delete,
9515 Truncate,
9516}
9517
9518#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9520#[cfg_attr(feature = "bindings", derive(TS))]
9521pub enum TriggerForEach {
9522 Row,
9523 Statement,
9524}
9525
9526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9528#[cfg_attr(feature = "bindings", derive(TS))]
9529pub enum TriggerBody {
9530 Execute {
9532 function: TableRef,
9533 args: Vec<Expression>,
9534 },
9535 Block(String),
9537}
9538
9539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9541#[cfg_attr(feature = "bindings", derive(TS))]
9542pub struct TriggerReferencing {
9543 pub old_table: Option<Identifier>,
9544 pub new_table: Option<Identifier>,
9545 pub old_row: Option<Identifier>,
9546 pub new_row: Option<Identifier>,
9547}
9548
9549impl CreateTrigger {
9550 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9551 Self {
9552 name: Identifier::new(name),
9553 table: TableRef::new(table),
9554 timing: TriggerTiming::Before,
9555 events: Vec::new(),
9556 for_each: Some(TriggerForEach::Row),
9557 when: None,
9558 when_paren: false,
9559 body: TriggerBody::Execute {
9560 function: TableRef::new(""),
9561 args: Vec::new(),
9562 },
9563 or_replace: false,
9564 or_alter: false,
9565 constraint: false,
9566 deferrable: None,
9567 initially_deferred: None,
9568 referencing: None,
9569 }
9570 }
9571}
9572
9573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9575#[cfg_attr(feature = "bindings", derive(TS))]
9576pub struct DropTrigger {
9577 pub name: Identifier,
9578 pub table: Option<TableRef>,
9579 pub if_exists: bool,
9580 pub cascade: bool,
9581}
9582
9583impl DropTrigger {
9584 pub fn new(name: impl Into<String>) -> Self {
9585 Self {
9586 name: Identifier::new(name),
9587 table: None,
9588 if_exists: false,
9589 cascade: false,
9590 }
9591 }
9592}
9593
9594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9596#[cfg_attr(feature = "bindings", derive(TS))]
9597pub struct CreateType {
9598 pub name: TableRef,
9599 pub definition: TypeDefinition,
9600 pub if_not_exists: bool,
9601}
9602
9603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9605#[cfg_attr(feature = "bindings", derive(TS))]
9606pub enum TypeDefinition {
9607 Enum(Vec<String>),
9609 Composite(Vec<TypeAttribute>),
9611 Range {
9613 subtype: DataType,
9614 subtype_diff: Option<String>,
9615 canonical: Option<String>,
9616 },
9617 Base {
9619 input: String,
9620 output: String,
9621 internallength: Option<i32>,
9622 },
9623 Domain {
9625 base_type: DataType,
9626 default: Option<Expression>,
9627 constraints: Vec<DomainConstraint>,
9628 },
9629}
9630
9631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9633#[cfg_attr(feature = "bindings", derive(TS))]
9634pub struct TypeAttribute {
9635 pub name: Identifier,
9636 pub data_type: DataType,
9637 pub collate: Option<Identifier>,
9638}
9639
9640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9642#[cfg_attr(feature = "bindings", derive(TS))]
9643pub struct DomainConstraint {
9644 pub name: Option<Identifier>,
9645 pub check: Expression,
9646}
9647
9648impl CreateType {
9649 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9650 Self {
9651 name: TableRef::new(name),
9652 definition: TypeDefinition::Enum(values),
9653 if_not_exists: false,
9654 }
9655 }
9656
9657 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9658 Self {
9659 name: TableRef::new(name),
9660 definition: TypeDefinition::Composite(attributes),
9661 if_not_exists: false,
9662 }
9663 }
9664}
9665
9666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9668#[cfg_attr(feature = "bindings", derive(TS))]
9669pub struct DropType {
9670 pub name: TableRef,
9671 pub if_exists: bool,
9672 pub cascade: bool,
9673}
9674
9675impl DropType {
9676 pub fn new(name: impl Into<String>) -> Self {
9677 Self {
9678 name: TableRef::new(name),
9679 if_exists: false,
9680 cascade: false,
9681 }
9682 }
9683}
9684
9685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9687#[cfg_attr(feature = "bindings", derive(TS))]
9688pub struct Describe {
9689 pub target: Expression,
9691 pub extended: bool,
9693 pub formatted: bool,
9695 #[serde(default)]
9697 pub kind: Option<String>,
9698 #[serde(default)]
9700 pub properties: Vec<(String, String)>,
9701 #[serde(default, skip_serializing_if = "Option::is_none")]
9703 pub style: Option<String>,
9704 #[serde(default)]
9706 pub partition: Option<Box<Expression>>,
9707 #[serde(default)]
9709 pub leading_comments: Vec<String>,
9710 #[serde(default)]
9712 pub as_json: bool,
9713 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9715 pub params: Vec<String>,
9716}
9717
9718impl Describe {
9719 pub fn new(target: Expression) -> Self {
9720 Self {
9721 target,
9722 extended: false,
9723 formatted: false,
9724 kind: None,
9725 properties: Vec::new(),
9726 style: None,
9727 partition: None,
9728 leading_comments: Vec::new(),
9729 as_json: false,
9730 params: Vec::new(),
9731 }
9732 }
9733}
9734
9735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9737#[cfg_attr(feature = "bindings", derive(TS))]
9738pub struct Show {
9739 pub this: String,
9741 #[serde(default)]
9743 pub terse: bool,
9744 #[serde(default)]
9746 pub history: bool,
9747 pub like: Option<Expression>,
9749 pub scope_kind: Option<String>,
9751 pub scope: Option<Expression>,
9753 pub starts_with: Option<Expression>,
9755 pub limit: Option<Box<Limit>>,
9757 pub from: Option<Expression>,
9759 #[serde(default, skip_serializing_if = "Option::is_none")]
9761 pub where_clause: Option<Expression>,
9762 #[serde(default, skip_serializing_if = "Option::is_none")]
9764 pub for_target: Option<Expression>,
9765 #[serde(default, skip_serializing_if = "Option::is_none")]
9767 pub db: Option<Expression>,
9768 #[serde(default, skip_serializing_if = "Option::is_none")]
9770 pub target: Option<Expression>,
9771 #[serde(default, skip_serializing_if = "Option::is_none")]
9773 pub mutex: Option<bool>,
9774 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9776 pub privileges: Vec<String>,
9777}
9778
9779impl Show {
9780 pub fn new(this: impl Into<String>) -> Self {
9781 Self {
9782 this: this.into(),
9783 terse: false,
9784 history: false,
9785 like: None,
9786 scope_kind: None,
9787 scope: None,
9788 starts_with: None,
9789 limit: None,
9790 from: None,
9791 where_clause: None,
9792 for_target: None,
9793 db: None,
9794 target: None,
9795 mutex: None,
9796 privileges: Vec::new(),
9797 }
9798 }
9799}
9800
9801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9806#[cfg_attr(feature = "bindings", derive(TS))]
9807pub struct Paren {
9808 pub this: Expression,
9810 #[serde(default)]
9811 pub trailing_comments: Vec<String>,
9812}
9813
9814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9816#[cfg_attr(feature = "bindings", derive(TS))]
9817pub struct Annotated {
9818 pub this: Expression,
9819 pub trailing_comments: Vec<String>,
9820}
9821
9822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9827#[cfg_attr(feature = "bindings", derive(TS))]
9828pub struct Refresh {
9829 pub this: Box<Expression>,
9830 pub kind: String,
9831}
9832
9833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9835#[cfg_attr(feature = "bindings", derive(TS))]
9836pub struct LockingStatement {
9837 pub this: Box<Expression>,
9838 pub expression: Box<Expression>,
9839}
9840
9841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9843#[cfg_attr(feature = "bindings", derive(TS))]
9844pub struct SequenceProperties {
9845 #[serde(default)]
9846 pub increment: Option<Box<Expression>>,
9847 #[serde(default)]
9848 pub minvalue: Option<Box<Expression>>,
9849 #[serde(default)]
9850 pub maxvalue: Option<Box<Expression>>,
9851 #[serde(default)]
9852 pub cache: Option<Box<Expression>>,
9853 #[serde(default)]
9854 pub start: Option<Box<Expression>>,
9855 #[serde(default)]
9856 pub owned: Option<Box<Expression>>,
9857 #[serde(default)]
9858 pub options: Vec<Expression>,
9859}
9860
9861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9863#[cfg_attr(feature = "bindings", derive(TS))]
9864pub struct TruncateTable {
9865 #[serde(default)]
9866 pub expressions: Vec<Expression>,
9867 #[serde(default)]
9868 pub is_database: Option<Box<Expression>>,
9869 #[serde(default)]
9870 pub exists: bool,
9871 #[serde(default)]
9872 pub only: Option<Box<Expression>>,
9873 #[serde(default)]
9874 pub cluster: Option<Box<Expression>>,
9875 #[serde(default)]
9876 pub identity: Option<Box<Expression>>,
9877 #[serde(default)]
9878 pub option: Option<Box<Expression>>,
9879 #[serde(default)]
9880 pub partition: Option<Box<Expression>>,
9881}
9882
9883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9885#[cfg_attr(feature = "bindings", derive(TS))]
9886pub struct Clone {
9887 pub this: Box<Expression>,
9888 #[serde(default)]
9889 pub shallow: Option<Box<Expression>>,
9890 #[serde(default)]
9891 pub copy: Option<Box<Expression>>,
9892}
9893
9894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9896#[cfg_attr(feature = "bindings", derive(TS))]
9897pub struct Attach {
9898 pub this: Box<Expression>,
9899 #[serde(default)]
9900 pub exists: bool,
9901 #[serde(default)]
9902 pub expressions: Vec<Expression>,
9903}
9904
9905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9907#[cfg_attr(feature = "bindings", derive(TS))]
9908pub struct Detach {
9909 pub this: Box<Expression>,
9910 #[serde(default)]
9911 pub exists: bool,
9912}
9913
9914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9916#[cfg_attr(feature = "bindings", derive(TS))]
9917pub struct Install {
9918 pub this: Box<Expression>,
9919 #[serde(default)]
9920 pub from_: Option<Box<Expression>>,
9921 #[serde(default)]
9922 pub force: Option<Box<Expression>>,
9923}
9924
9925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9927#[cfg_attr(feature = "bindings", derive(TS))]
9928pub struct Summarize {
9929 pub this: Box<Expression>,
9930 #[serde(default)]
9931 pub table: Option<Box<Expression>>,
9932}
9933
9934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9936#[cfg_attr(feature = "bindings", derive(TS))]
9937pub struct Declare {
9938 #[serde(default)]
9939 pub expressions: Vec<Expression>,
9940 #[serde(default)]
9941 pub replace: bool,
9942}
9943
9944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9946#[cfg_attr(feature = "bindings", derive(TS))]
9947pub struct DeclareItem {
9948 pub this: Box<Expression>,
9949 #[serde(default)]
9950 pub kind: Option<String>,
9951 #[serde(default)]
9952 pub default: Option<Box<Expression>>,
9953 #[serde(default)]
9954 pub has_as: bool,
9955 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9957 pub additional_names: Vec<Expression>,
9958}
9959
9960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9962#[cfg_attr(feature = "bindings", derive(TS))]
9963pub struct Set {
9964 #[serde(default)]
9965 pub expressions: Vec<Expression>,
9966 #[serde(default)]
9967 pub unset: Option<Box<Expression>>,
9968 #[serde(default)]
9969 pub tag: Option<Box<Expression>>,
9970}
9971
9972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9974#[cfg_attr(feature = "bindings", derive(TS))]
9975pub struct Heredoc {
9976 pub this: Box<Expression>,
9977 #[serde(default)]
9978 pub tag: Option<Box<Expression>>,
9979}
9980
9981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9983#[cfg_attr(feature = "bindings", derive(TS))]
9984pub struct QueryBand {
9985 pub this: Box<Expression>,
9986 #[serde(default)]
9987 pub scope: Option<Box<Expression>>,
9988 #[serde(default)]
9989 pub update: Option<Box<Expression>>,
9990}
9991
9992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9994#[cfg_attr(feature = "bindings", derive(TS))]
9995pub struct UserDefinedFunction {
9996 pub this: Box<Expression>,
9997 #[serde(default)]
9998 pub expressions: Vec<Expression>,
9999 #[serde(default)]
10000 pub wrapped: Option<Box<Expression>>,
10001}
10002
10003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10005#[cfg_attr(feature = "bindings", derive(TS))]
10006pub struct RecursiveWithSearch {
10007 pub kind: String,
10008 pub this: Box<Expression>,
10009 pub expression: Box<Expression>,
10010 #[serde(default)]
10011 pub using: Option<Box<Expression>>,
10012}
10013
10014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10016#[cfg_attr(feature = "bindings", derive(TS))]
10017pub struct ProjectionDef {
10018 pub this: Box<Expression>,
10019 pub expression: Box<Expression>,
10020}
10021
10022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10024#[cfg_attr(feature = "bindings", derive(TS))]
10025pub struct TableAlias {
10026 #[serde(default)]
10027 pub this: Option<Box<Expression>>,
10028 #[serde(default)]
10029 pub columns: Vec<Expression>,
10030}
10031
10032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10034#[cfg_attr(feature = "bindings", derive(TS))]
10035pub struct ByteString {
10036 pub this: Box<Expression>,
10037 #[serde(default)]
10038 pub is_bytes: Option<Box<Expression>>,
10039}
10040
10041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10044#[cfg_attr(feature = "bindings", derive(TS))]
10045pub struct HexStringExpr {
10046 pub this: Box<Expression>,
10047 #[serde(default)]
10048 pub is_integer: Option<bool>,
10049}
10050
10051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10053#[cfg_attr(feature = "bindings", derive(TS))]
10054pub struct UnicodeString {
10055 pub this: Box<Expression>,
10056 #[serde(default)]
10057 pub escape: Option<Box<Expression>>,
10058}
10059
10060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10062#[cfg_attr(feature = "bindings", derive(TS))]
10063pub struct AlterColumn {
10064 pub this: Box<Expression>,
10065 #[serde(default)]
10066 pub dtype: Option<Box<Expression>>,
10067 #[serde(default)]
10068 pub collate: Option<Box<Expression>>,
10069 #[serde(default)]
10070 pub using: Option<Box<Expression>>,
10071 #[serde(default)]
10072 pub default: Option<Box<Expression>>,
10073 #[serde(default)]
10074 pub drop: Option<Box<Expression>>,
10075 #[serde(default)]
10076 pub comment: Option<Box<Expression>>,
10077 #[serde(default)]
10078 pub allow_null: Option<Box<Expression>>,
10079 #[serde(default)]
10080 pub visible: Option<Box<Expression>>,
10081 #[serde(default)]
10082 pub rename_to: Option<Box<Expression>>,
10083}
10084
10085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10087#[cfg_attr(feature = "bindings", derive(TS))]
10088pub struct AlterSortKey {
10089 #[serde(default)]
10090 pub this: Option<Box<Expression>>,
10091 #[serde(default)]
10092 pub expressions: Vec<Expression>,
10093 #[serde(default)]
10094 pub compound: Option<Box<Expression>>,
10095}
10096
10097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10099#[cfg_attr(feature = "bindings", derive(TS))]
10100pub struct AlterSet {
10101 #[serde(default)]
10102 pub expressions: Vec<Expression>,
10103 #[serde(default)]
10104 pub option: Option<Box<Expression>>,
10105 #[serde(default)]
10106 pub tablespace: Option<Box<Expression>>,
10107 #[serde(default)]
10108 pub access_method: Option<Box<Expression>>,
10109 #[serde(default)]
10110 pub file_format: Option<Box<Expression>>,
10111 #[serde(default)]
10112 pub copy_options: Option<Box<Expression>>,
10113 #[serde(default)]
10114 pub tag: Option<Box<Expression>>,
10115 #[serde(default)]
10116 pub location: Option<Box<Expression>>,
10117 #[serde(default)]
10118 pub serde: Option<Box<Expression>>,
10119}
10120
10121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10123#[cfg_attr(feature = "bindings", derive(TS))]
10124pub struct RenameColumn {
10125 pub this: Box<Expression>,
10126 #[serde(default)]
10127 pub to: Option<Box<Expression>>,
10128 #[serde(default)]
10129 pub exists: bool,
10130}
10131
10132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10134#[cfg_attr(feature = "bindings", derive(TS))]
10135pub struct Comprehension {
10136 pub this: Box<Expression>,
10137 pub expression: Box<Expression>,
10138 #[serde(default)]
10139 pub position: Option<Box<Expression>>,
10140 #[serde(default)]
10141 pub iterator: Option<Box<Expression>>,
10142 #[serde(default)]
10143 pub condition: Option<Box<Expression>>,
10144}
10145
10146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10148#[cfg_attr(feature = "bindings", derive(TS))]
10149pub struct MergeTreeTTLAction {
10150 pub this: Box<Expression>,
10151 #[serde(default)]
10152 pub delete: Option<Box<Expression>>,
10153 #[serde(default)]
10154 pub recompress: Option<Box<Expression>>,
10155 #[serde(default)]
10156 pub to_disk: Option<Box<Expression>>,
10157 #[serde(default)]
10158 pub to_volume: Option<Box<Expression>>,
10159}
10160
10161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10163#[cfg_attr(feature = "bindings", derive(TS))]
10164pub struct MergeTreeTTL {
10165 #[serde(default)]
10166 pub expressions: Vec<Expression>,
10167 #[serde(default)]
10168 pub where_: Option<Box<Expression>>,
10169 #[serde(default)]
10170 pub group: Option<Box<Expression>>,
10171 #[serde(default)]
10172 pub aggregates: Option<Box<Expression>>,
10173}
10174
10175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10177#[cfg_attr(feature = "bindings", derive(TS))]
10178pub struct IndexConstraintOption {
10179 #[serde(default)]
10180 pub key_block_size: Option<Box<Expression>>,
10181 #[serde(default)]
10182 pub using: Option<Box<Expression>>,
10183 #[serde(default)]
10184 pub parser: Option<Box<Expression>>,
10185 #[serde(default)]
10186 pub comment: Option<Box<Expression>>,
10187 #[serde(default)]
10188 pub visible: Option<Box<Expression>>,
10189 #[serde(default)]
10190 pub engine_attr: Option<Box<Expression>>,
10191 #[serde(default)]
10192 pub secondary_engine_attr: Option<Box<Expression>>,
10193}
10194
10195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10197#[cfg_attr(feature = "bindings", derive(TS))]
10198pub struct PeriodForSystemTimeConstraint {
10199 pub this: Box<Expression>,
10200 pub expression: Box<Expression>,
10201}
10202
10203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10205#[cfg_attr(feature = "bindings", derive(TS))]
10206pub struct CaseSpecificColumnConstraint {
10207 #[serde(default)]
10208 pub not_: Option<Box<Expression>>,
10209}
10210
10211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10213#[cfg_attr(feature = "bindings", derive(TS))]
10214pub struct CharacterSetColumnConstraint {
10215 pub this: Box<Expression>,
10216}
10217
10218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10220#[cfg_attr(feature = "bindings", derive(TS))]
10221pub struct CheckColumnConstraint {
10222 pub this: Box<Expression>,
10223 #[serde(default)]
10224 pub enforced: Option<Box<Expression>>,
10225}
10226
10227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10229#[cfg_attr(feature = "bindings", derive(TS))]
10230pub struct AssumeColumnConstraint {
10231 pub this: Box<Expression>,
10232}
10233
10234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10236#[cfg_attr(feature = "bindings", derive(TS))]
10237pub struct CompressColumnConstraint {
10238 #[serde(default)]
10239 pub this: Option<Box<Expression>>,
10240}
10241
10242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10244#[cfg_attr(feature = "bindings", derive(TS))]
10245pub struct DateFormatColumnConstraint {
10246 pub this: Box<Expression>,
10247}
10248
10249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10251#[cfg_attr(feature = "bindings", derive(TS))]
10252pub struct EphemeralColumnConstraint {
10253 #[serde(default)]
10254 pub this: Option<Box<Expression>>,
10255}
10256
10257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10259#[cfg_attr(feature = "bindings", derive(TS))]
10260pub struct WithOperator {
10261 pub this: Box<Expression>,
10262 pub op: String,
10263}
10264
10265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10267#[cfg_attr(feature = "bindings", derive(TS))]
10268pub struct GeneratedAsIdentityColumnConstraint {
10269 #[serde(default)]
10270 pub this: Option<Box<Expression>>,
10271 #[serde(default)]
10272 pub expression: Option<Box<Expression>>,
10273 #[serde(default)]
10274 pub on_null: Option<Box<Expression>>,
10275 #[serde(default)]
10276 pub start: Option<Box<Expression>>,
10277 #[serde(default)]
10278 pub increment: Option<Box<Expression>>,
10279 #[serde(default)]
10280 pub minvalue: Option<Box<Expression>>,
10281 #[serde(default)]
10282 pub maxvalue: Option<Box<Expression>>,
10283 #[serde(default)]
10284 pub cycle: Option<Box<Expression>>,
10285 #[serde(default)]
10286 pub order: Option<Box<Expression>>,
10287}
10288
10289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10292#[cfg_attr(feature = "bindings", derive(TS))]
10293pub struct AutoIncrementColumnConstraint;
10294
10295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10297#[cfg_attr(feature = "bindings", derive(TS))]
10298pub struct CommentColumnConstraint;
10299
10300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10302#[cfg_attr(feature = "bindings", derive(TS))]
10303pub struct GeneratedAsRowColumnConstraint {
10304 #[serde(default)]
10305 pub start: Option<Box<Expression>>,
10306 #[serde(default)]
10307 pub hidden: Option<Box<Expression>>,
10308}
10309
10310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10312#[cfg_attr(feature = "bindings", derive(TS))]
10313pub struct IndexColumnConstraint {
10314 #[serde(default)]
10315 pub this: Option<Box<Expression>>,
10316 #[serde(default)]
10317 pub expressions: Vec<Expression>,
10318 #[serde(default)]
10319 pub kind: Option<String>,
10320 #[serde(default)]
10321 pub index_type: Option<Box<Expression>>,
10322 #[serde(default)]
10323 pub options: Vec<Expression>,
10324 #[serde(default)]
10325 pub expression: Option<Box<Expression>>,
10326 #[serde(default)]
10327 pub granularity: Option<Box<Expression>>,
10328}
10329
10330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10332#[cfg_attr(feature = "bindings", derive(TS))]
10333pub struct MaskingPolicyColumnConstraint {
10334 pub this: Box<Expression>,
10335 #[serde(default)]
10336 pub expressions: Vec<Expression>,
10337}
10338
10339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10341#[cfg_attr(feature = "bindings", derive(TS))]
10342pub struct NotNullColumnConstraint {
10343 #[serde(default)]
10344 pub allow_null: Option<Box<Expression>>,
10345}
10346
10347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10349#[cfg_attr(feature = "bindings", derive(TS))]
10350pub struct DefaultColumnConstraint {
10351 pub this: Box<Expression>,
10352 #[serde(default, skip_serializing_if = "Option::is_none")]
10354 pub for_column: Option<Identifier>,
10355}
10356
10357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10359#[cfg_attr(feature = "bindings", derive(TS))]
10360pub struct PrimaryKeyColumnConstraint {
10361 #[serde(default)]
10362 pub desc: Option<Box<Expression>>,
10363 #[serde(default)]
10364 pub options: Vec<Expression>,
10365}
10366
10367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10369#[cfg_attr(feature = "bindings", derive(TS))]
10370pub struct UniqueColumnConstraint {
10371 #[serde(default)]
10372 pub this: Option<Box<Expression>>,
10373 #[serde(default)]
10374 pub index_type: Option<Box<Expression>>,
10375 #[serde(default)]
10376 pub on_conflict: Option<Box<Expression>>,
10377 #[serde(default)]
10378 pub nulls: Option<Box<Expression>>,
10379 #[serde(default)]
10380 pub options: Vec<Expression>,
10381}
10382
10383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10385#[cfg_attr(feature = "bindings", derive(TS))]
10386pub struct WatermarkColumnConstraint {
10387 pub this: Box<Expression>,
10388 pub expression: Box<Expression>,
10389}
10390
10391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10393#[cfg_attr(feature = "bindings", derive(TS))]
10394pub struct ComputedColumnConstraint {
10395 pub this: Box<Expression>,
10396 #[serde(default)]
10397 pub persisted: Option<Box<Expression>>,
10398 #[serde(default)]
10399 pub not_null: Option<Box<Expression>>,
10400 #[serde(default)]
10401 pub data_type: Option<Box<Expression>>,
10402}
10403
10404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10406#[cfg_attr(feature = "bindings", derive(TS))]
10407pub struct InOutColumnConstraint {
10408 #[serde(default)]
10409 pub input_: Option<Box<Expression>>,
10410 #[serde(default)]
10411 pub output: Option<Box<Expression>>,
10412}
10413
10414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10416#[cfg_attr(feature = "bindings", derive(TS))]
10417pub struct PathColumnConstraint {
10418 pub this: Box<Expression>,
10419}
10420
10421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10423#[cfg_attr(feature = "bindings", derive(TS))]
10424pub struct Constraint {
10425 pub this: Box<Expression>,
10426 #[serde(default)]
10427 pub expressions: Vec<Expression>,
10428}
10429
10430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10432#[cfg_attr(feature = "bindings", derive(TS))]
10433pub struct Export {
10434 pub this: Box<Expression>,
10435 #[serde(default)]
10436 pub connection: Option<Box<Expression>>,
10437 #[serde(default)]
10438 pub options: Vec<Expression>,
10439}
10440
10441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10443#[cfg_attr(feature = "bindings", derive(TS))]
10444pub struct Filter {
10445 pub this: Box<Expression>,
10446 pub expression: Box<Expression>,
10447}
10448
10449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10451#[cfg_attr(feature = "bindings", derive(TS))]
10452pub struct Changes {
10453 #[serde(default)]
10454 pub information: Option<Box<Expression>>,
10455 #[serde(default)]
10456 pub at_before: Option<Box<Expression>>,
10457 #[serde(default)]
10458 pub end: Option<Box<Expression>>,
10459}
10460
10461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10463#[cfg_attr(feature = "bindings", derive(TS))]
10464pub struct Directory {
10465 pub this: Box<Expression>,
10466 #[serde(default)]
10467 pub local: Option<Box<Expression>>,
10468 #[serde(default)]
10469 pub row_format: Option<Box<Expression>>,
10470}
10471
10472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10474#[cfg_attr(feature = "bindings", derive(TS))]
10475pub struct ForeignKey {
10476 #[serde(default)]
10477 pub expressions: Vec<Expression>,
10478 #[serde(default)]
10479 pub reference: Option<Box<Expression>>,
10480 #[serde(default)]
10481 pub delete: Option<Box<Expression>>,
10482 #[serde(default)]
10483 pub update: Option<Box<Expression>>,
10484 #[serde(default)]
10485 pub options: Vec<Expression>,
10486}
10487
10488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10490#[cfg_attr(feature = "bindings", derive(TS))]
10491pub struct ColumnPrefix {
10492 pub this: Box<Expression>,
10493 pub expression: Box<Expression>,
10494}
10495
10496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10498#[cfg_attr(feature = "bindings", derive(TS))]
10499pub struct PrimaryKey {
10500 #[serde(default)]
10501 pub this: Option<Box<Expression>>,
10502 #[serde(default)]
10503 pub expressions: Vec<Expression>,
10504 #[serde(default)]
10505 pub options: Vec<Expression>,
10506 #[serde(default)]
10507 pub include: Option<Box<Expression>>,
10508}
10509
10510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10512#[cfg_attr(feature = "bindings", derive(TS))]
10513pub struct IntoClause {
10514 #[serde(default)]
10515 pub this: Option<Box<Expression>>,
10516 #[serde(default)]
10517 pub temporary: bool,
10518 #[serde(default)]
10519 pub unlogged: Option<Box<Expression>>,
10520 #[serde(default)]
10521 pub bulk_collect: Option<Box<Expression>>,
10522 #[serde(default)]
10523 pub expressions: Vec<Expression>,
10524}
10525
10526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10528#[cfg_attr(feature = "bindings", derive(TS))]
10529pub struct JoinHint {
10530 pub this: Box<Expression>,
10531 #[serde(default)]
10532 pub expressions: Vec<Expression>,
10533}
10534
10535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10537#[cfg_attr(feature = "bindings", derive(TS))]
10538pub struct Opclass {
10539 pub this: Box<Expression>,
10540 pub expression: Box<Expression>,
10541}
10542
10543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10545#[cfg_attr(feature = "bindings", derive(TS))]
10546pub struct Index {
10547 #[serde(default)]
10548 pub this: Option<Box<Expression>>,
10549 #[serde(default)]
10550 pub table: Option<Box<Expression>>,
10551 #[serde(default)]
10552 pub unique: bool,
10553 #[serde(default)]
10554 pub primary: Option<Box<Expression>>,
10555 #[serde(default)]
10556 pub amp: Option<Box<Expression>>,
10557 #[serde(default)]
10558 pub params: Vec<Expression>,
10559}
10560
10561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10563#[cfg_attr(feature = "bindings", derive(TS))]
10564pub struct IndexParameters {
10565 #[serde(default)]
10566 pub using: Option<Box<Expression>>,
10567 #[serde(default)]
10568 pub include: Option<Box<Expression>>,
10569 #[serde(default)]
10570 pub columns: Vec<Expression>,
10571 #[serde(default)]
10572 pub with_storage: Option<Box<Expression>>,
10573 #[serde(default)]
10574 pub partition_by: Option<Box<Expression>>,
10575 #[serde(default)]
10576 pub tablespace: Option<Box<Expression>>,
10577 #[serde(default)]
10578 pub where_: Option<Box<Expression>>,
10579 #[serde(default)]
10580 pub on: Option<Box<Expression>>,
10581}
10582
10583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10585#[cfg_attr(feature = "bindings", derive(TS))]
10586pub struct ConditionalInsert {
10587 pub this: Box<Expression>,
10588 #[serde(default)]
10589 pub expression: Option<Box<Expression>>,
10590 #[serde(default)]
10591 pub else_: Option<Box<Expression>>,
10592}
10593
10594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10596#[cfg_attr(feature = "bindings", derive(TS))]
10597pub struct MultitableInserts {
10598 #[serde(default)]
10599 pub expressions: Vec<Expression>,
10600 pub kind: String,
10601 #[serde(default)]
10602 pub source: Option<Box<Expression>>,
10603 #[serde(default)]
10605 pub leading_comments: Vec<String>,
10606 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10608 pub overwrite: bool,
10609}
10610
10611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10613#[cfg_attr(feature = "bindings", derive(TS))]
10614pub struct OnConflict {
10615 #[serde(default)]
10616 pub duplicate: Option<Box<Expression>>,
10617 #[serde(default)]
10618 pub expressions: Vec<Expression>,
10619 #[serde(default)]
10620 pub action: Option<Box<Expression>>,
10621 #[serde(default)]
10622 pub conflict_keys: Option<Box<Expression>>,
10623 #[serde(default)]
10624 pub index_predicate: Option<Box<Expression>>,
10625 #[serde(default)]
10626 pub constraint: Option<Box<Expression>>,
10627 #[serde(default)]
10628 pub where_: Option<Box<Expression>>,
10629}
10630
10631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10633#[cfg_attr(feature = "bindings", derive(TS))]
10634pub struct OnCondition {
10635 #[serde(default)]
10636 pub error: Option<Box<Expression>>,
10637 #[serde(default)]
10638 pub empty: Option<Box<Expression>>,
10639 #[serde(default)]
10640 pub null: Option<Box<Expression>>,
10641}
10642
10643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10645#[cfg_attr(feature = "bindings", derive(TS))]
10646pub struct Returning {
10647 #[serde(default)]
10648 pub expressions: Vec<Expression>,
10649 #[serde(default)]
10650 pub into: Option<Box<Expression>>,
10651}
10652
10653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10655#[cfg_attr(feature = "bindings", derive(TS))]
10656pub struct Introducer {
10657 pub this: Box<Expression>,
10658 pub expression: Box<Expression>,
10659}
10660
10661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10663#[cfg_attr(feature = "bindings", derive(TS))]
10664pub struct PartitionRange {
10665 pub this: Box<Expression>,
10666 #[serde(default)]
10667 pub expression: Option<Box<Expression>>,
10668 #[serde(default)]
10669 pub expressions: Vec<Expression>,
10670}
10671
10672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10674#[cfg_attr(feature = "bindings", derive(TS))]
10675pub struct Group {
10676 #[serde(default)]
10677 pub expressions: Vec<Expression>,
10678 #[serde(default)]
10679 pub grouping_sets: Option<Box<Expression>>,
10680 #[serde(default)]
10681 pub cube: Option<Box<Expression>>,
10682 #[serde(default)]
10683 pub rollup: Option<Box<Expression>>,
10684 #[serde(default)]
10685 pub totals: Option<Box<Expression>>,
10686 #[serde(default)]
10688 pub all: Option<bool>,
10689}
10690
10691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10693#[cfg_attr(feature = "bindings", derive(TS))]
10694pub struct Cube {
10695 #[serde(default)]
10696 pub expressions: Vec<Expression>,
10697}
10698
10699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10701#[cfg_attr(feature = "bindings", derive(TS))]
10702pub struct Rollup {
10703 #[serde(default)]
10704 pub expressions: Vec<Expression>,
10705}
10706
10707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10709#[cfg_attr(feature = "bindings", derive(TS))]
10710pub struct GroupingSets {
10711 #[serde(default)]
10712 pub expressions: Vec<Expression>,
10713}
10714
10715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10717#[cfg_attr(feature = "bindings", derive(TS))]
10718pub struct LimitOptions {
10719 #[serde(default)]
10720 pub percent: Option<Box<Expression>>,
10721 #[serde(default)]
10722 pub rows: Option<Box<Expression>>,
10723 #[serde(default)]
10724 pub with_ties: Option<Box<Expression>>,
10725}
10726
10727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10729#[cfg_attr(feature = "bindings", derive(TS))]
10730pub struct Lateral {
10731 pub this: Box<Expression>,
10732 #[serde(default)]
10733 pub view: Option<Box<Expression>>,
10734 #[serde(default)]
10735 pub outer: Option<Box<Expression>>,
10736 #[serde(default)]
10737 pub alias: Option<String>,
10738 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10740 pub alias_quoted: bool,
10741 #[serde(default)]
10742 pub cross_apply: Option<Box<Expression>>,
10743 #[serde(default)]
10744 pub ordinality: Option<Box<Expression>>,
10745 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10747 pub column_aliases: Vec<String>,
10748}
10749
10750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10752#[cfg_attr(feature = "bindings", derive(TS))]
10753pub struct TableFromRows {
10754 pub this: Box<Expression>,
10755 #[serde(default)]
10756 pub alias: Option<String>,
10757 #[serde(default)]
10758 pub joins: Vec<Expression>,
10759 #[serde(default)]
10760 pub pivots: Option<Box<Expression>>,
10761 #[serde(default)]
10762 pub sample: Option<Box<Expression>>,
10763}
10764
10765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10768#[cfg_attr(feature = "bindings", derive(TS))]
10769pub struct RowsFrom {
10770 pub expressions: Vec<Expression>,
10772 #[serde(default)]
10774 pub ordinality: bool,
10775 #[serde(default)]
10777 pub alias: Option<Box<Expression>>,
10778}
10779
10780#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10782#[cfg_attr(feature = "bindings", derive(TS))]
10783pub struct WithFill {
10784 #[serde(default)]
10785 pub from_: Option<Box<Expression>>,
10786 #[serde(default)]
10787 pub to: Option<Box<Expression>>,
10788 #[serde(default)]
10789 pub step: Option<Box<Expression>>,
10790 #[serde(default)]
10791 pub staleness: Option<Box<Expression>>,
10792 #[serde(default)]
10793 pub interpolate: Option<Box<Expression>>,
10794}
10795
10796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10798#[cfg_attr(feature = "bindings", derive(TS))]
10799pub struct Property {
10800 pub this: Box<Expression>,
10801 #[serde(default)]
10802 pub value: Option<Box<Expression>>,
10803}
10804
10805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10807#[cfg_attr(feature = "bindings", derive(TS))]
10808pub struct GrantPrivilege {
10809 pub this: Box<Expression>,
10810 #[serde(default)]
10811 pub expressions: Vec<Expression>,
10812}
10813
10814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10816#[cfg_attr(feature = "bindings", derive(TS))]
10817pub struct AllowedValuesProperty {
10818 #[serde(default)]
10819 pub expressions: Vec<Expression>,
10820}
10821
10822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10824#[cfg_attr(feature = "bindings", derive(TS))]
10825pub struct AlgorithmProperty {
10826 pub this: Box<Expression>,
10827}
10828
10829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10831#[cfg_attr(feature = "bindings", derive(TS))]
10832pub struct AutoIncrementProperty {
10833 pub this: Box<Expression>,
10834}
10835
10836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10838#[cfg_attr(feature = "bindings", derive(TS))]
10839pub struct AutoRefreshProperty {
10840 pub this: Box<Expression>,
10841}
10842
10843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10845#[cfg_attr(feature = "bindings", derive(TS))]
10846pub struct BackupProperty {
10847 pub this: Box<Expression>,
10848}
10849
10850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10852#[cfg_attr(feature = "bindings", derive(TS))]
10853pub struct BuildProperty {
10854 pub this: Box<Expression>,
10855}
10856
10857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10859#[cfg_attr(feature = "bindings", derive(TS))]
10860pub struct BlockCompressionProperty {
10861 #[serde(default)]
10862 pub autotemp: Option<Box<Expression>>,
10863 #[serde(default)]
10864 pub always: Option<Box<Expression>>,
10865 #[serde(default)]
10866 pub default: Option<Box<Expression>>,
10867 #[serde(default)]
10868 pub manual: Option<Box<Expression>>,
10869 #[serde(default)]
10870 pub never: Option<Box<Expression>>,
10871}
10872
10873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10875#[cfg_attr(feature = "bindings", derive(TS))]
10876pub struct CharacterSetProperty {
10877 pub this: Box<Expression>,
10878 #[serde(default)]
10879 pub default: Option<Box<Expression>>,
10880}
10881
10882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10884#[cfg_attr(feature = "bindings", derive(TS))]
10885pub struct ChecksumProperty {
10886 #[serde(default)]
10887 pub on: Option<Box<Expression>>,
10888 #[serde(default)]
10889 pub default: Option<Box<Expression>>,
10890}
10891
10892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10894#[cfg_attr(feature = "bindings", derive(TS))]
10895pub struct CollateProperty {
10896 pub this: Box<Expression>,
10897 #[serde(default)]
10898 pub default: Option<Box<Expression>>,
10899}
10900
10901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10903#[cfg_attr(feature = "bindings", derive(TS))]
10904pub struct DataBlocksizeProperty {
10905 #[serde(default)]
10906 pub size: Option<i64>,
10907 #[serde(default)]
10908 pub units: Option<Box<Expression>>,
10909 #[serde(default)]
10910 pub minimum: Option<Box<Expression>>,
10911 #[serde(default)]
10912 pub maximum: Option<Box<Expression>>,
10913 #[serde(default)]
10914 pub default: Option<Box<Expression>>,
10915}
10916
10917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10919#[cfg_attr(feature = "bindings", derive(TS))]
10920pub struct DataDeletionProperty {
10921 pub on: Box<Expression>,
10922 #[serde(default)]
10923 pub filter_column: Option<Box<Expression>>,
10924 #[serde(default)]
10925 pub retention_period: Option<Box<Expression>>,
10926}
10927
10928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10930#[cfg_attr(feature = "bindings", derive(TS))]
10931pub struct DefinerProperty {
10932 pub this: Box<Expression>,
10933}
10934
10935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10937#[cfg_attr(feature = "bindings", derive(TS))]
10938pub struct DistKeyProperty {
10939 pub this: Box<Expression>,
10940}
10941
10942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10944#[cfg_attr(feature = "bindings", derive(TS))]
10945pub struct DistributedByProperty {
10946 #[serde(default)]
10947 pub expressions: Vec<Expression>,
10948 pub kind: String,
10949 #[serde(default)]
10950 pub buckets: Option<Box<Expression>>,
10951 #[serde(default)]
10952 pub order: Option<Box<Expression>>,
10953}
10954
10955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10957#[cfg_attr(feature = "bindings", derive(TS))]
10958pub struct DistStyleProperty {
10959 pub this: Box<Expression>,
10960}
10961
10962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10964#[cfg_attr(feature = "bindings", derive(TS))]
10965pub struct DuplicateKeyProperty {
10966 #[serde(default)]
10967 pub expressions: Vec<Expression>,
10968}
10969
10970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10972#[cfg_attr(feature = "bindings", derive(TS))]
10973pub struct EngineProperty {
10974 pub this: Box<Expression>,
10975}
10976
10977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10979#[cfg_attr(feature = "bindings", derive(TS))]
10980pub struct ToTableProperty {
10981 pub this: Box<Expression>,
10982}
10983
10984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10986#[cfg_attr(feature = "bindings", derive(TS))]
10987pub struct ExecuteAsProperty {
10988 pub this: Box<Expression>,
10989}
10990
10991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10993#[cfg_attr(feature = "bindings", derive(TS))]
10994pub struct ExternalProperty {
10995 #[serde(default)]
10996 pub this: Option<Box<Expression>>,
10997}
10998
10999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11001#[cfg_attr(feature = "bindings", derive(TS))]
11002pub struct FallbackProperty {
11003 #[serde(default)]
11004 pub no: Option<Box<Expression>>,
11005 #[serde(default)]
11006 pub protection: Option<Box<Expression>>,
11007}
11008
11009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11011#[cfg_attr(feature = "bindings", derive(TS))]
11012pub struct FileFormatProperty {
11013 #[serde(default)]
11014 pub this: Option<Box<Expression>>,
11015 #[serde(default)]
11016 pub expressions: Vec<Expression>,
11017 #[serde(default)]
11018 pub hive_format: Option<Box<Expression>>,
11019}
11020
11021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11023#[cfg_attr(feature = "bindings", derive(TS))]
11024pub struct CredentialsProperty {
11025 #[serde(default)]
11026 pub expressions: Vec<Expression>,
11027}
11028
11029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11031#[cfg_attr(feature = "bindings", derive(TS))]
11032pub struct FreespaceProperty {
11033 pub this: Box<Expression>,
11034 #[serde(default)]
11035 pub percent: Option<Box<Expression>>,
11036}
11037
11038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11040#[cfg_attr(feature = "bindings", derive(TS))]
11041pub struct InheritsProperty {
11042 #[serde(default)]
11043 pub expressions: Vec<Expression>,
11044}
11045
11046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11048#[cfg_attr(feature = "bindings", derive(TS))]
11049pub struct InputModelProperty {
11050 pub this: Box<Expression>,
11051}
11052
11053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11055#[cfg_attr(feature = "bindings", derive(TS))]
11056pub struct OutputModelProperty {
11057 pub this: Box<Expression>,
11058}
11059
11060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11062#[cfg_attr(feature = "bindings", derive(TS))]
11063pub struct IsolatedLoadingProperty {
11064 #[serde(default)]
11065 pub no: Option<Box<Expression>>,
11066 #[serde(default)]
11067 pub concurrent: Option<Box<Expression>>,
11068 #[serde(default)]
11069 pub target: Option<Box<Expression>>,
11070}
11071
11072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11074#[cfg_attr(feature = "bindings", derive(TS))]
11075pub struct JournalProperty {
11076 #[serde(default)]
11077 pub no: Option<Box<Expression>>,
11078 #[serde(default)]
11079 pub dual: Option<Box<Expression>>,
11080 #[serde(default)]
11081 pub before: Option<Box<Expression>>,
11082 #[serde(default)]
11083 pub local: Option<Box<Expression>>,
11084 #[serde(default)]
11085 pub after: Option<Box<Expression>>,
11086}
11087
11088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11090#[cfg_attr(feature = "bindings", derive(TS))]
11091pub struct LanguageProperty {
11092 pub this: Box<Expression>,
11093}
11094
11095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11097#[cfg_attr(feature = "bindings", derive(TS))]
11098pub struct EnviromentProperty {
11099 #[serde(default)]
11100 pub expressions: Vec<Expression>,
11101}
11102
11103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11105#[cfg_attr(feature = "bindings", derive(TS))]
11106pub struct ClusteredByProperty {
11107 #[serde(default)]
11108 pub expressions: Vec<Expression>,
11109 #[serde(default)]
11110 pub sorted_by: Option<Box<Expression>>,
11111 #[serde(default)]
11112 pub buckets: Option<Box<Expression>>,
11113}
11114
11115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11117#[cfg_attr(feature = "bindings", derive(TS))]
11118pub struct DictProperty {
11119 pub this: Box<Expression>,
11120 pub kind: String,
11121 #[serde(default)]
11122 pub settings: Option<Box<Expression>>,
11123}
11124
11125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11127#[cfg_attr(feature = "bindings", derive(TS))]
11128pub struct DictRange {
11129 pub this: Box<Expression>,
11130 #[serde(default)]
11131 pub min: Option<Box<Expression>>,
11132 #[serde(default)]
11133 pub max: Option<Box<Expression>>,
11134}
11135
11136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11138#[cfg_attr(feature = "bindings", derive(TS))]
11139pub struct OnCluster {
11140 pub this: Box<Expression>,
11141}
11142
11143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11145#[cfg_attr(feature = "bindings", derive(TS))]
11146pub struct LikeProperty {
11147 pub this: Box<Expression>,
11148 #[serde(default)]
11149 pub expressions: Vec<Expression>,
11150}
11151
11152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11154#[cfg_attr(feature = "bindings", derive(TS))]
11155pub struct LocationProperty {
11156 pub this: Box<Expression>,
11157}
11158
11159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11161#[cfg_attr(feature = "bindings", derive(TS))]
11162pub struct LockProperty {
11163 pub this: Box<Expression>,
11164}
11165
11166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11168#[cfg_attr(feature = "bindings", derive(TS))]
11169pub struct LockingProperty {
11170 #[serde(default)]
11171 pub this: Option<Box<Expression>>,
11172 pub kind: String,
11173 #[serde(default)]
11174 pub for_or_in: Option<Box<Expression>>,
11175 #[serde(default)]
11176 pub lock_type: Option<Box<Expression>>,
11177 #[serde(default)]
11178 pub override_: Option<Box<Expression>>,
11179}
11180
11181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11183#[cfg_attr(feature = "bindings", derive(TS))]
11184pub struct LogProperty {
11185 #[serde(default)]
11186 pub no: Option<Box<Expression>>,
11187}
11188
11189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11191#[cfg_attr(feature = "bindings", derive(TS))]
11192pub struct MaterializedProperty {
11193 #[serde(default)]
11194 pub this: Option<Box<Expression>>,
11195}
11196
11197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11199#[cfg_attr(feature = "bindings", derive(TS))]
11200pub struct MergeBlockRatioProperty {
11201 #[serde(default)]
11202 pub this: Option<Box<Expression>>,
11203 #[serde(default)]
11204 pub no: Option<Box<Expression>>,
11205 #[serde(default)]
11206 pub default: Option<Box<Expression>>,
11207 #[serde(default)]
11208 pub percent: Option<Box<Expression>>,
11209}
11210
11211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11213#[cfg_attr(feature = "bindings", derive(TS))]
11214pub struct OnProperty {
11215 pub this: Box<Expression>,
11216}
11217
11218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11220#[cfg_attr(feature = "bindings", derive(TS))]
11221pub struct OnCommitProperty {
11222 #[serde(default)]
11223 pub delete: Option<Box<Expression>>,
11224}
11225
11226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11228#[cfg_attr(feature = "bindings", derive(TS))]
11229pub struct PartitionedByProperty {
11230 pub this: Box<Expression>,
11231}
11232
11233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11235#[cfg_attr(feature = "bindings", derive(TS))]
11236pub struct PartitionByProperty {
11237 #[serde(default)]
11238 pub expressions: Vec<Expression>,
11239}
11240
11241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11243#[cfg_attr(feature = "bindings", derive(TS))]
11244pub struct PartitionedByBucket {
11245 pub this: Box<Expression>,
11246 pub expression: Box<Expression>,
11247}
11248
11249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11251#[cfg_attr(feature = "bindings", derive(TS))]
11252pub struct ClusterByColumnsProperty {
11253 #[serde(default)]
11254 pub columns: Vec<Identifier>,
11255}
11256
11257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11259#[cfg_attr(feature = "bindings", derive(TS))]
11260pub struct PartitionByTruncate {
11261 pub this: Box<Expression>,
11262 pub expression: Box<Expression>,
11263}
11264
11265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11267#[cfg_attr(feature = "bindings", derive(TS))]
11268pub struct PartitionByRangeProperty {
11269 #[serde(default)]
11270 pub partition_expressions: Option<Box<Expression>>,
11271 #[serde(default)]
11272 pub create_expressions: Option<Box<Expression>>,
11273}
11274
11275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11277#[cfg_attr(feature = "bindings", derive(TS))]
11278pub struct PartitionByRangePropertyDynamic {
11279 #[serde(default)]
11280 pub this: Option<Box<Expression>>,
11281 #[serde(default)]
11282 pub start: Option<Box<Expression>>,
11283 #[serde(default)]
11285 pub use_start_end: bool,
11286 #[serde(default)]
11287 pub end: Option<Box<Expression>>,
11288 #[serde(default)]
11289 pub every: Option<Box<Expression>>,
11290}
11291
11292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11294#[cfg_attr(feature = "bindings", derive(TS))]
11295pub struct PartitionByListProperty {
11296 #[serde(default)]
11297 pub partition_expressions: Option<Box<Expression>>,
11298 #[serde(default)]
11299 pub create_expressions: Option<Box<Expression>>,
11300}
11301
11302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11304#[cfg_attr(feature = "bindings", derive(TS))]
11305pub struct PartitionList {
11306 pub this: Box<Expression>,
11307 #[serde(default)]
11308 pub expressions: Vec<Expression>,
11309}
11310
11311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11313#[cfg_attr(feature = "bindings", derive(TS))]
11314pub struct Partition {
11315 pub expressions: Vec<Expression>,
11316 #[serde(default)]
11317 pub subpartition: bool,
11318}
11319
11320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11323#[cfg_attr(feature = "bindings", derive(TS))]
11324pub struct RefreshTriggerProperty {
11325 pub method: String,
11327 #[serde(default)]
11329 pub kind: Option<String>,
11330 #[serde(default)]
11332 pub every: Option<Box<Expression>>,
11333 #[serde(default)]
11335 pub unit: Option<String>,
11336 #[serde(default)]
11338 pub starts: Option<Box<Expression>>,
11339}
11340
11341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11343#[cfg_attr(feature = "bindings", derive(TS))]
11344pub struct UniqueKeyProperty {
11345 #[serde(default)]
11346 pub expressions: Vec<Expression>,
11347}
11348
11349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11351#[cfg_attr(feature = "bindings", derive(TS))]
11352pub struct RollupProperty {
11353 pub expressions: Vec<RollupIndex>,
11354}
11355
11356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11358#[cfg_attr(feature = "bindings", derive(TS))]
11359pub struct RollupIndex {
11360 pub name: Identifier,
11361 pub expressions: Vec<Identifier>,
11362}
11363
11364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11366#[cfg_attr(feature = "bindings", derive(TS))]
11367pub struct PartitionBoundSpec {
11368 #[serde(default)]
11369 pub this: Option<Box<Expression>>,
11370 #[serde(default)]
11371 pub expression: Option<Box<Expression>>,
11372 #[serde(default)]
11373 pub from_expressions: Option<Box<Expression>>,
11374 #[serde(default)]
11375 pub to_expressions: Option<Box<Expression>>,
11376}
11377
11378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11380#[cfg_attr(feature = "bindings", derive(TS))]
11381pub struct PartitionedOfProperty {
11382 pub this: Box<Expression>,
11383 pub expression: Box<Expression>,
11384}
11385
11386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11388#[cfg_attr(feature = "bindings", derive(TS))]
11389pub struct RemoteWithConnectionModelProperty {
11390 pub this: Box<Expression>,
11391}
11392
11393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11395#[cfg_attr(feature = "bindings", derive(TS))]
11396pub struct ReturnsProperty {
11397 #[serde(default)]
11398 pub this: Option<Box<Expression>>,
11399 #[serde(default)]
11400 pub is_table: Option<Box<Expression>>,
11401 #[serde(default)]
11402 pub table: Option<Box<Expression>>,
11403 #[serde(default)]
11404 pub null: Option<Box<Expression>>,
11405}
11406
11407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11409#[cfg_attr(feature = "bindings", derive(TS))]
11410pub struct RowFormatProperty {
11411 pub this: Box<Expression>,
11412}
11413
11414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11416#[cfg_attr(feature = "bindings", derive(TS))]
11417pub struct RowFormatDelimitedProperty {
11418 #[serde(default)]
11419 pub fields: Option<Box<Expression>>,
11420 #[serde(default)]
11421 pub escaped: Option<Box<Expression>>,
11422 #[serde(default)]
11423 pub collection_items: Option<Box<Expression>>,
11424 #[serde(default)]
11425 pub map_keys: Option<Box<Expression>>,
11426 #[serde(default)]
11427 pub lines: Option<Box<Expression>>,
11428 #[serde(default)]
11429 pub null: Option<Box<Expression>>,
11430 #[serde(default)]
11431 pub serde: Option<Box<Expression>>,
11432}
11433
11434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11436#[cfg_attr(feature = "bindings", derive(TS))]
11437pub struct RowFormatSerdeProperty {
11438 pub this: Box<Expression>,
11439 #[serde(default)]
11440 pub serde_properties: Option<Box<Expression>>,
11441}
11442
11443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11445#[cfg_attr(feature = "bindings", derive(TS))]
11446pub struct QueryTransform {
11447 #[serde(default)]
11448 pub expressions: Vec<Expression>,
11449 #[serde(default)]
11450 pub command_script: Option<Box<Expression>>,
11451 #[serde(default)]
11452 pub schema: Option<Box<Expression>>,
11453 #[serde(default)]
11454 pub row_format_before: Option<Box<Expression>>,
11455 #[serde(default)]
11456 pub record_writer: Option<Box<Expression>>,
11457 #[serde(default)]
11458 pub row_format_after: Option<Box<Expression>>,
11459 #[serde(default)]
11460 pub record_reader: Option<Box<Expression>>,
11461}
11462
11463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11465#[cfg_attr(feature = "bindings", derive(TS))]
11466pub struct SampleProperty {
11467 pub this: Box<Expression>,
11468}
11469
11470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11472#[cfg_attr(feature = "bindings", derive(TS))]
11473pub struct SecurityProperty {
11474 pub this: Box<Expression>,
11475}
11476
11477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11479#[cfg_attr(feature = "bindings", derive(TS))]
11480pub struct SchemaCommentProperty {
11481 pub this: Box<Expression>,
11482}
11483
11484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11486#[cfg_attr(feature = "bindings", derive(TS))]
11487pub struct SemanticView {
11488 pub this: Box<Expression>,
11489 #[serde(default)]
11490 pub metrics: Option<Box<Expression>>,
11491 #[serde(default)]
11492 pub dimensions: Option<Box<Expression>>,
11493 #[serde(default)]
11494 pub facts: Option<Box<Expression>>,
11495 #[serde(default)]
11496 pub where_: Option<Box<Expression>>,
11497}
11498
11499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11501#[cfg_attr(feature = "bindings", derive(TS))]
11502pub struct SerdeProperties {
11503 #[serde(default)]
11504 pub expressions: Vec<Expression>,
11505 #[serde(default)]
11506 pub with_: Option<Box<Expression>>,
11507}
11508
11509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11511#[cfg_attr(feature = "bindings", derive(TS))]
11512pub struct SetProperty {
11513 #[serde(default)]
11514 pub multi: Option<Box<Expression>>,
11515}
11516
11517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11519#[cfg_attr(feature = "bindings", derive(TS))]
11520pub struct SharingProperty {
11521 #[serde(default)]
11522 pub this: Option<Box<Expression>>,
11523}
11524
11525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11527#[cfg_attr(feature = "bindings", derive(TS))]
11528pub struct SetConfigProperty {
11529 pub this: Box<Expression>,
11530}
11531
11532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11534#[cfg_attr(feature = "bindings", derive(TS))]
11535pub struct SettingsProperty {
11536 #[serde(default)]
11537 pub expressions: Vec<Expression>,
11538}
11539
11540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11542#[cfg_attr(feature = "bindings", derive(TS))]
11543pub struct SortKeyProperty {
11544 pub this: Box<Expression>,
11545 #[serde(default)]
11546 pub compound: Option<Box<Expression>>,
11547}
11548
11549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11551#[cfg_attr(feature = "bindings", derive(TS))]
11552pub struct SqlReadWriteProperty {
11553 pub this: Box<Expression>,
11554}
11555
11556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11558#[cfg_attr(feature = "bindings", derive(TS))]
11559pub struct SqlSecurityProperty {
11560 pub this: Box<Expression>,
11561}
11562
11563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11565#[cfg_attr(feature = "bindings", derive(TS))]
11566pub struct StabilityProperty {
11567 pub this: Box<Expression>,
11568}
11569
11570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11572#[cfg_attr(feature = "bindings", derive(TS))]
11573pub struct StorageHandlerProperty {
11574 pub this: Box<Expression>,
11575}
11576
11577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11579#[cfg_attr(feature = "bindings", derive(TS))]
11580pub struct TemporaryProperty {
11581 #[serde(default)]
11582 pub this: Option<Box<Expression>>,
11583}
11584
11585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11587#[cfg_attr(feature = "bindings", derive(TS))]
11588pub struct Tags {
11589 #[serde(default)]
11590 pub expressions: Vec<Expression>,
11591}
11592
11593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11595#[cfg_attr(feature = "bindings", derive(TS))]
11596pub struct TransformModelProperty {
11597 #[serde(default)]
11598 pub expressions: Vec<Expression>,
11599}
11600
11601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11603#[cfg_attr(feature = "bindings", derive(TS))]
11604pub struct TransientProperty {
11605 #[serde(default)]
11606 pub this: Option<Box<Expression>>,
11607}
11608
11609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11611#[cfg_attr(feature = "bindings", derive(TS))]
11612pub struct UsingTemplateProperty {
11613 pub this: Box<Expression>,
11614}
11615
11616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11618#[cfg_attr(feature = "bindings", derive(TS))]
11619pub struct ViewAttributeProperty {
11620 pub this: Box<Expression>,
11621}
11622
11623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11625#[cfg_attr(feature = "bindings", derive(TS))]
11626pub struct VolatileProperty {
11627 #[serde(default)]
11628 pub this: Option<Box<Expression>>,
11629}
11630
11631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11633#[cfg_attr(feature = "bindings", derive(TS))]
11634pub struct WithDataProperty {
11635 #[serde(default)]
11636 pub no: Option<Box<Expression>>,
11637 #[serde(default)]
11638 pub statistics: Option<Box<Expression>>,
11639}
11640
11641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11643#[cfg_attr(feature = "bindings", derive(TS))]
11644pub struct WithJournalTableProperty {
11645 pub this: Box<Expression>,
11646}
11647
11648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11650#[cfg_attr(feature = "bindings", derive(TS))]
11651pub struct WithSchemaBindingProperty {
11652 pub this: Box<Expression>,
11653}
11654
11655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11657#[cfg_attr(feature = "bindings", derive(TS))]
11658pub struct WithSystemVersioningProperty {
11659 #[serde(default)]
11660 pub on: Option<Box<Expression>>,
11661 #[serde(default)]
11662 pub this: Option<Box<Expression>>,
11663 #[serde(default)]
11664 pub data_consistency: Option<Box<Expression>>,
11665 #[serde(default)]
11666 pub retention_period: Option<Box<Expression>>,
11667 #[serde(default)]
11668 pub with_: Option<Box<Expression>>,
11669}
11670
11671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11673#[cfg_attr(feature = "bindings", derive(TS))]
11674pub struct WithProcedureOptions {
11675 #[serde(default)]
11676 pub expressions: Vec<Expression>,
11677}
11678
11679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11681#[cfg_attr(feature = "bindings", derive(TS))]
11682pub struct EncodeProperty {
11683 pub this: Box<Expression>,
11684 #[serde(default)]
11685 pub properties: Vec<Expression>,
11686 #[serde(default)]
11687 pub key: Option<Box<Expression>>,
11688}
11689
11690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11692#[cfg_attr(feature = "bindings", derive(TS))]
11693pub struct IncludeProperty {
11694 pub this: Box<Expression>,
11695 #[serde(default)]
11696 pub alias: Option<String>,
11697 #[serde(default)]
11698 pub column_def: Option<Box<Expression>>,
11699}
11700
11701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11703#[cfg_attr(feature = "bindings", derive(TS))]
11704pub struct Properties {
11705 #[serde(default)]
11706 pub expressions: Vec<Expression>,
11707}
11708
11709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11711#[cfg_attr(feature = "bindings", derive(TS))]
11712pub struct OptionEntry {
11713 pub key: Identifier,
11714 pub value: Expression,
11715}
11716
11717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11719#[cfg_attr(feature = "bindings", derive(TS))]
11720pub struct OptionsProperty {
11721 #[serde(default)]
11722 pub entries: Vec<OptionEntry>,
11723}
11724
11725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11727#[cfg_attr(feature = "bindings", derive(TS))]
11728pub struct InputOutputFormat {
11729 #[serde(default)]
11730 pub input_format: Option<Box<Expression>>,
11731 #[serde(default)]
11732 pub output_format: Option<Box<Expression>>,
11733}
11734
11735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11737#[cfg_attr(feature = "bindings", derive(TS))]
11738pub struct Reference {
11739 pub this: Box<Expression>,
11740 #[serde(default)]
11741 pub expressions: Vec<Expression>,
11742 #[serde(default)]
11743 pub options: Vec<Expression>,
11744}
11745
11746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11748#[cfg_attr(feature = "bindings", derive(TS))]
11749pub struct QueryOption {
11750 pub this: Box<Expression>,
11751 #[serde(default)]
11752 pub expression: Option<Box<Expression>>,
11753}
11754
11755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11757#[cfg_attr(feature = "bindings", derive(TS))]
11758pub struct WithTableHint {
11759 #[serde(default)]
11760 pub expressions: Vec<Expression>,
11761}
11762
11763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11765#[cfg_attr(feature = "bindings", derive(TS))]
11766pub struct IndexTableHint {
11767 pub this: Box<Expression>,
11768 #[serde(default)]
11769 pub expressions: Vec<Expression>,
11770 #[serde(default)]
11771 pub target: Option<Box<Expression>>,
11772}
11773
11774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11776#[cfg_attr(feature = "bindings", derive(TS))]
11777pub struct Get {
11778 pub this: Box<Expression>,
11779 #[serde(default)]
11780 pub target: Option<Box<Expression>>,
11781 #[serde(default)]
11782 pub properties: Vec<Expression>,
11783}
11784
11785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11787#[cfg_attr(feature = "bindings", derive(TS))]
11788pub struct SetOperation {
11789 #[serde(default)]
11790 pub with_: Option<Box<Expression>>,
11791 pub this: Box<Expression>,
11792 pub expression: Box<Expression>,
11793 #[serde(default)]
11794 pub distinct: bool,
11795 #[serde(default)]
11796 pub by_name: Option<Box<Expression>>,
11797 #[serde(default)]
11798 pub side: Option<Box<Expression>>,
11799 #[serde(default)]
11800 pub kind: Option<String>,
11801 #[serde(default)]
11802 pub on: Option<Box<Expression>>,
11803}
11804
11805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11807#[cfg_attr(feature = "bindings", derive(TS))]
11808pub struct Var {
11809 pub this: String,
11810}
11811
11812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11814#[cfg_attr(feature = "bindings", derive(TS))]
11815pub struct Variadic {
11816 pub this: Box<Expression>,
11817}
11818
11819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11821#[cfg_attr(feature = "bindings", derive(TS))]
11822pub struct Version {
11823 pub this: Box<Expression>,
11824 pub kind: String,
11825 #[serde(default)]
11826 pub expression: Option<Box<Expression>>,
11827}
11828
11829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11831#[cfg_attr(feature = "bindings", derive(TS))]
11832pub struct Schema {
11833 #[serde(default)]
11834 pub this: Option<Box<Expression>>,
11835 #[serde(default)]
11836 pub expressions: Vec<Expression>,
11837}
11838
11839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11841#[cfg_attr(feature = "bindings", derive(TS))]
11842pub struct Lock {
11843 #[serde(default)]
11844 pub update: Option<Box<Expression>>,
11845 #[serde(default)]
11846 pub expressions: Vec<Expression>,
11847 #[serde(default)]
11848 pub wait: Option<Box<Expression>>,
11849 #[serde(default)]
11850 pub key: Option<Box<Expression>>,
11851}
11852
11853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11856#[cfg_attr(feature = "bindings", derive(TS))]
11857pub struct TableSample {
11858 #[serde(default, skip_serializing_if = "Option::is_none")]
11860 pub this: Option<Box<Expression>>,
11861 #[serde(default, skip_serializing_if = "Option::is_none")]
11863 pub sample: Option<Box<Sample>>,
11864 #[serde(default)]
11865 pub expressions: Vec<Expression>,
11866 #[serde(default)]
11867 pub method: Option<String>,
11868 #[serde(default)]
11869 pub bucket_numerator: Option<Box<Expression>>,
11870 #[serde(default)]
11871 pub bucket_denominator: Option<Box<Expression>>,
11872 #[serde(default)]
11873 pub bucket_field: Option<Box<Expression>>,
11874 #[serde(default)]
11875 pub percent: Option<Box<Expression>>,
11876 #[serde(default)]
11877 pub rows: Option<Box<Expression>>,
11878 #[serde(default)]
11879 pub size: Option<i64>,
11880 #[serde(default)]
11881 pub seed: Option<Box<Expression>>,
11882}
11883
11884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11886#[cfg_attr(feature = "bindings", derive(TS))]
11887pub struct Tag {
11888 #[serde(default)]
11889 pub this: Option<Box<Expression>>,
11890 #[serde(default)]
11891 pub prefix: Option<Box<Expression>>,
11892 #[serde(default)]
11893 pub postfix: Option<Box<Expression>>,
11894}
11895
11896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11898#[cfg_attr(feature = "bindings", derive(TS))]
11899pub struct UnpivotColumns {
11900 pub this: Box<Expression>,
11901 #[serde(default)]
11902 pub expressions: Vec<Expression>,
11903}
11904
11905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11907#[cfg_attr(feature = "bindings", derive(TS))]
11908pub struct SessionParameter {
11909 pub this: Box<Expression>,
11910 #[serde(default)]
11911 pub kind: Option<String>,
11912}
11913
11914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11916#[cfg_attr(feature = "bindings", derive(TS))]
11917pub struct PseudoType {
11918 pub this: Box<Expression>,
11919}
11920
11921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11923#[cfg_attr(feature = "bindings", derive(TS))]
11924pub struct ObjectIdentifier {
11925 pub this: Box<Expression>,
11926}
11927
11928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11930#[cfg_attr(feature = "bindings", derive(TS))]
11931pub struct Transaction {
11932 #[serde(default)]
11933 pub this: Option<Box<Expression>>,
11934 #[serde(default)]
11935 pub modes: Option<Box<Expression>>,
11936 #[serde(default)]
11937 pub mark: Option<Box<Expression>>,
11938}
11939
11940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11942#[cfg_attr(feature = "bindings", derive(TS))]
11943pub struct Commit {
11944 #[serde(default)]
11945 pub chain: Option<Box<Expression>>,
11946 #[serde(default)]
11947 pub this: Option<Box<Expression>>,
11948 #[serde(default)]
11949 pub durability: Option<Box<Expression>>,
11950}
11951
11952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11954#[cfg_attr(feature = "bindings", derive(TS))]
11955pub struct Rollback {
11956 #[serde(default)]
11957 pub savepoint: Option<Box<Expression>>,
11958 #[serde(default)]
11959 pub this: Option<Box<Expression>>,
11960}
11961
11962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11964#[cfg_attr(feature = "bindings", derive(TS))]
11965pub struct AlterSession {
11966 #[serde(default)]
11967 pub expressions: Vec<Expression>,
11968 #[serde(default)]
11969 pub unset: Option<Box<Expression>>,
11970}
11971
11972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11974#[cfg_attr(feature = "bindings", derive(TS))]
11975pub struct Analyze {
11976 #[serde(default)]
11977 pub kind: Option<String>,
11978 #[serde(default)]
11979 pub this: Option<Box<Expression>>,
11980 #[serde(default)]
11981 pub options: Vec<Expression>,
11982 #[serde(default)]
11983 pub mode: Option<Box<Expression>>,
11984 #[serde(default)]
11985 pub partition: Option<Box<Expression>>,
11986 #[serde(default)]
11987 pub expression: Option<Box<Expression>>,
11988 #[serde(default)]
11989 pub properties: Vec<Expression>,
11990 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11992 pub columns: Vec<String>,
11993}
11994
11995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11997#[cfg_attr(feature = "bindings", derive(TS))]
11998pub struct AnalyzeStatistics {
11999 pub kind: String,
12000 #[serde(default)]
12001 pub option: Option<Box<Expression>>,
12002 #[serde(default)]
12003 pub this: Option<Box<Expression>>,
12004 #[serde(default)]
12005 pub expressions: Vec<Expression>,
12006}
12007
12008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12010#[cfg_attr(feature = "bindings", derive(TS))]
12011pub struct AnalyzeHistogram {
12012 pub this: Box<Expression>,
12013 #[serde(default)]
12014 pub expressions: Vec<Expression>,
12015 #[serde(default)]
12016 pub expression: Option<Box<Expression>>,
12017 #[serde(default)]
12018 pub update_options: Option<Box<Expression>>,
12019}
12020
12021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12023#[cfg_attr(feature = "bindings", derive(TS))]
12024pub struct AnalyzeSample {
12025 pub kind: String,
12026 #[serde(default)]
12027 pub sample: Option<Box<Expression>>,
12028}
12029
12030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12032#[cfg_attr(feature = "bindings", derive(TS))]
12033pub struct AnalyzeListChainedRows {
12034 #[serde(default)]
12035 pub expression: Option<Box<Expression>>,
12036}
12037
12038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12040#[cfg_attr(feature = "bindings", derive(TS))]
12041pub struct AnalyzeDelete {
12042 #[serde(default)]
12043 pub kind: Option<String>,
12044}
12045
12046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12048#[cfg_attr(feature = "bindings", derive(TS))]
12049pub struct AnalyzeWith {
12050 #[serde(default)]
12051 pub expressions: Vec<Expression>,
12052}
12053
12054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12056#[cfg_attr(feature = "bindings", derive(TS))]
12057pub struct AnalyzeValidate {
12058 pub kind: String,
12059 #[serde(default)]
12060 pub this: Option<Box<Expression>>,
12061 #[serde(default)]
12062 pub expression: Option<Box<Expression>>,
12063}
12064
12065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12067#[cfg_attr(feature = "bindings", derive(TS))]
12068pub struct AddPartition {
12069 pub this: Box<Expression>,
12070 #[serde(default)]
12071 pub exists: bool,
12072 #[serde(default)]
12073 pub location: Option<Box<Expression>>,
12074}
12075
12076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12078#[cfg_attr(feature = "bindings", derive(TS))]
12079pub struct AttachOption {
12080 pub this: Box<Expression>,
12081 #[serde(default)]
12082 pub expression: Option<Box<Expression>>,
12083}
12084
12085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12087#[cfg_attr(feature = "bindings", derive(TS))]
12088pub struct DropPartition {
12089 #[serde(default)]
12090 pub expressions: Vec<Expression>,
12091 #[serde(default)]
12092 pub exists: bool,
12093}
12094
12095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12097#[cfg_attr(feature = "bindings", derive(TS))]
12098pub struct ReplacePartition {
12099 pub expression: Box<Expression>,
12100 #[serde(default)]
12101 pub source: Option<Box<Expression>>,
12102}
12103
12104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12106#[cfg_attr(feature = "bindings", derive(TS))]
12107pub struct DPipe {
12108 pub this: Box<Expression>,
12109 pub expression: Box<Expression>,
12110 #[serde(default)]
12111 pub safe: Option<Box<Expression>>,
12112}
12113
12114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12116#[cfg_attr(feature = "bindings", derive(TS))]
12117pub struct Operator {
12118 pub this: Box<Expression>,
12119 #[serde(default)]
12120 pub operator: Option<Box<Expression>>,
12121 pub expression: Box<Expression>,
12122 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12124 pub comments: Vec<String>,
12125}
12126
12127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12129#[cfg_attr(feature = "bindings", derive(TS))]
12130pub struct PivotAny {
12131 #[serde(default)]
12132 pub this: Option<Box<Expression>>,
12133}
12134
12135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12137#[cfg_attr(feature = "bindings", derive(TS))]
12138pub struct Aliases {
12139 pub this: Box<Expression>,
12140 #[serde(default)]
12141 pub expressions: Vec<Expression>,
12142}
12143
12144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12146#[cfg_attr(feature = "bindings", derive(TS))]
12147pub struct AtIndex {
12148 pub this: Box<Expression>,
12149 pub expression: Box<Expression>,
12150}
12151
12152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12154#[cfg_attr(feature = "bindings", derive(TS))]
12155pub struct FromTimeZone {
12156 pub this: Box<Expression>,
12157 #[serde(default)]
12158 pub zone: Option<Box<Expression>>,
12159}
12160
12161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12163#[cfg_attr(feature = "bindings", derive(TS))]
12164pub struct FormatPhrase {
12165 pub this: Box<Expression>,
12166 pub format: String,
12167}
12168
12169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12171#[cfg_attr(feature = "bindings", derive(TS))]
12172pub struct ForIn {
12173 pub this: Box<Expression>,
12174 pub expression: Box<Expression>,
12175}
12176
12177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12179#[cfg_attr(feature = "bindings", derive(TS))]
12180pub struct TimeUnit {
12181 #[serde(default)]
12182 pub unit: Option<String>,
12183}
12184
12185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12187#[cfg_attr(feature = "bindings", derive(TS))]
12188pub struct IntervalOp {
12189 #[serde(default)]
12190 pub unit: Option<String>,
12191 pub expression: Box<Expression>,
12192}
12193
12194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12196#[cfg_attr(feature = "bindings", derive(TS))]
12197pub struct HavingMax {
12198 pub this: Box<Expression>,
12199 pub expression: Box<Expression>,
12200 #[serde(default)]
12201 pub max: Option<Box<Expression>>,
12202}
12203
12204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12206#[cfg_attr(feature = "bindings", derive(TS))]
12207pub struct CosineDistance {
12208 pub this: Box<Expression>,
12209 pub expression: Box<Expression>,
12210}
12211
12212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12214#[cfg_attr(feature = "bindings", derive(TS))]
12215pub struct DotProduct {
12216 pub this: Box<Expression>,
12217 pub expression: Box<Expression>,
12218}
12219
12220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12222#[cfg_attr(feature = "bindings", derive(TS))]
12223pub struct EuclideanDistance {
12224 pub this: Box<Expression>,
12225 pub expression: Box<Expression>,
12226}
12227
12228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12230#[cfg_attr(feature = "bindings", derive(TS))]
12231pub struct ManhattanDistance {
12232 pub this: Box<Expression>,
12233 pub expression: Box<Expression>,
12234}
12235
12236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12238#[cfg_attr(feature = "bindings", derive(TS))]
12239pub struct JarowinklerSimilarity {
12240 pub this: Box<Expression>,
12241 pub expression: Box<Expression>,
12242}
12243
12244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12246#[cfg_attr(feature = "bindings", derive(TS))]
12247pub struct Booland {
12248 pub this: Box<Expression>,
12249 pub expression: Box<Expression>,
12250}
12251
12252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12254#[cfg_attr(feature = "bindings", derive(TS))]
12255pub struct Boolor {
12256 pub this: Box<Expression>,
12257 pub expression: Box<Expression>,
12258}
12259
12260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12262#[cfg_attr(feature = "bindings", derive(TS))]
12263pub struct ParameterizedAgg {
12264 pub this: Box<Expression>,
12265 #[serde(default)]
12266 pub expressions: Vec<Expression>,
12267 #[serde(default)]
12268 pub params: Vec<Expression>,
12269}
12270
12271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12273#[cfg_attr(feature = "bindings", derive(TS))]
12274pub struct ArgMax {
12275 pub this: Box<Expression>,
12276 pub expression: Box<Expression>,
12277 #[serde(default)]
12278 pub count: Option<Box<Expression>>,
12279}
12280
12281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12283#[cfg_attr(feature = "bindings", derive(TS))]
12284pub struct ArgMin {
12285 pub this: Box<Expression>,
12286 pub expression: Box<Expression>,
12287 #[serde(default)]
12288 pub count: Option<Box<Expression>>,
12289}
12290
12291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12293#[cfg_attr(feature = "bindings", derive(TS))]
12294pub struct ApproxTopK {
12295 pub this: Box<Expression>,
12296 #[serde(default)]
12297 pub expression: Option<Box<Expression>>,
12298 #[serde(default)]
12299 pub counters: Option<Box<Expression>>,
12300}
12301
12302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12304#[cfg_attr(feature = "bindings", derive(TS))]
12305pub struct ApproxTopKAccumulate {
12306 pub this: Box<Expression>,
12307 #[serde(default)]
12308 pub expression: Option<Box<Expression>>,
12309}
12310
12311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12313#[cfg_attr(feature = "bindings", derive(TS))]
12314pub struct ApproxTopKCombine {
12315 pub this: Box<Expression>,
12316 #[serde(default)]
12317 pub expression: Option<Box<Expression>>,
12318}
12319
12320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12322#[cfg_attr(feature = "bindings", derive(TS))]
12323pub struct ApproxTopKEstimate {
12324 pub this: Box<Expression>,
12325 #[serde(default)]
12326 pub expression: Option<Box<Expression>>,
12327}
12328
12329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12331#[cfg_attr(feature = "bindings", derive(TS))]
12332pub struct ApproxTopSum {
12333 pub this: Box<Expression>,
12334 pub expression: Box<Expression>,
12335 #[serde(default)]
12336 pub count: Option<Box<Expression>>,
12337}
12338
12339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12341#[cfg_attr(feature = "bindings", derive(TS))]
12342pub struct ApproxQuantiles {
12343 pub this: Box<Expression>,
12344 #[serde(default)]
12345 pub expression: Option<Box<Expression>>,
12346}
12347
12348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12350#[cfg_attr(feature = "bindings", derive(TS))]
12351pub struct Minhash {
12352 pub this: Box<Expression>,
12353 #[serde(default)]
12354 pub expressions: Vec<Expression>,
12355}
12356
12357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12359#[cfg_attr(feature = "bindings", derive(TS))]
12360pub struct FarmFingerprint {
12361 #[serde(default)]
12362 pub expressions: Vec<Expression>,
12363}
12364
12365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12367#[cfg_attr(feature = "bindings", derive(TS))]
12368pub struct Float64 {
12369 pub this: Box<Expression>,
12370 #[serde(default)]
12371 pub expression: Option<Box<Expression>>,
12372}
12373
12374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12376#[cfg_attr(feature = "bindings", derive(TS))]
12377pub struct Transform {
12378 pub this: Box<Expression>,
12379 pub expression: Box<Expression>,
12380}
12381
12382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12384#[cfg_attr(feature = "bindings", derive(TS))]
12385pub struct Translate {
12386 pub this: Box<Expression>,
12387 #[serde(default)]
12388 pub from_: Option<Box<Expression>>,
12389 #[serde(default)]
12390 pub to: Option<Box<Expression>>,
12391}
12392
12393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12395#[cfg_attr(feature = "bindings", derive(TS))]
12396pub struct Grouping {
12397 #[serde(default)]
12398 pub expressions: Vec<Expression>,
12399}
12400
12401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12403#[cfg_attr(feature = "bindings", derive(TS))]
12404pub struct GroupingId {
12405 #[serde(default)]
12406 pub expressions: Vec<Expression>,
12407}
12408
12409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12411#[cfg_attr(feature = "bindings", derive(TS))]
12412pub struct Anonymous {
12413 pub this: Box<Expression>,
12414 #[serde(default)]
12415 pub expressions: Vec<Expression>,
12416}
12417
12418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12420#[cfg_attr(feature = "bindings", derive(TS))]
12421pub struct AnonymousAggFunc {
12422 pub this: Box<Expression>,
12423 #[serde(default)]
12424 pub expressions: Vec<Expression>,
12425}
12426
12427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12429#[cfg_attr(feature = "bindings", derive(TS))]
12430pub struct CombinedAggFunc {
12431 pub this: Box<Expression>,
12432 #[serde(default)]
12433 pub expressions: Vec<Expression>,
12434}
12435
12436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12438#[cfg_attr(feature = "bindings", derive(TS))]
12439pub struct CombinedParameterizedAgg {
12440 pub this: Box<Expression>,
12441 #[serde(default)]
12442 pub expressions: Vec<Expression>,
12443 #[serde(default)]
12444 pub params: Vec<Expression>,
12445}
12446
12447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12449#[cfg_attr(feature = "bindings", derive(TS))]
12450pub struct HashAgg {
12451 pub this: Box<Expression>,
12452 #[serde(default)]
12453 pub expressions: Vec<Expression>,
12454}
12455
12456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12458#[cfg_attr(feature = "bindings", derive(TS))]
12459pub struct Hll {
12460 pub this: Box<Expression>,
12461 #[serde(default)]
12462 pub expressions: Vec<Expression>,
12463}
12464
12465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12467#[cfg_attr(feature = "bindings", derive(TS))]
12468pub struct Apply {
12469 pub this: Box<Expression>,
12470 pub expression: Box<Expression>,
12471}
12472
12473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12475#[cfg_attr(feature = "bindings", derive(TS))]
12476pub struct ToBoolean {
12477 pub this: Box<Expression>,
12478 #[serde(default)]
12479 pub safe: Option<Box<Expression>>,
12480}
12481
12482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12484#[cfg_attr(feature = "bindings", derive(TS))]
12485pub struct List {
12486 #[serde(default)]
12487 pub expressions: Vec<Expression>,
12488}
12489
12490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12495#[cfg_attr(feature = "bindings", derive(TS))]
12496pub struct ToMap {
12497 pub this: Box<Expression>,
12499}
12500
12501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12503#[cfg_attr(feature = "bindings", derive(TS))]
12504pub struct Pad {
12505 pub this: Box<Expression>,
12506 pub expression: Box<Expression>,
12507 #[serde(default)]
12508 pub fill_pattern: Option<Box<Expression>>,
12509 #[serde(default)]
12510 pub is_left: Option<Box<Expression>>,
12511}
12512
12513#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12515#[cfg_attr(feature = "bindings", derive(TS))]
12516pub struct ToChar {
12517 pub this: Box<Expression>,
12518 #[serde(default)]
12519 pub format: Option<String>,
12520 #[serde(default)]
12521 pub nlsparam: Option<Box<Expression>>,
12522 #[serde(default)]
12523 pub is_numeric: Option<Box<Expression>>,
12524}
12525
12526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12528#[cfg_attr(feature = "bindings", derive(TS))]
12529pub struct StringFunc {
12530 pub this: Box<Expression>,
12531 #[serde(default)]
12532 pub zone: Option<Box<Expression>>,
12533}
12534
12535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12537#[cfg_attr(feature = "bindings", derive(TS))]
12538pub struct ToNumber {
12539 pub this: Box<Expression>,
12540 #[serde(default)]
12541 pub format: Option<Box<Expression>>,
12542 #[serde(default)]
12543 pub nlsparam: Option<Box<Expression>>,
12544 #[serde(default)]
12545 pub precision: Option<Box<Expression>>,
12546 #[serde(default)]
12547 pub scale: Option<Box<Expression>>,
12548 #[serde(default)]
12549 pub safe: Option<Box<Expression>>,
12550 #[serde(default)]
12551 pub safe_name: Option<Box<Expression>>,
12552}
12553
12554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12556#[cfg_attr(feature = "bindings", derive(TS))]
12557pub struct ToDouble {
12558 pub this: Box<Expression>,
12559 #[serde(default)]
12560 pub format: Option<String>,
12561 #[serde(default)]
12562 pub safe: Option<Box<Expression>>,
12563}
12564
12565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12567#[cfg_attr(feature = "bindings", derive(TS))]
12568pub struct ToDecfloat {
12569 pub this: Box<Expression>,
12570 #[serde(default)]
12571 pub format: Option<String>,
12572}
12573
12574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12576#[cfg_attr(feature = "bindings", derive(TS))]
12577pub struct TryToDecfloat {
12578 pub this: Box<Expression>,
12579 #[serde(default)]
12580 pub format: Option<String>,
12581}
12582
12583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12585#[cfg_attr(feature = "bindings", derive(TS))]
12586pub struct ToFile {
12587 pub this: Box<Expression>,
12588 #[serde(default)]
12589 pub path: Option<Box<Expression>>,
12590 #[serde(default)]
12591 pub safe: Option<Box<Expression>>,
12592}
12593
12594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12596#[cfg_attr(feature = "bindings", derive(TS))]
12597pub struct Columns {
12598 pub this: Box<Expression>,
12599 #[serde(default)]
12600 pub unpack: Option<Box<Expression>>,
12601}
12602
12603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12605#[cfg_attr(feature = "bindings", derive(TS))]
12606pub struct ConvertToCharset {
12607 pub this: Box<Expression>,
12608 #[serde(default)]
12609 pub dest: Option<Box<Expression>>,
12610 #[serde(default)]
12611 pub source: Option<Box<Expression>>,
12612}
12613
12614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12616#[cfg_attr(feature = "bindings", derive(TS))]
12617pub struct ConvertTimezone {
12618 #[serde(default)]
12619 pub source_tz: Option<Box<Expression>>,
12620 #[serde(default)]
12621 pub target_tz: Option<Box<Expression>>,
12622 #[serde(default)]
12623 pub timestamp: Option<Box<Expression>>,
12624 #[serde(default)]
12625 pub options: Vec<Expression>,
12626}
12627
12628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12630#[cfg_attr(feature = "bindings", derive(TS))]
12631pub struct GenerateSeries {
12632 #[serde(default)]
12633 pub start: Option<Box<Expression>>,
12634 #[serde(default)]
12635 pub end: Option<Box<Expression>>,
12636 #[serde(default)]
12637 pub step: Option<Box<Expression>>,
12638 #[serde(default)]
12639 pub is_end_exclusive: Option<Box<Expression>>,
12640}
12641
12642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12644#[cfg_attr(feature = "bindings", derive(TS))]
12645pub struct AIAgg {
12646 pub this: Box<Expression>,
12647 pub expression: Box<Expression>,
12648}
12649
12650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12652#[cfg_attr(feature = "bindings", derive(TS))]
12653pub struct AIClassify {
12654 pub this: Box<Expression>,
12655 #[serde(default)]
12656 pub categories: Option<Box<Expression>>,
12657 #[serde(default)]
12658 pub config: Option<Box<Expression>>,
12659}
12660
12661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12663#[cfg_attr(feature = "bindings", derive(TS))]
12664pub struct ArrayAll {
12665 pub this: Box<Expression>,
12666 pub expression: Box<Expression>,
12667}
12668
12669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12671#[cfg_attr(feature = "bindings", derive(TS))]
12672pub struct ArrayAny {
12673 pub this: Box<Expression>,
12674 pub expression: Box<Expression>,
12675}
12676
12677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12679#[cfg_attr(feature = "bindings", derive(TS))]
12680pub struct ArrayConstructCompact {
12681 #[serde(default)]
12682 pub expressions: Vec<Expression>,
12683}
12684
12685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12687#[cfg_attr(feature = "bindings", derive(TS))]
12688pub struct StPoint {
12689 pub this: Box<Expression>,
12690 pub expression: Box<Expression>,
12691 #[serde(default)]
12692 pub null: Option<Box<Expression>>,
12693}
12694
12695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12697#[cfg_attr(feature = "bindings", derive(TS))]
12698pub struct StDistance {
12699 pub this: Box<Expression>,
12700 pub expression: Box<Expression>,
12701 #[serde(default)]
12702 pub use_spheroid: Option<Box<Expression>>,
12703}
12704
12705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12707#[cfg_attr(feature = "bindings", derive(TS))]
12708pub struct StringToArray {
12709 pub this: Box<Expression>,
12710 #[serde(default)]
12711 pub expression: Option<Box<Expression>>,
12712 #[serde(default)]
12713 pub null: Option<Box<Expression>>,
12714}
12715
12716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12718#[cfg_attr(feature = "bindings", derive(TS))]
12719pub struct ArraySum {
12720 pub this: Box<Expression>,
12721 #[serde(default)]
12722 pub expression: Option<Box<Expression>>,
12723}
12724
12725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12727#[cfg_attr(feature = "bindings", derive(TS))]
12728pub struct ObjectAgg {
12729 pub this: Box<Expression>,
12730 pub expression: Box<Expression>,
12731}
12732
12733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12735#[cfg_attr(feature = "bindings", derive(TS))]
12736pub struct CastToStrType {
12737 pub this: Box<Expression>,
12738 #[serde(default)]
12739 pub to: Option<Box<Expression>>,
12740}
12741
12742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12744#[cfg_attr(feature = "bindings", derive(TS))]
12745pub struct CheckJson {
12746 pub this: Box<Expression>,
12747}
12748
12749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12751#[cfg_attr(feature = "bindings", derive(TS))]
12752pub struct CheckXml {
12753 pub this: Box<Expression>,
12754 #[serde(default)]
12755 pub disable_auto_convert: Option<Box<Expression>>,
12756}
12757
12758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12760#[cfg_attr(feature = "bindings", derive(TS))]
12761pub struct TranslateCharacters {
12762 pub this: Box<Expression>,
12763 pub expression: Box<Expression>,
12764 #[serde(default)]
12765 pub with_error: Option<Box<Expression>>,
12766}
12767
12768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12770#[cfg_attr(feature = "bindings", derive(TS))]
12771pub struct CurrentSchemas {
12772 #[serde(default)]
12773 pub this: Option<Box<Expression>>,
12774}
12775
12776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12778#[cfg_attr(feature = "bindings", derive(TS))]
12779pub struct CurrentDatetime {
12780 #[serde(default)]
12781 pub this: Option<Box<Expression>>,
12782}
12783
12784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12786#[cfg_attr(feature = "bindings", derive(TS))]
12787pub struct Localtime {
12788 #[serde(default)]
12789 pub this: Option<Box<Expression>>,
12790}
12791
12792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12794#[cfg_attr(feature = "bindings", derive(TS))]
12795pub struct Localtimestamp {
12796 #[serde(default)]
12797 pub this: Option<Box<Expression>>,
12798}
12799
12800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12802#[cfg_attr(feature = "bindings", derive(TS))]
12803pub struct Systimestamp {
12804 #[serde(default)]
12805 pub this: Option<Box<Expression>>,
12806}
12807
12808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12810#[cfg_attr(feature = "bindings", derive(TS))]
12811pub struct CurrentSchema {
12812 #[serde(default)]
12813 pub this: Option<Box<Expression>>,
12814}
12815
12816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12818#[cfg_attr(feature = "bindings", derive(TS))]
12819pub struct CurrentUser {
12820 #[serde(default)]
12821 pub this: Option<Box<Expression>>,
12822}
12823
12824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12826#[cfg_attr(feature = "bindings", derive(TS))]
12827pub struct SessionUser;
12828
12829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12831#[cfg_attr(feature = "bindings", derive(TS))]
12832pub struct JSONPathRoot;
12833
12834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12836#[cfg_attr(feature = "bindings", derive(TS))]
12837pub struct UtcTime {
12838 #[serde(default)]
12839 pub this: Option<Box<Expression>>,
12840}
12841
12842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12844#[cfg_attr(feature = "bindings", derive(TS))]
12845pub struct UtcTimestamp {
12846 #[serde(default)]
12847 pub this: Option<Box<Expression>>,
12848}
12849
12850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12852#[cfg_attr(feature = "bindings", derive(TS))]
12853pub struct TimestampFunc {
12854 #[serde(default)]
12855 pub this: Option<Box<Expression>>,
12856 #[serde(default)]
12857 pub zone: Option<Box<Expression>>,
12858 #[serde(default)]
12859 pub with_tz: Option<bool>,
12860 #[serde(default)]
12861 pub safe: Option<bool>,
12862}
12863
12864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12866#[cfg_attr(feature = "bindings", derive(TS))]
12867pub struct DateBin {
12868 pub this: Box<Expression>,
12869 pub expression: Box<Expression>,
12870 #[serde(default)]
12871 pub unit: Option<String>,
12872 #[serde(default)]
12873 pub zone: Option<Box<Expression>>,
12874 #[serde(default)]
12875 pub origin: Option<Box<Expression>>,
12876}
12877
12878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12880#[cfg_attr(feature = "bindings", derive(TS))]
12881pub struct Datetime {
12882 pub this: Box<Expression>,
12883 #[serde(default)]
12884 pub expression: Option<Box<Expression>>,
12885}
12886
12887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12889#[cfg_attr(feature = "bindings", derive(TS))]
12890pub struct DatetimeAdd {
12891 pub this: Box<Expression>,
12892 pub expression: Box<Expression>,
12893 #[serde(default)]
12894 pub unit: Option<String>,
12895}
12896
12897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12899#[cfg_attr(feature = "bindings", derive(TS))]
12900pub struct DatetimeSub {
12901 pub this: Box<Expression>,
12902 pub expression: Box<Expression>,
12903 #[serde(default)]
12904 pub unit: Option<String>,
12905}
12906
12907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12909#[cfg_attr(feature = "bindings", derive(TS))]
12910pub struct DatetimeDiff {
12911 pub this: Box<Expression>,
12912 pub expression: Box<Expression>,
12913 #[serde(default)]
12914 pub unit: Option<String>,
12915}
12916
12917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12919#[cfg_attr(feature = "bindings", derive(TS))]
12920pub struct DatetimeTrunc {
12921 pub this: Box<Expression>,
12922 pub unit: String,
12923 #[serde(default)]
12924 pub zone: Option<Box<Expression>>,
12925}
12926
12927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12929#[cfg_attr(feature = "bindings", derive(TS))]
12930pub struct Dayname {
12931 pub this: Box<Expression>,
12932 #[serde(default)]
12933 pub abbreviated: Option<Box<Expression>>,
12934}
12935
12936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12938#[cfg_attr(feature = "bindings", derive(TS))]
12939pub struct MakeInterval {
12940 #[serde(default)]
12941 pub year: Option<Box<Expression>>,
12942 #[serde(default)]
12943 pub month: Option<Box<Expression>>,
12944 #[serde(default)]
12945 pub week: Option<Box<Expression>>,
12946 #[serde(default)]
12947 pub day: Option<Box<Expression>>,
12948 #[serde(default)]
12949 pub hour: Option<Box<Expression>>,
12950 #[serde(default)]
12951 pub minute: Option<Box<Expression>>,
12952 #[serde(default)]
12953 pub second: Option<Box<Expression>>,
12954}
12955
12956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12958#[cfg_attr(feature = "bindings", derive(TS))]
12959pub struct PreviousDay {
12960 pub this: Box<Expression>,
12961 pub expression: Box<Expression>,
12962}
12963
12964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12966#[cfg_attr(feature = "bindings", derive(TS))]
12967pub struct Elt {
12968 pub this: Box<Expression>,
12969 #[serde(default)]
12970 pub expressions: Vec<Expression>,
12971}
12972
12973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12975#[cfg_attr(feature = "bindings", derive(TS))]
12976pub struct TimestampAdd {
12977 pub this: Box<Expression>,
12978 pub expression: Box<Expression>,
12979 #[serde(default)]
12980 pub unit: Option<String>,
12981}
12982
12983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12985#[cfg_attr(feature = "bindings", derive(TS))]
12986pub struct TimestampSub {
12987 pub this: Box<Expression>,
12988 pub expression: Box<Expression>,
12989 #[serde(default)]
12990 pub unit: Option<String>,
12991}
12992
12993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12995#[cfg_attr(feature = "bindings", derive(TS))]
12996pub struct TimestampDiff {
12997 pub this: Box<Expression>,
12998 pub expression: Box<Expression>,
12999 #[serde(default)]
13000 pub unit: Option<String>,
13001}
13002
13003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13005#[cfg_attr(feature = "bindings", derive(TS))]
13006pub struct TimeSlice {
13007 pub this: Box<Expression>,
13008 pub expression: Box<Expression>,
13009 pub unit: String,
13010 #[serde(default)]
13011 pub kind: Option<String>,
13012}
13013
13014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13016#[cfg_attr(feature = "bindings", derive(TS))]
13017pub struct TimeAdd {
13018 pub this: Box<Expression>,
13019 pub expression: Box<Expression>,
13020 #[serde(default)]
13021 pub unit: Option<String>,
13022}
13023
13024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13026#[cfg_attr(feature = "bindings", derive(TS))]
13027pub struct TimeSub {
13028 pub this: Box<Expression>,
13029 pub expression: Box<Expression>,
13030 #[serde(default)]
13031 pub unit: Option<String>,
13032}
13033
13034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13036#[cfg_attr(feature = "bindings", derive(TS))]
13037pub struct TimeDiff {
13038 pub this: Box<Expression>,
13039 pub expression: Box<Expression>,
13040 #[serde(default)]
13041 pub unit: Option<String>,
13042}
13043
13044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13046#[cfg_attr(feature = "bindings", derive(TS))]
13047pub struct TimeTrunc {
13048 pub this: Box<Expression>,
13049 pub unit: String,
13050 #[serde(default)]
13051 pub zone: Option<Box<Expression>>,
13052}
13053
13054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13056#[cfg_attr(feature = "bindings", derive(TS))]
13057pub struct DateFromParts {
13058 #[serde(default)]
13059 pub year: Option<Box<Expression>>,
13060 #[serde(default)]
13061 pub month: Option<Box<Expression>>,
13062 #[serde(default)]
13063 pub day: Option<Box<Expression>>,
13064 #[serde(default)]
13065 pub allow_overflow: Option<Box<Expression>>,
13066}
13067
13068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13070#[cfg_attr(feature = "bindings", derive(TS))]
13071pub struct TimeFromParts {
13072 #[serde(default)]
13073 pub hour: Option<Box<Expression>>,
13074 #[serde(default)]
13075 pub min: Option<Box<Expression>>,
13076 #[serde(default)]
13077 pub sec: Option<Box<Expression>>,
13078 #[serde(default)]
13079 pub nano: Option<Box<Expression>>,
13080 #[serde(default)]
13081 pub fractions: Option<Box<Expression>>,
13082 #[serde(default)]
13083 pub precision: Option<i64>,
13084}
13085
13086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13088#[cfg_attr(feature = "bindings", derive(TS))]
13089pub struct DecodeCase {
13090 #[serde(default)]
13091 pub expressions: Vec<Expression>,
13092}
13093
13094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13096#[cfg_attr(feature = "bindings", derive(TS))]
13097pub struct Decrypt {
13098 pub this: Box<Expression>,
13099 #[serde(default)]
13100 pub passphrase: Option<Box<Expression>>,
13101 #[serde(default)]
13102 pub aad: Option<Box<Expression>>,
13103 #[serde(default)]
13104 pub encryption_method: Option<Box<Expression>>,
13105 #[serde(default)]
13106 pub safe: Option<Box<Expression>>,
13107}
13108
13109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13111#[cfg_attr(feature = "bindings", derive(TS))]
13112pub struct DecryptRaw {
13113 pub this: Box<Expression>,
13114 #[serde(default)]
13115 pub key: Option<Box<Expression>>,
13116 #[serde(default)]
13117 pub iv: Option<Box<Expression>>,
13118 #[serde(default)]
13119 pub aad: Option<Box<Expression>>,
13120 #[serde(default)]
13121 pub encryption_method: Option<Box<Expression>>,
13122 #[serde(default)]
13123 pub aead: Option<Box<Expression>>,
13124 #[serde(default)]
13125 pub safe: Option<Box<Expression>>,
13126}
13127
13128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13130#[cfg_attr(feature = "bindings", derive(TS))]
13131pub struct Encode {
13132 pub this: Box<Expression>,
13133 #[serde(default)]
13134 pub charset: Option<Box<Expression>>,
13135}
13136
13137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13139#[cfg_attr(feature = "bindings", derive(TS))]
13140pub struct Encrypt {
13141 pub this: Box<Expression>,
13142 #[serde(default)]
13143 pub passphrase: Option<Box<Expression>>,
13144 #[serde(default)]
13145 pub aad: Option<Box<Expression>>,
13146 #[serde(default)]
13147 pub encryption_method: Option<Box<Expression>>,
13148}
13149
13150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13152#[cfg_attr(feature = "bindings", derive(TS))]
13153pub struct EncryptRaw {
13154 pub this: Box<Expression>,
13155 #[serde(default)]
13156 pub key: Option<Box<Expression>>,
13157 #[serde(default)]
13158 pub iv: Option<Box<Expression>>,
13159 #[serde(default)]
13160 pub aad: Option<Box<Expression>>,
13161 #[serde(default)]
13162 pub encryption_method: Option<Box<Expression>>,
13163}
13164
13165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13167#[cfg_attr(feature = "bindings", derive(TS))]
13168pub struct EqualNull {
13169 pub this: Box<Expression>,
13170 pub expression: Box<Expression>,
13171}
13172
13173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13175#[cfg_attr(feature = "bindings", derive(TS))]
13176pub struct ToBinary {
13177 pub this: Box<Expression>,
13178 #[serde(default)]
13179 pub format: Option<String>,
13180 #[serde(default)]
13181 pub safe: Option<Box<Expression>>,
13182}
13183
13184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13186#[cfg_attr(feature = "bindings", derive(TS))]
13187pub struct Base64DecodeBinary {
13188 pub this: Box<Expression>,
13189 #[serde(default)]
13190 pub alphabet: Option<Box<Expression>>,
13191}
13192
13193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13195#[cfg_attr(feature = "bindings", derive(TS))]
13196pub struct Base64DecodeString {
13197 pub this: Box<Expression>,
13198 #[serde(default)]
13199 pub alphabet: Option<Box<Expression>>,
13200}
13201
13202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13204#[cfg_attr(feature = "bindings", derive(TS))]
13205pub struct Base64Encode {
13206 pub this: Box<Expression>,
13207 #[serde(default)]
13208 pub max_line_length: Option<Box<Expression>>,
13209 #[serde(default)]
13210 pub alphabet: Option<Box<Expression>>,
13211}
13212
13213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13215#[cfg_attr(feature = "bindings", derive(TS))]
13216pub struct TryBase64DecodeBinary {
13217 pub this: Box<Expression>,
13218 #[serde(default)]
13219 pub alphabet: Option<Box<Expression>>,
13220}
13221
13222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13224#[cfg_attr(feature = "bindings", derive(TS))]
13225pub struct TryBase64DecodeString {
13226 pub this: Box<Expression>,
13227 #[serde(default)]
13228 pub alphabet: Option<Box<Expression>>,
13229}
13230
13231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13233#[cfg_attr(feature = "bindings", derive(TS))]
13234pub struct GapFill {
13235 pub this: Box<Expression>,
13236 #[serde(default)]
13237 pub ts_column: Option<Box<Expression>>,
13238 #[serde(default)]
13239 pub bucket_width: Option<Box<Expression>>,
13240 #[serde(default)]
13241 pub partitioning_columns: Option<Box<Expression>>,
13242 #[serde(default)]
13243 pub value_columns: Option<Box<Expression>>,
13244 #[serde(default)]
13245 pub origin: Option<Box<Expression>>,
13246 #[serde(default)]
13247 pub ignore_nulls: Option<Box<Expression>>,
13248}
13249
13250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13252#[cfg_attr(feature = "bindings", derive(TS))]
13253pub struct GenerateDateArray {
13254 #[serde(default)]
13255 pub start: Option<Box<Expression>>,
13256 #[serde(default)]
13257 pub end: Option<Box<Expression>>,
13258 #[serde(default)]
13259 pub step: Option<Box<Expression>>,
13260}
13261
13262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13264#[cfg_attr(feature = "bindings", derive(TS))]
13265pub struct GenerateTimestampArray {
13266 #[serde(default)]
13267 pub start: Option<Box<Expression>>,
13268 #[serde(default)]
13269 pub end: Option<Box<Expression>>,
13270 #[serde(default)]
13271 pub step: Option<Box<Expression>>,
13272}
13273
13274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13276#[cfg_attr(feature = "bindings", derive(TS))]
13277pub struct GetExtract {
13278 pub this: Box<Expression>,
13279 pub expression: Box<Expression>,
13280}
13281
13282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13284#[cfg_attr(feature = "bindings", derive(TS))]
13285pub struct Getbit {
13286 pub this: Box<Expression>,
13287 pub expression: Box<Expression>,
13288 #[serde(default)]
13289 pub zero_is_msb: Option<Box<Expression>>,
13290}
13291
13292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13294#[cfg_attr(feature = "bindings", derive(TS))]
13295pub struct OverflowTruncateBehavior {
13296 #[serde(default)]
13297 pub this: Option<Box<Expression>>,
13298 #[serde(default)]
13299 pub with_count: Option<Box<Expression>>,
13300}
13301
13302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13304#[cfg_attr(feature = "bindings", derive(TS))]
13305pub struct HexEncode {
13306 pub this: Box<Expression>,
13307 #[serde(default)]
13308 pub case: Option<Box<Expression>>,
13309}
13310
13311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13313#[cfg_attr(feature = "bindings", derive(TS))]
13314pub struct Compress {
13315 pub this: Box<Expression>,
13316 #[serde(default)]
13317 pub method: Option<String>,
13318}
13319
13320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13322#[cfg_attr(feature = "bindings", derive(TS))]
13323pub struct DecompressBinary {
13324 pub this: Box<Expression>,
13325 pub method: String,
13326}
13327
13328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13330#[cfg_attr(feature = "bindings", derive(TS))]
13331pub struct DecompressString {
13332 pub this: Box<Expression>,
13333 pub method: String,
13334}
13335
13336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13338#[cfg_attr(feature = "bindings", derive(TS))]
13339pub struct Xor {
13340 #[serde(default)]
13341 pub this: Option<Box<Expression>>,
13342 #[serde(default)]
13343 pub expression: Option<Box<Expression>>,
13344 #[serde(default)]
13345 pub expressions: Vec<Expression>,
13346}
13347
13348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13350#[cfg_attr(feature = "bindings", derive(TS))]
13351pub struct Nullif {
13352 pub this: Box<Expression>,
13353 pub expression: Box<Expression>,
13354}
13355
13356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13358#[cfg_attr(feature = "bindings", derive(TS))]
13359pub struct JSON {
13360 #[serde(default)]
13361 pub this: Option<Box<Expression>>,
13362 #[serde(default)]
13363 pub with_: Option<Box<Expression>>,
13364 #[serde(default)]
13365 pub unique: bool,
13366}
13367
13368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13370#[cfg_attr(feature = "bindings", derive(TS))]
13371pub struct JSONPath {
13372 #[serde(default)]
13373 pub expressions: Vec<Expression>,
13374 #[serde(default)]
13375 pub escape: Option<Box<Expression>>,
13376}
13377
13378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13380#[cfg_attr(feature = "bindings", derive(TS))]
13381pub struct JSONPathFilter {
13382 pub this: Box<Expression>,
13383}
13384
13385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13387#[cfg_attr(feature = "bindings", derive(TS))]
13388pub struct JSONPathKey {
13389 pub this: Box<Expression>,
13390}
13391
13392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13394#[cfg_attr(feature = "bindings", derive(TS))]
13395pub struct JSONPathRecursive {
13396 #[serde(default)]
13397 pub this: Option<Box<Expression>>,
13398}
13399
13400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13402#[cfg_attr(feature = "bindings", derive(TS))]
13403pub struct JSONPathScript {
13404 pub this: Box<Expression>,
13405}
13406
13407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13409#[cfg_attr(feature = "bindings", derive(TS))]
13410pub struct JSONPathSlice {
13411 #[serde(default)]
13412 pub start: Option<Box<Expression>>,
13413 #[serde(default)]
13414 pub end: Option<Box<Expression>>,
13415 #[serde(default)]
13416 pub step: Option<Box<Expression>>,
13417}
13418
13419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13421#[cfg_attr(feature = "bindings", derive(TS))]
13422pub struct JSONPathSelector {
13423 pub this: Box<Expression>,
13424}
13425
13426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13428#[cfg_attr(feature = "bindings", derive(TS))]
13429pub struct JSONPathSubscript {
13430 pub this: Box<Expression>,
13431}
13432
13433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13435#[cfg_attr(feature = "bindings", derive(TS))]
13436pub struct JSONPathUnion {
13437 #[serde(default)]
13438 pub expressions: Vec<Expression>,
13439}
13440
13441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13443#[cfg_attr(feature = "bindings", derive(TS))]
13444pub struct Format {
13445 pub this: Box<Expression>,
13446 #[serde(default)]
13447 pub expressions: Vec<Expression>,
13448}
13449
13450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13452#[cfg_attr(feature = "bindings", derive(TS))]
13453pub struct JSONKeys {
13454 pub this: Box<Expression>,
13455 #[serde(default)]
13456 pub expression: Option<Box<Expression>>,
13457 #[serde(default)]
13458 pub expressions: Vec<Expression>,
13459}
13460
13461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13463#[cfg_attr(feature = "bindings", derive(TS))]
13464pub struct JSONKeyValue {
13465 pub this: Box<Expression>,
13466 pub expression: Box<Expression>,
13467}
13468
13469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13471#[cfg_attr(feature = "bindings", derive(TS))]
13472pub struct JSONKeysAtDepth {
13473 pub this: Box<Expression>,
13474 #[serde(default)]
13475 pub expression: Option<Box<Expression>>,
13476 #[serde(default)]
13477 pub mode: Option<Box<Expression>>,
13478}
13479
13480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13482#[cfg_attr(feature = "bindings", derive(TS))]
13483pub struct JSONObject {
13484 #[serde(default)]
13485 pub expressions: Vec<Expression>,
13486 #[serde(default)]
13487 pub null_handling: Option<Box<Expression>>,
13488 #[serde(default)]
13489 pub unique_keys: Option<Box<Expression>>,
13490 #[serde(default)]
13491 pub return_type: Option<Box<Expression>>,
13492 #[serde(default)]
13493 pub encoding: Option<Box<Expression>>,
13494}
13495
13496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13498#[cfg_attr(feature = "bindings", derive(TS))]
13499pub struct JSONObjectAgg {
13500 #[serde(default)]
13501 pub expressions: Vec<Expression>,
13502 #[serde(default)]
13503 pub null_handling: Option<Box<Expression>>,
13504 #[serde(default)]
13505 pub unique_keys: Option<Box<Expression>>,
13506 #[serde(default)]
13507 pub return_type: Option<Box<Expression>>,
13508 #[serde(default)]
13509 pub encoding: Option<Box<Expression>>,
13510}
13511
13512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13514#[cfg_attr(feature = "bindings", derive(TS))]
13515pub struct JSONBObjectAgg {
13516 pub this: Box<Expression>,
13517 pub expression: Box<Expression>,
13518}
13519
13520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13522#[cfg_attr(feature = "bindings", derive(TS))]
13523pub struct JSONArray {
13524 #[serde(default)]
13525 pub expressions: Vec<Expression>,
13526 #[serde(default)]
13527 pub null_handling: Option<Box<Expression>>,
13528 #[serde(default)]
13529 pub return_type: Option<Box<Expression>>,
13530 #[serde(default)]
13531 pub strict: Option<Box<Expression>>,
13532}
13533
13534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13536#[cfg_attr(feature = "bindings", derive(TS))]
13537pub struct JSONArrayAgg {
13538 pub this: Box<Expression>,
13539 #[serde(default)]
13540 pub order: Option<Box<Expression>>,
13541 #[serde(default)]
13542 pub null_handling: Option<Box<Expression>>,
13543 #[serde(default)]
13544 pub return_type: Option<Box<Expression>>,
13545 #[serde(default)]
13546 pub strict: Option<Box<Expression>>,
13547}
13548
13549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13551#[cfg_attr(feature = "bindings", derive(TS))]
13552pub struct JSONExists {
13553 pub this: Box<Expression>,
13554 #[serde(default)]
13555 pub path: Option<Box<Expression>>,
13556 #[serde(default)]
13557 pub passing: Option<Box<Expression>>,
13558 #[serde(default)]
13559 pub on_condition: Option<Box<Expression>>,
13560 #[serde(default)]
13561 pub from_dcolonqmark: Option<Box<Expression>>,
13562}
13563
13564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13566#[cfg_attr(feature = "bindings", derive(TS))]
13567pub struct JSONColumnDef {
13568 #[serde(default)]
13569 pub this: Option<Box<Expression>>,
13570 #[serde(default)]
13571 pub kind: Option<String>,
13572 #[serde(default)]
13573 pub path: Option<Box<Expression>>,
13574 #[serde(default)]
13575 pub nested_schema: Option<Box<Expression>>,
13576 #[serde(default)]
13577 pub ordinality: Option<Box<Expression>>,
13578}
13579
13580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13582#[cfg_attr(feature = "bindings", derive(TS))]
13583pub struct JSONSchema {
13584 #[serde(default)]
13585 pub expressions: Vec<Expression>,
13586}
13587
13588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13590#[cfg_attr(feature = "bindings", derive(TS))]
13591pub struct JSONSet {
13592 pub this: Box<Expression>,
13593 #[serde(default)]
13594 pub expressions: Vec<Expression>,
13595}
13596
13597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13599#[cfg_attr(feature = "bindings", derive(TS))]
13600pub struct JSONStripNulls {
13601 pub this: Box<Expression>,
13602 #[serde(default)]
13603 pub expression: Option<Box<Expression>>,
13604 #[serde(default)]
13605 pub include_arrays: Option<Box<Expression>>,
13606 #[serde(default)]
13607 pub remove_empty: Option<Box<Expression>>,
13608}
13609
13610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13612#[cfg_attr(feature = "bindings", derive(TS))]
13613pub struct JSONValue {
13614 pub this: Box<Expression>,
13615 #[serde(default)]
13616 pub path: Option<Box<Expression>>,
13617 #[serde(default)]
13618 pub returning: Option<Box<Expression>>,
13619 #[serde(default)]
13620 pub on_condition: Option<Box<Expression>>,
13621}
13622
13623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13625#[cfg_attr(feature = "bindings", derive(TS))]
13626pub struct JSONValueArray {
13627 pub this: Box<Expression>,
13628 #[serde(default)]
13629 pub expression: Option<Box<Expression>>,
13630}
13631
13632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13634#[cfg_attr(feature = "bindings", derive(TS))]
13635pub struct JSONRemove {
13636 pub this: Box<Expression>,
13637 #[serde(default)]
13638 pub expressions: Vec<Expression>,
13639}
13640
13641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13643#[cfg_attr(feature = "bindings", derive(TS))]
13644pub struct JSONTable {
13645 pub this: Box<Expression>,
13646 #[serde(default)]
13647 pub schema: Option<Box<Expression>>,
13648 #[serde(default)]
13649 pub path: Option<Box<Expression>>,
13650 #[serde(default)]
13651 pub error_handling: Option<Box<Expression>>,
13652 #[serde(default)]
13653 pub empty_handling: Option<Box<Expression>>,
13654}
13655
13656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13658#[cfg_attr(feature = "bindings", derive(TS))]
13659pub struct JSONType {
13660 pub this: Box<Expression>,
13661 #[serde(default)]
13662 pub expression: Option<Box<Expression>>,
13663}
13664
13665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13667#[cfg_attr(feature = "bindings", derive(TS))]
13668pub struct ObjectInsert {
13669 pub this: Box<Expression>,
13670 #[serde(default)]
13671 pub key: Option<Box<Expression>>,
13672 #[serde(default)]
13673 pub value: Option<Box<Expression>>,
13674 #[serde(default)]
13675 pub update_flag: Option<Box<Expression>>,
13676}
13677
13678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13680#[cfg_attr(feature = "bindings", derive(TS))]
13681pub struct OpenJSONColumnDef {
13682 pub this: Box<Expression>,
13683 pub kind: String,
13684 #[serde(default)]
13685 pub path: Option<Box<Expression>>,
13686 #[serde(default)]
13687 pub as_json: Option<Box<Expression>>,
13688 #[serde(default, skip_serializing_if = "Option::is_none")]
13690 pub data_type: Option<DataType>,
13691}
13692
13693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13695#[cfg_attr(feature = "bindings", derive(TS))]
13696pub struct OpenJSON {
13697 pub this: Box<Expression>,
13698 #[serde(default)]
13699 pub path: Option<Box<Expression>>,
13700 #[serde(default)]
13701 pub expressions: Vec<Expression>,
13702}
13703
13704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13706#[cfg_attr(feature = "bindings", derive(TS))]
13707pub struct JSONBExists {
13708 pub this: Box<Expression>,
13709 #[serde(default)]
13710 pub path: Option<Box<Expression>>,
13711}
13712
13713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13715#[cfg_attr(feature = "bindings", derive(TS))]
13716pub struct JSONCast {
13717 pub this: Box<Expression>,
13718 pub to: DataType,
13719}
13720
13721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13723#[cfg_attr(feature = "bindings", derive(TS))]
13724pub struct JSONExtract {
13725 pub this: Box<Expression>,
13726 pub expression: Box<Expression>,
13727 #[serde(default)]
13728 pub only_json_types: Option<Box<Expression>>,
13729 #[serde(default)]
13730 pub expressions: Vec<Expression>,
13731 #[serde(default)]
13732 pub variant_extract: Option<Box<Expression>>,
13733 #[serde(default)]
13734 pub json_query: Option<Box<Expression>>,
13735 #[serde(default)]
13736 pub option: Option<Box<Expression>>,
13737 #[serde(default)]
13738 pub quote: Option<Box<Expression>>,
13739 #[serde(default)]
13740 pub on_condition: Option<Box<Expression>>,
13741 #[serde(default)]
13742 pub requires_json: Option<Box<Expression>>,
13743}
13744
13745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13747#[cfg_attr(feature = "bindings", derive(TS))]
13748pub struct JSONExtractQuote {
13749 #[serde(default)]
13750 pub option: Option<Box<Expression>>,
13751 #[serde(default)]
13752 pub scalar: Option<Box<Expression>>,
13753}
13754
13755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13757#[cfg_attr(feature = "bindings", derive(TS))]
13758pub struct JSONExtractArray {
13759 pub this: Box<Expression>,
13760 #[serde(default)]
13761 pub expression: Option<Box<Expression>>,
13762}
13763
13764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13766#[cfg_attr(feature = "bindings", derive(TS))]
13767pub struct JSONExtractScalar {
13768 pub this: Box<Expression>,
13769 pub expression: Box<Expression>,
13770 #[serde(default)]
13771 pub only_json_types: Option<Box<Expression>>,
13772 #[serde(default)]
13773 pub expressions: Vec<Expression>,
13774 #[serde(default)]
13775 pub json_type: Option<Box<Expression>>,
13776 #[serde(default)]
13777 pub scalar_only: Option<Box<Expression>>,
13778}
13779
13780#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13782#[cfg_attr(feature = "bindings", derive(TS))]
13783pub struct JSONBExtractScalar {
13784 pub this: Box<Expression>,
13785 pub expression: Box<Expression>,
13786 #[serde(default)]
13787 pub json_type: Option<Box<Expression>>,
13788}
13789
13790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13792#[cfg_attr(feature = "bindings", derive(TS))]
13793pub struct JSONFormat {
13794 #[serde(default)]
13795 pub this: Option<Box<Expression>>,
13796 #[serde(default)]
13797 pub options: Vec<Expression>,
13798 #[serde(default)]
13799 pub is_json: Option<Box<Expression>>,
13800 #[serde(default)]
13801 pub to_json: Option<Box<Expression>>,
13802}
13803
13804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13806#[cfg_attr(feature = "bindings", derive(TS))]
13807pub struct JSONArrayAppend {
13808 pub this: Box<Expression>,
13809 #[serde(default)]
13810 pub expressions: Vec<Expression>,
13811}
13812
13813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13815#[cfg_attr(feature = "bindings", derive(TS))]
13816pub struct JSONArrayContains {
13817 pub this: Box<Expression>,
13818 pub expression: Box<Expression>,
13819 #[serde(default)]
13820 pub json_type: Option<Box<Expression>>,
13821}
13822
13823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13825#[cfg_attr(feature = "bindings", derive(TS))]
13826pub struct JSONArrayInsert {
13827 pub this: Box<Expression>,
13828 #[serde(default)]
13829 pub expressions: Vec<Expression>,
13830}
13831
13832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13834#[cfg_attr(feature = "bindings", derive(TS))]
13835pub struct ParseJSON {
13836 pub this: Box<Expression>,
13837 #[serde(default)]
13838 pub expression: Option<Box<Expression>>,
13839 #[serde(default)]
13840 pub safe: Option<Box<Expression>>,
13841}
13842
13843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13845#[cfg_attr(feature = "bindings", derive(TS))]
13846pub struct ParseUrl {
13847 pub this: Box<Expression>,
13848 #[serde(default)]
13849 pub part_to_extract: Option<Box<Expression>>,
13850 #[serde(default)]
13851 pub key: Option<Box<Expression>>,
13852 #[serde(default)]
13853 pub permissive: Option<Box<Expression>>,
13854}
13855
13856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13858#[cfg_attr(feature = "bindings", derive(TS))]
13859pub struct ParseIp {
13860 pub this: Box<Expression>,
13861 #[serde(default)]
13862 pub type_: Option<Box<Expression>>,
13863 #[serde(default)]
13864 pub permissive: Option<Box<Expression>>,
13865}
13866
13867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13869#[cfg_attr(feature = "bindings", derive(TS))]
13870pub struct ParseTime {
13871 pub this: Box<Expression>,
13872 pub format: String,
13873}
13874
13875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13877#[cfg_attr(feature = "bindings", derive(TS))]
13878pub struct ParseDatetime {
13879 pub this: Box<Expression>,
13880 #[serde(default)]
13881 pub format: Option<String>,
13882 #[serde(default)]
13883 pub zone: Option<Box<Expression>>,
13884}
13885
13886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13888#[cfg_attr(feature = "bindings", derive(TS))]
13889pub struct Map {
13890 #[serde(default)]
13891 pub keys: Vec<Expression>,
13892 #[serde(default)]
13893 pub values: Vec<Expression>,
13894}
13895
13896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13898#[cfg_attr(feature = "bindings", derive(TS))]
13899pub struct MapCat {
13900 pub this: Box<Expression>,
13901 pub expression: Box<Expression>,
13902}
13903
13904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13906#[cfg_attr(feature = "bindings", derive(TS))]
13907pub struct MapDelete {
13908 pub this: Box<Expression>,
13909 #[serde(default)]
13910 pub expressions: Vec<Expression>,
13911}
13912
13913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13915#[cfg_attr(feature = "bindings", derive(TS))]
13916pub struct MapInsert {
13917 pub this: Box<Expression>,
13918 #[serde(default)]
13919 pub key: Option<Box<Expression>>,
13920 #[serde(default)]
13921 pub value: Option<Box<Expression>>,
13922 #[serde(default)]
13923 pub update_flag: Option<Box<Expression>>,
13924}
13925
13926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13928#[cfg_attr(feature = "bindings", derive(TS))]
13929pub struct MapPick {
13930 pub this: Box<Expression>,
13931 #[serde(default)]
13932 pub expressions: Vec<Expression>,
13933}
13934
13935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13937#[cfg_attr(feature = "bindings", derive(TS))]
13938pub struct ScopeResolution {
13939 #[serde(default)]
13940 pub this: Option<Box<Expression>>,
13941 pub expression: Box<Expression>,
13942}
13943
13944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13946#[cfg_attr(feature = "bindings", derive(TS))]
13947pub struct Slice {
13948 #[serde(default)]
13949 pub this: Option<Box<Expression>>,
13950 #[serde(default)]
13951 pub expression: Option<Box<Expression>>,
13952 #[serde(default)]
13953 pub step: Option<Box<Expression>>,
13954}
13955
13956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13958#[cfg_attr(feature = "bindings", derive(TS))]
13959pub struct VarMap {
13960 #[serde(default)]
13961 pub keys: Vec<Expression>,
13962 #[serde(default)]
13963 pub values: Vec<Expression>,
13964}
13965
13966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13968#[cfg_attr(feature = "bindings", derive(TS))]
13969pub struct MatchAgainst {
13970 pub this: Box<Expression>,
13971 #[serde(default)]
13972 pub expressions: Vec<Expression>,
13973 #[serde(default)]
13974 pub modifier: Option<Box<Expression>>,
13975}
13976
13977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13979#[cfg_attr(feature = "bindings", derive(TS))]
13980pub struct MD5Digest {
13981 pub this: Box<Expression>,
13982 #[serde(default)]
13983 pub expressions: Vec<Expression>,
13984}
13985
13986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13988#[cfg_attr(feature = "bindings", derive(TS))]
13989pub struct Monthname {
13990 pub this: Box<Expression>,
13991 #[serde(default)]
13992 pub abbreviated: Option<Box<Expression>>,
13993}
13994
13995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13997#[cfg_attr(feature = "bindings", derive(TS))]
13998pub struct Ntile {
13999 #[serde(default)]
14000 pub this: Option<Box<Expression>>,
14001}
14002
14003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14005#[cfg_attr(feature = "bindings", derive(TS))]
14006pub struct Normalize {
14007 pub this: Box<Expression>,
14008 #[serde(default)]
14009 pub form: Option<Box<Expression>>,
14010 #[serde(default)]
14011 pub is_casefold: Option<Box<Expression>>,
14012}
14013
14014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14016#[cfg_attr(feature = "bindings", derive(TS))]
14017pub struct Normal {
14018 pub this: Box<Expression>,
14019 #[serde(default)]
14020 pub stddev: Option<Box<Expression>>,
14021 #[serde(default)]
14022 pub gen: Option<Box<Expression>>,
14023}
14024
14025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14027#[cfg_attr(feature = "bindings", derive(TS))]
14028pub struct Predict {
14029 pub this: Box<Expression>,
14030 pub expression: Box<Expression>,
14031 #[serde(default)]
14032 pub params_struct: Option<Box<Expression>>,
14033}
14034
14035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14037#[cfg_attr(feature = "bindings", derive(TS))]
14038pub struct MLTranslate {
14039 pub this: Box<Expression>,
14040 pub expression: Box<Expression>,
14041 #[serde(default)]
14042 pub params_struct: Option<Box<Expression>>,
14043}
14044
14045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14047#[cfg_attr(feature = "bindings", derive(TS))]
14048pub struct FeaturesAtTime {
14049 pub this: Box<Expression>,
14050 #[serde(default)]
14051 pub time: Option<Box<Expression>>,
14052 #[serde(default)]
14053 pub num_rows: Option<Box<Expression>>,
14054 #[serde(default)]
14055 pub ignore_feature_nulls: Option<Box<Expression>>,
14056}
14057
14058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14060#[cfg_attr(feature = "bindings", derive(TS))]
14061pub struct GenerateEmbedding {
14062 pub this: Box<Expression>,
14063 pub expression: Box<Expression>,
14064 #[serde(default)]
14065 pub params_struct: Option<Box<Expression>>,
14066 #[serde(default)]
14067 pub is_text: Option<Box<Expression>>,
14068}
14069
14070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14072#[cfg_attr(feature = "bindings", derive(TS))]
14073pub struct MLForecast {
14074 pub this: Box<Expression>,
14075 #[serde(default)]
14076 pub expression: Option<Box<Expression>>,
14077 #[serde(default)]
14078 pub params_struct: Option<Box<Expression>>,
14079}
14080
14081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14083#[cfg_attr(feature = "bindings", derive(TS))]
14084pub struct ModelAttribute {
14085 pub this: Box<Expression>,
14086 pub expression: Box<Expression>,
14087}
14088
14089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14091#[cfg_attr(feature = "bindings", derive(TS))]
14092pub struct VectorSearch {
14093 pub this: Box<Expression>,
14094 #[serde(default)]
14095 pub column_to_search: Option<Box<Expression>>,
14096 #[serde(default)]
14097 pub query_table: Option<Box<Expression>>,
14098 #[serde(default)]
14099 pub query_column_to_search: Option<Box<Expression>>,
14100 #[serde(default)]
14101 pub top_k: Option<Box<Expression>>,
14102 #[serde(default)]
14103 pub distance_type: Option<Box<Expression>>,
14104 #[serde(default)]
14105 pub options: Vec<Expression>,
14106}
14107
14108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14110#[cfg_attr(feature = "bindings", derive(TS))]
14111pub struct Quantile {
14112 pub this: Box<Expression>,
14113 #[serde(default)]
14114 pub quantile: Option<Box<Expression>>,
14115}
14116
14117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14119#[cfg_attr(feature = "bindings", derive(TS))]
14120pub struct ApproxQuantile {
14121 pub this: Box<Expression>,
14122 #[serde(default)]
14123 pub quantile: Option<Box<Expression>>,
14124 #[serde(default)]
14125 pub accuracy: Option<Box<Expression>>,
14126 #[serde(default)]
14127 pub weight: Option<Box<Expression>>,
14128 #[serde(default)]
14129 pub error_tolerance: Option<Box<Expression>>,
14130}
14131
14132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14134#[cfg_attr(feature = "bindings", derive(TS))]
14135pub struct ApproxPercentileEstimate {
14136 pub this: Box<Expression>,
14137 #[serde(default)]
14138 pub percentile: Option<Box<Expression>>,
14139}
14140
14141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14143#[cfg_attr(feature = "bindings", derive(TS))]
14144pub struct Randn {
14145 #[serde(default)]
14146 pub this: Option<Box<Expression>>,
14147}
14148
14149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14151#[cfg_attr(feature = "bindings", derive(TS))]
14152pub struct Randstr {
14153 pub this: Box<Expression>,
14154 #[serde(default)]
14155 pub generator: Option<Box<Expression>>,
14156}
14157
14158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14160#[cfg_attr(feature = "bindings", derive(TS))]
14161pub struct RangeN {
14162 pub this: Box<Expression>,
14163 #[serde(default)]
14164 pub expressions: Vec<Expression>,
14165 #[serde(default)]
14166 pub each: Option<Box<Expression>>,
14167}
14168
14169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14171#[cfg_attr(feature = "bindings", derive(TS))]
14172pub struct RangeBucket {
14173 pub this: Box<Expression>,
14174 pub expression: Box<Expression>,
14175}
14176
14177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14179#[cfg_attr(feature = "bindings", derive(TS))]
14180pub struct ReadCSV {
14181 pub this: Box<Expression>,
14182 #[serde(default)]
14183 pub expressions: Vec<Expression>,
14184}
14185
14186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14188#[cfg_attr(feature = "bindings", derive(TS))]
14189pub struct ReadParquet {
14190 #[serde(default)]
14191 pub expressions: Vec<Expression>,
14192}
14193
14194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14196#[cfg_attr(feature = "bindings", derive(TS))]
14197pub struct Reduce {
14198 pub this: Box<Expression>,
14199 #[serde(default)]
14200 pub initial: Option<Box<Expression>>,
14201 #[serde(default)]
14202 pub merge: Option<Box<Expression>>,
14203 #[serde(default)]
14204 pub finish: Option<Box<Expression>>,
14205}
14206
14207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14209#[cfg_attr(feature = "bindings", derive(TS))]
14210pub struct RegexpExtractAll {
14211 pub this: Box<Expression>,
14212 pub expression: Box<Expression>,
14213 #[serde(default)]
14214 pub group: Option<Box<Expression>>,
14215 #[serde(default)]
14216 pub parameters: Option<Box<Expression>>,
14217 #[serde(default)]
14218 pub position: Option<Box<Expression>>,
14219 #[serde(default)]
14220 pub occurrence: Option<Box<Expression>>,
14221}
14222
14223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14225#[cfg_attr(feature = "bindings", derive(TS))]
14226pub struct RegexpILike {
14227 pub this: Box<Expression>,
14228 pub expression: Box<Expression>,
14229 #[serde(default)]
14230 pub flag: Option<Box<Expression>>,
14231}
14232
14233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14235#[cfg_attr(feature = "bindings", derive(TS))]
14236pub struct RegexpFullMatch {
14237 pub this: Box<Expression>,
14238 pub expression: Box<Expression>,
14239 #[serde(default)]
14240 pub options: Vec<Expression>,
14241}
14242
14243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14245#[cfg_attr(feature = "bindings", derive(TS))]
14246pub struct RegexpInstr {
14247 pub this: Box<Expression>,
14248 pub expression: Box<Expression>,
14249 #[serde(default)]
14250 pub position: Option<Box<Expression>>,
14251 #[serde(default)]
14252 pub occurrence: Option<Box<Expression>>,
14253 #[serde(default)]
14254 pub option: Option<Box<Expression>>,
14255 #[serde(default)]
14256 pub parameters: Option<Box<Expression>>,
14257 #[serde(default)]
14258 pub group: Option<Box<Expression>>,
14259}
14260
14261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14263#[cfg_attr(feature = "bindings", derive(TS))]
14264pub struct RegexpSplit {
14265 pub this: Box<Expression>,
14266 pub expression: Box<Expression>,
14267 #[serde(default)]
14268 pub limit: Option<Box<Expression>>,
14269}
14270
14271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14273#[cfg_attr(feature = "bindings", derive(TS))]
14274pub struct RegexpCount {
14275 pub this: Box<Expression>,
14276 pub expression: Box<Expression>,
14277 #[serde(default)]
14278 pub position: Option<Box<Expression>>,
14279 #[serde(default)]
14280 pub parameters: Option<Box<Expression>>,
14281}
14282
14283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14285#[cfg_attr(feature = "bindings", derive(TS))]
14286pub struct RegrValx {
14287 pub this: Box<Expression>,
14288 pub expression: Box<Expression>,
14289}
14290
14291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14293#[cfg_attr(feature = "bindings", derive(TS))]
14294pub struct RegrValy {
14295 pub this: Box<Expression>,
14296 pub expression: Box<Expression>,
14297}
14298
14299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14301#[cfg_attr(feature = "bindings", derive(TS))]
14302pub struct RegrAvgy {
14303 pub this: Box<Expression>,
14304 pub expression: Box<Expression>,
14305}
14306
14307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14309#[cfg_attr(feature = "bindings", derive(TS))]
14310pub struct RegrAvgx {
14311 pub this: Box<Expression>,
14312 pub expression: Box<Expression>,
14313}
14314
14315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14317#[cfg_attr(feature = "bindings", derive(TS))]
14318pub struct RegrCount {
14319 pub this: Box<Expression>,
14320 pub expression: Box<Expression>,
14321}
14322
14323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14325#[cfg_attr(feature = "bindings", derive(TS))]
14326pub struct RegrIntercept {
14327 pub this: Box<Expression>,
14328 pub expression: Box<Expression>,
14329}
14330
14331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14333#[cfg_attr(feature = "bindings", derive(TS))]
14334pub struct RegrR2 {
14335 pub this: Box<Expression>,
14336 pub expression: Box<Expression>,
14337}
14338
14339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14341#[cfg_attr(feature = "bindings", derive(TS))]
14342pub struct RegrSxx {
14343 pub this: Box<Expression>,
14344 pub expression: Box<Expression>,
14345}
14346
14347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14349#[cfg_attr(feature = "bindings", derive(TS))]
14350pub struct RegrSxy {
14351 pub this: Box<Expression>,
14352 pub expression: Box<Expression>,
14353}
14354
14355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14357#[cfg_attr(feature = "bindings", derive(TS))]
14358pub struct RegrSyy {
14359 pub this: Box<Expression>,
14360 pub expression: Box<Expression>,
14361}
14362
14363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14365#[cfg_attr(feature = "bindings", derive(TS))]
14366pub struct RegrSlope {
14367 pub this: Box<Expression>,
14368 pub expression: Box<Expression>,
14369}
14370
14371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14373#[cfg_attr(feature = "bindings", derive(TS))]
14374pub struct SafeAdd {
14375 pub this: Box<Expression>,
14376 pub expression: Box<Expression>,
14377}
14378
14379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14381#[cfg_attr(feature = "bindings", derive(TS))]
14382pub struct SafeDivide {
14383 pub this: Box<Expression>,
14384 pub expression: Box<Expression>,
14385}
14386
14387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14389#[cfg_attr(feature = "bindings", derive(TS))]
14390pub struct SafeMultiply {
14391 pub this: Box<Expression>,
14392 pub expression: Box<Expression>,
14393}
14394
14395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14397#[cfg_attr(feature = "bindings", derive(TS))]
14398pub struct SafeSubtract {
14399 pub this: Box<Expression>,
14400 pub expression: Box<Expression>,
14401}
14402
14403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14405#[cfg_attr(feature = "bindings", derive(TS))]
14406pub struct SHA2 {
14407 pub this: Box<Expression>,
14408 #[serde(default)]
14409 pub length: Option<i64>,
14410}
14411
14412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14414#[cfg_attr(feature = "bindings", derive(TS))]
14415pub struct SHA2Digest {
14416 pub this: Box<Expression>,
14417 #[serde(default)]
14418 pub length: Option<i64>,
14419}
14420
14421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14423#[cfg_attr(feature = "bindings", derive(TS))]
14424pub struct SortArray {
14425 pub this: Box<Expression>,
14426 #[serde(default)]
14427 pub asc: Option<Box<Expression>>,
14428 #[serde(default)]
14429 pub nulls_first: Option<Box<Expression>>,
14430}
14431
14432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14434#[cfg_attr(feature = "bindings", derive(TS))]
14435pub struct SplitPart {
14436 pub this: Box<Expression>,
14437 #[serde(default)]
14438 pub delimiter: Option<Box<Expression>>,
14439 #[serde(default)]
14440 pub part_index: Option<Box<Expression>>,
14441}
14442
14443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14445#[cfg_attr(feature = "bindings", derive(TS))]
14446pub struct SubstringIndex {
14447 pub this: Box<Expression>,
14448 #[serde(default)]
14449 pub delimiter: Option<Box<Expression>>,
14450 #[serde(default)]
14451 pub count: Option<Box<Expression>>,
14452}
14453
14454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14456#[cfg_attr(feature = "bindings", derive(TS))]
14457pub struct StandardHash {
14458 pub this: Box<Expression>,
14459 #[serde(default)]
14460 pub expression: Option<Box<Expression>>,
14461}
14462
14463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14465#[cfg_attr(feature = "bindings", derive(TS))]
14466pub struct StrPosition {
14467 pub this: Box<Expression>,
14468 #[serde(default)]
14469 pub substr: Option<Box<Expression>>,
14470 #[serde(default)]
14471 pub position: Option<Box<Expression>>,
14472 #[serde(default)]
14473 pub occurrence: Option<Box<Expression>>,
14474}
14475
14476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14478#[cfg_attr(feature = "bindings", derive(TS))]
14479pub struct Search {
14480 pub this: Box<Expression>,
14481 pub expression: Box<Expression>,
14482 #[serde(default)]
14483 pub json_scope: Option<Box<Expression>>,
14484 #[serde(default)]
14485 pub analyzer: Option<Box<Expression>>,
14486 #[serde(default)]
14487 pub analyzer_options: Option<Box<Expression>>,
14488 #[serde(default)]
14489 pub search_mode: Option<Box<Expression>>,
14490}
14491
14492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14494#[cfg_attr(feature = "bindings", derive(TS))]
14495pub struct SearchIp {
14496 pub this: Box<Expression>,
14497 pub expression: Box<Expression>,
14498}
14499
14500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14502#[cfg_attr(feature = "bindings", derive(TS))]
14503pub struct StrToDate {
14504 pub this: Box<Expression>,
14505 #[serde(default)]
14506 pub format: Option<String>,
14507 #[serde(default)]
14508 pub safe: Option<Box<Expression>>,
14509}
14510
14511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14513#[cfg_attr(feature = "bindings", derive(TS))]
14514pub struct StrToTime {
14515 pub this: Box<Expression>,
14516 pub format: String,
14517 #[serde(default)]
14518 pub zone: Option<Box<Expression>>,
14519 #[serde(default)]
14520 pub safe: Option<Box<Expression>>,
14521 #[serde(default)]
14522 pub target_type: Option<Box<Expression>>,
14523}
14524
14525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14527#[cfg_attr(feature = "bindings", derive(TS))]
14528pub struct StrToUnix {
14529 #[serde(default)]
14530 pub this: Option<Box<Expression>>,
14531 #[serde(default)]
14532 pub format: Option<String>,
14533}
14534
14535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14537#[cfg_attr(feature = "bindings", derive(TS))]
14538pub struct StrToMap {
14539 pub this: Box<Expression>,
14540 #[serde(default)]
14541 pub pair_delim: Option<Box<Expression>>,
14542 #[serde(default)]
14543 pub key_value_delim: Option<Box<Expression>>,
14544 #[serde(default)]
14545 pub duplicate_resolution_callback: Option<Box<Expression>>,
14546}
14547
14548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14550#[cfg_attr(feature = "bindings", derive(TS))]
14551pub struct NumberToStr {
14552 pub this: Box<Expression>,
14553 pub format: String,
14554 #[serde(default)]
14555 pub culture: Option<Box<Expression>>,
14556}
14557
14558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14560#[cfg_attr(feature = "bindings", derive(TS))]
14561pub struct FromBase {
14562 pub this: Box<Expression>,
14563 pub expression: Box<Expression>,
14564}
14565
14566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14568#[cfg_attr(feature = "bindings", derive(TS))]
14569pub struct Stuff {
14570 pub this: Box<Expression>,
14571 #[serde(default)]
14572 pub start: Option<Box<Expression>>,
14573 #[serde(default)]
14574 pub length: Option<i64>,
14575 pub expression: Box<Expression>,
14576}
14577
14578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14580#[cfg_attr(feature = "bindings", derive(TS))]
14581pub struct TimeToStr {
14582 pub this: Box<Expression>,
14583 pub format: String,
14584 #[serde(default)]
14585 pub culture: Option<Box<Expression>>,
14586 #[serde(default)]
14587 pub zone: Option<Box<Expression>>,
14588}
14589
14590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14592#[cfg_attr(feature = "bindings", derive(TS))]
14593pub struct TimeStrToTime {
14594 pub this: Box<Expression>,
14595 #[serde(default)]
14596 pub zone: Option<Box<Expression>>,
14597}
14598
14599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14601#[cfg_attr(feature = "bindings", derive(TS))]
14602pub struct TsOrDsAdd {
14603 pub this: Box<Expression>,
14604 pub expression: Box<Expression>,
14605 #[serde(default)]
14606 pub unit: Option<String>,
14607 #[serde(default)]
14608 pub return_type: Option<Box<Expression>>,
14609}
14610
14611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14613#[cfg_attr(feature = "bindings", derive(TS))]
14614pub struct TsOrDsDiff {
14615 pub this: Box<Expression>,
14616 pub expression: Box<Expression>,
14617 #[serde(default)]
14618 pub unit: Option<String>,
14619}
14620
14621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14623#[cfg_attr(feature = "bindings", derive(TS))]
14624pub struct TsOrDsToDate {
14625 pub this: Box<Expression>,
14626 #[serde(default)]
14627 pub format: Option<String>,
14628 #[serde(default)]
14629 pub safe: Option<Box<Expression>>,
14630}
14631
14632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14634#[cfg_attr(feature = "bindings", derive(TS))]
14635pub struct TsOrDsToTime {
14636 pub this: Box<Expression>,
14637 #[serde(default)]
14638 pub format: Option<String>,
14639 #[serde(default)]
14640 pub safe: Option<Box<Expression>>,
14641}
14642
14643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14645#[cfg_attr(feature = "bindings", derive(TS))]
14646pub struct Unhex {
14647 pub this: Box<Expression>,
14648 #[serde(default)]
14649 pub expression: Option<Box<Expression>>,
14650}
14651
14652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14654#[cfg_attr(feature = "bindings", derive(TS))]
14655pub struct Uniform {
14656 pub this: Box<Expression>,
14657 pub expression: Box<Expression>,
14658 #[serde(default)]
14659 pub gen: Option<Box<Expression>>,
14660 #[serde(default)]
14661 pub seed: Option<Box<Expression>>,
14662}
14663
14664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14666#[cfg_attr(feature = "bindings", derive(TS))]
14667pub struct UnixToStr {
14668 pub this: Box<Expression>,
14669 #[serde(default)]
14670 pub format: Option<String>,
14671}
14672
14673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14675#[cfg_attr(feature = "bindings", derive(TS))]
14676pub struct UnixToTime {
14677 pub this: Box<Expression>,
14678 #[serde(default)]
14679 pub scale: Option<i64>,
14680 #[serde(default)]
14681 pub zone: Option<Box<Expression>>,
14682 #[serde(default)]
14683 pub hours: Option<Box<Expression>>,
14684 #[serde(default)]
14685 pub minutes: Option<Box<Expression>>,
14686 #[serde(default)]
14687 pub format: Option<String>,
14688 #[serde(default)]
14689 pub target_type: Option<Box<Expression>>,
14690}
14691
14692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14694#[cfg_attr(feature = "bindings", derive(TS))]
14695pub struct Uuid {
14696 #[serde(default)]
14697 pub this: Option<Box<Expression>>,
14698 #[serde(default)]
14699 pub name: Option<String>,
14700 #[serde(default)]
14701 pub is_string: Option<Box<Expression>>,
14702}
14703
14704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14706#[cfg_attr(feature = "bindings", derive(TS))]
14707pub struct TimestampFromParts {
14708 #[serde(default)]
14709 pub zone: Option<Box<Expression>>,
14710 #[serde(default)]
14711 pub milli: Option<Box<Expression>>,
14712 #[serde(default)]
14713 pub this: Option<Box<Expression>>,
14714 #[serde(default)]
14715 pub expression: Option<Box<Expression>>,
14716}
14717
14718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14720#[cfg_attr(feature = "bindings", derive(TS))]
14721pub struct TimestampTzFromParts {
14722 #[serde(default)]
14723 pub zone: Option<Box<Expression>>,
14724}
14725
14726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14728#[cfg_attr(feature = "bindings", derive(TS))]
14729pub struct Corr {
14730 pub this: Box<Expression>,
14731 pub expression: Box<Expression>,
14732 #[serde(default)]
14733 pub null_on_zero_variance: Option<Box<Expression>>,
14734}
14735
14736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14738#[cfg_attr(feature = "bindings", derive(TS))]
14739pub struct WidthBucket {
14740 pub this: Box<Expression>,
14741 #[serde(default)]
14742 pub min_value: Option<Box<Expression>>,
14743 #[serde(default)]
14744 pub max_value: Option<Box<Expression>>,
14745 #[serde(default)]
14746 pub num_buckets: Option<Box<Expression>>,
14747 #[serde(default)]
14748 pub threshold: Option<Box<Expression>>,
14749}
14750
14751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14753#[cfg_attr(feature = "bindings", derive(TS))]
14754pub struct CovarSamp {
14755 pub this: Box<Expression>,
14756 pub expression: Box<Expression>,
14757}
14758
14759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14761#[cfg_attr(feature = "bindings", derive(TS))]
14762pub struct CovarPop {
14763 pub this: Box<Expression>,
14764 pub expression: Box<Expression>,
14765}
14766
14767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14769#[cfg_attr(feature = "bindings", derive(TS))]
14770pub struct Week {
14771 pub this: Box<Expression>,
14772 #[serde(default)]
14773 pub mode: Option<Box<Expression>>,
14774}
14775
14776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14778#[cfg_attr(feature = "bindings", derive(TS))]
14779pub struct XMLElement {
14780 pub this: Box<Expression>,
14781 #[serde(default)]
14782 pub expressions: Vec<Expression>,
14783 #[serde(default)]
14784 pub evalname: Option<Box<Expression>>,
14785}
14786
14787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14789#[cfg_attr(feature = "bindings", derive(TS))]
14790pub struct XMLGet {
14791 pub this: Box<Expression>,
14792 pub expression: Box<Expression>,
14793 #[serde(default)]
14794 pub instance: Option<Box<Expression>>,
14795}
14796
14797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14799#[cfg_attr(feature = "bindings", derive(TS))]
14800pub struct XMLTable {
14801 pub this: Box<Expression>,
14802 #[serde(default)]
14803 pub namespaces: Option<Box<Expression>>,
14804 #[serde(default)]
14805 pub passing: Option<Box<Expression>>,
14806 #[serde(default)]
14807 pub columns: Vec<Expression>,
14808 #[serde(default)]
14809 pub by_ref: Option<Box<Expression>>,
14810}
14811
14812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14814#[cfg_attr(feature = "bindings", derive(TS))]
14815pub struct XMLKeyValueOption {
14816 pub this: Box<Expression>,
14817 #[serde(default)]
14818 pub expression: Option<Box<Expression>>,
14819}
14820
14821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14823#[cfg_attr(feature = "bindings", derive(TS))]
14824pub struct Zipf {
14825 pub this: Box<Expression>,
14826 #[serde(default)]
14827 pub elementcount: Option<Box<Expression>>,
14828 #[serde(default)]
14829 pub gen: Option<Box<Expression>>,
14830}
14831
14832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14834#[cfg_attr(feature = "bindings", derive(TS))]
14835pub struct Merge {
14836 pub this: Box<Expression>,
14837 pub using: Box<Expression>,
14838 #[serde(default)]
14839 pub on: Option<Box<Expression>>,
14840 #[serde(default)]
14841 pub using_cond: Option<Box<Expression>>,
14842 #[serde(default)]
14843 pub whens: Option<Box<Expression>>,
14844 #[serde(default)]
14845 pub with_: Option<Box<Expression>>,
14846 #[serde(default)]
14847 pub returning: Option<Box<Expression>>,
14848}
14849
14850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14852#[cfg_attr(feature = "bindings", derive(TS))]
14853pub struct When {
14854 #[serde(default)]
14855 pub matched: Option<Box<Expression>>,
14856 #[serde(default)]
14857 pub source: Option<Box<Expression>>,
14858 #[serde(default)]
14859 pub condition: Option<Box<Expression>>,
14860 pub then: Box<Expression>,
14861}
14862
14863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14865#[cfg_attr(feature = "bindings", derive(TS))]
14866pub struct Whens {
14867 #[serde(default)]
14868 pub expressions: Vec<Expression>,
14869}
14870
14871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14873#[cfg_attr(feature = "bindings", derive(TS))]
14874pub struct NextValueFor {
14875 pub this: Box<Expression>,
14876 #[serde(default)]
14877 pub order: Option<Box<Expression>>,
14878}
14879
14880#[cfg(test)]
14881mod tests {
14882 use super::*;
14883
14884 #[test]
14885 #[cfg(feature = "bindings")]
14886 fn export_typescript_types() {
14887 Expression::export_all(&ts_rs::Config::default())
14890 .expect("Failed to export Expression types");
14891 }
14892
14893 #[test]
14894 fn test_simple_select_builder() {
14895 let select = Select::new()
14896 .column(Expression::star())
14897 .from(Expression::Table(Box::new(TableRef::new("users"))));
14898
14899 assert_eq!(select.expressions.len(), 1);
14900 assert!(select.from.is_some());
14901 }
14902
14903 #[test]
14904 fn test_expression_alias() {
14905 let expr = Expression::column("id").alias("user_id");
14906
14907 match expr {
14908 Expression::Alias(a) => {
14909 assert_eq!(a.alias.name, "user_id");
14910 }
14911 _ => panic!("Expected Alias"),
14912 }
14913 }
14914
14915 #[test]
14916 fn test_literal_creation() {
14917 let num = Expression::number(42);
14918 let str = Expression::string("hello");
14919
14920 match num {
14921 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14922 let Literal::Number(n) = lit.as_ref() else {
14923 unreachable!()
14924 };
14925 assert_eq!(n, "42")
14926 }
14927 _ => panic!("Expected Number"),
14928 }
14929
14930 match str {
14931 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
14932 let Literal::String(s) = lit.as_ref() else {
14933 unreachable!()
14934 };
14935 assert_eq!(s, "hello")
14936 }
14937 _ => panic!("Expected String"),
14938 }
14939 }
14940
14941 #[test]
14942 fn test_expression_sql() {
14943 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14944 assert_eq!(expr.sql(), "SELECT 1 + 2");
14945 }
14946
14947 #[test]
14948 fn test_expression_sql_for() {
14949 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14950 let sql = expr.sql_for(crate::DialectType::Generic);
14951 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
14953 }
14954}