1use crate::tokens::Span;
34use serde::{Deserialize, Serialize};
35use std::fmt;
36#[cfg(feature = "bindings")]
37use ts_rs::TS;
38
39fn default_true() -> bool {
41 true
42}
43
44fn is_true(v: &bool) -> bool {
45 *v
46}
47
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[cfg_attr(feature = "bindings", derive(TS))]
78#[serde(rename_all = "snake_case")]
79#[cfg_attr(feature = "bindings", ts(export))]
80pub enum Expression {
81 Literal(Box<Literal>),
83 Boolean(BooleanLiteral),
84 Null(Null),
85
86 Identifier(Identifier),
88 Column(Box<Column>),
89 Table(Box<TableRef>),
90 Star(Star),
91 BracedWildcard(Box<Expression>),
93
94 Select(Box<Select>),
96 Union(Box<Union>),
97 Intersect(Box<Intersect>),
98 Except(Box<Except>),
99 Subquery(Box<Subquery>),
100 PipeOperator(Box<PipeOperator>),
101 Pivot(Box<Pivot>),
102 PivotAlias(Box<PivotAlias>),
103 Unpivot(Box<Unpivot>),
104 Values(Box<Values>),
105 PreWhere(Box<PreWhere>),
106 Stream(Box<Stream>),
107 UsingData(Box<UsingData>),
108 XmlNamespace(Box<XmlNamespace>),
109
110 Insert(Box<Insert>),
112 Update(Box<Update>),
113 Delete(Box<Delete>),
114 Copy(Box<CopyStmt>),
115 Put(Box<PutStmt>),
116 StageReference(Box<StageReference>),
117
118 Alias(Box<Alias>),
120 Cast(Box<Cast>),
121 Collation(Box<CollationExpr>),
122 Case(Box<Case>),
123
124 And(Box<BinaryOp>),
126 Or(Box<BinaryOp>),
127 Add(Box<BinaryOp>),
128 Sub(Box<BinaryOp>),
129 Mul(Box<BinaryOp>),
130 Div(Box<BinaryOp>),
131 Mod(Box<BinaryOp>),
132 Eq(Box<BinaryOp>),
133 Neq(Box<BinaryOp>),
134 Lt(Box<BinaryOp>),
135 Lte(Box<BinaryOp>),
136 Gt(Box<BinaryOp>),
137 Gte(Box<BinaryOp>),
138 Like(Box<LikeOp>),
139 ILike(Box<LikeOp>),
140 Match(Box<BinaryOp>),
142 BitwiseAnd(Box<BinaryOp>),
143 BitwiseOr(Box<BinaryOp>),
144 BitwiseXor(Box<BinaryOp>),
145 Concat(Box<BinaryOp>),
146 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
162 Neg(Box<UnaryOp>),
163 BitwiseNot(Box<UnaryOp>),
164
165 In(Box<In>),
167 Between(Box<Between>),
168 IsNull(Box<IsNull>),
169 IsTrue(Box<IsTrueFalse>),
170 IsFalse(Box<IsTrueFalse>),
171 IsJson(Box<IsJson>),
172 Is(Box<BinaryOp>), Exists(Box<Exists>),
174 MemberOf(Box<BinaryOp>),
176
177 Function(Box<Function>),
179 AggregateFunction(Box<AggregateFunction>),
180 WindowFunction(Box<WindowFunction>),
181
182 From(Box<From>),
184 Join(Box<Join>),
185 JoinedTable(Box<JoinedTable>),
186 Where(Box<Where>),
187 GroupBy(Box<GroupBy>),
188 Having(Box<Having>),
189 OrderBy(Box<OrderBy>),
190 Limit(Box<Limit>),
191 Offset(Box<Offset>),
192 Qualify(Box<Qualify>),
193 With(Box<With>),
194 Cte(Box<Cte>),
195 DistributeBy(Box<DistributeBy>),
196 ClusterBy(Box<ClusterBy>),
197 SortBy(Box<SortBy>),
198 LateralView(Box<LateralView>),
199 Hint(Box<Hint>),
200 Pseudocolumn(Pseudocolumn),
201
202 Connect(Box<Connect>),
204 Prior(Box<Prior>),
205 ConnectByRoot(Box<ConnectByRoot>),
206
207 MatchRecognize(Box<MatchRecognize>),
209
210 Ordered(Box<Ordered>),
212
213 Window(Box<WindowSpec>),
215 Over(Box<Over>),
216 WithinGroup(Box<WithinGroup>),
217
218 DataType(DataType),
220
221 Array(Box<Array>),
223 Struct(Box<Struct>),
224 Tuple(Box<Tuple>),
225
226 Interval(Box<Interval>),
228
229 ConcatWs(Box<ConcatWs>),
231 Substring(Box<SubstringFunc>),
232 Upper(Box<UnaryFunc>),
233 Lower(Box<UnaryFunc>),
234 Length(Box<UnaryFunc>),
235 Trim(Box<TrimFunc>),
236 LTrim(Box<UnaryFunc>),
237 RTrim(Box<UnaryFunc>),
238 Replace(Box<ReplaceFunc>),
239 Reverse(Box<UnaryFunc>),
240 Left(Box<LeftRightFunc>),
241 Right(Box<LeftRightFunc>),
242 Repeat(Box<RepeatFunc>),
243 Lpad(Box<PadFunc>),
244 Rpad(Box<PadFunc>),
245 Split(Box<SplitFunc>),
246 RegexpLike(Box<RegexpFunc>),
247 RegexpReplace(Box<RegexpReplaceFunc>),
248 RegexpExtract(Box<RegexpExtractFunc>),
249 Overlay(Box<OverlayFunc>),
250
251 Abs(Box<UnaryFunc>),
253 Round(Box<RoundFunc>),
254 Floor(Box<FloorFunc>),
255 Ceil(Box<CeilFunc>),
256 Power(Box<BinaryFunc>),
257 Sqrt(Box<UnaryFunc>),
258 Cbrt(Box<UnaryFunc>),
259 Ln(Box<UnaryFunc>),
260 Log(Box<LogFunc>),
261 Exp(Box<UnaryFunc>),
262 Sign(Box<UnaryFunc>),
263 Greatest(Box<VarArgFunc>),
264 Least(Box<VarArgFunc>),
265
266 CurrentDate(CurrentDate),
268 CurrentTime(CurrentTime),
269 CurrentTimestamp(CurrentTimestamp),
270 CurrentTimestampLTZ(CurrentTimestampLTZ),
271 AtTimeZone(Box<AtTimeZone>),
272 DateAdd(Box<DateAddFunc>),
273 DateSub(Box<DateAddFunc>),
274 DateDiff(Box<DateDiffFunc>),
275 DateTrunc(Box<DateTruncFunc>),
276 Extract(Box<ExtractFunc>),
277 ToDate(Box<ToDateFunc>),
278 ToTimestamp(Box<ToTimestampFunc>),
279 Date(Box<UnaryFunc>),
280 Time(Box<UnaryFunc>),
281 DateFromUnixDate(Box<UnaryFunc>),
282 UnixDate(Box<UnaryFunc>),
283 UnixSeconds(Box<UnaryFunc>),
284 UnixMillis(Box<UnaryFunc>),
285 UnixMicros(Box<UnaryFunc>),
286 UnixToTimeStr(Box<BinaryFunc>),
287 TimeStrToDate(Box<UnaryFunc>),
288 DateToDi(Box<UnaryFunc>),
289 DiToDate(Box<UnaryFunc>),
290 TsOrDiToDi(Box<UnaryFunc>),
291 TsOrDsToDatetime(Box<UnaryFunc>),
292 TsOrDsToTimestamp(Box<UnaryFunc>),
293 YearOfWeek(Box<UnaryFunc>),
294 YearOfWeekIso(Box<UnaryFunc>),
295
296 Coalesce(Box<VarArgFunc>),
298 NullIf(Box<BinaryFunc>),
299 IfFunc(Box<IfFunc>),
300 IfNull(Box<BinaryFunc>),
301 Nvl(Box<BinaryFunc>),
302 Nvl2(Box<Nvl2Func>),
303
304 TryCast(Box<Cast>),
306 SafeCast(Box<Cast>),
307
308 Count(Box<CountFunc>),
310 Sum(Box<AggFunc>),
311 Avg(Box<AggFunc>),
312 Min(Box<AggFunc>),
313 Max(Box<AggFunc>),
314 GroupConcat(Box<GroupConcatFunc>),
315 StringAgg(Box<StringAggFunc>),
316 ListAgg(Box<ListAggFunc>),
317 ArrayAgg(Box<AggFunc>),
318 CountIf(Box<AggFunc>),
319 SumIf(Box<SumIfFunc>),
320 Stddev(Box<AggFunc>),
321 StddevPop(Box<AggFunc>),
322 StddevSamp(Box<AggFunc>),
323 Variance(Box<AggFunc>),
324 VarPop(Box<AggFunc>),
325 VarSamp(Box<AggFunc>),
326 Median(Box<AggFunc>),
327 Mode(Box<AggFunc>),
328 First(Box<AggFunc>),
329 Last(Box<AggFunc>),
330 AnyValue(Box<AggFunc>),
331 ApproxDistinct(Box<AggFunc>),
332 ApproxCountDistinct(Box<AggFunc>),
333 ApproxPercentile(Box<ApproxPercentileFunc>),
334 Percentile(Box<PercentileFunc>),
335 LogicalAnd(Box<AggFunc>),
336 LogicalOr(Box<AggFunc>),
337 Skewness(Box<AggFunc>),
338 BitwiseCount(Box<UnaryFunc>),
339 ArrayConcatAgg(Box<AggFunc>),
340 ArrayUniqueAgg(Box<AggFunc>),
341 BoolXorAgg(Box<AggFunc>),
342
343 RowNumber(RowNumber),
345 Rank(Rank),
346 DenseRank(DenseRank),
347 NTile(Box<NTileFunc>),
348 Lead(Box<LeadLagFunc>),
349 Lag(Box<LeadLagFunc>),
350 FirstValue(Box<ValueFunc>),
351 LastValue(Box<ValueFunc>),
352 NthValue(Box<NthValueFunc>),
353 PercentRank(PercentRank),
354 CumeDist(CumeDist),
355 PercentileCont(Box<PercentileFunc>),
356 PercentileDisc(Box<PercentileFunc>),
357
358 Contains(Box<BinaryFunc>),
360 StartsWith(Box<BinaryFunc>),
361 EndsWith(Box<BinaryFunc>),
362 Position(Box<PositionFunc>),
363 Initcap(Box<UnaryFunc>),
364 Ascii(Box<UnaryFunc>),
365 Chr(Box<UnaryFunc>),
366 CharFunc(Box<CharFunc>),
368 Soundex(Box<UnaryFunc>),
369 Levenshtein(Box<BinaryFunc>),
370 ByteLength(Box<UnaryFunc>),
371 Hex(Box<UnaryFunc>),
372 LowerHex(Box<UnaryFunc>),
373 Unicode(Box<UnaryFunc>),
374
375 ModFunc(Box<BinaryFunc>),
377 Random(Random),
378 Rand(Box<Rand>),
379 TruncFunc(Box<TruncateFunc>),
380 Pi(Pi),
381 Radians(Box<UnaryFunc>),
382 Degrees(Box<UnaryFunc>),
383 Sin(Box<UnaryFunc>),
384 Cos(Box<UnaryFunc>),
385 Tan(Box<UnaryFunc>),
386 Asin(Box<UnaryFunc>),
387 Acos(Box<UnaryFunc>),
388 Atan(Box<UnaryFunc>),
389 Atan2(Box<BinaryFunc>),
390 IsNan(Box<UnaryFunc>),
391 IsInf(Box<UnaryFunc>),
392 IntDiv(Box<BinaryFunc>),
393
394 Decode(Box<DecodeFunc>),
396
397 DateFormat(Box<DateFormatFunc>),
399 FormatDate(Box<DateFormatFunc>),
400 Year(Box<UnaryFunc>),
401 Month(Box<UnaryFunc>),
402 Day(Box<UnaryFunc>),
403 Hour(Box<UnaryFunc>),
404 Minute(Box<UnaryFunc>),
405 Second(Box<UnaryFunc>),
406 DayOfWeek(Box<UnaryFunc>),
407 DayOfWeekIso(Box<UnaryFunc>),
408 DayOfMonth(Box<UnaryFunc>),
409 DayOfYear(Box<UnaryFunc>),
410 WeekOfYear(Box<UnaryFunc>),
411 Quarter(Box<UnaryFunc>),
412 AddMonths(Box<BinaryFunc>),
413 MonthsBetween(Box<BinaryFunc>),
414 LastDay(Box<LastDayFunc>),
415 NextDay(Box<BinaryFunc>),
416 Epoch(Box<UnaryFunc>),
417 EpochMs(Box<UnaryFunc>),
418 FromUnixtime(Box<FromUnixtimeFunc>),
419 UnixTimestamp(Box<UnixTimestampFunc>),
420 MakeDate(Box<MakeDateFunc>),
421 MakeTimestamp(Box<MakeTimestampFunc>),
422 TimestampTrunc(Box<DateTruncFunc>),
423 TimeStrToUnix(Box<UnaryFunc>),
424
425 SessionUser(SessionUser),
427
428 SHA(Box<UnaryFunc>),
430 SHA1Digest(Box<UnaryFunc>),
431
432 TimeToUnix(Box<UnaryFunc>),
434
435 ArrayFunc(Box<ArrayConstructor>),
437 ArrayLength(Box<UnaryFunc>),
438 ArraySize(Box<UnaryFunc>),
439 Cardinality(Box<UnaryFunc>),
440 ArrayContains(Box<BinaryFunc>),
441 ArrayPosition(Box<BinaryFunc>),
442 ArrayAppend(Box<BinaryFunc>),
443 ArrayPrepend(Box<BinaryFunc>),
444 ArrayConcat(Box<VarArgFunc>),
445 ArraySort(Box<ArraySortFunc>),
446 ArrayReverse(Box<UnaryFunc>),
447 ArrayDistinct(Box<UnaryFunc>),
448 ArrayJoin(Box<ArrayJoinFunc>),
449 ArrayToString(Box<ArrayJoinFunc>),
450 Unnest(Box<UnnestFunc>),
451 Explode(Box<UnaryFunc>),
452 ExplodeOuter(Box<UnaryFunc>),
453 ArrayFilter(Box<ArrayFilterFunc>),
454 ArrayTransform(Box<ArrayTransformFunc>),
455 ArrayFlatten(Box<UnaryFunc>),
456 ArrayCompact(Box<UnaryFunc>),
457 ArrayIntersect(Box<VarArgFunc>),
458 ArrayUnion(Box<BinaryFunc>),
459 ArrayExcept(Box<BinaryFunc>),
460 ArrayRemove(Box<BinaryFunc>),
461 ArrayZip(Box<VarArgFunc>),
462 Sequence(Box<SequenceFunc>),
463 Generate(Box<SequenceFunc>),
464 ExplodingGenerateSeries(Box<SequenceFunc>),
465 ToArray(Box<UnaryFunc>),
466 StarMap(Box<BinaryFunc>),
467
468 StructFunc(Box<StructConstructor>),
470 StructExtract(Box<StructExtractFunc>),
471 NamedStruct(Box<NamedStructFunc>),
472
473 MapFunc(Box<MapConstructor>),
475 MapFromEntries(Box<UnaryFunc>),
476 MapFromArrays(Box<BinaryFunc>),
477 MapKeys(Box<UnaryFunc>),
478 MapValues(Box<UnaryFunc>),
479 MapContainsKey(Box<BinaryFunc>),
480 MapConcat(Box<VarArgFunc>),
481 ElementAt(Box<BinaryFunc>),
482 TransformKeys(Box<TransformFunc>),
483 TransformValues(Box<TransformFunc>),
484
485 FunctionEmits(Box<FunctionEmits>),
487
488 JsonExtract(Box<JsonExtractFunc>),
490 JsonExtractScalar(Box<JsonExtractFunc>),
491 JsonExtractPath(Box<JsonPathFunc>),
492 JsonArray(Box<VarArgFunc>),
493 JsonObject(Box<JsonObjectFunc>),
494 JsonQuery(Box<JsonExtractFunc>),
495 JsonValue(Box<JsonExtractFunc>),
496 JsonArrayLength(Box<UnaryFunc>),
497 JsonKeys(Box<UnaryFunc>),
498 JsonType(Box<UnaryFunc>),
499 ParseJson(Box<UnaryFunc>),
500 ToJson(Box<UnaryFunc>),
501 JsonSet(Box<JsonModifyFunc>),
502 JsonInsert(Box<JsonModifyFunc>),
503 JsonRemove(Box<JsonPathFunc>),
504 JsonMergePatch(Box<BinaryFunc>),
505 JsonArrayAgg(Box<JsonArrayAggFunc>),
506 JsonObjectAgg(Box<JsonObjectAggFunc>),
507
508 Convert(Box<ConvertFunc>),
510 Typeof(Box<UnaryFunc>),
511
512 Lambda(Box<LambdaExpr>),
514 Parameter(Box<Parameter>),
515 Placeholder(Placeholder),
516 NamedArgument(Box<NamedArgument>),
517 TableArgument(Box<TableArgument>),
520 SqlComment(Box<SqlComment>),
521
522 NullSafeEq(Box<BinaryOp>),
524 NullSafeNeq(Box<BinaryOp>),
525 Glob(Box<BinaryOp>),
526 SimilarTo(Box<SimilarToExpr>),
527 Any(Box<QuantifiedExpr>),
528 All(Box<QuantifiedExpr>),
529 Overlaps(Box<OverlapsExpr>),
530
531 BitwiseLeftShift(Box<BinaryOp>),
533 BitwiseRightShift(Box<BinaryOp>),
534 BitwiseAndAgg(Box<AggFunc>),
535 BitwiseOrAgg(Box<AggFunc>),
536 BitwiseXorAgg(Box<AggFunc>),
537
538 Subscript(Box<Subscript>),
540 Dot(Box<DotAccess>),
541 MethodCall(Box<MethodCall>),
542 ArraySlice(Box<ArraySlice>),
543
544 CreateTable(Box<CreateTable>),
546 DropTable(Box<DropTable>),
547 Undrop(Box<Undrop>),
548 AlterTable(Box<AlterTable>),
549 CreateIndex(Box<CreateIndex>),
550 DropIndex(Box<DropIndex>),
551 CreateView(Box<CreateView>),
552 DropView(Box<DropView>),
553 AlterView(Box<AlterView>),
554 AlterIndex(Box<AlterIndex>),
555 Truncate(Box<Truncate>),
556 Use(Box<Use>),
557 Cache(Box<Cache>),
558 Uncache(Box<Uncache>),
559 LoadData(Box<LoadData>),
560 Pragma(Box<Pragma>),
561 Grant(Box<Grant>),
562 Revoke(Box<Revoke>),
563 Comment(Box<Comment>),
564 SetStatement(Box<SetStatement>),
565 CreateSchema(Box<CreateSchema>),
567 DropSchema(Box<DropSchema>),
568 DropNamespace(Box<DropNamespace>),
569 CreateDatabase(Box<CreateDatabase>),
570 DropDatabase(Box<DropDatabase>),
571 CreateFunction(Box<CreateFunction>),
572 DropFunction(Box<DropFunction>),
573 CreateProcedure(Box<CreateProcedure>),
574 DropProcedure(Box<DropProcedure>),
575 CreateSequence(Box<CreateSequence>),
576 CreateSynonym(Box<CreateSynonym>),
577 DropSequence(Box<DropSequence>),
578 AlterSequence(Box<AlterSequence>),
579 CreateTrigger(Box<CreateTrigger>),
580 DropTrigger(Box<DropTrigger>),
581 CreateType(Box<CreateType>),
582 DropType(Box<DropType>),
583 Describe(Box<Describe>),
584 Show(Box<Show>),
585
586 Command(Box<Command>),
588 Kill(Box<Kill>),
589 Execute(Box<ExecuteStatement>),
591
592 CreateTask(Box<CreateTask>),
594
595 Raw(Raw),
597
598 Paren(Box<Paren>),
600
601 Annotated(Box<Annotated>),
603
604 Refresh(Box<Refresh>),
607 LockingStatement(Box<LockingStatement>),
608 SequenceProperties(Box<SequenceProperties>),
609 TruncateTable(Box<TruncateTable>),
610 Clone(Box<Clone>),
611 Attach(Box<Attach>),
612 Detach(Box<Detach>),
613 Install(Box<Install>),
614 Summarize(Box<Summarize>),
615 Declare(Box<Declare>),
616 DeclareItem(Box<DeclareItem>),
617 Set(Box<Set>),
618 Heredoc(Box<Heredoc>),
619 SetItem(Box<SetItem>),
620 QueryBand(Box<QueryBand>),
621 UserDefinedFunction(Box<UserDefinedFunction>),
622 RecursiveWithSearch(Box<RecursiveWithSearch>),
623 ProjectionDef(Box<ProjectionDef>),
624 TableAlias(Box<TableAlias>),
625 ByteString(Box<ByteString>),
626 HexStringExpr(Box<HexStringExpr>),
627 UnicodeString(Box<UnicodeString>),
628 ColumnPosition(Box<ColumnPosition>),
629 ColumnDef(Box<ColumnDef>),
630 AlterColumn(Box<AlterColumn>),
631 AlterSortKey(Box<AlterSortKey>),
632 AlterSet(Box<AlterSet>),
633 RenameColumn(Box<RenameColumn>),
634 Comprehension(Box<Comprehension>),
635 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
636 MergeTreeTTL(Box<MergeTreeTTL>),
637 IndexConstraintOption(Box<IndexConstraintOption>),
638 ColumnConstraint(Box<ColumnConstraint>),
639 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
640 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
641 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
642 CheckColumnConstraint(Box<CheckColumnConstraint>),
643 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
644 CompressColumnConstraint(Box<CompressColumnConstraint>),
645 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
646 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
647 WithOperator(Box<WithOperator>),
648 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
649 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
650 CommentColumnConstraint(CommentColumnConstraint),
651 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
652 IndexColumnConstraint(Box<IndexColumnConstraint>),
653 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
654 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
655 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
656 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
657 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
658 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
659 InOutColumnConstraint(Box<InOutColumnConstraint>),
660 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
661 PathColumnConstraint(Box<PathColumnConstraint>),
662 Constraint(Box<Constraint>),
663 Export(Box<Export>),
664 Filter(Box<Filter>),
665 Changes(Box<Changes>),
666 CopyParameter(Box<CopyParameter>),
667 Credentials(Box<Credentials>),
668 Directory(Box<Directory>),
669 ForeignKey(Box<ForeignKey>),
670 ColumnPrefix(Box<ColumnPrefix>),
671 PrimaryKey(Box<PrimaryKey>),
672 IntoClause(Box<IntoClause>),
673 JoinHint(Box<JoinHint>),
674 Opclass(Box<Opclass>),
675 Index(Box<Index>),
676 IndexParameters(Box<IndexParameters>),
677 ConditionalInsert(Box<ConditionalInsert>),
678 MultitableInserts(Box<MultitableInserts>),
679 OnConflict(Box<OnConflict>),
680 OnCondition(Box<OnCondition>),
681 Returning(Box<Returning>),
682 Introducer(Box<Introducer>),
683 PartitionRange(Box<PartitionRange>),
684 Fetch(Box<Fetch>),
685 Group(Box<Group>),
686 Cube(Box<Cube>),
687 Rollup(Box<Rollup>),
688 GroupingSets(Box<GroupingSets>),
689 LimitOptions(Box<LimitOptions>),
690 Lateral(Box<Lateral>),
691 TableFromRows(Box<TableFromRows>),
692 RowsFrom(Box<RowsFrom>),
693 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
694 WithFill(Box<WithFill>),
695 Property(Box<Property>),
696 GrantPrivilege(Box<GrantPrivilege>),
697 GrantPrincipal(Box<GrantPrincipal>),
698 AllowedValuesProperty(Box<AllowedValuesProperty>),
699 AlgorithmProperty(Box<AlgorithmProperty>),
700 AutoIncrementProperty(Box<AutoIncrementProperty>),
701 AutoRefreshProperty(Box<AutoRefreshProperty>),
702 BackupProperty(Box<BackupProperty>),
703 BuildProperty(Box<BuildProperty>),
704 BlockCompressionProperty(Box<BlockCompressionProperty>),
705 CharacterSetProperty(Box<CharacterSetProperty>),
706 ChecksumProperty(Box<ChecksumProperty>),
707 CollateProperty(Box<CollateProperty>),
708 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
709 DataDeletionProperty(Box<DataDeletionProperty>),
710 DefinerProperty(Box<DefinerProperty>),
711 DistKeyProperty(Box<DistKeyProperty>),
712 DistributedByProperty(Box<DistributedByProperty>),
713 DistStyleProperty(Box<DistStyleProperty>),
714 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
715 EngineProperty(Box<EngineProperty>),
716 ToTableProperty(Box<ToTableProperty>),
717 ExecuteAsProperty(Box<ExecuteAsProperty>),
718 ExternalProperty(Box<ExternalProperty>),
719 FallbackProperty(Box<FallbackProperty>),
720 FileFormatProperty(Box<FileFormatProperty>),
721 CredentialsProperty(Box<CredentialsProperty>),
722 FreespaceProperty(Box<FreespaceProperty>),
723 InheritsProperty(Box<InheritsProperty>),
724 InputModelProperty(Box<InputModelProperty>),
725 OutputModelProperty(Box<OutputModelProperty>),
726 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
727 JournalProperty(Box<JournalProperty>),
728 LanguageProperty(Box<LanguageProperty>),
729 EnviromentProperty(Box<EnviromentProperty>),
730 ClusteredByProperty(Box<ClusteredByProperty>),
731 DictProperty(Box<DictProperty>),
732 DictRange(Box<DictRange>),
733 OnCluster(Box<OnCluster>),
734 LikeProperty(Box<LikeProperty>),
735 LocationProperty(Box<LocationProperty>),
736 LockProperty(Box<LockProperty>),
737 LockingProperty(Box<LockingProperty>),
738 LogProperty(Box<LogProperty>),
739 MaterializedProperty(Box<MaterializedProperty>),
740 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
741 OnProperty(Box<OnProperty>),
742 OnCommitProperty(Box<OnCommitProperty>),
743 PartitionedByProperty(Box<PartitionedByProperty>),
744 PartitionByProperty(Box<PartitionByProperty>),
745 PartitionedByBucket(Box<PartitionedByBucket>),
746 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
747 PartitionByTruncate(Box<PartitionByTruncate>),
748 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
749 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
750 PartitionByListProperty(Box<PartitionByListProperty>),
751 PartitionList(Box<PartitionList>),
752 Partition(Box<Partition>),
753 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
754 UniqueKeyProperty(Box<UniqueKeyProperty>),
755 RollupProperty(Box<RollupProperty>),
756 PartitionBoundSpec(Box<PartitionBoundSpec>),
757 PartitionedOfProperty(Box<PartitionedOfProperty>),
758 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
759 ReturnsProperty(Box<ReturnsProperty>),
760 RowFormatProperty(Box<RowFormatProperty>),
761 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
762 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
763 QueryTransform(Box<QueryTransform>),
764 SampleProperty(Box<SampleProperty>),
765 SecurityProperty(Box<SecurityProperty>),
766 SchemaCommentProperty(Box<SchemaCommentProperty>),
767 SemanticView(Box<SemanticView>),
768 SerdeProperties(Box<SerdeProperties>),
769 SetProperty(Box<SetProperty>),
770 SharingProperty(Box<SharingProperty>),
771 SetConfigProperty(Box<SetConfigProperty>),
772 SettingsProperty(Box<SettingsProperty>),
773 SortKeyProperty(Box<SortKeyProperty>),
774 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
775 SqlSecurityProperty(Box<SqlSecurityProperty>),
776 StabilityProperty(Box<StabilityProperty>),
777 StorageHandlerProperty(Box<StorageHandlerProperty>),
778 TemporaryProperty(Box<TemporaryProperty>),
779 Tags(Box<Tags>),
780 TransformModelProperty(Box<TransformModelProperty>),
781 TransientProperty(Box<TransientProperty>),
782 UsingTemplateProperty(Box<UsingTemplateProperty>),
783 ViewAttributeProperty(Box<ViewAttributeProperty>),
784 VolatileProperty(Box<VolatileProperty>),
785 WithDataProperty(Box<WithDataProperty>),
786 WithJournalTableProperty(Box<WithJournalTableProperty>),
787 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
788 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
789 WithProcedureOptions(Box<WithProcedureOptions>),
790 EncodeProperty(Box<EncodeProperty>),
791 IncludeProperty(Box<IncludeProperty>),
792 Properties(Box<Properties>),
793 OptionsProperty(Box<OptionsProperty>),
794 InputOutputFormat(Box<InputOutputFormat>),
795 Reference(Box<Reference>),
796 QueryOption(Box<QueryOption>),
797 WithTableHint(Box<WithTableHint>),
798 IndexTableHint(Box<IndexTableHint>),
799 HistoricalData(Box<HistoricalData>),
800 Get(Box<Get>),
801 SetOperation(Box<SetOperation>),
802 Var(Box<Var>),
803 Variadic(Box<Variadic>),
804 Version(Box<Version>),
805 Schema(Box<Schema>),
806 Lock(Box<Lock>),
807 TableSample(Box<TableSample>),
808 Tag(Box<Tag>),
809 UnpivotColumns(Box<UnpivotColumns>),
810 WindowSpec(Box<WindowSpec>),
811 SessionParameter(Box<SessionParameter>),
812 PseudoType(Box<PseudoType>),
813 ObjectIdentifier(Box<ObjectIdentifier>),
814 Transaction(Box<Transaction>),
815 Commit(Box<Commit>),
816 Rollback(Box<Rollback>),
817 AlterSession(Box<AlterSession>),
818 Analyze(Box<Analyze>),
819 AnalyzeStatistics(Box<AnalyzeStatistics>),
820 AnalyzeHistogram(Box<AnalyzeHistogram>),
821 AnalyzeSample(Box<AnalyzeSample>),
822 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
823 AnalyzeDelete(Box<AnalyzeDelete>),
824 AnalyzeWith(Box<AnalyzeWith>),
825 AnalyzeValidate(Box<AnalyzeValidate>),
826 AddPartition(Box<AddPartition>),
827 AttachOption(Box<AttachOption>),
828 DropPartition(Box<DropPartition>),
829 ReplacePartition(Box<ReplacePartition>),
830 DPipe(Box<DPipe>),
831 Operator(Box<Operator>),
832 PivotAny(Box<PivotAny>),
833 Aliases(Box<Aliases>),
834 AtIndex(Box<AtIndex>),
835 FromTimeZone(Box<FromTimeZone>),
836 FormatPhrase(Box<FormatPhrase>),
837 ForIn(Box<ForIn>),
838 TimeUnit(Box<TimeUnit>),
839 IntervalOp(Box<IntervalOp>),
840 IntervalSpan(Box<IntervalSpan>),
841 HavingMax(Box<HavingMax>),
842 CosineDistance(Box<CosineDistance>),
843 DotProduct(Box<DotProduct>),
844 EuclideanDistance(Box<EuclideanDistance>),
845 ManhattanDistance(Box<ManhattanDistance>),
846 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
847 Booland(Box<Booland>),
848 Boolor(Box<Boolor>),
849 ParameterizedAgg(Box<ParameterizedAgg>),
850 ArgMax(Box<ArgMax>),
851 ArgMin(Box<ArgMin>),
852 ApproxTopK(Box<ApproxTopK>),
853 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
854 ApproxTopKCombine(Box<ApproxTopKCombine>),
855 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
856 ApproxTopSum(Box<ApproxTopSum>),
857 ApproxQuantiles(Box<ApproxQuantiles>),
858 Minhash(Box<Minhash>),
859 FarmFingerprint(Box<FarmFingerprint>),
860 Float64(Box<Float64>),
861 Transform(Box<Transform>),
862 Translate(Box<Translate>),
863 Grouping(Box<Grouping>),
864 GroupingId(Box<GroupingId>),
865 Anonymous(Box<Anonymous>),
866 AnonymousAggFunc(Box<AnonymousAggFunc>),
867 CombinedAggFunc(Box<CombinedAggFunc>),
868 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
869 HashAgg(Box<HashAgg>),
870 Hll(Box<Hll>),
871 Apply(Box<Apply>),
872 ToBoolean(Box<ToBoolean>),
873 List(Box<List>),
874 ToMap(Box<ToMap>),
875 Pad(Box<Pad>),
876 ToChar(Box<ToChar>),
877 ToNumber(Box<ToNumber>),
878 ToDouble(Box<ToDouble>),
879 Int64(Box<UnaryFunc>),
880 StringFunc(Box<StringFunc>),
881 ToDecfloat(Box<ToDecfloat>),
882 TryToDecfloat(Box<TryToDecfloat>),
883 ToFile(Box<ToFile>),
884 Columns(Box<Columns>),
885 ConvertToCharset(Box<ConvertToCharset>),
886 ConvertTimezone(Box<ConvertTimezone>),
887 GenerateSeries(Box<GenerateSeries>),
888 AIAgg(Box<AIAgg>),
889 AIClassify(Box<AIClassify>),
890 ArrayAll(Box<ArrayAll>),
891 ArrayAny(Box<ArrayAny>),
892 ArrayConstructCompact(Box<ArrayConstructCompact>),
893 StPoint(Box<StPoint>),
894 StDistance(Box<StDistance>),
895 StringToArray(Box<StringToArray>),
896 ArraySum(Box<ArraySum>),
897 ObjectAgg(Box<ObjectAgg>),
898 CastToStrType(Box<CastToStrType>),
899 CheckJson(Box<CheckJson>),
900 CheckXml(Box<CheckXml>),
901 TranslateCharacters(Box<TranslateCharacters>),
902 CurrentSchemas(Box<CurrentSchemas>),
903 CurrentDatetime(Box<CurrentDatetime>),
904 Localtime(Box<Localtime>),
905 Localtimestamp(Box<Localtimestamp>),
906 Systimestamp(Box<Systimestamp>),
907 CurrentSchema(Box<CurrentSchema>),
908 CurrentUser(Box<CurrentUser>),
909 UtcTime(Box<UtcTime>),
910 UtcTimestamp(Box<UtcTimestamp>),
911 Timestamp(Box<TimestampFunc>),
912 DateBin(Box<DateBin>),
913 Datetime(Box<Datetime>),
914 DatetimeAdd(Box<DatetimeAdd>),
915 DatetimeSub(Box<DatetimeSub>),
916 DatetimeDiff(Box<DatetimeDiff>),
917 DatetimeTrunc(Box<DatetimeTrunc>),
918 Dayname(Box<Dayname>),
919 MakeInterval(Box<MakeInterval>),
920 PreviousDay(Box<PreviousDay>),
921 Elt(Box<Elt>),
922 TimestampAdd(Box<TimestampAdd>),
923 TimestampSub(Box<TimestampSub>),
924 TimestampDiff(Box<TimestampDiff>),
925 TimeSlice(Box<TimeSlice>),
926 TimeAdd(Box<TimeAdd>),
927 TimeSub(Box<TimeSub>),
928 TimeDiff(Box<TimeDiff>),
929 TimeTrunc(Box<TimeTrunc>),
930 DateFromParts(Box<DateFromParts>),
931 TimeFromParts(Box<TimeFromParts>),
932 DecodeCase(Box<DecodeCase>),
933 Decrypt(Box<Decrypt>),
934 DecryptRaw(Box<DecryptRaw>),
935 Encode(Box<Encode>),
936 Encrypt(Box<Encrypt>),
937 EncryptRaw(Box<EncryptRaw>),
938 EqualNull(Box<EqualNull>),
939 ToBinary(Box<ToBinary>),
940 Base64DecodeBinary(Box<Base64DecodeBinary>),
941 Base64DecodeString(Box<Base64DecodeString>),
942 Base64Encode(Box<Base64Encode>),
943 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
944 TryBase64DecodeString(Box<TryBase64DecodeString>),
945 GapFill(Box<GapFill>),
946 GenerateDateArray(Box<GenerateDateArray>),
947 GenerateTimestampArray(Box<GenerateTimestampArray>),
948 GetExtract(Box<GetExtract>),
949 Getbit(Box<Getbit>),
950 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
951 HexEncode(Box<HexEncode>),
952 Compress(Box<Compress>),
953 DecompressBinary(Box<DecompressBinary>),
954 DecompressString(Box<DecompressString>),
955 Xor(Box<Xor>),
956 Nullif(Box<Nullif>),
957 JSON(Box<JSON>),
958 JSONPath(Box<JSONPath>),
959 JSONPathFilter(Box<JSONPathFilter>),
960 JSONPathKey(Box<JSONPathKey>),
961 JSONPathRecursive(Box<JSONPathRecursive>),
962 JSONPathScript(Box<JSONPathScript>),
963 JSONPathSlice(Box<JSONPathSlice>),
964 JSONPathSelector(Box<JSONPathSelector>),
965 JSONPathSubscript(Box<JSONPathSubscript>),
966 JSONPathUnion(Box<JSONPathUnion>),
967 Format(Box<Format>),
968 JSONKeys(Box<JSONKeys>),
969 JSONKeyValue(Box<JSONKeyValue>),
970 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
971 JSONObject(Box<JSONObject>),
972 JSONObjectAgg(Box<JSONObjectAgg>),
973 JSONBObjectAgg(Box<JSONBObjectAgg>),
974 JSONArray(Box<JSONArray>),
975 JSONArrayAgg(Box<JSONArrayAgg>),
976 JSONExists(Box<JSONExists>),
977 JSONColumnDef(Box<JSONColumnDef>),
978 JSONSchema(Box<JSONSchema>),
979 JSONSet(Box<JSONSet>),
980 JSONStripNulls(Box<JSONStripNulls>),
981 JSONValue(Box<JSONValue>),
982 JSONValueArray(Box<JSONValueArray>),
983 JSONRemove(Box<JSONRemove>),
984 JSONTable(Box<JSONTable>),
985 JSONType(Box<JSONType>),
986 ObjectInsert(Box<ObjectInsert>),
987 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
988 OpenJSON(Box<OpenJSON>),
989 JSONBExists(Box<JSONBExists>),
990 JSONBContains(Box<BinaryFunc>),
991 JSONBExtract(Box<BinaryFunc>),
992 JSONCast(Box<JSONCast>),
993 JSONExtract(Box<JSONExtract>),
994 JSONExtractQuote(Box<JSONExtractQuote>),
995 JSONExtractArray(Box<JSONExtractArray>),
996 JSONExtractScalar(Box<JSONExtractScalar>),
997 JSONBExtractScalar(Box<JSONBExtractScalar>),
998 JSONFormat(Box<JSONFormat>),
999 JSONBool(Box<UnaryFunc>),
1000 JSONPathRoot(JSONPathRoot),
1001 JSONArrayAppend(Box<JSONArrayAppend>),
1002 JSONArrayContains(Box<JSONArrayContains>),
1003 JSONArrayInsert(Box<JSONArrayInsert>),
1004 ParseJSON(Box<ParseJSON>),
1005 ParseUrl(Box<ParseUrl>),
1006 ParseIp(Box<ParseIp>),
1007 ParseTime(Box<ParseTime>),
1008 ParseDatetime(Box<ParseDatetime>),
1009 Map(Box<Map>),
1010 MapCat(Box<MapCat>),
1011 MapDelete(Box<MapDelete>),
1012 MapInsert(Box<MapInsert>),
1013 MapPick(Box<MapPick>),
1014 ScopeResolution(Box<ScopeResolution>),
1015 Slice(Box<Slice>),
1016 VarMap(Box<VarMap>),
1017 MatchAgainst(Box<MatchAgainst>),
1018 MD5Digest(Box<MD5Digest>),
1019 MD5NumberLower64(Box<UnaryFunc>),
1020 MD5NumberUpper64(Box<UnaryFunc>),
1021 Monthname(Box<Monthname>),
1022 Ntile(Box<Ntile>),
1023 Normalize(Box<Normalize>),
1024 Normal(Box<Normal>),
1025 Predict(Box<Predict>),
1026 MLTranslate(Box<MLTranslate>),
1027 FeaturesAtTime(Box<FeaturesAtTime>),
1028 GenerateEmbedding(Box<GenerateEmbedding>),
1029 MLForecast(Box<MLForecast>),
1030 ModelAttribute(Box<ModelAttribute>),
1031 VectorSearch(Box<VectorSearch>),
1032 Quantile(Box<Quantile>),
1033 ApproxQuantile(Box<ApproxQuantile>),
1034 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1035 Randn(Box<Randn>),
1036 Randstr(Box<Randstr>),
1037 RangeN(Box<RangeN>),
1038 RangeBucket(Box<RangeBucket>),
1039 ReadCSV(Box<ReadCSV>),
1040 ReadParquet(Box<ReadParquet>),
1041 Reduce(Box<Reduce>),
1042 RegexpExtractAll(Box<RegexpExtractAll>),
1043 RegexpILike(Box<RegexpILike>),
1044 RegexpFullMatch(Box<RegexpFullMatch>),
1045 RegexpInstr(Box<RegexpInstr>),
1046 RegexpSplit(Box<RegexpSplit>),
1047 RegexpCount(Box<RegexpCount>),
1048 RegrValx(Box<RegrValx>),
1049 RegrValy(Box<RegrValy>),
1050 RegrAvgy(Box<RegrAvgy>),
1051 RegrAvgx(Box<RegrAvgx>),
1052 RegrCount(Box<RegrCount>),
1053 RegrIntercept(Box<RegrIntercept>),
1054 RegrR2(Box<RegrR2>),
1055 RegrSxx(Box<RegrSxx>),
1056 RegrSxy(Box<RegrSxy>),
1057 RegrSyy(Box<RegrSyy>),
1058 RegrSlope(Box<RegrSlope>),
1059 SafeAdd(Box<SafeAdd>),
1060 SafeDivide(Box<SafeDivide>),
1061 SafeMultiply(Box<SafeMultiply>),
1062 SafeSubtract(Box<SafeSubtract>),
1063 SHA2(Box<SHA2>),
1064 SHA2Digest(Box<SHA2Digest>),
1065 SortArray(Box<SortArray>),
1066 SplitPart(Box<SplitPart>),
1067 SubstringIndex(Box<SubstringIndex>),
1068 StandardHash(Box<StandardHash>),
1069 StrPosition(Box<StrPosition>),
1070 Search(Box<Search>),
1071 SearchIp(Box<SearchIp>),
1072 StrToDate(Box<StrToDate>),
1073 DateStrToDate(Box<UnaryFunc>),
1074 DateToDateStr(Box<UnaryFunc>),
1075 StrToTime(Box<StrToTime>),
1076 StrToUnix(Box<StrToUnix>),
1077 StrToMap(Box<StrToMap>),
1078 NumberToStr(Box<NumberToStr>),
1079 FromBase(Box<FromBase>),
1080 Stuff(Box<Stuff>),
1081 TimeToStr(Box<TimeToStr>),
1082 TimeStrToTime(Box<TimeStrToTime>),
1083 TsOrDsAdd(Box<TsOrDsAdd>),
1084 TsOrDsDiff(Box<TsOrDsDiff>),
1085 TsOrDsToDate(Box<TsOrDsToDate>),
1086 TsOrDsToTime(Box<TsOrDsToTime>),
1087 Unhex(Box<Unhex>),
1088 Uniform(Box<Uniform>),
1089 UnixToStr(Box<UnixToStr>),
1090 UnixToTime(Box<UnixToTime>),
1091 Uuid(Box<Uuid>),
1092 TimestampFromParts(Box<TimestampFromParts>),
1093 TimestampTzFromParts(Box<TimestampTzFromParts>),
1094 Corr(Box<Corr>),
1095 WidthBucket(Box<WidthBucket>),
1096 CovarSamp(Box<CovarSamp>),
1097 CovarPop(Box<CovarPop>),
1098 Week(Box<Week>),
1099 XMLElement(Box<XMLElement>),
1100 XMLGet(Box<XMLGet>),
1101 XMLTable(Box<XMLTable>),
1102 XMLKeyValueOption(Box<XMLKeyValueOption>),
1103 Zipf(Box<Zipf>),
1104 Merge(Box<Merge>),
1105 When(Box<When>),
1106 Whens(Box<Whens>),
1107 NextValueFor(Box<NextValueFor>),
1108 ReturnStmt(Box<Expression>),
1110}
1111
1112impl Expression {
1113 #[inline]
1115 pub fn boxed_column(col: Column) -> Self {
1116 Expression::Column(Box::new(col))
1117 }
1118
1119 #[inline]
1121 pub fn boxed_table(t: TableRef) -> Self {
1122 Expression::Table(Box::new(t))
1123 }
1124
1125 pub fn is_statement(&self) -> bool {
1132 match self {
1133 Expression::Select(_)
1135 | Expression::Union(_)
1136 | Expression::Intersect(_)
1137 | Expression::Except(_)
1138 | Expression::Subquery(_)
1139 | Expression::Values(_)
1140 | Expression::PipeOperator(_)
1141
1142 | Expression::Insert(_)
1144 | Expression::Update(_)
1145 | Expression::Delete(_)
1146 | Expression::Copy(_)
1147 | Expression::Put(_)
1148 | Expression::Merge(_)
1149
1150 | Expression::CreateTable(_)
1152 | Expression::DropTable(_)
1153 | Expression::Undrop(_)
1154 | Expression::AlterTable(_)
1155 | Expression::CreateIndex(_)
1156 | Expression::DropIndex(_)
1157 | Expression::CreateView(_)
1158 | Expression::DropView(_)
1159 | Expression::AlterView(_)
1160 | Expression::AlterIndex(_)
1161 | Expression::Truncate(_)
1162 | Expression::TruncateTable(_)
1163 | Expression::CreateSchema(_)
1164 | Expression::DropSchema(_)
1165 | Expression::DropNamespace(_)
1166 | Expression::CreateDatabase(_)
1167 | Expression::DropDatabase(_)
1168 | Expression::CreateFunction(_)
1169 | Expression::DropFunction(_)
1170 | Expression::CreateProcedure(_)
1171 | Expression::DropProcedure(_)
1172 | Expression::CreateSequence(_)
1173 | Expression::CreateSynonym(_)
1174 | Expression::DropSequence(_)
1175 | Expression::AlterSequence(_)
1176 | Expression::CreateTrigger(_)
1177 | Expression::DropTrigger(_)
1178 | Expression::CreateType(_)
1179 | Expression::DropType(_)
1180 | Expression::Comment(_)
1181
1182 | Expression::Use(_)
1184 | Expression::Set(_)
1185 | Expression::SetStatement(_)
1186 | Expression::Transaction(_)
1187 | Expression::Commit(_)
1188 | Expression::Rollback(_)
1189 | Expression::Grant(_)
1190 | Expression::Revoke(_)
1191 | Expression::Cache(_)
1192 | Expression::Uncache(_)
1193 | Expression::LoadData(_)
1194 | Expression::Pragma(_)
1195 | Expression::Describe(_)
1196 | Expression::Show(_)
1197 | Expression::Kill(_)
1198 | Expression::Execute(_)
1199 | Expression::Declare(_)
1200 | Expression::Refresh(_)
1201 | Expression::AlterSession(_)
1202 | Expression::LockingStatement(_)
1203
1204 | Expression::Analyze(_)
1206 | Expression::AnalyzeStatistics(_)
1207 | Expression::AnalyzeHistogram(_)
1208 | Expression::AnalyzeSample(_)
1209 | Expression::AnalyzeListChainedRows(_)
1210 | Expression::AnalyzeDelete(_)
1211
1212 | Expression::Attach(_)
1214 | Expression::Detach(_)
1215 | Expression::Install(_)
1216 | Expression::Summarize(_)
1217
1218 | Expression::Pivot(_)
1220 | Expression::Unpivot(_)
1221
1222 | Expression::Command(_)
1224 | Expression::Raw(_)
1225 | Expression::CreateTask(_)
1226
1227 | Expression::ReturnStmt(_) => true,
1229
1230 Expression::Annotated(a) => a.this.is_statement(),
1232
1233 Expression::Alias(a) => a.this.is_statement(),
1235
1236 _ => false,
1238 }
1239 }
1240
1241 pub fn number(n: i64) -> Self {
1243 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1244 }
1245
1246 pub fn string(s: impl Into<String>) -> Self {
1248 Expression::Literal(Box::new(Literal::String(s.into())))
1249 }
1250
1251 pub fn float(f: f64) -> Self {
1253 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1254 }
1255
1256 pub fn inferred_type(&self) -> Option<&DataType> {
1262 match self {
1263 Expression::And(op)
1265 | Expression::Or(op)
1266 | Expression::Add(op)
1267 | Expression::Sub(op)
1268 | Expression::Mul(op)
1269 | Expression::Div(op)
1270 | Expression::Mod(op)
1271 | Expression::Eq(op)
1272 | Expression::Neq(op)
1273 | Expression::Lt(op)
1274 | Expression::Lte(op)
1275 | Expression::Gt(op)
1276 | Expression::Gte(op)
1277 | Expression::Concat(op)
1278 | Expression::BitwiseAnd(op)
1279 | Expression::BitwiseOr(op)
1280 | Expression::BitwiseXor(op)
1281 | Expression::Adjacent(op)
1282 | Expression::TsMatch(op)
1283 | Expression::PropertyEQ(op)
1284 | Expression::ArrayContainsAll(op)
1285 | Expression::ArrayContainedBy(op)
1286 | Expression::ArrayOverlaps(op)
1287 | Expression::JSONBContainsAllTopKeys(op)
1288 | Expression::JSONBContainsAnyTopKeys(op)
1289 | Expression::JSONBDeleteAtPath(op)
1290 | Expression::ExtendsLeft(op)
1291 | Expression::ExtendsRight(op)
1292 | Expression::Is(op)
1293 | Expression::MemberOf(op)
1294 | Expression::Match(op)
1295 | Expression::NullSafeEq(op)
1296 | Expression::NullSafeNeq(op)
1297 | Expression::Glob(op)
1298 | Expression::BitwiseLeftShift(op)
1299 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1300
1301 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1302 op.inferred_type.as_ref()
1303 }
1304
1305 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1306
1307 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1308 c.inferred_type.as_ref()
1309 }
1310
1311 Expression::Column(c) => c.inferred_type.as_ref(),
1312 Expression::Function(f) => f.inferred_type.as_ref(),
1313 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1314 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1315 Expression::Case(c) => c.inferred_type.as_ref(),
1316 Expression::Subquery(s) => s.inferred_type.as_ref(),
1317 Expression::Alias(a) => a.inferred_type.as_ref(),
1318 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1319 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1320 Expression::Count(f) => f.inferred_type.as_ref(),
1321 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1322 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1323 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1324 Expression::SumIf(f) => f.inferred_type.as_ref(),
1325
1326 Expression::Upper(f)
1328 | Expression::Lower(f)
1329 | Expression::Length(f)
1330 | Expression::LTrim(f)
1331 | Expression::RTrim(f)
1332 | Expression::Reverse(f)
1333 | Expression::Abs(f)
1334 | Expression::Sqrt(f)
1335 | Expression::Cbrt(f)
1336 | Expression::Ln(f)
1337 | Expression::Exp(f)
1338 | Expression::Sign(f)
1339 | Expression::Date(f)
1340 | Expression::Time(f)
1341 | Expression::Initcap(f)
1342 | Expression::Ascii(f)
1343 | Expression::Chr(f)
1344 | Expression::Soundex(f)
1345 | Expression::ByteLength(f)
1346 | Expression::Hex(f)
1347 | Expression::LowerHex(f)
1348 | Expression::Unicode(f)
1349 | Expression::Typeof(f)
1350 | Expression::Explode(f)
1351 | Expression::ExplodeOuter(f)
1352 | Expression::MapFromEntries(f)
1353 | Expression::MapKeys(f)
1354 | Expression::MapValues(f)
1355 | Expression::ArrayLength(f)
1356 | Expression::ArraySize(f)
1357 | Expression::Cardinality(f)
1358 | Expression::ArrayReverse(f)
1359 | Expression::ArrayDistinct(f)
1360 | Expression::ArrayFlatten(f)
1361 | Expression::ArrayCompact(f)
1362 | Expression::ToArray(f)
1363 | Expression::JsonArrayLength(f)
1364 | Expression::JsonKeys(f)
1365 | Expression::JsonType(f)
1366 | Expression::ParseJson(f)
1367 | Expression::ToJson(f)
1368 | Expression::Radians(f)
1369 | Expression::Degrees(f)
1370 | Expression::Sin(f)
1371 | Expression::Cos(f)
1372 | Expression::Tan(f)
1373 | Expression::Asin(f)
1374 | Expression::Acos(f)
1375 | Expression::Atan(f)
1376 | Expression::IsNan(f)
1377 | Expression::IsInf(f)
1378 | Expression::Year(f)
1379 | Expression::Month(f)
1380 | Expression::Day(f)
1381 | Expression::Hour(f)
1382 | Expression::Minute(f)
1383 | Expression::Second(f)
1384 | Expression::DayOfWeek(f)
1385 | Expression::DayOfWeekIso(f)
1386 | Expression::DayOfMonth(f)
1387 | Expression::DayOfYear(f)
1388 | Expression::WeekOfYear(f)
1389 | Expression::Quarter(f)
1390 | Expression::Epoch(f)
1391 | Expression::EpochMs(f)
1392 | Expression::BitwiseCount(f)
1393 | Expression::DateFromUnixDate(f)
1394 | Expression::UnixDate(f)
1395 | Expression::UnixSeconds(f)
1396 | Expression::UnixMillis(f)
1397 | Expression::UnixMicros(f)
1398 | Expression::TimeStrToDate(f)
1399 | Expression::DateToDi(f)
1400 | Expression::DiToDate(f)
1401 | Expression::TsOrDiToDi(f)
1402 | Expression::TsOrDsToDatetime(f)
1403 | Expression::TsOrDsToTimestamp(f)
1404 | Expression::YearOfWeek(f)
1405 | Expression::YearOfWeekIso(f)
1406 | Expression::SHA(f)
1407 | Expression::SHA1Digest(f)
1408 | Expression::TimeToUnix(f)
1409 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1410
1411 Expression::Power(f)
1413 | Expression::NullIf(f)
1414 | Expression::IfNull(f)
1415 | Expression::Nvl(f)
1416 | Expression::Contains(f)
1417 | Expression::StartsWith(f)
1418 | Expression::EndsWith(f)
1419 | Expression::Levenshtein(f)
1420 | Expression::ModFunc(f)
1421 | Expression::IntDiv(f)
1422 | Expression::Atan2(f)
1423 | Expression::AddMonths(f)
1424 | Expression::MonthsBetween(f)
1425 | Expression::NextDay(f)
1426 | Expression::UnixToTimeStr(f)
1427 | Expression::ArrayContains(f)
1428 | Expression::ArrayPosition(f)
1429 | Expression::ArrayAppend(f)
1430 | Expression::ArrayPrepend(f)
1431 | Expression::ArrayUnion(f)
1432 | Expression::ArrayExcept(f)
1433 | Expression::ArrayRemove(f)
1434 | Expression::StarMap(f)
1435 | Expression::MapFromArrays(f)
1436 | Expression::MapContainsKey(f)
1437 | Expression::ElementAt(f)
1438 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1439
1440 Expression::Coalesce(f)
1442 | Expression::Greatest(f)
1443 | Expression::Least(f)
1444 | Expression::ArrayConcat(f)
1445 | Expression::ArrayIntersect(f)
1446 | Expression::ArrayZip(f)
1447 | Expression::MapConcat(f)
1448 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1449
1450 Expression::Sum(f)
1452 | Expression::Avg(f)
1453 | Expression::Min(f)
1454 | Expression::Max(f)
1455 | Expression::ArrayAgg(f)
1456 | Expression::CountIf(f)
1457 | Expression::Stddev(f)
1458 | Expression::StddevPop(f)
1459 | Expression::StddevSamp(f)
1460 | Expression::Variance(f)
1461 | Expression::VarPop(f)
1462 | Expression::VarSamp(f)
1463 | Expression::Median(f)
1464 | Expression::Mode(f)
1465 | Expression::First(f)
1466 | Expression::Last(f)
1467 | Expression::AnyValue(f)
1468 | Expression::ApproxDistinct(f)
1469 | Expression::ApproxCountDistinct(f)
1470 | Expression::LogicalAnd(f)
1471 | Expression::LogicalOr(f)
1472 | Expression::Skewness(f)
1473 | Expression::ArrayConcatAgg(f)
1474 | Expression::ArrayUniqueAgg(f)
1475 | Expression::BoolXorAgg(f)
1476 | Expression::BitwiseAndAgg(f)
1477 | Expression::BitwiseOrAgg(f)
1478 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1479
1480 _ => None,
1482 }
1483 }
1484
1485 pub fn set_inferred_type(&mut self, dt: DataType) {
1490 match self {
1491 Expression::And(op)
1492 | Expression::Or(op)
1493 | Expression::Add(op)
1494 | Expression::Sub(op)
1495 | Expression::Mul(op)
1496 | Expression::Div(op)
1497 | Expression::Mod(op)
1498 | Expression::Eq(op)
1499 | Expression::Neq(op)
1500 | Expression::Lt(op)
1501 | Expression::Lte(op)
1502 | Expression::Gt(op)
1503 | Expression::Gte(op)
1504 | Expression::Concat(op)
1505 | Expression::BitwiseAnd(op)
1506 | Expression::BitwiseOr(op)
1507 | Expression::BitwiseXor(op)
1508 | Expression::Adjacent(op)
1509 | Expression::TsMatch(op)
1510 | Expression::PropertyEQ(op)
1511 | Expression::ArrayContainsAll(op)
1512 | Expression::ArrayContainedBy(op)
1513 | Expression::ArrayOverlaps(op)
1514 | Expression::JSONBContainsAllTopKeys(op)
1515 | Expression::JSONBContainsAnyTopKeys(op)
1516 | Expression::JSONBDeleteAtPath(op)
1517 | Expression::ExtendsLeft(op)
1518 | Expression::ExtendsRight(op)
1519 | Expression::Is(op)
1520 | Expression::MemberOf(op)
1521 | Expression::Match(op)
1522 | Expression::NullSafeEq(op)
1523 | Expression::NullSafeNeq(op)
1524 | Expression::Glob(op)
1525 | Expression::BitwiseLeftShift(op)
1526 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1527
1528 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1529 op.inferred_type = Some(dt)
1530 }
1531
1532 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1533
1534 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1535 c.inferred_type = Some(dt)
1536 }
1537
1538 Expression::Column(c) => c.inferred_type = Some(dt),
1539 Expression::Function(f) => f.inferred_type = Some(dt),
1540 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1541 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1542 Expression::Case(c) => c.inferred_type = Some(dt),
1543 Expression::Subquery(s) => s.inferred_type = Some(dt),
1544 Expression::Alias(a) => a.inferred_type = Some(dt),
1545 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1546 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1547 Expression::Count(f) => f.inferred_type = Some(dt),
1548 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1549 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1550 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1551 Expression::SumIf(f) => f.inferred_type = Some(dt),
1552
1553 Expression::Upper(f)
1555 | Expression::Lower(f)
1556 | Expression::Length(f)
1557 | Expression::LTrim(f)
1558 | Expression::RTrim(f)
1559 | Expression::Reverse(f)
1560 | Expression::Abs(f)
1561 | Expression::Sqrt(f)
1562 | Expression::Cbrt(f)
1563 | Expression::Ln(f)
1564 | Expression::Exp(f)
1565 | Expression::Sign(f)
1566 | Expression::Date(f)
1567 | Expression::Time(f)
1568 | Expression::Initcap(f)
1569 | Expression::Ascii(f)
1570 | Expression::Chr(f)
1571 | Expression::Soundex(f)
1572 | Expression::ByteLength(f)
1573 | Expression::Hex(f)
1574 | Expression::LowerHex(f)
1575 | Expression::Unicode(f)
1576 | Expression::Typeof(f)
1577 | Expression::Explode(f)
1578 | Expression::ExplodeOuter(f)
1579 | Expression::MapFromEntries(f)
1580 | Expression::MapKeys(f)
1581 | Expression::MapValues(f)
1582 | Expression::ArrayLength(f)
1583 | Expression::ArraySize(f)
1584 | Expression::Cardinality(f)
1585 | Expression::ArrayReverse(f)
1586 | Expression::ArrayDistinct(f)
1587 | Expression::ArrayFlatten(f)
1588 | Expression::ArrayCompact(f)
1589 | Expression::ToArray(f)
1590 | Expression::JsonArrayLength(f)
1591 | Expression::JsonKeys(f)
1592 | Expression::JsonType(f)
1593 | Expression::ParseJson(f)
1594 | Expression::ToJson(f)
1595 | Expression::Radians(f)
1596 | Expression::Degrees(f)
1597 | Expression::Sin(f)
1598 | Expression::Cos(f)
1599 | Expression::Tan(f)
1600 | Expression::Asin(f)
1601 | Expression::Acos(f)
1602 | Expression::Atan(f)
1603 | Expression::IsNan(f)
1604 | Expression::IsInf(f)
1605 | Expression::Year(f)
1606 | Expression::Month(f)
1607 | Expression::Day(f)
1608 | Expression::Hour(f)
1609 | Expression::Minute(f)
1610 | Expression::Second(f)
1611 | Expression::DayOfWeek(f)
1612 | Expression::DayOfWeekIso(f)
1613 | Expression::DayOfMonth(f)
1614 | Expression::DayOfYear(f)
1615 | Expression::WeekOfYear(f)
1616 | Expression::Quarter(f)
1617 | Expression::Epoch(f)
1618 | Expression::EpochMs(f)
1619 | Expression::BitwiseCount(f)
1620 | Expression::DateFromUnixDate(f)
1621 | Expression::UnixDate(f)
1622 | Expression::UnixSeconds(f)
1623 | Expression::UnixMillis(f)
1624 | Expression::UnixMicros(f)
1625 | Expression::TimeStrToDate(f)
1626 | Expression::DateToDi(f)
1627 | Expression::DiToDate(f)
1628 | Expression::TsOrDiToDi(f)
1629 | Expression::TsOrDsToDatetime(f)
1630 | Expression::TsOrDsToTimestamp(f)
1631 | Expression::YearOfWeek(f)
1632 | Expression::YearOfWeekIso(f)
1633 | Expression::SHA(f)
1634 | Expression::SHA1Digest(f)
1635 | Expression::TimeToUnix(f)
1636 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1637
1638 Expression::Power(f)
1640 | Expression::NullIf(f)
1641 | Expression::IfNull(f)
1642 | Expression::Nvl(f)
1643 | Expression::Contains(f)
1644 | Expression::StartsWith(f)
1645 | Expression::EndsWith(f)
1646 | Expression::Levenshtein(f)
1647 | Expression::ModFunc(f)
1648 | Expression::IntDiv(f)
1649 | Expression::Atan2(f)
1650 | Expression::AddMonths(f)
1651 | Expression::MonthsBetween(f)
1652 | Expression::NextDay(f)
1653 | Expression::UnixToTimeStr(f)
1654 | Expression::ArrayContains(f)
1655 | Expression::ArrayPosition(f)
1656 | Expression::ArrayAppend(f)
1657 | Expression::ArrayPrepend(f)
1658 | Expression::ArrayUnion(f)
1659 | Expression::ArrayExcept(f)
1660 | Expression::ArrayRemove(f)
1661 | Expression::StarMap(f)
1662 | Expression::MapFromArrays(f)
1663 | Expression::MapContainsKey(f)
1664 | Expression::ElementAt(f)
1665 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1666
1667 Expression::Coalesce(f)
1669 | Expression::Greatest(f)
1670 | Expression::Least(f)
1671 | Expression::ArrayConcat(f)
1672 | Expression::ArrayIntersect(f)
1673 | Expression::ArrayZip(f)
1674 | Expression::MapConcat(f)
1675 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1676
1677 Expression::Sum(f)
1679 | Expression::Avg(f)
1680 | Expression::Min(f)
1681 | Expression::Max(f)
1682 | Expression::ArrayAgg(f)
1683 | Expression::CountIf(f)
1684 | Expression::Stddev(f)
1685 | Expression::StddevPop(f)
1686 | Expression::StddevSamp(f)
1687 | Expression::Variance(f)
1688 | Expression::VarPop(f)
1689 | Expression::VarSamp(f)
1690 | Expression::Median(f)
1691 | Expression::Mode(f)
1692 | Expression::First(f)
1693 | Expression::Last(f)
1694 | Expression::AnyValue(f)
1695 | Expression::ApproxDistinct(f)
1696 | Expression::ApproxCountDistinct(f)
1697 | Expression::LogicalAnd(f)
1698 | Expression::LogicalOr(f)
1699 | Expression::Skewness(f)
1700 | Expression::ArrayConcatAgg(f)
1701 | Expression::ArrayUniqueAgg(f)
1702 | Expression::BoolXorAgg(f)
1703 | Expression::BitwiseAndAgg(f)
1704 | Expression::BitwiseOrAgg(f)
1705 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1706
1707 _ => {}
1709 }
1710 }
1711
1712 pub fn column(name: impl Into<String>) -> Self {
1714 Expression::Column(Box::new(Column {
1715 name: Identifier::new(name),
1716 table: None,
1717 join_mark: false,
1718 trailing_comments: Vec::new(),
1719 span: None,
1720 inferred_type: None,
1721 }))
1722 }
1723
1724 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1726 Expression::Column(Box::new(Column {
1727 name: Identifier::new(column),
1728 table: Some(Identifier::new(table)),
1729 join_mark: false,
1730 trailing_comments: Vec::new(),
1731 span: None,
1732 inferred_type: None,
1733 }))
1734 }
1735
1736 pub fn identifier(name: impl Into<String>) -> Self {
1738 Expression::Identifier(Identifier::new(name))
1739 }
1740
1741 pub fn null() -> Self {
1743 Expression::Null(Null)
1744 }
1745
1746 pub fn true_() -> Self {
1748 Expression::Boolean(BooleanLiteral { value: true })
1749 }
1750
1751 pub fn false_() -> Self {
1753 Expression::Boolean(BooleanLiteral { value: false })
1754 }
1755
1756 pub fn star() -> Self {
1758 Expression::Star(Star {
1759 table: None,
1760 except: None,
1761 replace: None,
1762 rename: None,
1763 trailing_comments: Vec::new(),
1764 span: None,
1765 })
1766 }
1767
1768 pub fn alias(self, name: impl Into<String>) -> Self {
1770 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1771 }
1772
1773 pub fn is_select(&self) -> bool {
1775 matches!(self, Expression::Select(_))
1776 }
1777
1778 pub fn as_select(&self) -> Option<&Select> {
1780 match self {
1781 Expression::Select(s) => Some(s),
1782 _ => None,
1783 }
1784 }
1785
1786 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1788 match self {
1789 Expression::Select(s) => Some(s),
1790 _ => None,
1791 }
1792 }
1793
1794 pub fn sql(&self) -> String {
1799 crate::generator::Generator::sql(self).unwrap_or_default()
1800 }
1801
1802 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1808 crate::generate(self, dialect).unwrap_or_default()
1809 }
1810}
1811
1812impl Expression {
1815 pub fn variant_name(&self) -> &'static str {
1818 match self {
1819 Expression::Literal(_) => "literal",
1820 Expression::Boolean(_) => "boolean",
1821 Expression::Null(_) => "null",
1822 Expression::Identifier(_) => "identifier",
1823 Expression::Column(_) => "column",
1824 Expression::Table(_) => "table",
1825 Expression::Star(_) => "star",
1826 Expression::BracedWildcard(_) => "braced_wildcard",
1827 Expression::Select(_) => "select",
1828 Expression::Union(_) => "union",
1829 Expression::Intersect(_) => "intersect",
1830 Expression::Except(_) => "except",
1831 Expression::Subquery(_) => "subquery",
1832 Expression::PipeOperator(_) => "pipe_operator",
1833 Expression::Pivot(_) => "pivot",
1834 Expression::PivotAlias(_) => "pivot_alias",
1835 Expression::Unpivot(_) => "unpivot",
1836 Expression::Values(_) => "values",
1837 Expression::PreWhere(_) => "pre_where",
1838 Expression::Stream(_) => "stream",
1839 Expression::UsingData(_) => "using_data",
1840 Expression::XmlNamespace(_) => "xml_namespace",
1841 Expression::Insert(_) => "insert",
1842 Expression::Update(_) => "update",
1843 Expression::Delete(_) => "delete",
1844 Expression::Copy(_) => "copy",
1845 Expression::Put(_) => "put",
1846 Expression::StageReference(_) => "stage_reference",
1847 Expression::Alias(_) => "alias",
1848 Expression::Cast(_) => "cast",
1849 Expression::Collation(_) => "collation",
1850 Expression::Case(_) => "case",
1851 Expression::And(_) => "and",
1852 Expression::Or(_) => "or",
1853 Expression::Add(_) => "add",
1854 Expression::Sub(_) => "sub",
1855 Expression::Mul(_) => "mul",
1856 Expression::Div(_) => "div",
1857 Expression::Mod(_) => "mod",
1858 Expression::Eq(_) => "eq",
1859 Expression::Neq(_) => "neq",
1860 Expression::Lt(_) => "lt",
1861 Expression::Lte(_) => "lte",
1862 Expression::Gt(_) => "gt",
1863 Expression::Gte(_) => "gte",
1864 Expression::Like(_) => "like",
1865 Expression::ILike(_) => "i_like",
1866 Expression::Match(_) => "match",
1867 Expression::BitwiseAnd(_) => "bitwise_and",
1868 Expression::BitwiseOr(_) => "bitwise_or",
1869 Expression::BitwiseXor(_) => "bitwise_xor",
1870 Expression::Concat(_) => "concat",
1871 Expression::Adjacent(_) => "adjacent",
1872 Expression::TsMatch(_) => "ts_match",
1873 Expression::PropertyEQ(_) => "property_e_q",
1874 Expression::ArrayContainsAll(_) => "array_contains_all",
1875 Expression::ArrayContainedBy(_) => "array_contained_by",
1876 Expression::ArrayOverlaps(_) => "array_overlaps",
1877 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1878 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1879 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1880 Expression::ExtendsLeft(_) => "extends_left",
1881 Expression::ExtendsRight(_) => "extends_right",
1882 Expression::Not(_) => "not",
1883 Expression::Neg(_) => "neg",
1884 Expression::BitwiseNot(_) => "bitwise_not",
1885 Expression::In(_) => "in",
1886 Expression::Between(_) => "between",
1887 Expression::IsNull(_) => "is_null",
1888 Expression::IsTrue(_) => "is_true",
1889 Expression::IsFalse(_) => "is_false",
1890 Expression::IsJson(_) => "is_json",
1891 Expression::Is(_) => "is",
1892 Expression::Exists(_) => "exists",
1893 Expression::MemberOf(_) => "member_of",
1894 Expression::Function(_) => "function",
1895 Expression::AggregateFunction(_) => "aggregate_function",
1896 Expression::WindowFunction(_) => "window_function",
1897 Expression::From(_) => "from",
1898 Expression::Join(_) => "join",
1899 Expression::JoinedTable(_) => "joined_table",
1900 Expression::Where(_) => "where",
1901 Expression::GroupBy(_) => "group_by",
1902 Expression::Having(_) => "having",
1903 Expression::OrderBy(_) => "order_by",
1904 Expression::Limit(_) => "limit",
1905 Expression::Offset(_) => "offset",
1906 Expression::Qualify(_) => "qualify",
1907 Expression::With(_) => "with",
1908 Expression::Cte(_) => "cte",
1909 Expression::DistributeBy(_) => "distribute_by",
1910 Expression::ClusterBy(_) => "cluster_by",
1911 Expression::SortBy(_) => "sort_by",
1912 Expression::LateralView(_) => "lateral_view",
1913 Expression::Hint(_) => "hint",
1914 Expression::Pseudocolumn(_) => "pseudocolumn",
1915 Expression::Connect(_) => "connect",
1916 Expression::Prior(_) => "prior",
1917 Expression::ConnectByRoot(_) => "connect_by_root",
1918 Expression::MatchRecognize(_) => "match_recognize",
1919 Expression::Ordered(_) => "ordered",
1920 Expression::Window(_) => "window",
1921 Expression::Over(_) => "over",
1922 Expression::WithinGroup(_) => "within_group",
1923 Expression::DataType(_) => "data_type",
1924 Expression::Array(_) => "array",
1925 Expression::Struct(_) => "struct",
1926 Expression::Tuple(_) => "tuple",
1927 Expression::Interval(_) => "interval",
1928 Expression::ConcatWs(_) => "concat_ws",
1929 Expression::Substring(_) => "substring",
1930 Expression::Upper(_) => "upper",
1931 Expression::Lower(_) => "lower",
1932 Expression::Length(_) => "length",
1933 Expression::Trim(_) => "trim",
1934 Expression::LTrim(_) => "l_trim",
1935 Expression::RTrim(_) => "r_trim",
1936 Expression::Replace(_) => "replace",
1937 Expression::Reverse(_) => "reverse",
1938 Expression::Left(_) => "left",
1939 Expression::Right(_) => "right",
1940 Expression::Repeat(_) => "repeat",
1941 Expression::Lpad(_) => "lpad",
1942 Expression::Rpad(_) => "rpad",
1943 Expression::Split(_) => "split",
1944 Expression::RegexpLike(_) => "regexp_like",
1945 Expression::RegexpReplace(_) => "regexp_replace",
1946 Expression::RegexpExtract(_) => "regexp_extract",
1947 Expression::Overlay(_) => "overlay",
1948 Expression::Abs(_) => "abs",
1949 Expression::Round(_) => "round",
1950 Expression::Floor(_) => "floor",
1951 Expression::Ceil(_) => "ceil",
1952 Expression::Power(_) => "power",
1953 Expression::Sqrt(_) => "sqrt",
1954 Expression::Cbrt(_) => "cbrt",
1955 Expression::Ln(_) => "ln",
1956 Expression::Log(_) => "log",
1957 Expression::Exp(_) => "exp",
1958 Expression::Sign(_) => "sign",
1959 Expression::Greatest(_) => "greatest",
1960 Expression::Least(_) => "least",
1961 Expression::CurrentDate(_) => "current_date",
1962 Expression::CurrentTime(_) => "current_time",
1963 Expression::CurrentTimestamp(_) => "current_timestamp",
1964 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1965 Expression::AtTimeZone(_) => "at_time_zone",
1966 Expression::DateAdd(_) => "date_add",
1967 Expression::DateSub(_) => "date_sub",
1968 Expression::DateDiff(_) => "date_diff",
1969 Expression::DateTrunc(_) => "date_trunc",
1970 Expression::Extract(_) => "extract",
1971 Expression::ToDate(_) => "to_date",
1972 Expression::ToTimestamp(_) => "to_timestamp",
1973 Expression::Date(_) => "date",
1974 Expression::Time(_) => "time",
1975 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1976 Expression::UnixDate(_) => "unix_date",
1977 Expression::UnixSeconds(_) => "unix_seconds",
1978 Expression::UnixMillis(_) => "unix_millis",
1979 Expression::UnixMicros(_) => "unix_micros",
1980 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1981 Expression::TimeStrToDate(_) => "time_str_to_date",
1982 Expression::DateToDi(_) => "date_to_di",
1983 Expression::DiToDate(_) => "di_to_date",
1984 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1985 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1986 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1987 Expression::YearOfWeek(_) => "year_of_week",
1988 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1989 Expression::Coalesce(_) => "coalesce",
1990 Expression::NullIf(_) => "null_if",
1991 Expression::IfFunc(_) => "if_func",
1992 Expression::IfNull(_) => "if_null",
1993 Expression::Nvl(_) => "nvl",
1994 Expression::Nvl2(_) => "nvl2",
1995 Expression::TryCast(_) => "try_cast",
1996 Expression::SafeCast(_) => "safe_cast",
1997 Expression::Count(_) => "count",
1998 Expression::Sum(_) => "sum",
1999 Expression::Avg(_) => "avg",
2000 Expression::Min(_) => "min",
2001 Expression::Max(_) => "max",
2002 Expression::GroupConcat(_) => "group_concat",
2003 Expression::StringAgg(_) => "string_agg",
2004 Expression::ListAgg(_) => "list_agg",
2005 Expression::ArrayAgg(_) => "array_agg",
2006 Expression::CountIf(_) => "count_if",
2007 Expression::SumIf(_) => "sum_if",
2008 Expression::Stddev(_) => "stddev",
2009 Expression::StddevPop(_) => "stddev_pop",
2010 Expression::StddevSamp(_) => "stddev_samp",
2011 Expression::Variance(_) => "variance",
2012 Expression::VarPop(_) => "var_pop",
2013 Expression::VarSamp(_) => "var_samp",
2014 Expression::Median(_) => "median",
2015 Expression::Mode(_) => "mode",
2016 Expression::First(_) => "first",
2017 Expression::Last(_) => "last",
2018 Expression::AnyValue(_) => "any_value",
2019 Expression::ApproxDistinct(_) => "approx_distinct",
2020 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2021 Expression::ApproxPercentile(_) => "approx_percentile",
2022 Expression::Percentile(_) => "percentile",
2023 Expression::LogicalAnd(_) => "logical_and",
2024 Expression::LogicalOr(_) => "logical_or",
2025 Expression::Skewness(_) => "skewness",
2026 Expression::BitwiseCount(_) => "bitwise_count",
2027 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2028 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2029 Expression::BoolXorAgg(_) => "bool_xor_agg",
2030 Expression::RowNumber(_) => "row_number",
2031 Expression::Rank(_) => "rank",
2032 Expression::DenseRank(_) => "dense_rank",
2033 Expression::NTile(_) => "n_tile",
2034 Expression::Lead(_) => "lead",
2035 Expression::Lag(_) => "lag",
2036 Expression::FirstValue(_) => "first_value",
2037 Expression::LastValue(_) => "last_value",
2038 Expression::NthValue(_) => "nth_value",
2039 Expression::PercentRank(_) => "percent_rank",
2040 Expression::CumeDist(_) => "cume_dist",
2041 Expression::PercentileCont(_) => "percentile_cont",
2042 Expression::PercentileDisc(_) => "percentile_disc",
2043 Expression::Contains(_) => "contains",
2044 Expression::StartsWith(_) => "starts_with",
2045 Expression::EndsWith(_) => "ends_with",
2046 Expression::Position(_) => "position",
2047 Expression::Initcap(_) => "initcap",
2048 Expression::Ascii(_) => "ascii",
2049 Expression::Chr(_) => "chr",
2050 Expression::CharFunc(_) => "char_func",
2051 Expression::Soundex(_) => "soundex",
2052 Expression::Levenshtein(_) => "levenshtein",
2053 Expression::ByteLength(_) => "byte_length",
2054 Expression::Hex(_) => "hex",
2055 Expression::LowerHex(_) => "lower_hex",
2056 Expression::Unicode(_) => "unicode",
2057 Expression::ModFunc(_) => "mod_func",
2058 Expression::Random(_) => "random",
2059 Expression::Rand(_) => "rand",
2060 Expression::TruncFunc(_) => "trunc_func",
2061 Expression::Pi(_) => "pi",
2062 Expression::Radians(_) => "radians",
2063 Expression::Degrees(_) => "degrees",
2064 Expression::Sin(_) => "sin",
2065 Expression::Cos(_) => "cos",
2066 Expression::Tan(_) => "tan",
2067 Expression::Asin(_) => "asin",
2068 Expression::Acos(_) => "acos",
2069 Expression::Atan(_) => "atan",
2070 Expression::Atan2(_) => "atan2",
2071 Expression::IsNan(_) => "is_nan",
2072 Expression::IsInf(_) => "is_inf",
2073 Expression::IntDiv(_) => "int_div",
2074 Expression::Decode(_) => "decode",
2075 Expression::DateFormat(_) => "date_format",
2076 Expression::FormatDate(_) => "format_date",
2077 Expression::Year(_) => "year",
2078 Expression::Month(_) => "month",
2079 Expression::Day(_) => "day",
2080 Expression::Hour(_) => "hour",
2081 Expression::Minute(_) => "minute",
2082 Expression::Second(_) => "second",
2083 Expression::DayOfWeek(_) => "day_of_week",
2084 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2085 Expression::DayOfMonth(_) => "day_of_month",
2086 Expression::DayOfYear(_) => "day_of_year",
2087 Expression::WeekOfYear(_) => "week_of_year",
2088 Expression::Quarter(_) => "quarter",
2089 Expression::AddMonths(_) => "add_months",
2090 Expression::MonthsBetween(_) => "months_between",
2091 Expression::LastDay(_) => "last_day",
2092 Expression::NextDay(_) => "next_day",
2093 Expression::Epoch(_) => "epoch",
2094 Expression::EpochMs(_) => "epoch_ms",
2095 Expression::FromUnixtime(_) => "from_unixtime",
2096 Expression::UnixTimestamp(_) => "unix_timestamp",
2097 Expression::MakeDate(_) => "make_date",
2098 Expression::MakeTimestamp(_) => "make_timestamp",
2099 Expression::TimestampTrunc(_) => "timestamp_trunc",
2100 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2101 Expression::SessionUser(_) => "session_user",
2102 Expression::SHA(_) => "s_h_a",
2103 Expression::SHA1Digest(_) => "s_h_a1_digest",
2104 Expression::TimeToUnix(_) => "time_to_unix",
2105 Expression::ArrayFunc(_) => "array_func",
2106 Expression::ArrayLength(_) => "array_length",
2107 Expression::ArraySize(_) => "array_size",
2108 Expression::Cardinality(_) => "cardinality",
2109 Expression::ArrayContains(_) => "array_contains",
2110 Expression::ArrayPosition(_) => "array_position",
2111 Expression::ArrayAppend(_) => "array_append",
2112 Expression::ArrayPrepend(_) => "array_prepend",
2113 Expression::ArrayConcat(_) => "array_concat",
2114 Expression::ArraySort(_) => "array_sort",
2115 Expression::ArrayReverse(_) => "array_reverse",
2116 Expression::ArrayDistinct(_) => "array_distinct",
2117 Expression::ArrayJoin(_) => "array_join",
2118 Expression::ArrayToString(_) => "array_to_string",
2119 Expression::Unnest(_) => "unnest",
2120 Expression::Explode(_) => "explode",
2121 Expression::ExplodeOuter(_) => "explode_outer",
2122 Expression::ArrayFilter(_) => "array_filter",
2123 Expression::ArrayTransform(_) => "array_transform",
2124 Expression::ArrayFlatten(_) => "array_flatten",
2125 Expression::ArrayCompact(_) => "array_compact",
2126 Expression::ArrayIntersect(_) => "array_intersect",
2127 Expression::ArrayUnion(_) => "array_union",
2128 Expression::ArrayExcept(_) => "array_except",
2129 Expression::ArrayRemove(_) => "array_remove",
2130 Expression::ArrayZip(_) => "array_zip",
2131 Expression::Sequence(_) => "sequence",
2132 Expression::Generate(_) => "generate",
2133 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2134 Expression::ToArray(_) => "to_array",
2135 Expression::StarMap(_) => "star_map",
2136 Expression::StructFunc(_) => "struct_func",
2137 Expression::StructExtract(_) => "struct_extract",
2138 Expression::NamedStruct(_) => "named_struct",
2139 Expression::MapFunc(_) => "map_func",
2140 Expression::MapFromEntries(_) => "map_from_entries",
2141 Expression::MapFromArrays(_) => "map_from_arrays",
2142 Expression::MapKeys(_) => "map_keys",
2143 Expression::MapValues(_) => "map_values",
2144 Expression::MapContainsKey(_) => "map_contains_key",
2145 Expression::MapConcat(_) => "map_concat",
2146 Expression::ElementAt(_) => "element_at",
2147 Expression::TransformKeys(_) => "transform_keys",
2148 Expression::TransformValues(_) => "transform_values",
2149 Expression::FunctionEmits(_) => "function_emits",
2150 Expression::JsonExtract(_) => "json_extract",
2151 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2152 Expression::JsonExtractPath(_) => "json_extract_path",
2153 Expression::JsonArray(_) => "json_array",
2154 Expression::JsonObject(_) => "json_object",
2155 Expression::JsonQuery(_) => "json_query",
2156 Expression::JsonValue(_) => "json_value",
2157 Expression::JsonArrayLength(_) => "json_array_length",
2158 Expression::JsonKeys(_) => "json_keys",
2159 Expression::JsonType(_) => "json_type",
2160 Expression::ParseJson(_) => "parse_json",
2161 Expression::ToJson(_) => "to_json",
2162 Expression::JsonSet(_) => "json_set",
2163 Expression::JsonInsert(_) => "json_insert",
2164 Expression::JsonRemove(_) => "json_remove",
2165 Expression::JsonMergePatch(_) => "json_merge_patch",
2166 Expression::JsonArrayAgg(_) => "json_array_agg",
2167 Expression::JsonObjectAgg(_) => "json_object_agg",
2168 Expression::Convert(_) => "convert",
2169 Expression::Typeof(_) => "typeof",
2170 Expression::Lambda(_) => "lambda",
2171 Expression::Parameter(_) => "parameter",
2172 Expression::Placeholder(_) => "placeholder",
2173 Expression::NamedArgument(_) => "named_argument",
2174 Expression::TableArgument(_) => "table_argument",
2175 Expression::SqlComment(_) => "sql_comment",
2176 Expression::NullSafeEq(_) => "null_safe_eq",
2177 Expression::NullSafeNeq(_) => "null_safe_neq",
2178 Expression::Glob(_) => "glob",
2179 Expression::SimilarTo(_) => "similar_to",
2180 Expression::Any(_) => "any",
2181 Expression::All(_) => "all",
2182 Expression::Overlaps(_) => "overlaps",
2183 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2184 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2185 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2186 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2187 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2188 Expression::Subscript(_) => "subscript",
2189 Expression::Dot(_) => "dot",
2190 Expression::MethodCall(_) => "method_call",
2191 Expression::ArraySlice(_) => "array_slice",
2192 Expression::CreateTable(_) => "create_table",
2193 Expression::DropTable(_) => "drop_table",
2194 Expression::Undrop(_) => "undrop",
2195 Expression::AlterTable(_) => "alter_table",
2196 Expression::CreateIndex(_) => "create_index",
2197 Expression::DropIndex(_) => "drop_index",
2198 Expression::CreateView(_) => "create_view",
2199 Expression::DropView(_) => "drop_view",
2200 Expression::AlterView(_) => "alter_view",
2201 Expression::AlterIndex(_) => "alter_index",
2202 Expression::Truncate(_) => "truncate",
2203 Expression::Use(_) => "use",
2204 Expression::Cache(_) => "cache",
2205 Expression::Uncache(_) => "uncache",
2206 Expression::LoadData(_) => "load_data",
2207 Expression::Pragma(_) => "pragma",
2208 Expression::Grant(_) => "grant",
2209 Expression::Revoke(_) => "revoke",
2210 Expression::Comment(_) => "comment",
2211 Expression::SetStatement(_) => "set_statement",
2212 Expression::CreateSchema(_) => "create_schema",
2213 Expression::DropSchema(_) => "drop_schema",
2214 Expression::DropNamespace(_) => "drop_namespace",
2215 Expression::CreateDatabase(_) => "create_database",
2216 Expression::DropDatabase(_) => "drop_database",
2217 Expression::CreateFunction(_) => "create_function",
2218 Expression::DropFunction(_) => "drop_function",
2219 Expression::CreateProcedure(_) => "create_procedure",
2220 Expression::DropProcedure(_) => "drop_procedure",
2221 Expression::CreateSequence(_) => "create_sequence",
2222 Expression::CreateSynonym(_) => "create_synonym",
2223 Expression::DropSequence(_) => "drop_sequence",
2224 Expression::AlterSequence(_) => "alter_sequence",
2225 Expression::CreateTrigger(_) => "create_trigger",
2226 Expression::DropTrigger(_) => "drop_trigger",
2227 Expression::CreateType(_) => "create_type",
2228 Expression::DropType(_) => "drop_type",
2229 Expression::Describe(_) => "describe",
2230 Expression::Show(_) => "show",
2231 Expression::Command(_) => "command",
2232 Expression::Kill(_) => "kill",
2233 Expression::Execute(_) => "execute",
2234 Expression::Raw(_) => "raw",
2235 Expression::CreateTask(_) => "create_task",
2236 Expression::Paren(_) => "paren",
2237 Expression::Annotated(_) => "annotated",
2238 Expression::Refresh(_) => "refresh",
2239 Expression::LockingStatement(_) => "locking_statement",
2240 Expression::SequenceProperties(_) => "sequence_properties",
2241 Expression::TruncateTable(_) => "truncate_table",
2242 Expression::Clone(_) => "clone",
2243 Expression::Attach(_) => "attach",
2244 Expression::Detach(_) => "detach",
2245 Expression::Install(_) => "install",
2246 Expression::Summarize(_) => "summarize",
2247 Expression::Declare(_) => "declare",
2248 Expression::DeclareItem(_) => "declare_item",
2249 Expression::Set(_) => "set",
2250 Expression::Heredoc(_) => "heredoc",
2251 Expression::SetItem(_) => "set_item",
2252 Expression::QueryBand(_) => "query_band",
2253 Expression::UserDefinedFunction(_) => "user_defined_function",
2254 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2255 Expression::ProjectionDef(_) => "projection_def",
2256 Expression::TableAlias(_) => "table_alias",
2257 Expression::ByteString(_) => "byte_string",
2258 Expression::HexStringExpr(_) => "hex_string_expr",
2259 Expression::UnicodeString(_) => "unicode_string",
2260 Expression::ColumnPosition(_) => "column_position",
2261 Expression::ColumnDef(_) => "column_def",
2262 Expression::AlterColumn(_) => "alter_column",
2263 Expression::AlterSortKey(_) => "alter_sort_key",
2264 Expression::AlterSet(_) => "alter_set",
2265 Expression::RenameColumn(_) => "rename_column",
2266 Expression::Comprehension(_) => "comprehension",
2267 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2268 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2269 Expression::IndexConstraintOption(_) => "index_constraint_option",
2270 Expression::ColumnConstraint(_) => "column_constraint",
2271 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2272 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2273 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2274 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2275 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2276 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2277 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2278 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2279 Expression::WithOperator(_) => "with_operator",
2280 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2281 "generated_as_identity_column_constraint"
2282 }
2283 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2284 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2285 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2286 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2287 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2288 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2289 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2290 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2291 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2292 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2293 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2294 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2295 Expression::PathColumnConstraint(_) => "path_column_constraint",
2296 Expression::Constraint(_) => "constraint",
2297 Expression::Export(_) => "export",
2298 Expression::Filter(_) => "filter",
2299 Expression::Changes(_) => "changes",
2300 Expression::CopyParameter(_) => "copy_parameter",
2301 Expression::Credentials(_) => "credentials",
2302 Expression::Directory(_) => "directory",
2303 Expression::ForeignKey(_) => "foreign_key",
2304 Expression::ColumnPrefix(_) => "column_prefix",
2305 Expression::PrimaryKey(_) => "primary_key",
2306 Expression::IntoClause(_) => "into_clause",
2307 Expression::JoinHint(_) => "join_hint",
2308 Expression::Opclass(_) => "opclass",
2309 Expression::Index(_) => "index",
2310 Expression::IndexParameters(_) => "index_parameters",
2311 Expression::ConditionalInsert(_) => "conditional_insert",
2312 Expression::MultitableInserts(_) => "multitable_inserts",
2313 Expression::OnConflict(_) => "on_conflict",
2314 Expression::OnCondition(_) => "on_condition",
2315 Expression::Returning(_) => "returning",
2316 Expression::Introducer(_) => "introducer",
2317 Expression::PartitionRange(_) => "partition_range",
2318 Expression::Fetch(_) => "fetch",
2319 Expression::Group(_) => "group",
2320 Expression::Cube(_) => "cube",
2321 Expression::Rollup(_) => "rollup",
2322 Expression::GroupingSets(_) => "grouping_sets",
2323 Expression::LimitOptions(_) => "limit_options",
2324 Expression::Lateral(_) => "lateral",
2325 Expression::TableFromRows(_) => "table_from_rows",
2326 Expression::RowsFrom(_) => "rows_from",
2327 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2328 Expression::WithFill(_) => "with_fill",
2329 Expression::Property(_) => "property",
2330 Expression::GrantPrivilege(_) => "grant_privilege",
2331 Expression::GrantPrincipal(_) => "grant_principal",
2332 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2333 Expression::AlgorithmProperty(_) => "algorithm_property",
2334 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2335 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2336 Expression::BackupProperty(_) => "backup_property",
2337 Expression::BuildProperty(_) => "build_property",
2338 Expression::BlockCompressionProperty(_) => "block_compression_property",
2339 Expression::CharacterSetProperty(_) => "character_set_property",
2340 Expression::ChecksumProperty(_) => "checksum_property",
2341 Expression::CollateProperty(_) => "collate_property",
2342 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2343 Expression::DataDeletionProperty(_) => "data_deletion_property",
2344 Expression::DefinerProperty(_) => "definer_property",
2345 Expression::DistKeyProperty(_) => "dist_key_property",
2346 Expression::DistributedByProperty(_) => "distributed_by_property",
2347 Expression::DistStyleProperty(_) => "dist_style_property",
2348 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2349 Expression::EngineProperty(_) => "engine_property",
2350 Expression::ToTableProperty(_) => "to_table_property",
2351 Expression::ExecuteAsProperty(_) => "execute_as_property",
2352 Expression::ExternalProperty(_) => "external_property",
2353 Expression::FallbackProperty(_) => "fallback_property",
2354 Expression::FileFormatProperty(_) => "file_format_property",
2355 Expression::CredentialsProperty(_) => "credentials_property",
2356 Expression::FreespaceProperty(_) => "freespace_property",
2357 Expression::InheritsProperty(_) => "inherits_property",
2358 Expression::InputModelProperty(_) => "input_model_property",
2359 Expression::OutputModelProperty(_) => "output_model_property",
2360 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2361 Expression::JournalProperty(_) => "journal_property",
2362 Expression::LanguageProperty(_) => "language_property",
2363 Expression::EnviromentProperty(_) => "enviroment_property",
2364 Expression::ClusteredByProperty(_) => "clustered_by_property",
2365 Expression::DictProperty(_) => "dict_property",
2366 Expression::DictRange(_) => "dict_range",
2367 Expression::OnCluster(_) => "on_cluster",
2368 Expression::LikeProperty(_) => "like_property",
2369 Expression::LocationProperty(_) => "location_property",
2370 Expression::LockProperty(_) => "lock_property",
2371 Expression::LockingProperty(_) => "locking_property",
2372 Expression::LogProperty(_) => "log_property",
2373 Expression::MaterializedProperty(_) => "materialized_property",
2374 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2375 Expression::OnProperty(_) => "on_property",
2376 Expression::OnCommitProperty(_) => "on_commit_property",
2377 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2378 Expression::PartitionByProperty(_) => "partition_by_property",
2379 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2380 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2381 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2382 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2383 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2384 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2385 Expression::PartitionList(_) => "partition_list",
2386 Expression::Partition(_) => "partition",
2387 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2388 Expression::UniqueKeyProperty(_) => "unique_key_property",
2389 Expression::RollupProperty(_) => "rollup_property",
2390 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2391 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2392 Expression::RemoteWithConnectionModelProperty(_) => {
2393 "remote_with_connection_model_property"
2394 }
2395 Expression::ReturnsProperty(_) => "returns_property",
2396 Expression::RowFormatProperty(_) => "row_format_property",
2397 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2398 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2399 Expression::QueryTransform(_) => "query_transform",
2400 Expression::SampleProperty(_) => "sample_property",
2401 Expression::SecurityProperty(_) => "security_property",
2402 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2403 Expression::SemanticView(_) => "semantic_view",
2404 Expression::SerdeProperties(_) => "serde_properties",
2405 Expression::SetProperty(_) => "set_property",
2406 Expression::SharingProperty(_) => "sharing_property",
2407 Expression::SetConfigProperty(_) => "set_config_property",
2408 Expression::SettingsProperty(_) => "settings_property",
2409 Expression::SortKeyProperty(_) => "sort_key_property",
2410 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2411 Expression::SqlSecurityProperty(_) => "sql_security_property",
2412 Expression::StabilityProperty(_) => "stability_property",
2413 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2414 Expression::TemporaryProperty(_) => "temporary_property",
2415 Expression::Tags(_) => "tags",
2416 Expression::TransformModelProperty(_) => "transform_model_property",
2417 Expression::TransientProperty(_) => "transient_property",
2418 Expression::UsingTemplateProperty(_) => "using_template_property",
2419 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2420 Expression::VolatileProperty(_) => "volatile_property",
2421 Expression::WithDataProperty(_) => "with_data_property",
2422 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2423 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2424 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2425 Expression::WithProcedureOptions(_) => "with_procedure_options",
2426 Expression::EncodeProperty(_) => "encode_property",
2427 Expression::IncludeProperty(_) => "include_property",
2428 Expression::Properties(_) => "properties",
2429 Expression::OptionsProperty(_) => "options_property",
2430 Expression::InputOutputFormat(_) => "input_output_format",
2431 Expression::Reference(_) => "reference",
2432 Expression::QueryOption(_) => "query_option",
2433 Expression::WithTableHint(_) => "with_table_hint",
2434 Expression::IndexTableHint(_) => "index_table_hint",
2435 Expression::HistoricalData(_) => "historical_data",
2436 Expression::Get(_) => "get",
2437 Expression::SetOperation(_) => "set_operation",
2438 Expression::Var(_) => "var",
2439 Expression::Variadic(_) => "variadic",
2440 Expression::Version(_) => "version",
2441 Expression::Schema(_) => "schema",
2442 Expression::Lock(_) => "lock",
2443 Expression::TableSample(_) => "table_sample",
2444 Expression::Tag(_) => "tag",
2445 Expression::UnpivotColumns(_) => "unpivot_columns",
2446 Expression::WindowSpec(_) => "window_spec",
2447 Expression::SessionParameter(_) => "session_parameter",
2448 Expression::PseudoType(_) => "pseudo_type",
2449 Expression::ObjectIdentifier(_) => "object_identifier",
2450 Expression::Transaction(_) => "transaction",
2451 Expression::Commit(_) => "commit",
2452 Expression::Rollback(_) => "rollback",
2453 Expression::AlterSession(_) => "alter_session",
2454 Expression::Analyze(_) => "analyze",
2455 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2456 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2457 Expression::AnalyzeSample(_) => "analyze_sample",
2458 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2459 Expression::AnalyzeDelete(_) => "analyze_delete",
2460 Expression::AnalyzeWith(_) => "analyze_with",
2461 Expression::AnalyzeValidate(_) => "analyze_validate",
2462 Expression::AddPartition(_) => "add_partition",
2463 Expression::AttachOption(_) => "attach_option",
2464 Expression::DropPartition(_) => "drop_partition",
2465 Expression::ReplacePartition(_) => "replace_partition",
2466 Expression::DPipe(_) => "d_pipe",
2467 Expression::Operator(_) => "operator",
2468 Expression::PivotAny(_) => "pivot_any",
2469 Expression::Aliases(_) => "aliases",
2470 Expression::AtIndex(_) => "at_index",
2471 Expression::FromTimeZone(_) => "from_time_zone",
2472 Expression::FormatPhrase(_) => "format_phrase",
2473 Expression::ForIn(_) => "for_in",
2474 Expression::TimeUnit(_) => "time_unit",
2475 Expression::IntervalOp(_) => "interval_op",
2476 Expression::IntervalSpan(_) => "interval_span",
2477 Expression::HavingMax(_) => "having_max",
2478 Expression::CosineDistance(_) => "cosine_distance",
2479 Expression::DotProduct(_) => "dot_product",
2480 Expression::EuclideanDistance(_) => "euclidean_distance",
2481 Expression::ManhattanDistance(_) => "manhattan_distance",
2482 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2483 Expression::Booland(_) => "booland",
2484 Expression::Boolor(_) => "boolor",
2485 Expression::ParameterizedAgg(_) => "parameterized_agg",
2486 Expression::ArgMax(_) => "arg_max",
2487 Expression::ArgMin(_) => "arg_min",
2488 Expression::ApproxTopK(_) => "approx_top_k",
2489 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2490 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2491 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2492 Expression::ApproxTopSum(_) => "approx_top_sum",
2493 Expression::ApproxQuantiles(_) => "approx_quantiles",
2494 Expression::Minhash(_) => "minhash",
2495 Expression::FarmFingerprint(_) => "farm_fingerprint",
2496 Expression::Float64(_) => "float64",
2497 Expression::Transform(_) => "transform",
2498 Expression::Translate(_) => "translate",
2499 Expression::Grouping(_) => "grouping",
2500 Expression::GroupingId(_) => "grouping_id",
2501 Expression::Anonymous(_) => "anonymous",
2502 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2503 Expression::CombinedAggFunc(_) => "combined_agg_func",
2504 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2505 Expression::HashAgg(_) => "hash_agg",
2506 Expression::Hll(_) => "hll",
2507 Expression::Apply(_) => "apply",
2508 Expression::ToBoolean(_) => "to_boolean",
2509 Expression::List(_) => "list",
2510 Expression::ToMap(_) => "to_map",
2511 Expression::Pad(_) => "pad",
2512 Expression::ToChar(_) => "to_char",
2513 Expression::ToNumber(_) => "to_number",
2514 Expression::ToDouble(_) => "to_double",
2515 Expression::Int64(_) => "int64",
2516 Expression::StringFunc(_) => "string_func",
2517 Expression::ToDecfloat(_) => "to_decfloat",
2518 Expression::TryToDecfloat(_) => "try_to_decfloat",
2519 Expression::ToFile(_) => "to_file",
2520 Expression::Columns(_) => "columns",
2521 Expression::ConvertToCharset(_) => "convert_to_charset",
2522 Expression::ConvertTimezone(_) => "convert_timezone",
2523 Expression::GenerateSeries(_) => "generate_series",
2524 Expression::AIAgg(_) => "a_i_agg",
2525 Expression::AIClassify(_) => "a_i_classify",
2526 Expression::ArrayAll(_) => "array_all",
2527 Expression::ArrayAny(_) => "array_any",
2528 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2529 Expression::StPoint(_) => "st_point",
2530 Expression::StDistance(_) => "st_distance",
2531 Expression::StringToArray(_) => "string_to_array",
2532 Expression::ArraySum(_) => "array_sum",
2533 Expression::ObjectAgg(_) => "object_agg",
2534 Expression::CastToStrType(_) => "cast_to_str_type",
2535 Expression::CheckJson(_) => "check_json",
2536 Expression::CheckXml(_) => "check_xml",
2537 Expression::TranslateCharacters(_) => "translate_characters",
2538 Expression::CurrentSchemas(_) => "current_schemas",
2539 Expression::CurrentDatetime(_) => "current_datetime",
2540 Expression::Localtime(_) => "localtime",
2541 Expression::Localtimestamp(_) => "localtimestamp",
2542 Expression::Systimestamp(_) => "systimestamp",
2543 Expression::CurrentSchema(_) => "current_schema",
2544 Expression::CurrentUser(_) => "current_user",
2545 Expression::UtcTime(_) => "utc_time",
2546 Expression::UtcTimestamp(_) => "utc_timestamp",
2547 Expression::Timestamp(_) => "timestamp",
2548 Expression::DateBin(_) => "date_bin",
2549 Expression::Datetime(_) => "datetime",
2550 Expression::DatetimeAdd(_) => "datetime_add",
2551 Expression::DatetimeSub(_) => "datetime_sub",
2552 Expression::DatetimeDiff(_) => "datetime_diff",
2553 Expression::DatetimeTrunc(_) => "datetime_trunc",
2554 Expression::Dayname(_) => "dayname",
2555 Expression::MakeInterval(_) => "make_interval",
2556 Expression::PreviousDay(_) => "previous_day",
2557 Expression::Elt(_) => "elt",
2558 Expression::TimestampAdd(_) => "timestamp_add",
2559 Expression::TimestampSub(_) => "timestamp_sub",
2560 Expression::TimestampDiff(_) => "timestamp_diff",
2561 Expression::TimeSlice(_) => "time_slice",
2562 Expression::TimeAdd(_) => "time_add",
2563 Expression::TimeSub(_) => "time_sub",
2564 Expression::TimeDiff(_) => "time_diff",
2565 Expression::TimeTrunc(_) => "time_trunc",
2566 Expression::DateFromParts(_) => "date_from_parts",
2567 Expression::TimeFromParts(_) => "time_from_parts",
2568 Expression::DecodeCase(_) => "decode_case",
2569 Expression::Decrypt(_) => "decrypt",
2570 Expression::DecryptRaw(_) => "decrypt_raw",
2571 Expression::Encode(_) => "encode",
2572 Expression::Encrypt(_) => "encrypt",
2573 Expression::EncryptRaw(_) => "encrypt_raw",
2574 Expression::EqualNull(_) => "equal_null",
2575 Expression::ToBinary(_) => "to_binary",
2576 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2577 Expression::Base64DecodeString(_) => "base64_decode_string",
2578 Expression::Base64Encode(_) => "base64_encode",
2579 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2580 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2581 Expression::GapFill(_) => "gap_fill",
2582 Expression::GenerateDateArray(_) => "generate_date_array",
2583 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2584 Expression::GetExtract(_) => "get_extract",
2585 Expression::Getbit(_) => "getbit",
2586 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2587 Expression::HexEncode(_) => "hex_encode",
2588 Expression::Compress(_) => "compress",
2589 Expression::DecompressBinary(_) => "decompress_binary",
2590 Expression::DecompressString(_) => "decompress_string",
2591 Expression::Xor(_) => "xor",
2592 Expression::Nullif(_) => "nullif",
2593 Expression::JSON(_) => "j_s_o_n",
2594 Expression::JSONPath(_) => "j_s_o_n_path",
2595 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2596 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2597 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2598 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2599 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2600 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2601 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2602 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2603 Expression::Format(_) => "format",
2604 Expression::JSONKeys(_) => "j_s_o_n_keys",
2605 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2606 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2607 Expression::JSONObject(_) => "j_s_o_n_object",
2608 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2609 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2610 Expression::JSONArray(_) => "j_s_o_n_array",
2611 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2612 Expression::JSONExists(_) => "j_s_o_n_exists",
2613 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2614 Expression::JSONSchema(_) => "j_s_o_n_schema",
2615 Expression::JSONSet(_) => "j_s_o_n_set",
2616 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2617 Expression::JSONValue(_) => "j_s_o_n_value",
2618 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2619 Expression::JSONRemove(_) => "j_s_o_n_remove",
2620 Expression::JSONTable(_) => "j_s_o_n_table",
2621 Expression::JSONType(_) => "j_s_o_n_type",
2622 Expression::ObjectInsert(_) => "object_insert",
2623 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2624 Expression::OpenJSON(_) => "open_j_s_o_n",
2625 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2626 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2627 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2628 Expression::JSONCast(_) => "j_s_o_n_cast",
2629 Expression::JSONExtract(_) => "j_s_o_n_extract",
2630 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2631 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2632 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2633 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2634 Expression::JSONFormat(_) => "j_s_o_n_format",
2635 Expression::JSONBool(_) => "j_s_o_n_bool",
2636 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2637 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2638 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2639 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2640 Expression::ParseJSON(_) => "parse_j_s_o_n",
2641 Expression::ParseUrl(_) => "parse_url",
2642 Expression::ParseIp(_) => "parse_ip",
2643 Expression::ParseTime(_) => "parse_time",
2644 Expression::ParseDatetime(_) => "parse_datetime",
2645 Expression::Map(_) => "map",
2646 Expression::MapCat(_) => "map_cat",
2647 Expression::MapDelete(_) => "map_delete",
2648 Expression::MapInsert(_) => "map_insert",
2649 Expression::MapPick(_) => "map_pick",
2650 Expression::ScopeResolution(_) => "scope_resolution",
2651 Expression::Slice(_) => "slice",
2652 Expression::VarMap(_) => "var_map",
2653 Expression::MatchAgainst(_) => "match_against",
2654 Expression::MD5Digest(_) => "m_d5_digest",
2655 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2656 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2657 Expression::Monthname(_) => "monthname",
2658 Expression::Ntile(_) => "ntile",
2659 Expression::Normalize(_) => "normalize",
2660 Expression::Normal(_) => "normal",
2661 Expression::Predict(_) => "predict",
2662 Expression::MLTranslate(_) => "m_l_translate",
2663 Expression::FeaturesAtTime(_) => "features_at_time",
2664 Expression::GenerateEmbedding(_) => "generate_embedding",
2665 Expression::MLForecast(_) => "m_l_forecast",
2666 Expression::ModelAttribute(_) => "model_attribute",
2667 Expression::VectorSearch(_) => "vector_search",
2668 Expression::Quantile(_) => "quantile",
2669 Expression::ApproxQuantile(_) => "approx_quantile",
2670 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2671 Expression::Randn(_) => "randn",
2672 Expression::Randstr(_) => "randstr",
2673 Expression::RangeN(_) => "range_n",
2674 Expression::RangeBucket(_) => "range_bucket",
2675 Expression::ReadCSV(_) => "read_c_s_v",
2676 Expression::ReadParquet(_) => "read_parquet",
2677 Expression::Reduce(_) => "reduce",
2678 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2679 Expression::RegexpILike(_) => "regexp_i_like",
2680 Expression::RegexpFullMatch(_) => "regexp_full_match",
2681 Expression::RegexpInstr(_) => "regexp_instr",
2682 Expression::RegexpSplit(_) => "regexp_split",
2683 Expression::RegexpCount(_) => "regexp_count",
2684 Expression::RegrValx(_) => "regr_valx",
2685 Expression::RegrValy(_) => "regr_valy",
2686 Expression::RegrAvgy(_) => "regr_avgy",
2687 Expression::RegrAvgx(_) => "regr_avgx",
2688 Expression::RegrCount(_) => "regr_count",
2689 Expression::RegrIntercept(_) => "regr_intercept",
2690 Expression::RegrR2(_) => "regr_r2",
2691 Expression::RegrSxx(_) => "regr_sxx",
2692 Expression::RegrSxy(_) => "regr_sxy",
2693 Expression::RegrSyy(_) => "regr_syy",
2694 Expression::RegrSlope(_) => "regr_slope",
2695 Expression::SafeAdd(_) => "safe_add",
2696 Expression::SafeDivide(_) => "safe_divide",
2697 Expression::SafeMultiply(_) => "safe_multiply",
2698 Expression::SafeSubtract(_) => "safe_subtract",
2699 Expression::SHA2(_) => "s_h_a2",
2700 Expression::SHA2Digest(_) => "s_h_a2_digest",
2701 Expression::SortArray(_) => "sort_array",
2702 Expression::SplitPart(_) => "split_part",
2703 Expression::SubstringIndex(_) => "substring_index",
2704 Expression::StandardHash(_) => "standard_hash",
2705 Expression::StrPosition(_) => "str_position",
2706 Expression::Search(_) => "search",
2707 Expression::SearchIp(_) => "search_ip",
2708 Expression::StrToDate(_) => "str_to_date",
2709 Expression::DateStrToDate(_) => "date_str_to_date",
2710 Expression::DateToDateStr(_) => "date_to_date_str",
2711 Expression::StrToTime(_) => "str_to_time",
2712 Expression::StrToUnix(_) => "str_to_unix",
2713 Expression::StrToMap(_) => "str_to_map",
2714 Expression::NumberToStr(_) => "number_to_str",
2715 Expression::FromBase(_) => "from_base",
2716 Expression::Stuff(_) => "stuff",
2717 Expression::TimeToStr(_) => "time_to_str",
2718 Expression::TimeStrToTime(_) => "time_str_to_time",
2719 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2720 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2721 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2722 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2723 Expression::Unhex(_) => "unhex",
2724 Expression::Uniform(_) => "uniform",
2725 Expression::UnixToStr(_) => "unix_to_str",
2726 Expression::UnixToTime(_) => "unix_to_time",
2727 Expression::Uuid(_) => "uuid",
2728 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2729 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2730 Expression::Corr(_) => "corr",
2731 Expression::WidthBucket(_) => "width_bucket",
2732 Expression::CovarSamp(_) => "covar_samp",
2733 Expression::CovarPop(_) => "covar_pop",
2734 Expression::Week(_) => "week",
2735 Expression::XMLElement(_) => "x_m_l_element",
2736 Expression::XMLGet(_) => "x_m_l_get",
2737 Expression::XMLTable(_) => "x_m_l_table",
2738 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2739 Expression::Zipf(_) => "zipf",
2740 Expression::Merge(_) => "merge",
2741 Expression::When(_) => "when",
2742 Expression::Whens(_) => "whens",
2743 Expression::NextValueFor(_) => "next_value_for",
2744 Expression::ReturnStmt(_) => "return_stmt",
2745 }
2746 }
2747
2748 pub fn get_this(&self) -> Option<&Expression> {
2750 match self {
2751 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2753 Expression::Upper(f)
2755 | Expression::Lower(f)
2756 | Expression::Length(f)
2757 | Expression::LTrim(f)
2758 | Expression::RTrim(f)
2759 | Expression::Reverse(f)
2760 | Expression::Abs(f)
2761 | Expression::Sqrt(f)
2762 | Expression::Cbrt(f)
2763 | Expression::Ln(f)
2764 | Expression::Exp(f)
2765 | Expression::Sign(f)
2766 | Expression::Date(f)
2767 | Expression::Time(f)
2768 | Expression::Initcap(f)
2769 | Expression::Ascii(f)
2770 | Expression::Chr(f)
2771 | Expression::Soundex(f)
2772 | Expression::ByteLength(f)
2773 | Expression::Hex(f)
2774 | Expression::LowerHex(f)
2775 | Expression::Unicode(f)
2776 | Expression::Typeof(f)
2777 | Expression::Explode(f)
2778 | Expression::ExplodeOuter(f)
2779 | Expression::MapFromEntries(f)
2780 | Expression::MapKeys(f)
2781 | Expression::MapValues(f)
2782 | Expression::ArrayLength(f)
2783 | Expression::ArraySize(f)
2784 | Expression::Cardinality(f)
2785 | Expression::ArrayReverse(f)
2786 | Expression::ArrayDistinct(f)
2787 | Expression::ArrayFlatten(f)
2788 | Expression::ArrayCompact(f)
2789 | Expression::ToArray(f)
2790 | Expression::JsonArrayLength(f)
2791 | Expression::JsonKeys(f)
2792 | Expression::JsonType(f)
2793 | Expression::ParseJson(f)
2794 | Expression::ToJson(f)
2795 | Expression::Radians(f)
2796 | Expression::Degrees(f)
2797 | Expression::Sin(f)
2798 | Expression::Cos(f)
2799 | Expression::Tan(f)
2800 | Expression::Asin(f)
2801 | Expression::Acos(f)
2802 | Expression::Atan(f)
2803 | Expression::IsNan(f)
2804 | Expression::IsInf(f)
2805 | Expression::Year(f)
2806 | Expression::Month(f)
2807 | Expression::Day(f)
2808 | Expression::Hour(f)
2809 | Expression::Minute(f)
2810 | Expression::Second(f)
2811 | Expression::DayOfWeek(f)
2812 | Expression::DayOfWeekIso(f)
2813 | Expression::DayOfMonth(f)
2814 | Expression::DayOfYear(f)
2815 | Expression::WeekOfYear(f)
2816 | Expression::Quarter(f)
2817 | Expression::Epoch(f)
2818 | Expression::EpochMs(f)
2819 | Expression::BitwiseCount(f)
2820 | Expression::DateFromUnixDate(f)
2821 | Expression::UnixDate(f)
2822 | Expression::UnixSeconds(f)
2823 | Expression::UnixMillis(f)
2824 | Expression::UnixMicros(f)
2825 | Expression::TimeStrToDate(f)
2826 | Expression::DateToDi(f)
2827 | Expression::DiToDate(f)
2828 | Expression::TsOrDiToDi(f)
2829 | Expression::TsOrDsToDatetime(f)
2830 | Expression::TsOrDsToTimestamp(f)
2831 | Expression::YearOfWeek(f)
2832 | Expression::YearOfWeekIso(f)
2833 | Expression::SHA(f)
2834 | Expression::SHA1Digest(f)
2835 | Expression::TimeToUnix(f)
2836 | Expression::TimeStrToUnix(f)
2837 | Expression::Int64(f)
2838 | Expression::JSONBool(f)
2839 | Expression::MD5NumberLower64(f)
2840 | Expression::MD5NumberUpper64(f)
2841 | Expression::DateStrToDate(f)
2842 | Expression::DateToDateStr(f) => Some(&f.this),
2843 Expression::Power(f)
2845 | Expression::NullIf(f)
2846 | Expression::IfNull(f)
2847 | Expression::Nvl(f)
2848 | Expression::Contains(f)
2849 | Expression::StartsWith(f)
2850 | Expression::EndsWith(f)
2851 | Expression::Levenshtein(f)
2852 | Expression::ModFunc(f)
2853 | Expression::IntDiv(f)
2854 | Expression::Atan2(f)
2855 | Expression::AddMonths(f)
2856 | Expression::MonthsBetween(f)
2857 | Expression::NextDay(f)
2858 | Expression::UnixToTimeStr(f)
2859 | Expression::ArrayContains(f)
2860 | Expression::ArrayPosition(f)
2861 | Expression::ArrayAppend(f)
2862 | Expression::ArrayPrepend(f)
2863 | Expression::ArrayUnion(f)
2864 | Expression::ArrayExcept(f)
2865 | Expression::ArrayRemove(f)
2866 | Expression::StarMap(f)
2867 | Expression::MapFromArrays(f)
2868 | Expression::MapContainsKey(f)
2869 | Expression::ElementAt(f)
2870 | Expression::JsonMergePatch(f)
2871 | Expression::JSONBContains(f)
2872 | Expression::JSONBExtract(f) => Some(&f.this),
2873 Expression::Sum(af)
2875 | Expression::Avg(af)
2876 | Expression::Min(af)
2877 | Expression::Max(af)
2878 | Expression::ArrayAgg(af)
2879 | Expression::CountIf(af)
2880 | Expression::Stddev(af)
2881 | Expression::StddevPop(af)
2882 | Expression::StddevSamp(af)
2883 | Expression::Variance(af)
2884 | Expression::VarPop(af)
2885 | Expression::VarSamp(af)
2886 | Expression::Median(af)
2887 | Expression::Mode(af)
2888 | Expression::First(af)
2889 | Expression::Last(af)
2890 | Expression::AnyValue(af)
2891 | Expression::ApproxDistinct(af)
2892 | Expression::ApproxCountDistinct(af)
2893 | Expression::LogicalAnd(af)
2894 | Expression::LogicalOr(af)
2895 | Expression::Skewness(af)
2896 | Expression::ArrayConcatAgg(af)
2897 | Expression::ArrayUniqueAgg(af)
2898 | Expression::BoolXorAgg(af)
2899 | Expression::BitwiseAndAgg(af)
2900 | Expression::BitwiseOrAgg(af)
2901 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2902 Expression::And(op)
2904 | Expression::Or(op)
2905 | Expression::Add(op)
2906 | Expression::Sub(op)
2907 | Expression::Mul(op)
2908 | Expression::Div(op)
2909 | Expression::Mod(op)
2910 | Expression::Eq(op)
2911 | Expression::Neq(op)
2912 | Expression::Lt(op)
2913 | Expression::Lte(op)
2914 | Expression::Gt(op)
2915 | Expression::Gte(op)
2916 | Expression::BitwiseAnd(op)
2917 | Expression::BitwiseOr(op)
2918 | Expression::BitwiseXor(op)
2919 | Expression::Concat(op)
2920 | Expression::Adjacent(op)
2921 | Expression::TsMatch(op)
2922 | Expression::PropertyEQ(op)
2923 | Expression::ArrayContainsAll(op)
2924 | Expression::ArrayContainedBy(op)
2925 | Expression::ArrayOverlaps(op)
2926 | Expression::JSONBContainsAllTopKeys(op)
2927 | Expression::JSONBContainsAnyTopKeys(op)
2928 | Expression::JSONBDeleteAtPath(op)
2929 | Expression::ExtendsLeft(op)
2930 | Expression::ExtendsRight(op)
2931 | Expression::Is(op)
2932 | Expression::MemberOf(op)
2933 | Expression::Match(op)
2934 | Expression::NullSafeEq(op)
2935 | Expression::NullSafeNeq(op)
2936 | Expression::Glob(op)
2937 | Expression::BitwiseLeftShift(op)
2938 | Expression::BitwiseRightShift(op) => Some(&op.left),
2939 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2941 Expression::Alias(a) => Some(&a.this),
2943 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2944 Expression::Paren(p) => Some(&p.this),
2945 Expression::Annotated(a) => Some(&a.this),
2946 Expression::Subquery(s) => Some(&s.this),
2947 Expression::Where(w) => Some(&w.this),
2948 Expression::Having(h) => Some(&h.this),
2949 Expression::Qualify(q) => Some(&q.this),
2950 Expression::IsNull(i) => Some(&i.this),
2951 Expression::Exists(e) => Some(&e.this),
2952 Expression::Ordered(o) => Some(&o.this),
2953 Expression::WindowFunction(wf) => Some(&wf.this),
2954 Expression::Cte(cte) => Some(&cte.this),
2955 Expression::Between(b) => Some(&b.this),
2956 Expression::In(i) => Some(&i.this),
2957 Expression::ReturnStmt(e) => Some(e),
2958 _ => None,
2959 }
2960 }
2961
2962 pub fn get_expression(&self) -> Option<&Expression> {
2964 match self {
2965 Expression::And(op)
2967 | Expression::Or(op)
2968 | Expression::Add(op)
2969 | Expression::Sub(op)
2970 | Expression::Mul(op)
2971 | Expression::Div(op)
2972 | Expression::Mod(op)
2973 | Expression::Eq(op)
2974 | Expression::Neq(op)
2975 | Expression::Lt(op)
2976 | Expression::Lte(op)
2977 | Expression::Gt(op)
2978 | Expression::Gte(op)
2979 | Expression::BitwiseAnd(op)
2980 | Expression::BitwiseOr(op)
2981 | Expression::BitwiseXor(op)
2982 | Expression::Concat(op)
2983 | Expression::Adjacent(op)
2984 | Expression::TsMatch(op)
2985 | Expression::PropertyEQ(op)
2986 | Expression::ArrayContainsAll(op)
2987 | Expression::ArrayContainedBy(op)
2988 | Expression::ArrayOverlaps(op)
2989 | Expression::JSONBContainsAllTopKeys(op)
2990 | Expression::JSONBContainsAnyTopKeys(op)
2991 | Expression::JSONBDeleteAtPath(op)
2992 | Expression::ExtendsLeft(op)
2993 | Expression::ExtendsRight(op)
2994 | Expression::Is(op)
2995 | Expression::MemberOf(op)
2996 | Expression::Match(op)
2997 | Expression::NullSafeEq(op)
2998 | Expression::NullSafeNeq(op)
2999 | Expression::Glob(op)
3000 | Expression::BitwiseLeftShift(op)
3001 | Expression::BitwiseRightShift(op) => Some(&op.right),
3002 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3004 Expression::Power(f)
3006 | Expression::NullIf(f)
3007 | Expression::IfNull(f)
3008 | Expression::Nvl(f)
3009 | Expression::Contains(f)
3010 | Expression::StartsWith(f)
3011 | Expression::EndsWith(f)
3012 | Expression::Levenshtein(f)
3013 | Expression::ModFunc(f)
3014 | Expression::IntDiv(f)
3015 | Expression::Atan2(f)
3016 | Expression::AddMonths(f)
3017 | Expression::MonthsBetween(f)
3018 | Expression::NextDay(f)
3019 | Expression::UnixToTimeStr(f)
3020 | Expression::ArrayContains(f)
3021 | Expression::ArrayPosition(f)
3022 | Expression::ArrayAppend(f)
3023 | Expression::ArrayPrepend(f)
3024 | Expression::ArrayUnion(f)
3025 | Expression::ArrayExcept(f)
3026 | Expression::ArrayRemove(f)
3027 | Expression::StarMap(f)
3028 | Expression::MapFromArrays(f)
3029 | Expression::MapContainsKey(f)
3030 | Expression::ElementAt(f)
3031 | Expression::JsonMergePatch(f)
3032 | Expression::JSONBContains(f)
3033 | Expression::JSONBExtract(f) => Some(&f.expression),
3034 _ => None,
3035 }
3036 }
3037
3038 pub fn get_expressions(&self) -> &[Expression] {
3040 match self {
3041 Expression::Select(s) => &s.expressions,
3042 Expression::Function(f) => &f.args,
3043 Expression::AggregateFunction(f) => &f.args,
3044 Expression::From(f) => &f.expressions,
3045 Expression::GroupBy(g) => &g.expressions,
3046 Expression::In(i) => &i.expressions,
3047 Expression::Array(a) => &a.expressions,
3048 Expression::Tuple(t) => &t.expressions,
3049 Expression::Coalesce(f)
3050 | Expression::Greatest(f)
3051 | Expression::Least(f)
3052 | Expression::ArrayConcat(f)
3053 | Expression::ArrayIntersect(f)
3054 | Expression::ArrayZip(f)
3055 | Expression::MapConcat(f)
3056 | Expression::JsonArray(f) => &f.expressions,
3057 _ => &[],
3058 }
3059 }
3060
3061 pub fn get_name(&self) -> &str {
3063 match self {
3064 Expression::Identifier(id) => &id.name,
3065 Expression::Column(col) => &col.name.name,
3066 Expression::Table(t) => &t.name.name,
3067 Expression::Literal(lit) => lit.value_str(),
3068 Expression::Star(_) => "*",
3069 Expression::Function(f) => &f.name,
3070 Expression::AggregateFunction(f) => &f.name,
3071 Expression::Alias(a) => a.this.get_name(),
3072 Expression::Boolean(b) => {
3073 if b.value {
3074 "TRUE"
3075 } else {
3076 "FALSE"
3077 }
3078 }
3079 Expression::Null(_) => "NULL",
3080 _ => "",
3081 }
3082 }
3083
3084 pub fn get_alias(&self) -> &str {
3086 match self {
3087 Expression::Alias(a) => &a.alias.name,
3088 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3089 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3090 _ => "",
3091 }
3092 }
3093
3094 pub fn get_output_name(&self) -> &str {
3096 match self {
3097 Expression::Alias(a) => &a.alias.name,
3098 Expression::Column(c) => &c.name.name,
3099 Expression::Identifier(id) => &id.name,
3100 Expression::Literal(lit) => lit.value_str(),
3101 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3102 Expression::Star(_) => "*",
3103 _ => "",
3104 }
3105 }
3106
3107 pub fn get_comments(&self) -> Vec<&str> {
3109 match self {
3110 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3111 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3112 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3113 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3114 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3115 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3116 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3117 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3118 }
3119 Expression::And(op)
3120 | Expression::Or(op)
3121 | Expression::Add(op)
3122 | Expression::Sub(op)
3123 | Expression::Mul(op)
3124 | Expression::Div(op)
3125 | Expression::Mod(op)
3126 | Expression::Eq(op)
3127 | Expression::Neq(op)
3128 | Expression::Lt(op)
3129 | Expression::Lte(op)
3130 | Expression::Gt(op)
3131 | Expression::Gte(op)
3132 | Expression::Concat(op)
3133 | Expression::BitwiseAnd(op)
3134 | Expression::BitwiseOr(op)
3135 | Expression::BitwiseXor(op) => {
3136 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3137 }
3138 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3139 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3140 _ => Vec::new(),
3141 }
3142 }
3143}
3144
3145impl fmt::Display for Expression {
3146 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3147 match self {
3149 Expression::Literal(lit) => write!(f, "{}", lit),
3150 Expression::Identifier(id) => write!(f, "{}", id),
3151 Expression::Column(col) => write!(f, "{}", col),
3152 Expression::Star(_) => write!(f, "*"),
3153 Expression::Null(_) => write!(f, "NULL"),
3154 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3155 Expression::Select(_) => write!(f, "SELECT ..."),
3156 _ => write!(f, "{:?}", self),
3157 }
3158 }
3159}
3160
3161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3171#[cfg_attr(feature = "bindings", derive(TS))]
3172#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3173pub enum Literal {
3174 String(String),
3176 Number(String),
3178 HexString(String),
3180 HexNumber(String),
3182 BitString(String),
3183 ByteString(String),
3185 NationalString(String),
3187 Date(String),
3189 Time(String),
3191 Timestamp(String),
3193 Datetime(String),
3195 TripleQuotedString(String, char),
3198 EscapeString(String),
3200 DollarString(String),
3202 RawString(String),
3206}
3207
3208impl Literal {
3209 pub fn value_str(&self) -> &str {
3211 match self {
3212 Literal::String(s)
3213 | Literal::Number(s)
3214 | Literal::HexString(s)
3215 | Literal::HexNumber(s)
3216 | Literal::BitString(s)
3217 | Literal::ByteString(s)
3218 | Literal::NationalString(s)
3219 | Literal::Date(s)
3220 | Literal::Time(s)
3221 | Literal::Timestamp(s)
3222 | Literal::Datetime(s)
3223 | Literal::EscapeString(s)
3224 | Literal::DollarString(s)
3225 | Literal::RawString(s) => s.as_str(),
3226 Literal::TripleQuotedString(s, _) => s.as_str(),
3227 }
3228 }
3229
3230 pub fn is_string(&self) -> bool {
3232 matches!(
3233 self,
3234 Literal::String(_)
3235 | Literal::NationalString(_)
3236 | Literal::EscapeString(_)
3237 | Literal::DollarString(_)
3238 | Literal::RawString(_)
3239 | Literal::TripleQuotedString(_, _)
3240 )
3241 }
3242
3243 pub fn is_number(&self) -> bool {
3245 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3246 }
3247}
3248
3249impl fmt::Display for Literal {
3250 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3251 match self {
3252 Literal::String(s) => write!(f, "'{}'", s),
3253 Literal::Number(n) => write!(f, "{}", n),
3254 Literal::HexString(h) => write!(f, "X'{}'", h),
3255 Literal::HexNumber(h) => write!(f, "0x{}", h),
3256 Literal::BitString(b) => write!(f, "B'{}'", b),
3257 Literal::ByteString(b) => write!(f, "b'{}'", b),
3258 Literal::NationalString(s) => write!(f, "N'{}'", s),
3259 Literal::Date(d) => write!(f, "DATE '{}'", d),
3260 Literal::Time(t) => write!(f, "TIME '{}'", t),
3261 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3262 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3263 Literal::TripleQuotedString(s, q) => {
3264 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3265 }
3266 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3267 Literal::DollarString(s) => write!(f, "$${}$$", s),
3268 Literal::RawString(s) => write!(f, "r'{}'", s),
3269 }
3270 }
3271}
3272
3273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3275#[cfg_attr(feature = "bindings", derive(TS))]
3276pub struct BooleanLiteral {
3277 pub value: bool,
3278}
3279
3280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3282#[cfg_attr(feature = "bindings", derive(TS))]
3283pub struct Null;
3284
3285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3292#[cfg_attr(feature = "bindings", derive(TS))]
3293pub struct Identifier {
3294 pub name: String,
3296 pub quoted: bool,
3298 #[serde(default)]
3299 pub trailing_comments: Vec<String>,
3300 #[serde(default, skip_serializing_if = "Option::is_none")]
3302 pub span: Option<Span>,
3303}
3304
3305impl Identifier {
3306 pub fn new(name: impl Into<String>) -> Self {
3307 Self {
3308 name: name.into(),
3309 quoted: false,
3310 trailing_comments: Vec::new(),
3311 span: None,
3312 }
3313 }
3314
3315 pub fn quoted(name: impl Into<String>) -> Self {
3316 Self {
3317 name: name.into(),
3318 quoted: true,
3319 trailing_comments: Vec::new(),
3320 span: None,
3321 }
3322 }
3323
3324 pub fn empty() -> Self {
3325 Self {
3326 name: String::new(),
3327 quoted: false,
3328 trailing_comments: Vec::new(),
3329 span: None,
3330 }
3331 }
3332
3333 pub fn is_empty(&self) -> bool {
3334 self.name.is_empty()
3335 }
3336
3337 pub fn with_span(mut self, span: Span) -> Self {
3339 self.span = Some(span);
3340 self
3341 }
3342}
3343
3344impl fmt::Display for Identifier {
3345 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3346 if self.quoted {
3347 write!(f, "\"{}\"", self.name)
3348 } else {
3349 write!(f, "{}", self.name)
3350 }
3351 }
3352}
3353
3354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3360#[cfg_attr(feature = "bindings", derive(TS))]
3361pub struct Column {
3362 pub name: Identifier,
3364 pub table: Option<Identifier>,
3366 #[serde(default)]
3368 pub join_mark: bool,
3369 #[serde(default)]
3371 pub trailing_comments: Vec<String>,
3372 #[serde(default, skip_serializing_if = "Option::is_none")]
3374 pub span: Option<Span>,
3375 #[serde(default, skip_serializing_if = "Option::is_none")]
3377 pub inferred_type: Option<DataType>,
3378}
3379
3380impl fmt::Display for Column {
3381 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3382 if let Some(table) = &self.table {
3383 write!(f, "{}.{}", table, self.name)
3384 } else {
3385 write!(f, "{}", self.name)
3386 }
3387 }
3388}
3389
3390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3397#[cfg_attr(feature = "bindings", derive(TS))]
3398pub struct TableRef {
3399 pub name: Identifier,
3401 pub schema: Option<Identifier>,
3403 pub catalog: Option<Identifier>,
3405 pub alias: Option<Identifier>,
3407 #[serde(default)]
3409 pub alias_explicit_as: bool,
3410 #[serde(default)]
3412 pub column_aliases: Vec<Identifier>,
3413 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3415 pub leading_comments: Vec<String>,
3416 #[serde(default)]
3418 pub trailing_comments: Vec<String>,
3419 #[serde(default)]
3421 pub when: Option<Box<HistoricalData>>,
3422 #[serde(default)]
3424 pub only: bool,
3425 #[serde(default)]
3427 pub final_: bool,
3428 #[serde(default, skip_serializing_if = "Option::is_none")]
3430 pub table_sample: Option<Box<Sample>>,
3431 #[serde(default)]
3433 pub hints: Vec<Expression>,
3434 #[serde(default, skip_serializing_if = "Option::is_none")]
3437 pub system_time: Option<String>,
3438 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3440 pub partitions: Vec<Identifier>,
3441 #[serde(default, skip_serializing_if = "Option::is_none")]
3444 pub identifier_func: Option<Box<Expression>>,
3445 #[serde(default, skip_serializing_if = "Option::is_none")]
3447 pub changes: Option<Box<Changes>>,
3448 #[serde(default, skip_serializing_if = "Option::is_none")]
3450 pub version: Option<Box<Version>>,
3451 #[serde(default, skip_serializing_if = "Option::is_none")]
3453 pub span: Option<Span>,
3454}
3455
3456impl TableRef {
3457 pub fn new(name: impl Into<String>) -> Self {
3458 Self {
3459 name: Identifier::new(name),
3460 schema: None,
3461 catalog: None,
3462 alias: None,
3463 alias_explicit_as: false,
3464 column_aliases: Vec::new(),
3465 leading_comments: Vec::new(),
3466 trailing_comments: Vec::new(),
3467 when: None,
3468 only: false,
3469 final_: false,
3470 table_sample: None,
3471 hints: Vec::new(),
3472 system_time: None,
3473 partitions: Vec::new(),
3474 identifier_func: None,
3475 changes: None,
3476 version: None,
3477 span: None,
3478 }
3479 }
3480
3481 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3483 let mut t = Self::new(name);
3484 t.schema = Some(Identifier::new(schema));
3485 t
3486 }
3487
3488 pub fn new_with_catalog(
3490 name: impl Into<String>,
3491 schema: impl Into<String>,
3492 catalog: impl Into<String>,
3493 ) -> Self {
3494 let mut t = Self::new(name);
3495 t.schema = Some(Identifier::new(schema));
3496 t.catalog = Some(Identifier::new(catalog));
3497 t
3498 }
3499
3500 pub fn from_identifier(name: Identifier) -> Self {
3502 Self {
3503 name,
3504 schema: None,
3505 catalog: None,
3506 alias: None,
3507 alias_explicit_as: false,
3508 column_aliases: Vec::new(),
3509 leading_comments: Vec::new(),
3510 trailing_comments: Vec::new(),
3511 when: None,
3512 only: false,
3513 final_: false,
3514 table_sample: None,
3515 hints: Vec::new(),
3516 system_time: None,
3517 partitions: Vec::new(),
3518 identifier_func: None,
3519 changes: None,
3520 version: None,
3521 span: None,
3522 }
3523 }
3524
3525 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3526 self.alias = Some(Identifier::new(alias));
3527 self
3528 }
3529
3530 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3531 self.schema = Some(Identifier::new(schema));
3532 self
3533 }
3534}
3535
3536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3541#[cfg_attr(feature = "bindings", derive(TS))]
3542pub struct Star {
3543 pub table: Option<Identifier>,
3545 pub except: Option<Vec<Identifier>>,
3547 pub replace: Option<Vec<Alias>>,
3549 pub rename: Option<Vec<(Identifier, Identifier)>>,
3551 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3553 pub trailing_comments: Vec<String>,
3554 #[serde(default, skip_serializing_if = "Option::is_none")]
3556 pub span: Option<Span>,
3557}
3558
3559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3583#[cfg_attr(feature = "bindings", derive(TS))]
3584pub struct Select {
3585 pub expressions: Vec<Expression>,
3587 pub from: Option<From>,
3589 pub joins: Vec<Join>,
3591 pub lateral_views: Vec<LateralView>,
3592 #[serde(default, skip_serializing_if = "Option::is_none")]
3594 pub prewhere: Option<Expression>,
3595 pub where_clause: Option<Where>,
3596 pub group_by: Option<GroupBy>,
3597 pub having: Option<Having>,
3598 pub qualify: Option<Qualify>,
3599 pub order_by: Option<OrderBy>,
3600 pub distribute_by: Option<DistributeBy>,
3601 pub cluster_by: Option<ClusterBy>,
3602 pub sort_by: Option<SortBy>,
3603 pub limit: Option<Limit>,
3604 pub offset: Option<Offset>,
3605 #[serde(default, skip_serializing_if = "Option::is_none")]
3607 pub limit_by: Option<Vec<Expression>>,
3608 pub fetch: Option<Fetch>,
3609 pub distinct: bool,
3610 pub distinct_on: Option<Vec<Expression>>,
3611 pub top: Option<Top>,
3612 pub with: Option<With>,
3613 pub sample: Option<Sample>,
3614 #[serde(default, skip_serializing_if = "Option::is_none")]
3616 pub settings: Option<Vec<Expression>>,
3617 #[serde(default, skip_serializing_if = "Option::is_none")]
3619 pub format: Option<Expression>,
3620 pub windows: Option<Vec<NamedWindow>>,
3621 pub hint: Option<Hint>,
3622 pub connect: Option<Connect>,
3624 pub into: Option<SelectInto>,
3626 #[serde(default)]
3628 pub locks: Vec<Lock>,
3629 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3631 pub for_xml: Vec<Expression>,
3632 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub for_json: Vec<Expression>,
3635 #[serde(default)]
3637 pub leading_comments: Vec<String>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3641 pub post_select_comments: Vec<String>,
3642 #[serde(default, skip_serializing_if = "Option::is_none")]
3644 pub kind: Option<String>,
3645 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3647 pub operation_modifiers: Vec<String>,
3648 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3650 pub qualify_after_window: bool,
3651 #[serde(default, skip_serializing_if = "Option::is_none")]
3653 pub option: Option<String>,
3654 #[serde(default, skip_serializing_if = "Option::is_none")]
3657 pub exclude: Option<Vec<Expression>>,
3658}
3659
3660impl Select {
3661 pub fn new() -> Self {
3662 Self {
3663 expressions: Vec::new(),
3664 from: None,
3665 joins: Vec::new(),
3666 lateral_views: Vec::new(),
3667 prewhere: None,
3668 where_clause: None,
3669 group_by: None,
3670 having: None,
3671 qualify: None,
3672 order_by: None,
3673 distribute_by: None,
3674 cluster_by: None,
3675 sort_by: None,
3676 limit: None,
3677 offset: None,
3678 limit_by: None,
3679 fetch: None,
3680 distinct: false,
3681 distinct_on: None,
3682 top: None,
3683 with: None,
3684 sample: None,
3685 settings: None,
3686 format: None,
3687 windows: None,
3688 hint: None,
3689 connect: None,
3690 into: None,
3691 locks: Vec::new(),
3692 for_xml: Vec::new(),
3693 for_json: Vec::new(),
3694 leading_comments: Vec::new(),
3695 post_select_comments: Vec::new(),
3696 kind: None,
3697 operation_modifiers: Vec::new(),
3698 qualify_after_window: false,
3699 option: None,
3700 exclude: None,
3701 }
3702 }
3703
3704 pub fn column(mut self, expr: Expression) -> Self {
3706 self.expressions.push(expr);
3707 self
3708 }
3709
3710 pub fn from(mut self, table: Expression) -> Self {
3712 self.from = Some(From {
3713 expressions: vec![table],
3714 });
3715 self
3716 }
3717
3718 pub fn where_(mut self, condition: Expression) -> Self {
3720 self.where_clause = Some(Where { this: condition });
3721 self
3722 }
3723
3724 pub fn distinct(mut self) -> Self {
3726 self.distinct = true;
3727 self
3728 }
3729
3730 pub fn join(mut self, join: Join) -> Self {
3732 self.joins.push(join);
3733 self
3734 }
3735
3736 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3738 self.order_by = Some(OrderBy {
3739 expressions,
3740 siblings: false,
3741 comments: Vec::new(),
3742 });
3743 self
3744 }
3745
3746 pub fn limit(mut self, n: Expression) -> Self {
3748 self.limit = Some(Limit {
3749 this: n,
3750 percent: false,
3751 comments: Vec::new(),
3752 });
3753 self
3754 }
3755
3756 pub fn offset(mut self, n: Expression) -> Self {
3758 self.offset = Some(Offset {
3759 this: n,
3760 rows: None,
3761 });
3762 self
3763 }
3764}
3765
3766impl Default for Select {
3767 fn default() -> Self {
3768 Self::new()
3769 }
3770}
3771
3772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3778#[cfg_attr(feature = "bindings", derive(TS))]
3779pub struct Union {
3780 pub left: Expression,
3782 pub right: Expression,
3784 pub all: bool,
3786 #[serde(default)]
3788 pub distinct: bool,
3789 pub with: Option<With>,
3791 pub order_by: Option<OrderBy>,
3793 pub limit: Option<Box<Expression>>,
3795 pub offset: Option<Box<Expression>>,
3797 #[serde(default, skip_serializing_if = "Option::is_none")]
3799 pub distribute_by: Option<DistributeBy>,
3800 #[serde(default, skip_serializing_if = "Option::is_none")]
3802 pub sort_by: Option<SortBy>,
3803 #[serde(default, skip_serializing_if = "Option::is_none")]
3805 pub cluster_by: Option<ClusterBy>,
3806 #[serde(default)]
3808 pub by_name: bool,
3809 #[serde(default, skip_serializing_if = "Option::is_none")]
3811 pub side: Option<String>,
3812 #[serde(default, skip_serializing_if = "Option::is_none")]
3814 pub kind: Option<String>,
3815 #[serde(default)]
3817 pub corresponding: bool,
3818 #[serde(default)]
3820 pub strict: bool,
3821 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3823 pub on_columns: Vec<Expression>,
3824}
3825
3826impl Drop for Union {
3829 fn drop(&mut self) {
3830 loop {
3831 if let Expression::Union(ref mut inner) = self.left {
3832 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3833 let old_left = std::mem::replace(&mut self.left, next_left);
3834 drop(old_left);
3835 } else {
3836 break;
3837 }
3838 }
3839 }
3840}
3841
3842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3847#[cfg_attr(feature = "bindings", derive(TS))]
3848pub struct Intersect {
3849 pub left: Expression,
3851 pub right: Expression,
3853 pub all: bool,
3855 #[serde(default)]
3857 pub distinct: bool,
3858 pub with: Option<With>,
3860 pub order_by: Option<OrderBy>,
3862 pub limit: Option<Box<Expression>>,
3864 pub offset: Option<Box<Expression>>,
3866 #[serde(default, skip_serializing_if = "Option::is_none")]
3868 pub distribute_by: Option<DistributeBy>,
3869 #[serde(default, skip_serializing_if = "Option::is_none")]
3871 pub sort_by: Option<SortBy>,
3872 #[serde(default, skip_serializing_if = "Option::is_none")]
3874 pub cluster_by: Option<ClusterBy>,
3875 #[serde(default)]
3877 pub by_name: bool,
3878 #[serde(default, skip_serializing_if = "Option::is_none")]
3880 pub side: Option<String>,
3881 #[serde(default, skip_serializing_if = "Option::is_none")]
3883 pub kind: Option<String>,
3884 #[serde(default)]
3886 pub corresponding: bool,
3887 #[serde(default)]
3889 pub strict: bool,
3890 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3892 pub on_columns: Vec<Expression>,
3893}
3894
3895impl Drop for Intersect {
3896 fn drop(&mut self) {
3897 loop {
3898 if let Expression::Intersect(ref mut inner) = self.left {
3899 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3900 let old_left = std::mem::replace(&mut self.left, next_left);
3901 drop(old_left);
3902 } else {
3903 break;
3904 }
3905 }
3906 }
3907}
3908
3909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3914#[cfg_attr(feature = "bindings", derive(TS))]
3915pub struct Except {
3916 pub left: Expression,
3918 pub right: Expression,
3920 pub all: bool,
3922 #[serde(default)]
3924 pub distinct: bool,
3925 pub with: Option<With>,
3927 pub order_by: Option<OrderBy>,
3929 pub limit: Option<Box<Expression>>,
3931 pub offset: Option<Box<Expression>>,
3933 #[serde(default, skip_serializing_if = "Option::is_none")]
3935 pub distribute_by: Option<DistributeBy>,
3936 #[serde(default, skip_serializing_if = "Option::is_none")]
3938 pub sort_by: Option<SortBy>,
3939 #[serde(default, skip_serializing_if = "Option::is_none")]
3941 pub cluster_by: Option<ClusterBy>,
3942 #[serde(default)]
3944 pub by_name: bool,
3945 #[serde(default, skip_serializing_if = "Option::is_none")]
3947 pub side: Option<String>,
3948 #[serde(default, skip_serializing_if = "Option::is_none")]
3950 pub kind: Option<String>,
3951 #[serde(default)]
3953 pub corresponding: bool,
3954 #[serde(default)]
3956 pub strict: bool,
3957 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3959 pub on_columns: Vec<Expression>,
3960}
3961
3962impl Drop for Except {
3963 fn drop(&mut self) {
3964 loop {
3965 if let Expression::Except(ref mut inner) = self.left {
3966 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3967 let old_left = std::mem::replace(&mut self.left, next_left);
3968 drop(old_left);
3969 } else {
3970 break;
3971 }
3972 }
3973 }
3974}
3975
3976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3978#[cfg_attr(feature = "bindings", derive(TS))]
3979pub struct SelectInto {
3980 pub this: Expression,
3982 #[serde(default)]
3984 pub temporary: bool,
3985 #[serde(default)]
3987 pub unlogged: bool,
3988 #[serde(default)]
3990 pub bulk_collect: bool,
3991 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3993 pub expressions: Vec<Expression>,
3994}
3995
3996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4006#[cfg_attr(feature = "bindings", derive(TS))]
4007pub struct Subquery {
4008 pub this: Expression,
4010 pub alias: Option<Identifier>,
4012 pub column_aliases: Vec<Identifier>,
4014 pub order_by: Option<OrderBy>,
4016 pub limit: Option<Limit>,
4018 pub offset: Option<Offset>,
4020 #[serde(default, skip_serializing_if = "Option::is_none")]
4022 pub distribute_by: Option<DistributeBy>,
4023 #[serde(default, skip_serializing_if = "Option::is_none")]
4025 pub sort_by: Option<SortBy>,
4026 #[serde(default, skip_serializing_if = "Option::is_none")]
4028 pub cluster_by: Option<ClusterBy>,
4029 #[serde(default)]
4031 pub lateral: bool,
4032 #[serde(default)]
4036 pub modifiers_inside: bool,
4037 #[serde(default)]
4039 pub trailing_comments: Vec<String>,
4040 #[serde(default, skip_serializing_if = "Option::is_none")]
4042 pub inferred_type: Option<DataType>,
4043}
4044
4045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4050#[cfg_attr(feature = "bindings", derive(TS))]
4051pub struct PipeOperator {
4052 pub this: Expression,
4054 pub expression: Expression,
4056}
4057
4058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4060#[cfg_attr(feature = "bindings", derive(TS))]
4061pub struct Values {
4062 pub expressions: Vec<Tuple>,
4064 pub alias: Option<Identifier>,
4066 pub column_aliases: Vec<Identifier>,
4068}
4069
4070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4080#[cfg_attr(feature = "bindings", derive(TS))]
4081pub struct Pivot {
4082 pub this: Expression,
4084 #[serde(default)]
4087 pub expressions: Vec<Expression>,
4088 #[serde(default)]
4090 pub fields: Vec<Expression>,
4091 #[serde(default)]
4093 pub using: Vec<Expression>,
4094 #[serde(default)]
4096 pub group: Option<Box<Expression>>,
4097 #[serde(default)]
4099 pub unpivot: bool,
4100 #[serde(default)]
4102 pub into: Option<Box<Expression>>,
4103 #[serde(default)]
4105 pub alias: Option<Identifier>,
4106 #[serde(default)]
4108 pub include_nulls: Option<bool>,
4109 #[serde(default)]
4111 pub default_on_null: Option<Box<Expression>>,
4112 #[serde(default, skip_serializing_if = "Option::is_none")]
4114 pub with: Option<With>,
4115}
4116
4117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4119#[cfg_attr(feature = "bindings", derive(TS))]
4120pub struct Unpivot {
4121 pub this: Expression,
4122 pub value_column: Identifier,
4123 pub name_column: Identifier,
4124 pub columns: Vec<Expression>,
4125 pub alias: Option<Identifier>,
4126 #[serde(default)]
4128 pub value_column_parenthesized: bool,
4129 #[serde(default)]
4131 pub include_nulls: Option<bool>,
4132 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4134 pub extra_value_columns: Vec<Identifier>,
4135}
4136
4137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4140#[cfg_attr(feature = "bindings", derive(TS))]
4141pub struct PivotAlias {
4142 pub this: Expression,
4143 pub alias: Expression,
4144}
4145
4146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4148#[cfg_attr(feature = "bindings", derive(TS))]
4149pub struct PreWhere {
4150 pub this: Expression,
4151}
4152
4153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4155#[cfg_attr(feature = "bindings", derive(TS))]
4156pub struct Stream {
4157 pub this: Expression,
4158 #[serde(skip_serializing_if = "Option::is_none")]
4159 pub on: Option<Expression>,
4160 #[serde(skip_serializing_if = "Option::is_none")]
4161 pub show_initial_rows: Option<bool>,
4162}
4163
4164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4166#[cfg_attr(feature = "bindings", derive(TS))]
4167pub struct UsingData {
4168 pub this: Expression,
4169}
4170
4171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4173#[cfg_attr(feature = "bindings", derive(TS))]
4174pub struct XmlNamespace {
4175 pub this: Expression,
4176 #[serde(skip_serializing_if = "Option::is_none")]
4177 pub alias: Option<Identifier>,
4178}
4179
4180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4182#[cfg_attr(feature = "bindings", derive(TS))]
4183pub struct RowFormat {
4184 pub delimited: bool,
4185 pub fields_terminated_by: Option<String>,
4186 pub collection_items_terminated_by: Option<String>,
4187 pub map_keys_terminated_by: Option<String>,
4188 pub lines_terminated_by: Option<String>,
4189 pub null_defined_as: Option<String>,
4190}
4191
4192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4194#[cfg_attr(feature = "bindings", derive(TS))]
4195pub struct DirectoryInsert {
4196 pub local: bool,
4197 pub path: String,
4198 pub row_format: Option<RowFormat>,
4199 #[serde(default)]
4201 pub stored_as: Option<String>,
4202}
4203
4204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4206#[cfg_attr(feature = "bindings", derive(TS))]
4207pub struct Insert {
4208 pub table: TableRef,
4209 pub columns: Vec<Identifier>,
4210 pub values: Vec<Vec<Expression>>,
4211 pub query: Option<Expression>,
4212 pub overwrite: bool,
4214 pub partition: Vec<(Identifier, Option<Expression>)>,
4216 #[serde(default)]
4218 pub directory: Option<DirectoryInsert>,
4219 #[serde(default)]
4221 pub returning: Vec<Expression>,
4222 #[serde(default)]
4224 pub output: Option<OutputClause>,
4225 #[serde(default)]
4227 pub on_conflict: Option<Box<Expression>>,
4228 #[serde(default)]
4230 pub leading_comments: Vec<String>,
4231 #[serde(default)]
4233 pub if_exists: bool,
4234 #[serde(default)]
4236 pub with: Option<With>,
4237 #[serde(default)]
4239 pub ignore: bool,
4240 #[serde(default)]
4242 pub source_alias: Option<Identifier>,
4243 #[serde(default)]
4245 pub alias: Option<Identifier>,
4246 #[serde(default)]
4248 pub alias_explicit_as: bool,
4249 #[serde(default)]
4251 pub default_values: bool,
4252 #[serde(default)]
4254 pub by_name: bool,
4255 #[serde(default, skip_serializing_if = "Option::is_none")]
4257 pub conflict_action: Option<String>,
4258 #[serde(default)]
4260 pub is_replace: bool,
4261 #[serde(default, skip_serializing_if = "Option::is_none")]
4263 pub hint: Option<Hint>,
4264 #[serde(default)]
4266 pub replace_where: Option<Box<Expression>>,
4267 #[serde(default)]
4269 pub source: Option<Box<Expression>>,
4270 #[serde(default, skip_serializing_if = "Option::is_none")]
4272 pub function_target: Option<Box<Expression>>,
4273 #[serde(default, skip_serializing_if = "Option::is_none")]
4275 pub partition_by: Option<Box<Expression>>,
4276 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4278 pub settings: Vec<Expression>,
4279}
4280
4281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4283#[cfg_attr(feature = "bindings", derive(TS))]
4284pub struct OutputClause {
4285 pub columns: Vec<Expression>,
4287 #[serde(default)]
4289 pub into_table: Option<Expression>,
4290}
4291
4292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4294#[cfg_attr(feature = "bindings", derive(TS))]
4295pub struct Update {
4296 pub table: TableRef,
4297 #[serde(default)]
4298 pub hint: Option<Hint>,
4299 #[serde(default)]
4301 pub extra_tables: Vec<TableRef>,
4302 #[serde(default)]
4304 pub table_joins: Vec<Join>,
4305 pub set: Vec<(Identifier, Expression)>,
4306 pub from_clause: Option<From>,
4307 #[serde(default)]
4309 pub from_joins: Vec<Join>,
4310 pub where_clause: Option<Where>,
4311 #[serde(default)]
4313 pub returning: Vec<Expression>,
4314 #[serde(default)]
4316 pub output: Option<OutputClause>,
4317 #[serde(default)]
4319 pub with: Option<With>,
4320 #[serde(default)]
4322 pub leading_comments: Vec<String>,
4323 #[serde(default)]
4325 pub limit: Option<Expression>,
4326 #[serde(default)]
4328 pub order_by: Option<OrderBy>,
4329 #[serde(default)]
4331 pub from_before_set: bool,
4332}
4333
4334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4336#[cfg_attr(feature = "bindings", derive(TS))]
4337pub struct Delete {
4338 pub table: TableRef,
4339 #[serde(default)]
4340 pub hint: Option<Hint>,
4341 #[serde(default, skip_serializing_if = "Option::is_none")]
4343 pub on_cluster: Option<OnCluster>,
4344 pub alias: Option<Identifier>,
4346 #[serde(default)]
4348 pub alias_explicit_as: bool,
4349 pub using: Vec<TableRef>,
4351 pub where_clause: Option<Where>,
4352 #[serde(default)]
4354 pub output: Option<OutputClause>,
4355 #[serde(default)]
4357 pub leading_comments: Vec<String>,
4358 #[serde(default)]
4360 pub with: Option<With>,
4361 #[serde(default)]
4363 pub limit: Option<Expression>,
4364 #[serde(default)]
4366 pub order_by: Option<OrderBy>,
4367 #[serde(default)]
4369 pub returning: Vec<Expression>,
4370 #[serde(default)]
4373 pub tables: Vec<TableRef>,
4374 #[serde(default)]
4377 pub tables_from_using: bool,
4378 #[serde(default)]
4380 pub joins: Vec<Join>,
4381 #[serde(default)]
4383 pub force_index: Option<String>,
4384 #[serde(default)]
4386 pub no_from: bool,
4387}
4388
4389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4391#[cfg_attr(feature = "bindings", derive(TS))]
4392pub struct CopyStmt {
4393 pub this: Expression,
4395 pub kind: bool,
4397 pub files: Vec<Expression>,
4399 #[serde(default)]
4401 pub params: Vec<CopyParameter>,
4402 #[serde(default)]
4404 pub credentials: Option<Box<Credentials>>,
4405 #[serde(default)]
4407 pub is_into: bool,
4408 #[serde(default)]
4410 pub with_wrapped: bool,
4411}
4412
4413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4415#[cfg_attr(feature = "bindings", derive(TS))]
4416pub struct CopyParameter {
4417 pub name: String,
4418 pub value: Option<Expression>,
4419 pub values: Vec<Expression>,
4420 #[serde(default)]
4422 pub eq: bool,
4423}
4424
4425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4427#[cfg_attr(feature = "bindings", derive(TS))]
4428pub struct Credentials {
4429 pub credentials: Vec<(String, String)>,
4430 pub encryption: Option<String>,
4431 pub storage: Option<String>,
4432}
4433
4434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4436#[cfg_attr(feature = "bindings", derive(TS))]
4437pub struct PutStmt {
4438 pub source: String,
4440 #[serde(default)]
4442 pub source_quoted: bool,
4443 pub target: Expression,
4445 #[serde(default)]
4447 pub params: Vec<CopyParameter>,
4448}
4449
4450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4452#[cfg_attr(feature = "bindings", derive(TS))]
4453pub struct StageReference {
4454 pub name: String,
4456 #[serde(default)]
4458 pub path: Option<String>,
4459 #[serde(default)]
4461 pub file_format: Option<Expression>,
4462 #[serde(default)]
4464 pub pattern: Option<String>,
4465 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4467 pub quoted: bool,
4468}
4469
4470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4472#[cfg_attr(feature = "bindings", derive(TS))]
4473pub struct HistoricalData {
4474 pub this: Box<Expression>,
4476 pub kind: String,
4478 pub expression: Box<Expression>,
4480}
4481
4482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4487#[cfg_attr(feature = "bindings", derive(TS))]
4488pub struct Alias {
4489 pub this: Expression,
4491 pub alias: Identifier,
4493 #[serde(default)]
4495 pub column_aliases: Vec<Identifier>,
4496 #[serde(default)]
4498 pub pre_alias_comments: Vec<String>,
4499 #[serde(default)]
4501 pub trailing_comments: Vec<String>,
4502 #[serde(default, skip_serializing_if = "Option::is_none")]
4504 pub inferred_type: Option<DataType>,
4505}
4506
4507impl Alias {
4508 pub fn new(this: Expression, alias: Identifier) -> Self {
4510 Self {
4511 this,
4512 alias,
4513 column_aliases: Vec::new(),
4514 pre_alias_comments: Vec::new(),
4515 trailing_comments: Vec::new(),
4516 inferred_type: None,
4517 }
4518 }
4519
4520 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4522 Self {
4523 this,
4524 alias: Identifier::empty(),
4525 column_aliases,
4526 pre_alias_comments: Vec::new(),
4527 trailing_comments: Vec::new(),
4528 inferred_type: None,
4529 }
4530 }
4531}
4532
4533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4540#[cfg_attr(feature = "bindings", derive(TS))]
4541pub struct Cast {
4542 pub this: Expression,
4544 pub to: DataType,
4546 #[serde(default)]
4547 pub trailing_comments: Vec<String>,
4548 #[serde(default)]
4550 pub double_colon_syntax: bool,
4551 #[serde(skip_serializing_if = "Option::is_none", default)]
4553 pub format: Option<Box<Expression>>,
4554 #[serde(skip_serializing_if = "Option::is_none", default)]
4556 pub default: Option<Box<Expression>>,
4557 #[serde(default, skip_serializing_if = "Option::is_none")]
4559 pub inferred_type: Option<DataType>,
4560}
4561
4562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4564#[cfg_attr(feature = "bindings", derive(TS))]
4565pub struct CollationExpr {
4566 pub this: Expression,
4567 pub collation: String,
4568 #[serde(default)]
4570 pub quoted: bool,
4571 #[serde(default)]
4573 pub double_quoted: bool,
4574}
4575
4576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4582#[cfg_attr(feature = "bindings", derive(TS))]
4583pub struct Case {
4584 pub operand: Option<Expression>,
4586 pub whens: Vec<(Expression, Expression)>,
4588 pub else_: Option<Expression>,
4590 #[serde(default)]
4592 #[serde(skip_serializing_if = "Vec::is_empty")]
4593 pub comments: Vec<String>,
4594 #[serde(default, skip_serializing_if = "Option::is_none")]
4596 pub inferred_type: Option<DataType>,
4597}
4598
4599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4607#[cfg_attr(feature = "bindings", derive(TS))]
4608pub struct BinaryOp {
4609 pub left: Expression,
4610 pub right: Expression,
4611 #[serde(default)]
4613 pub left_comments: Vec<String>,
4614 #[serde(default)]
4616 pub operator_comments: Vec<String>,
4617 #[serde(default)]
4619 pub trailing_comments: Vec<String>,
4620 #[serde(default, skip_serializing_if = "Option::is_none")]
4622 pub inferred_type: Option<DataType>,
4623}
4624
4625impl BinaryOp {
4626 pub fn new(left: Expression, right: Expression) -> Self {
4627 Self {
4628 left,
4629 right,
4630 left_comments: Vec::new(),
4631 operator_comments: Vec::new(),
4632 trailing_comments: Vec::new(),
4633 inferred_type: None,
4634 }
4635 }
4636}
4637
4638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4640#[cfg_attr(feature = "bindings", derive(TS))]
4641pub struct LikeOp {
4642 pub left: Expression,
4643 pub right: Expression,
4644 #[serde(default)]
4646 pub escape: Option<Expression>,
4647 #[serde(default)]
4649 pub quantifier: Option<String>,
4650 #[serde(default, skip_serializing_if = "Option::is_none")]
4652 pub inferred_type: Option<DataType>,
4653}
4654
4655impl LikeOp {
4656 pub fn new(left: Expression, right: Expression) -> Self {
4657 Self {
4658 left,
4659 right,
4660 escape: None,
4661 quantifier: None,
4662 inferred_type: None,
4663 }
4664 }
4665
4666 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4667 Self {
4668 left,
4669 right,
4670 escape: Some(escape),
4671 quantifier: None,
4672 inferred_type: None,
4673 }
4674 }
4675}
4676
4677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4681#[cfg_attr(feature = "bindings", derive(TS))]
4682pub struct UnaryOp {
4683 pub this: Expression,
4685 #[serde(default, skip_serializing_if = "Option::is_none")]
4687 pub inferred_type: Option<DataType>,
4688}
4689
4690impl UnaryOp {
4691 pub fn new(this: Expression) -> Self {
4692 Self {
4693 this,
4694 inferred_type: None,
4695 }
4696 }
4697}
4698
4699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4704#[cfg_attr(feature = "bindings", derive(TS))]
4705pub struct In {
4706 pub this: Expression,
4708 pub expressions: Vec<Expression>,
4710 pub query: Option<Expression>,
4712 pub not: bool,
4714 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4715 pub global: bool,
4716 #[serde(default, skip_serializing_if = "Option::is_none")]
4718 pub unnest: Option<Box<Expression>>,
4719 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4723 pub is_field: bool,
4724}
4725
4726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4728#[cfg_attr(feature = "bindings", derive(TS))]
4729pub struct Between {
4730 pub this: Expression,
4732 pub low: Expression,
4734 pub high: Expression,
4736 pub not: bool,
4738 #[serde(default)]
4740 pub symmetric: Option<bool>,
4741}
4742
4743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4745#[cfg_attr(feature = "bindings", derive(TS))]
4746pub struct IsNull {
4747 pub this: Expression,
4748 pub not: bool,
4749 #[serde(default)]
4751 pub postfix_form: bool,
4752}
4753
4754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4756#[cfg_attr(feature = "bindings", derive(TS))]
4757pub struct IsTrueFalse {
4758 pub this: Expression,
4759 pub not: bool,
4760}
4761
4762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4765#[cfg_attr(feature = "bindings", derive(TS))]
4766pub struct IsJson {
4767 pub this: Expression,
4768 pub json_type: Option<String>,
4770 pub unique_keys: Option<JsonUniqueKeys>,
4772 pub negated: bool,
4774}
4775
4776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4778#[cfg_attr(feature = "bindings", derive(TS))]
4779pub enum JsonUniqueKeys {
4780 With,
4782 Without,
4784 Shorthand,
4786}
4787
4788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4790#[cfg_attr(feature = "bindings", derive(TS))]
4791pub struct Exists {
4792 pub this: Expression,
4794 pub not: bool,
4796}
4797
4798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4805#[cfg_attr(feature = "bindings", derive(TS))]
4806pub struct Function {
4807 pub name: String,
4809 pub args: Vec<Expression>,
4811 pub distinct: bool,
4813 #[serde(default)]
4814 pub trailing_comments: Vec<String>,
4815 #[serde(default)]
4817 pub use_bracket_syntax: bool,
4818 #[serde(default)]
4820 pub no_parens: bool,
4821 #[serde(default)]
4823 pub quoted: bool,
4824 #[serde(default, skip_serializing_if = "Option::is_none")]
4826 pub span: Option<Span>,
4827 #[serde(default, skip_serializing_if = "Option::is_none")]
4829 pub inferred_type: Option<DataType>,
4830}
4831
4832impl Default for Function {
4833 fn default() -> Self {
4834 Self {
4835 name: String::new(),
4836 args: Vec::new(),
4837 distinct: false,
4838 trailing_comments: Vec::new(),
4839 use_bracket_syntax: false,
4840 no_parens: false,
4841 quoted: false,
4842 span: None,
4843 inferred_type: None,
4844 }
4845 }
4846}
4847
4848impl Function {
4849 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4850 Self {
4851 name: name.into(),
4852 args,
4853 distinct: false,
4854 trailing_comments: Vec::new(),
4855 use_bracket_syntax: false,
4856 no_parens: false,
4857 quoted: false,
4858 span: None,
4859 inferred_type: None,
4860 }
4861 }
4862}
4863
4864#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4871#[cfg_attr(feature = "bindings", derive(TS))]
4872pub struct AggregateFunction {
4873 pub name: String,
4875 pub args: Vec<Expression>,
4877 pub distinct: bool,
4879 pub filter: Option<Expression>,
4881 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4883 pub order_by: Vec<Ordered>,
4884 #[serde(default, skip_serializing_if = "Option::is_none")]
4886 pub limit: Option<Box<Expression>>,
4887 #[serde(default, skip_serializing_if = "Option::is_none")]
4889 pub ignore_nulls: Option<bool>,
4890 #[serde(default, skip_serializing_if = "Option::is_none")]
4892 pub inferred_type: Option<DataType>,
4893}
4894
4895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4902#[cfg_attr(feature = "bindings", derive(TS))]
4903pub struct WindowFunction {
4904 pub this: Expression,
4906 pub over: Over,
4908 #[serde(default, skip_serializing_if = "Option::is_none")]
4910 pub keep: Option<Keep>,
4911 #[serde(default, skip_serializing_if = "Option::is_none")]
4913 pub inferred_type: Option<DataType>,
4914}
4915
4916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4919#[cfg_attr(feature = "bindings", derive(TS))]
4920pub struct Keep {
4921 pub first: bool,
4923 pub order_by: Vec<Ordered>,
4925}
4926
4927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4929#[cfg_attr(feature = "bindings", derive(TS))]
4930pub struct WithinGroup {
4931 pub this: Expression,
4933 pub order_by: Vec<Ordered>,
4935}
4936
4937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4942#[cfg_attr(feature = "bindings", derive(TS))]
4943pub struct From {
4944 pub expressions: Vec<Expression>,
4946}
4947
4948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4954#[cfg_attr(feature = "bindings", derive(TS))]
4955pub struct Join {
4956 pub this: Expression,
4958 pub on: Option<Expression>,
4960 pub using: Vec<Identifier>,
4962 pub kind: JoinKind,
4964 pub use_inner_keyword: bool,
4966 pub use_outer_keyword: bool,
4968 pub deferred_condition: bool,
4970 #[serde(default, skip_serializing_if = "Option::is_none")]
4972 pub join_hint: Option<String>,
4973 #[serde(default, skip_serializing_if = "Option::is_none")]
4975 pub match_condition: Option<Expression>,
4976 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4978 pub pivots: Vec<Expression>,
4979 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4981 pub comments: Vec<String>,
4982 #[serde(default)]
4986 pub nesting_group: usize,
4987 #[serde(default)]
4989 pub directed: bool,
4990}
4991
4992#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4999#[cfg_attr(feature = "bindings", derive(TS))]
5000pub enum JoinKind {
5001 Inner,
5002 Left,
5003 Right,
5004 Full,
5005 Outer, Cross,
5007 Natural,
5008 NaturalLeft,
5009 NaturalRight,
5010 NaturalFull,
5011 Semi,
5012 Anti,
5013 LeftSemi,
5015 LeftAnti,
5016 RightSemi,
5017 RightAnti,
5018 CrossApply,
5020 OuterApply,
5021 AsOf,
5023 AsOfLeft,
5024 AsOfRight,
5025 Lateral,
5027 LeftLateral,
5028 Straight,
5030 Implicit,
5032 Array,
5034 LeftArray,
5035 Paste,
5037 Positional,
5039}
5040
5041impl Default for JoinKind {
5042 fn default() -> Self {
5043 JoinKind::Inner
5044 }
5045}
5046
5047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5050#[cfg_attr(feature = "bindings", derive(TS))]
5051pub struct JoinedTable {
5052 pub left: Expression,
5054 pub joins: Vec<Join>,
5056 pub lateral_views: Vec<LateralView>,
5058 pub alias: Option<Identifier>,
5060}
5061
5062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5064#[cfg_attr(feature = "bindings", derive(TS))]
5065pub struct Where {
5066 pub this: Expression,
5068}
5069
5070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5075#[cfg_attr(feature = "bindings", derive(TS))]
5076pub struct GroupBy {
5077 pub expressions: Vec<Expression>,
5079 #[serde(default)]
5081 pub all: Option<bool>,
5082 #[serde(default)]
5084 pub totals: bool,
5085 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5087 pub comments: Vec<String>,
5088}
5089
5090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5092#[cfg_attr(feature = "bindings", derive(TS))]
5093pub struct Having {
5094 pub this: Expression,
5096 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5098 pub comments: Vec<String>,
5099}
5100
5101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5103#[cfg_attr(feature = "bindings", derive(TS))]
5104pub struct OrderBy {
5105 pub expressions: Vec<Ordered>,
5107 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5109 pub siblings: bool,
5110 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5112 pub comments: Vec<String>,
5113}
5114
5115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5122#[cfg_attr(feature = "bindings", derive(TS))]
5123pub struct Ordered {
5124 pub this: Expression,
5126 pub desc: bool,
5128 pub nulls_first: Option<bool>,
5130 #[serde(default)]
5132 pub explicit_asc: bool,
5133 #[serde(default, skip_serializing_if = "Option::is_none")]
5135 pub with_fill: Option<Box<WithFill>>,
5136}
5137
5138impl Ordered {
5139 pub fn asc(expr: Expression) -> Self {
5140 Self {
5141 this: expr,
5142 desc: false,
5143 nulls_first: None,
5144 explicit_asc: false,
5145 with_fill: None,
5146 }
5147 }
5148
5149 pub fn desc(expr: Expression) -> Self {
5150 Self {
5151 this: expr,
5152 desc: true,
5153 nulls_first: None,
5154 explicit_asc: false,
5155 with_fill: None,
5156 }
5157 }
5158}
5159
5160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5163#[cfg_attr(feature = "bindings", derive(TS))]
5164#[cfg_attr(feature = "bindings", ts(export))]
5165pub struct DistributeBy {
5166 pub expressions: Vec<Expression>,
5167}
5168
5169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5172#[cfg_attr(feature = "bindings", derive(TS))]
5173#[cfg_attr(feature = "bindings", ts(export))]
5174pub struct ClusterBy {
5175 pub expressions: Vec<Ordered>,
5176}
5177
5178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5181#[cfg_attr(feature = "bindings", derive(TS))]
5182#[cfg_attr(feature = "bindings", ts(export))]
5183pub struct SortBy {
5184 pub expressions: Vec<Ordered>,
5185}
5186
5187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5190#[cfg_attr(feature = "bindings", derive(TS))]
5191#[cfg_attr(feature = "bindings", ts(export))]
5192pub struct LateralView {
5193 pub this: Expression,
5195 pub table_alias: Option<Identifier>,
5197 pub column_aliases: Vec<Identifier>,
5199 pub outer: bool,
5201}
5202
5203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5205#[cfg_attr(feature = "bindings", derive(TS))]
5206#[cfg_attr(feature = "bindings", ts(export))]
5207pub struct Hint {
5208 pub expressions: Vec<HintExpression>,
5209}
5210
5211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5213#[cfg_attr(feature = "bindings", derive(TS))]
5214#[cfg_attr(feature = "bindings", ts(export))]
5215pub enum HintExpression {
5216 Function { name: String, args: Vec<Expression> },
5218 Identifier(String),
5220 Raw(String),
5222}
5223
5224#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5226#[cfg_attr(feature = "bindings", derive(TS))]
5227#[cfg_attr(feature = "bindings", ts(export))]
5228pub enum PseudocolumnType {
5229 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5236
5237impl PseudocolumnType {
5238 pub fn as_str(&self) -> &'static str {
5239 match self {
5240 PseudocolumnType::Rownum => "ROWNUM",
5241 PseudocolumnType::Rowid => "ROWID",
5242 PseudocolumnType::Level => "LEVEL",
5243 PseudocolumnType::Sysdate => "SYSDATE",
5244 PseudocolumnType::ObjectId => "OBJECT_ID",
5245 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5246 }
5247 }
5248
5249 pub fn from_str(s: &str) -> Option<Self> {
5250 match s.to_uppercase().as_str() {
5251 "ROWNUM" => Some(PseudocolumnType::Rownum),
5252 "ROWID" => Some(PseudocolumnType::Rowid),
5253 "LEVEL" => Some(PseudocolumnType::Level),
5254 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5255 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5256 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5257 _ => None,
5258 }
5259 }
5260}
5261
5262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5265#[cfg_attr(feature = "bindings", derive(TS))]
5266#[cfg_attr(feature = "bindings", ts(export))]
5267pub struct Pseudocolumn {
5268 pub kind: PseudocolumnType,
5269}
5270
5271impl Pseudocolumn {
5272 pub fn rownum() -> Self {
5273 Self {
5274 kind: PseudocolumnType::Rownum,
5275 }
5276 }
5277
5278 pub fn rowid() -> Self {
5279 Self {
5280 kind: PseudocolumnType::Rowid,
5281 }
5282 }
5283
5284 pub fn level() -> Self {
5285 Self {
5286 kind: PseudocolumnType::Level,
5287 }
5288 }
5289}
5290
5291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5293#[cfg_attr(feature = "bindings", derive(TS))]
5294#[cfg_attr(feature = "bindings", ts(export))]
5295pub struct Connect {
5296 pub start: Option<Expression>,
5298 pub connect: Expression,
5300 pub nocycle: bool,
5302}
5303
5304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5306#[cfg_attr(feature = "bindings", derive(TS))]
5307#[cfg_attr(feature = "bindings", ts(export))]
5308pub struct Prior {
5309 pub this: Expression,
5310}
5311
5312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5314#[cfg_attr(feature = "bindings", derive(TS))]
5315#[cfg_attr(feature = "bindings", ts(export))]
5316pub struct ConnectByRoot {
5317 pub this: Expression,
5318}
5319
5320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5322#[cfg_attr(feature = "bindings", derive(TS))]
5323#[cfg_attr(feature = "bindings", ts(export))]
5324pub struct MatchRecognize {
5325 pub this: Option<Box<Expression>>,
5327 pub partition_by: Option<Vec<Expression>>,
5329 pub order_by: Option<Vec<Ordered>>,
5331 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5333 pub rows: Option<MatchRecognizeRows>,
5335 pub after: Option<MatchRecognizeAfter>,
5337 pub pattern: Option<String>,
5339 pub define: Option<Vec<(Identifier, Expression)>>,
5341 pub alias: Option<Identifier>,
5343 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5345 pub alias_explicit_as: bool,
5346}
5347
5348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5350#[cfg_attr(feature = "bindings", derive(TS))]
5351#[cfg_attr(feature = "bindings", ts(export))]
5352pub struct MatchRecognizeMeasure {
5353 pub this: Expression,
5355 pub window_frame: Option<MatchRecognizeSemantics>,
5357}
5358
5359#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5361#[cfg_attr(feature = "bindings", derive(TS))]
5362#[cfg_attr(feature = "bindings", ts(export))]
5363pub enum MatchRecognizeSemantics {
5364 Running,
5365 Final,
5366}
5367
5368#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5370#[cfg_attr(feature = "bindings", derive(TS))]
5371#[cfg_attr(feature = "bindings", ts(export))]
5372pub enum MatchRecognizeRows {
5373 OneRowPerMatch,
5374 AllRowsPerMatch,
5375 AllRowsPerMatchShowEmptyMatches,
5376 AllRowsPerMatchOmitEmptyMatches,
5377 AllRowsPerMatchWithUnmatchedRows,
5378}
5379
5380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5382#[cfg_attr(feature = "bindings", derive(TS))]
5383#[cfg_attr(feature = "bindings", ts(export))]
5384pub enum MatchRecognizeAfter {
5385 PastLastRow,
5386 ToNextRow,
5387 ToFirst(Identifier),
5388 ToLast(Identifier),
5389}
5390
5391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5393#[cfg_attr(feature = "bindings", derive(TS))]
5394pub struct Limit {
5395 pub this: Expression,
5397 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5399 pub percent: bool,
5400 #[serde(default)]
5402 #[serde(skip_serializing_if = "Vec::is_empty")]
5403 pub comments: Vec<String>,
5404}
5405
5406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5408#[cfg_attr(feature = "bindings", derive(TS))]
5409pub struct Offset {
5410 pub this: Expression,
5411 #[serde(skip_serializing_if = "Option::is_none", default)]
5413 pub rows: Option<bool>,
5414}
5415
5416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5418#[cfg_attr(feature = "bindings", derive(TS))]
5419pub struct Top {
5420 pub this: Expression,
5421 pub percent: bool,
5422 pub with_ties: bool,
5423 #[serde(default)]
5425 pub parenthesized: bool,
5426}
5427
5428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5430#[cfg_attr(feature = "bindings", derive(TS))]
5431pub struct Fetch {
5432 pub direction: String,
5434 pub count: Option<Expression>,
5436 pub percent: bool,
5438 pub rows: bool,
5440 pub with_ties: bool,
5442}
5443
5444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5450#[cfg_attr(feature = "bindings", derive(TS))]
5451pub struct Qualify {
5452 pub this: Expression,
5454}
5455
5456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5458#[cfg_attr(feature = "bindings", derive(TS))]
5459pub struct Sample {
5460 pub method: SampleMethod,
5461 pub size: Expression,
5462 pub seed: Option<Expression>,
5463 #[serde(default)]
5465 pub offset: Option<Expression>,
5466 pub unit_after_size: bool,
5468 #[serde(default)]
5470 pub use_sample_keyword: bool,
5471 #[serde(default)]
5473 pub explicit_method: bool,
5474 #[serde(default)]
5476 pub method_before_size: bool,
5477 #[serde(default)]
5479 pub use_seed_keyword: bool,
5480 pub bucket_numerator: Option<Box<Expression>>,
5482 pub bucket_denominator: Option<Box<Expression>>,
5484 pub bucket_field: Option<Box<Expression>>,
5486 #[serde(default)]
5488 pub is_using_sample: bool,
5489 #[serde(default)]
5491 pub is_percent: bool,
5492 #[serde(default)]
5494 pub suppress_method_output: bool,
5495}
5496
5497#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5499#[cfg_attr(feature = "bindings", derive(TS))]
5500pub enum SampleMethod {
5501 Bernoulli,
5502 System,
5503 Block,
5504 Row,
5505 Percent,
5506 Bucket,
5508 Reservoir,
5510}
5511
5512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5514#[cfg_attr(feature = "bindings", derive(TS))]
5515pub struct NamedWindow {
5516 pub name: Identifier,
5517 pub spec: Over,
5518}
5519
5520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5526#[cfg_attr(feature = "bindings", derive(TS))]
5527pub struct With {
5528 pub ctes: Vec<Cte>,
5530 pub recursive: bool,
5532 #[serde(default)]
5534 pub leading_comments: Vec<String>,
5535 #[serde(default, skip_serializing_if = "Option::is_none")]
5537 pub search: Option<Box<Expression>>,
5538}
5539
5540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5547#[cfg_attr(feature = "bindings", derive(TS))]
5548pub struct Cte {
5549 pub alias: Identifier,
5551 pub this: Expression,
5553 pub columns: Vec<Identifier>,
5555 pub materialized: Option<bool>,
5557 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5559 pub key_expressions: Vec<Identifier>,
5560 #[serde(default)]
5562 pub alias_first: bool,
5563 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5565 pub comments: Vec<String>,
5566}
5567
5568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5570#[cfg_attr(feature = "bindings", derive(TS))]
5571pub struct WindowSpec {
5572 pub partition_by: Vec<Expression>,
5573 pub order_by: Vec<Ordered>,
5574 pub frame: Option<WindowFrame>,
5575}
5576
5577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5579#[cfg_attr(feature = "bindings", derive(TS))]
5580pub struct Over {
5581 pub window_name: Option<Identifier>,
5583 pub partition_by: Vec<Expression>,
5584 pub order_by: Vec<Ordered>,
5585 pub frame: Option<WindowFrame>,
5586 pub alias: Option<Identifier>,
5587}
5588
5589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5591#[cfg_attr(feature = "bindings", derive(TS))]
5592pub struct WindowFrame {
5593 pub kind: WindowFrameKind,
5594 pub start: WindowFrameBound,
5595 pub end: Option<WindowFrameBound>,
5596 pub exclude: Option<WindowFrameExclude>,
5597 #[serde(default, skip_serializing_if = "Option::is_none")]
5599 pub kind_text: Option<String>,
5600 #[serde(default, skip_serializing_if = "Option::is_none")]
5602 pub start_side_text: Option<String>,
5603 #[serde(default, skip_serializing_if = "Option::is_none")]
5605 pub end_side_text: Option<String>,
5606}
5607
5608#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5609#[cfg_attr(feature = "bindings", derive(TS))]
5610pub enum WindowFrameKind {
5611 Rows,
5612 Range,
5613 Groups,
5614}
5615
5616#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5618#[cfg_attr(feature = "bindings", derive(TS))]
5619pub enum WindowFrameExclude {
5620 CurrentRow,
5621 Group,
5622 Ties,
5623 NoOthers,
5624}
5625
5626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5627#[cfg_attr(feature = "bindings", derive(TS))]
5628pub enum WindowFrameBound {
5629 CurrentRow,
5630 UnboundedPreceding,
5631 UnboundedFollowing,
5632 Preceding(Box<Expression>),
5633 Following(Box<Expression>),
5634 BarePreceding,
5636 BareFollowing,
5638 Value(Box<Expression>),
5640}
5641
5642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5644#[cfg_attr(feature = "bindings", derive(TS))]
5645pub struct StructField {
5646 pub name: String,
5647 pub data_type: DataType,
5648 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5649 pub options: Vec<Expression>,
5650 #[serde(default, skip_serializing_if = "Option::is_none")]
5651 pub comment: Option<String>,
5652}
5653
5654impl StructField {
5655 pub fn new(name: String, data_type: DataType) -> Self {
5657 Self {
5658 name,
5659 data_type,
5660 options: Vec::new(),
5661 comment: None,
5662 }
5663 }
5664
5665 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5667 Self {
5668 name,
5669 data_type,
5670 options,
5671 comment: None,
5672 }
5673 }
5674
5675 pub fn with_options_and_comment(
5677 name: String,
5678 data_type: DataType,
5679 options: Vec<Expression>,
5680 comment: Option<String>,
5681 ) -> Self {
5682 Self {
5683 name,
5684 data_type,
5685 options,
5686 comment,
5687 }
5688 }
5689}
5690
5691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5703#[cfg_attr(feature = "bindings", derive(TS))]
5704#[serde(tag = "data_type", rename_all = "snake_case")]
5705pub enum DataType {
5706 Boolean,
5708 TinyInt {
5709 length: Option<u32>,
5710 },
5711 SmallInt {
5712 length: Option<u32>,
5713 },
5714 Int {
5718 length: Option<u32>,
5719 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5720 integer_spelling: bool,
5721 },
5722 BigInt {
5723 length: Option<u32>,
5724 },
5725 Float {
5729 precision: Option<u32>,
5730 scale: Option<u32>,
5731 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5732 real_spelling: bool,
5733 },
5734 Double {
5735 precision: Option<u32>,
5736 scale: Option<u32>,
5737 },
5738 Decimal {
5739 precision: Option<u32>,
5740 scale: Option<u32>,
5741 },
5742
5743 Char {
5745 length: Option<u32>,
5746 },
5747 VarChar {
5750 length: Option<u32>,
5751 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5752 parenthesized_length: bool,
5753 },
5754 String {
5756 length: Option<u32>,
5757 },
5758 Text,
5759 TextWithLength {
5761 length: u32,
5762 },
5763
5764 Binary {
5766 length: Option<u32>,
5767 },
5768 VarBinary {
5769 length: Option<u32>,
5770 },
5771 Blob,
5772
5773 Bit {
5775 length: Option<u32>,
5776 },
5777 VarBit {
5778 length: Option<u32>,
5779 },
5780
5781 Date,
5783 Time {
5784 precision: Option<u32>,
5785 #[serde(default)]
5786 timezone: bool,
5787 },
5788 Timestamp {
5789 precision: Option<u32>,
5790 timezone: bool,
5791 },
5792 Interval {
5793 unit: Option<String>,
5794 #[serde(default, skip_serializing_if = "Option::is_none")]
5796 to: Option<String>,
5797 },
5798
5799 Json,
5801 JsonB,
5802
5803 Uuid,
5805
5806 Array {
5808 element_type: Box<DataType>,
5809 #[serde(default, skip_serializing_if = "Option::is_none")]
5811 dimension: Option<u32>,
5812 },
5813
5814 List {
5817 element_type: Box<DataType>,
5818 },
5819
5820 Struct {
5824 fields: Vec<StructField>,
5825 nested: bool,
5826 },
5827 Map {
5828 key_type: Box<DataType>,
5829 value_type: Box<DataType>,
5830 },
5831
5832 Enum {
5834 values: Vec<String>,
5835 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5836 assignments: Vec<Option<String>>,
5837 },
5838
5839 Set {
5841 values: Vec<String>,
5842 },
5843
5844 Union {
5846 fields: Vec<(String, DataType)>,
5847 },
5848
5849 Vector {
5851 #[serde(default)]
5852 element_type: Option<Box<DataType>>,
5853 dimension: Option<u32>,
5854 },
5855
5856 Object {
5859 fields: Vec<(String, DataType, bool)>,
5860 modifier: Option<String>,
5861 },
5862
5863 Nullable {
5865 inner: Box<DataType>,
5866 },
5867
5868 Custom {
5870 name: String,
5871 },
5872
5873 Geometry {
5875 subtype: Option<String>,
5876 srid: Option<u32>,
5877 },
5878 Geography {
5879 subtype: Option<String>,
5880 srid: Option<u32>,
5881 },
5882
5883 CharacterSet {
5886 name: String,
5887 },
5888
5889 Unknown,
5891}
5892
5893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5895#[cfg_attr(feature = "bindings", derive(TS))]
5896#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5897pub struct Array {
5898 pub expressions: Vec<Expression>,
5899}
5900
5901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5903#[cfg_attr(feature = "bindings", derive(TS))]
5904pub struct Struct {
5905 pub fields: Vec<(Option<String>, Expression)>,
5906}
5907
5908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5910#[cfg_attr(feature = "bindings", derive(TS))]
5911pub struct Tuple {
5912 pub expressions: Vec<Expression>,
5913}
5914
5915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5917#[cfg_attr(feature = "bindings", derive(TS))]
5918pub struct Interval {
5919 pub this: Option<Expression>,
5921 pub unit: Option<IntervalUnitSpec>,
5923}
5924
5925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5927#[cfg_attr(feature = "bindings", derive(TS))]
5928#[serde(tag = "type", rename_all = "snake_case")]
5929pub enum IntervalUnitSpec {
5930 Simple {
5932 unit: IntervalUnit,
5933 use_plural: bool,
5935 },
5936 Span(IntervalSpan),
5938 ExprSpan(IntervalSpanExpr),
5941 Expr(Box<Expression>),
5943}
5944
5945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5947#[cfg_attr(feature = "bindings", derive(TS))]
5948pub struct IntervalSpan {
5949 pub this: IntervalUnit,
5951 pub expression: IntervalUnit,
5953}
5954
5955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5958#[cfg_attr(feature = "bindings", derive(TS))]
5959pub struct IntervalSpanExpr {
5960 pub this: Box<Expression>,
5962 pub expression: Box<Expression>,
5964}
5965
5966#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5967#[cfg_attr(feature = "bindings", derive(TS))]
5968pub enum IntervalUnit {
5969 Year,
5970 Quarter,
5971 Month,
5972 Week,
5973 Day,
5974 Hour,
5975 Minute,
5976 Second,
5977 Millisecond,
5978 Microsecond,
5979 Nanosecond,
5980}
5981
5982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5984#[cfg_attr(feature = "bindings", derive(TS))]
5985pub struct Command {
5986 pub this: String,
5988}
5989
5990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5993#[cfg_attr(feature = "bindings", derive(TS))]
5994pub struct ExecuteStatement {
5995 pub this: Expression,
5997 #[serde(default)]
5999 pub parameters: Vec<ExecuteParameter>,
6000 #[serde(default, skip_serializing_if = "Option::is_none")]
6002 pub suffix: Option<String>,
6003}
6004
6005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6007#[cfg_attr(feature = "bindings", derive(TS))]
6008pub struct ExecuteParameter {
6009 pub name: String,
6011 pub value: Expression,
6013 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6015 pub positional: bool,
6016 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6018 pub output: bool,
6019}
6020
6021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6024#[cfg_attr(feature = "bindings", derive(TS))]
6025pub struct Kill {
6026 pub this: Expression,
6028 pub kind: Option<String>,
6030}
6031
6032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6034#[cfg_attr(feature = "bindings", derive(TS))]
6035pub struct CreateTask {
6036 pub or_replace: bool,
6037 pub if_not_exists: bool,
6038 pub name: String,
6040 pub properties: String,
6042 pub body: Expression,
6044}
6045
6046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6048#[cfg_attr(feature = "bindings", derive(TS))]
6049pub struct Raw {
6050 pub sql: String,
6051}
6052
6053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6059#[cfg_attr(feature = "bindings", derive(TS))]
6060pub struct UnaryFunc {
6061 pub this: Expression,
6062 #[serde(skip_serializing_if = "Option::is_none", default)]
6064 pub original_name: Option<String>,
6065 #[serde(default, skip_serializing_if = "Option::is_none")]
6067 pub inferred_type: Option<DataType>,
6068}
6069
6070impl UnaryFunc {
6071 pub fn new(this: Expression) -> Self {
6073 Self {
6074 this,
6075 original_name: None,
6076 inferred_type: None,
6077 }
6078 }
6079
6080 pub fn with_name(this: Expression, name: String) -> Self {
6082 Self {
6083 this,
6084 original_name: Some(name),
6085 inferred_type: None,
6086 }
6087 }
6088}
6089
6090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6094#[cfg_attr(feature = "bindings", derive(TS))]
6095pub struct CharFunc {
6096 pub args: Vec<Expression>,
6097 #[serde(skip_serializing_if = "Option::is_none", default)]
6098 pub charset: Option<String>,
6099 #[serde(skip_serializing_if = "Option::is_none", default)]
6101 pub name: Option<String>,
6102}
6103
6104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6106#[cfg_attr(feature = "bindings", derive(TS))]
6107pub struct BinaryFunc {
6108 pub this: Expression,
6109 pub expression: Expression,
6110 #[serde(skip_serializing_if = "Option::is_none", default)]
6112 pub original_name: Option<String>,
6113 #[serde(default, skip_serializing_if = "Option::is_none")]
6115 pub inferred_type: Option<DataType>,
6116}
6117
6118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6120#[cfg_attr(feature = "bindings", derive(TS))]
6121pub struct VarArgFunc {
6122 pub expressions: Vec<Expression>,
6123 #[serde(skip_serializing_if = "Option::is_none", default)]
6125 pub original_name: Option<String>,
6126 #[serde(default, skip_serializing_if = "Option::is_none")]
6128 pub inferred_type: Option<DataType>,
6129}
6130
6131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6133#[cfg_attr(feature = "bindings", derive(TS))]
6134pub struct ConcatWs {
6135 pub separator: Expression,
6136 pub expressions: Vec<Expression>,
6137}
6138
6139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6141#[cfg_attr(feature = "bindings", derive(TS))]
6142pub struct SubstringFunc {
6143 pub this: Expression,
6144 pub start: Expression,
6145 pub length: Option<Expression>,
6146 #[serde(default)]
6148 pub from_for_syntax: bool,
6149}
6150
6151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6153#[cfg_attr(feature = "bindings", derive(TS))]
6154pub struct OverlayFunc {
6155 pub this: Expression,
6156 pub replacement: Expression,
6157 pub from: Expression,
6158 pub length: Option<Expression>,
6159}
6160
6161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6163#[cfg_attr(feature = "bindings", derive(TS))]
6164pub struct TrimFunc {
6165 pub this: Expression,
6166 pub characters: Option<Expression>,
6167 pub position: TrimPosition,
6168 #[serde(default)]
6170 pub sql_standard_syntax: bool,
6171 #[serde(default)]
6173 pub position_explicit: bool,
6174}
6175
6176#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6177#[cfg_attr(feature = "bindings", derive(TS))]
6178pub enum TrimPosition {
6179 Both,
6180 Leading,
6181 Trailing,
6182}
6183
6184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6186#[cfg_attr(feature = "bindings", derive(TS))]
6187pub struct ReplaceFunc {
6188 pub this: Expression,
6189 pub old: Expression,
6190 pub new: Expression,
6191}
6192
6193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6195#[cfg_attr(feature = "bindings", derive(TS))]
6196pub struct LeftRightFunc {
6197 pub this: Expression,
6198 pub length: Expression,
6199}
6200
6201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6203#[cfg_attr(feature = "bindings", derive(TS))]
6204pub struct RepeatFunc {
6205 pub this: Expression,
6206 pub times: Expression,
6207}
6208
6209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6211#[cfg_attr(feature = "bindings", derive(TS))]
6212pub struct PadFunc {
6213 pub this: Expression,
6214 pub length: Expression,
6215 pub fill: Option<Expression>,
6216}
6217
6218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6220#[cfg_attr(feature = "bindings", derive(TS))]
6221pub struct SplitFunc {
6222 pub this: Expression,
6223 pub delimiter: Expression,
6224}
6225
6226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6228#[cfg_attr(feature = "bindings", derive(TS))]
6229pub struct RegexpFunc {
6230 pub this: Expression,
6231 pub pattern: Expression,
6232 pub flags: Option<Expression>,
6233}
6234
6235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6237#[cfg_attr(feature = "bindings", derive(TS))]
6238pub struct RegexpReplaceFunc {
6239 pub this: Expression,
6240 pub pattern: Expression,
6241 pub replacement: Expression,
6242 pub flags: Option<Expression>,
6243}
6244
6245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6247#[cfg_attr(feature = "bindings", derive(TS))]
6248pub struct RegexpExtractFunc {
6249 pub this: Expression,
6250 pub pattern: Expression,
6251 pub group: Option<Expression>,
6252}
6253
6254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6256#[cfg_attr(feature = "bindings", derive(TS))]
6257pub struct RoundFunc {
6258 pub this: Expression,
6259 pub decimals: Option<Expression>,
6260}
6261
6262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6264#[cfg_attr(feature = "bindings", derive(TS))]
6265pub struct FloorFunc {
6266 pub this: Expression,
6267 pub scale: Option<Expression>,
6268 #[serde(skip_serializing_if = "Option::is_none", default)]
6270 pub to: Option<Expression>,
6271}
6272
6273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6275#[cfg_attr(feature = "bindings", derive(TS))]
6276pub struct CeilFunc {
6277 pub this: Expression,
6278 #[serde(skip_serializing_if = "Option::is_none", default)]
6279 pub decimals: Option<Expression>,
6280 #[serde(skip_serializing_if = "Option::is_none", default)]
6282 pub to: Option<Expression>,
6283}
6284
6285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6287#[cfg_attr(feature = "bindings", derive(TS))]
6288pub struct LogFunc {
6289 pub this: Expression,
6290 pub base: Option<Expression>,
6291}
6292
6293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6295#[cfg_attr(feature = "bindings", derive(TS))]
6296pub struct CurrentDate;
6297
6298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6300#[cfg_attr(feature = "bindings", derive(TS))]
6301pub struct CurrentTime {
6302 pub precision: Option<u32>,
6303}
6304
6305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6307#[cfg_attr(feature = "bindings", derive(TS))]
6308pub struct CurrentTimestamp {
6309 pub precision: Option<u32>,
6310 #[serde(default)]
6312 pub sysdate: bool,
6313}
6314
6315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6317#[cfg_attr(feature = "bindings", derive(TS))]
6318pub struct CurrentTimestampLTZ {
6319 pub precision: Option<u32>,
6320}
6321
6322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6324#[cfg_attr(feature = "bindings", derive(TS))]
6325pub struct AtTimeZone {
6326 pub this: Expression,
6328 pub zone: Expression,
6330}
6331
6332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6334#[cfg_attr(feature = "bindings", derive(TS))]
6335pub struct DateAddFunc {
6336 pub this: Expression,
6337 pub interval: Expression,
6338 pub unit: IntervalUnit,
6339}
6340
6341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6343#[cfg_attr(feature = "bindings", derive(TS))]
6344pub struct DateDiffFunc {
6345 pub this: Expression,
6346 pub expression: Expression,
6347 pub unit: Option<IntervalUnit>,
6348}
6349
6350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6352#[cfg_attr(feature = "bindings", derive(TS))]
6353pub struct DateTruncFunc {
6354 pub this: Expression,
6355 pub unit: DateTimeField,
6356}
6357
6358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6360#[cfg_attr(feature = "bindings", derive(TS))]
6361pub struct ExtractFunc {
6362 pub this: Expression,
6363 pub field: DateTimeField,
6364}
6365
6366#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6367#[cfg_attr(feature = "bindings", derive(TS))]
6368pub enum DateTimeField {
6369 Year,
6370 Month,
6371 Day,
6372 Hour,
6373 Minute,
6374 Second,
6375 Millisecond,
6376 Microsecond,
6377 DayOfWeek,
6378 DayOfYear,
6379 Week,
6380 WeekWithModifier(String),
6382 Quarter,
6383 Epoch,
6384 Timezone,
6385 TimezoneHour,
6386 TimezoneMinute,
6387 Date,
6388 Time,
6389 Custom(String),
6391}
6392
6393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6395#[cfg_attr(feature = "bindings", derive(TS))]
6396pub struct ToDateFunc {
6397 pub this: Expression,
6398 pub format: Option<Expression>,
6399}
6400
6401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6403#[cfg_attr(feature = "bindings", derive(TS))]
6404pub struct ToTimestampFunc {
6405 pub this: Expression,
6406 pub format: Option<Expression>,
6407}
6408
6409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6411#[cfg_attr(feature = "bindings", derive(TS))]
6412pub struct IfFunc {
6413 pub condition: Expression,
6414 pub true_value: Expression,
6415 pub false_value: Option<Expression>,
6416 #[serde(skip_serializing_if = "Option::is_none", default)]
6418 pub original_name: Option<String>,
6419 #[serde(default, skip_serializing_if = "Option::is_none")]
6421 pub inferred_type: Option<DataType>,
6422}
6423
6424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6426#[cfg_attr(feature = "bindings", derive(TS))]
6427pub struct Nvl2Func {
6428 pub this: Expression,
6429 pub true_value: Expression,
6430 pub false_value: Expression,
6431 #[serde(default, skip_serializing_if = "Option::is_none")]
6433 pub inferred_type: Option<DataType>,
6434}
6435
6436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6442#[cfg_attr(feature = "bindings", derive(TS))]
6443pub struct AggFunc {
6444 pub this: Expression,
6445 pub distinct: bool,
6446 pub filter: Option<Expression>,
6447 pub order_by: Vec<Ordered>,
6448 #[serde(skip_serializing_if = "Option::is_none", default)]
6450 pub name: Option<String>,
6451 #[serde(skip_serializing_if = "Option::is_none", default)]
6453 pub ignore_nulls: Option<bool>,
6454 #[serde(skip_serializing_if = "Option::is_none", default)]
6457 pub having_max: Option<(Box<Expression>, bool)>,
6458 #[serde(skip_serializing_if = "Option::is_none", default)]
6460 pub limit: Option<Box<Expression>>,
6461 #[serde(default, skip_serializing_if = "Option::is_none")]
6463 pub inferred_type: Option<DataType>,
6464}
6465
6466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6468#[cfg_attr(feature = "bindings", derive(TS))]
6469pub struct CountFunc {
6470 pub this: Option<Expression>,
6471 pub star: bool,
6472 pub distinct: bool,
6473 pub filter: Option<Expression>,
6474 #[serde(default, skip_serializing_if = "Option::is_none")]
6476 pub ignore_nulls: Option<bool>,
6477 #[serde(default, skip_serializing_if = "Option::is_none")]
6479 pub original_name: Option<String>,
6480 #[serde(default, skip_serializing_if = "Option::is_none")]
6482 pub inferred_type: Option<DataType>,
6483}
6484
6485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6487#[cfg_attr(feature = "bindings", derive(TS))]
6488pub struct GroupConcatFunc {
6489 pub this: Expression,
6490 pub separator: Option<Expression>,
6491 pub order_by: Option<Vec<Ordered>>,
6492 pub distinct: bool,
6493 pub filter: Option<Expression>,
6494 #[serde(default, skip_serializing_if = "Option::is_none")]
6496 pub limit: Option<Box<Expression>>,
6497 #[serde(default, skip_serializing_if = "Option::is_none")]
6499 pub inferred_type: Option<DataType>,
6500}
6501
6502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6504#[cfg_attr(feature = "bindings", derive(TS))]
6505pub struct StringAggFunc {
6506 pub this: Expression,
6507 #[serde(default)]
6508 pub separator: Option<Expression>,
6509 #[serde(default)]
6510 pub order_by: Option<Vec<Ordered>>,
6511 #[serde(default)]
6512 pub distinct: bool,
6513 #[serde(default)]
6514 pub filter: Option<Expression>,
6515 #[serde(default, skip_serializing_if = "Option::is_none")]
6517 pub limit: Option<Box<Expression>>,
6518 #[serde(default, skip_serializing_if = "Option::is_none")]
6520 pub inferred_type: Option<DataType>,
6521}
6522
6523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6525#[cfg_attr(feature = "bindings", derive(TS))]
6526pub struct ListAggFunc {
6527 pub this: Expression,
6528 pub separator: Option<Expression>,
6529 pub on_overflow: Option<ListAggOverflow>,
6530 pub order_by: Option<Vec<Ordered>>,
6531 pub distinct: bool,
6532 pub filter: Option<Expression>,
6533 #[serde(default, skip_serializing_if = "Option::is_none")]
6535 pub inferred_type: Option<DataType>,
6536}
6537
6538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6540#[cfg_attr(feature = "bindings", derive(TS))]
6541pub enum ListAggOverflow {
6542 Error,
6543 Truncate {
6544 filler: Option<Expression>,
6545 with_count: bool,
6546 },
6547}
6548
6549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6551#[cfg_attr(feature = "bindings", derive(TS))]
6552pub struct SumIfFunc {
6553 pub this: Expression,
6554 pub condition: Expression,
6555 pub filter: Option<Expression>,
6556 #[serde(default, skip_serializing_if = "Option::is_none")]
6558 pub inferred_type: Option<DataType>,
6559}
6560
6561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6563#[cfg_attr(feature = "bindings", derive(TS))]
6564pub struct ApproxPercentileFunc {
6565 pub this: Expression,
6566 pub percentile: Expression,
6567 pub accuracy: Option<Expression>,
6568 pub filter: Option<Expression>,
6569}
6570
6571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6573#[cfg_attr(feature = "bindings", derive(TS))]
6574pub struct PercentileFunc {
6575 pub this: Expression,
6576 pub percentile: Expression,
6577 pub order_by: Option<Vec<Ordered>>,
6578 pub filter: Option<Expression>,
6579}
6580
6581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6587#[cfg_attr(feature = "bindings", derive(TS))]
6588pub struct RowNumber;
6589
6590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6592#[cfg_attr(feature = "bindings", derive(TS))]
6593pub struct Rank {
6594 #[serde(default, skip_serializing_if = "Option::is_none")]
6596 pub order_by: Option<Vec<Ordered>>,
6597 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6599 pub args: Vec<Expression>,
6600}
6601
6602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6604#[cfg_attr(feature = "bindings", derive(TS))]
6605pub struct DenseRank {
6606 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6608 pub args: Vec<Expression>,
6609}
6610
6611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6613#[cfg_attr(feature = "bindings", derive(TS))]
6614pub struct NTileFunc {
6615 #[serde(default, skip_serializing_if = "Option::is_none")]
6617 pub num_buckets: Option<Expression>,
6618 #[serde(default, skip_serializing_if = "Option::is_none")]
6620 pub order_by: Option<Vec<Ordered>>,
6621}
6622
6623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6625#[cfg_attr(feature = "bindings", derive(TS))]
6626pub struct LeadLagFunc {
6627 pub this: Expression,
6628 pub offset: Option<Expression>,
6629 pub default: Option<Expression>,
6630 #[serde(default, skip_serializing_if = "Option::is_none")]
6632 pub ignore_nulls: Option<bool>,
6633}
6634
6635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6637#[cfg_attr(feature = "bindings", derive(TS))]
6638pub struct ValueFunc {
6639 pub this: Expression,
6640 #[serde(default, skip_serializing_if = "Option::is_none")]
6642 pub ignore_nulls: Option<bool>,
6643 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6645 pub order_by: Vec<Ordered>,
6646}
6647
6648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6650#[cfg_attr(feature = "bindings", derive(TS))]
6651pub struct NthValueFunc {
6652 pub this: Expression,
6653 pub offset: Expression,
6654 #[serde(default, skip_serializing_if = "Option::is_none")]
6656 pub ignore_nulls: Option<bool>,
6657 #[serde(default, skip_serializing_if = "Option::is_none")]
6660 pub from_first: Option<bool>,
6661}
6662
6663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6665#[cfg_attr(feature = "bindings", derive(TS))]
6666pub struct PercentRank {
6667 #[serde(default, skip_serializing_if = "Option::is_none")]
6669 pub order_by: Option<Vec<Ordered>>,
6670 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6672 pub args: Vec<Expression>,
6673}
6674
6675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6677#[cfg_attr(feature = "bindings", derive(TS))]
6678pub struct CumeDist {
6679 #[serde(default, skip_serializing_if = "Option::is_none")]
6681 pub order_by: Option<Vec<Ordered>>,
6682 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6684 pub args: Vec<Expression>,
6685}
6686
6687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6693#[cfg_attr(feature = "bindings", derive(TS))]
6694pub struct PositionFunc {
6695 pub substring: Expression,
6696 pub string: Expression,
6697 pub start: Option<Expression>,
6698}
6699
6700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6706#[cfg_attr(feature = "bindings", derive(TS))]
6707pub struct Random;
6708
6709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6711#[cfg_attr(feature = "bindings", derive(TS))]
6712pub struct Rand {
6713 pub seed: Option<Box<Expression>>,
6714 #[serde(default)]
6716 pub lower: Option<Box<Expression>>,
6717 #[serde(default)]
6719 pub upper: Option<Box<Expression>>,
6720}
6721
6722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6724#[cfg_attr(feature = "bindings", derive(TS))]
6725pub struct TruncateFunc {
6726 pub this: Expression,
6727 pub decimals: Option<Expression>,
6728}
6729
6730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6732#[cfg_attr(feature = "bindings", derive(TS))]
6733pub struct Pi;
6734
6735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6741#[cfg_attr(feature = "bindings", derive(TS))]
6742pub struct DecodeFunc {
6743 pub this: Expression,
6744 pub search_results: Vec<(Expression, Expression)>,
6745 pub default: Option<Expression>,
6746}
6747
6748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6754#[cfg_attr(feature = "bindings", derive(TS))]
6755pub struct DateFormatFunc {
6756 pub this: Expression,
6757 pub format: Expression,
6758}
6759
6760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6762#[cfg_attr(feature = "bindings", derive(TS))]
6763pub struct FromUnixtimeFunc {
6764 pub this: Expression,
6765 pub format: Option<Expression>,
6766}
6767
6768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6770#[cfg_attr(feature = "bindings", derive(TS))]
6771pub struct UnixTimestampFunc {
6772 pub this: Option<Expression>,
6773 pub format: Option<Expression>,
6774}
6775
6776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6778#[cfg_attr(feature = "bindings", derive(TS))]
6779pub struct MakeDateFunc {
6780 pub year: Expression,
6781 pub month: Expression,
6782 pub day: Expression,
6783}
6784
6785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6787#[cfg_attr(feature = "bindings", derive(TS))]
6788pub struct MakeTimestampFunc {
6789 pub year: Expression,
6790 pub month: Expression,
6791 pub day: Expression,
6792 pub hour: Expression,
6793 pub minute: Expression,
6794 pub second: Expression,
6795 pub timezone: Option<Expression>,
6796}
6797
6798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6800#[cfg_attr(feature = "bindings", derive(TS))]
6801pub struct LastDayFunc {
6802 pub this: Expression,
6803 #[serde(skip_serializing_if = "Option::is_none", default)]
6805 pub unit: Option<DateTimeField>,
6806}
6807
6808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6814#[cfg_attr(feature = "bindings", derive(TS))]
6815pub struct ArrayConstructor {
6816 pub expressions: Vec<Expression>,
6817 pub bracket_notation: bool,
6818 pub use_list_keyword: bool,
6820}
6821
6822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6824#[cfg_attr(feature = "bindings", derive(TS))]
6825pub struct ArraySortFunc {
6826 pub this: Expression,
6827 pub comparator: Option<Expression>,
6828 pub desc: bool,
6829 pub nulls_first: Option<bool>,
6830}
6831
6832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6834#[cfg_attr(feature = "bindings", derive(TS))]
6835pub struct ArrayJoinFunc {
6836 pub this: Expression,
6837 pub separator: Expression,
6838 pub null_replacement: Option<Expression>,
6839}
6840
6841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6843#[cfg_attr(feature = "bindings", derive(TS))]
6844pub struct UnnestFunc {
6845 pub this: Expression,
6846 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6848 pub expressions: Vec<Expression>,
6849 pub with_ordinality: bool,
6850 pub alias: Option<Identifier>,
6851 #[serde(default, skip_serializing_if = "Option::is_none")]
6853 pub offset_alias: Option<Identifier>,
6854}
6855
6856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6858#[cfg_attr(feature = "bindings", derive(TS))]
6859pub struct ArrayFilterFunc {
6860 pub this: Expression,
6861 pub filter: Expression,
6862}
6863
6864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6866#[cfg_attr(feature = "bindings", derive(TS))]
6867pub struct ArrayTransformFunc {
6868 pub this: Expression,
6869 pub transform: Expression,
6870}
6871
6872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6874#[cfg_attr(feature = "bindings", derive(TS))]
6875pub struct SequenceFunc {
6876 pub start: Expression,
6877 pub stop: Expression,
6878 pub step: Option<Expression>,
6879}
6880
6881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6887#[cfg_attr(feature = "bindings", derive(TS))]
6888pub struct StructConstructor {
6889 pub fields: Vec<(Option<Identifier>, Expression)>,
6890}
6891
6892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6894#[cfg_attr(feature = "bindings", derive(TS))]
6895pub struct StructExtractFunc {
6896 pub this: Expression,
6897 pub field: Identifier,
6898}
6899
6900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6902#[cfg_attr(feature = "bindings", derive(TS))]
6903pub struct NamedStructFunc {
6904 pub pairs: Vec<(Expression, Expression)>,
6905}
6906
6907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6913#[cfg_attr(feature = "bindings", derive(TS))]
6914pub struct MapConstructor {
6915 pub keys: Vec<Expression>,
6916 pub values: Vec<Expression>,
6917 #[serde(default)]
6919 pub curly_brace_syntax: bool,
6920 #[serde(default)]
6922 pub with_map_keyword: bool,
6923}
6924
6925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6927#[cfg_attr(feature = "bindings", derive(TS))]
6928pub struct TransformFunc {
6929 pub this: Expression,
6930 pub transform: Expression,
6931}
6932
6933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6936#[cfg_attr(feature = "bindings", derive(TS))]
6937pub struct FunctionEmits {
6938 pub this: Expression,
6940 pub emits: Expression,
6942}
6943
6944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6950#[cfg_attr(feature = "bindings", derive(TS))]
6951pub struct JsonExtractFunc {
6952 pub this: Expression,
6953 pub path: Expression,
6954 pub returning: Option<DataType>,
6955 #[serde(default)]
6957 pub arrow_syntax: bool,
6958 #[serde(default)]
6960 pub hash_arrow_syntax: bool,
6961 #[serde(default)]
6963 pub wrapper_option: Option<String>,
6964 #[serde(default)]
6966 pub quotes_option: Option<String>,
6967 #[serde(default)]
6969 pub on_scalar_string: bool,
6970 #[serde(default)]
6972 pub on_error: Option<String>,
6973}
6974
6975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6977#[cfg_attr(feature = "bindings", derive(TS))]
6978pub struct JsonPathFunc {
6979 pub this: Expression,
6980 pub paths: Vec<Expression>,
6981}
6982
6983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6985#[cfg_attr(feature = "bindings", derive(TS))]
6986pub struct JsonObjectFunc {
6987 pub pairs: Vec<(Expression, Expression)>,
6988 pub null_handling: Option<JsonNullHandling>,
6989 #[serde(default)]
6990 pub with_unique_keys: bool,
6991 #[serde(default)]
6992 pub returning_type: Option<DataType>,
6993 #[serde(default)]
6994 pub format_json: bool,
6995 #[serde(default)]
6996 pub encoding: Option<String>,
6997 #[serde(default)]
6999 pub star: bool,
7000}
7001
7002#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7004#[cfg_attr(feature = "bindings", derive(TS))]
7005pub enum JsonNullHandling {
7006 NullOnNull,
7007 AbsentOnNull,
7008}
7009
7010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7012#[cfg_attr(feature = "bindings", derive(TS))]
7013pub struct JsonModifyFunc {
7014 pub this: Expression,
7015 pub path_values: Vec<(Expression, Expression)>,
7016}
7017
7018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7020#[cfg_attr(feature = "bindings", derive(TS))]
7021pub struct JsonArrayAggFunc {
7022 pub this: Expression,
7023 pub order_by: Option<Vec<Ordered>>,
7024 pub null_handling: Option<JsonNullHandling>,
7025 pub filter: Option<Expression>,
7026}
7027
7028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7030#[cfg_attr(feature = "bindings", derive(TS))]
7031pub struct JsonObjectAggFunc {
7032 pub key: Expression,
7033 pub value: Expression,
7034 pub null_handling: Option<JsonNullHandling>,
7035 pub filter: Option<Expression>,
7036}
7037
7038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7044#[cfg_attr(feature = "bindings", derive(TS))]
7045pub struct ConvertFunc {
7046 pub this: Expression,
7047 pub to: DataType,
7048 pub style: Option<Expression>,
7049}
7050
7051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7057#[cfg_attr(feature = "bindings", derive(TS))]
7058pub struct LambdaExpr {
7059 pub parameters: Vec<Identifier>,
7060 pub body: Expression,
7061 #[serde(default)]
7063 pub colon: bool,
7064 #[serde(default)]
7067 pub parameter_types: Vec<Option<DataType>>,
7068}
7069
7070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7072#[cfg_attr(feature = "bindings", derive(TS))]
7073pub struct Parameter {
7074 pub name: Option<String>,
7075 pub index: Option<u32>,
7076 pub style: ParameterStyle,
7077 #[serde(default)]
7079 pub quoted: bool,
7080 #[serde(default)]
7082 pub string_quoted: bool,
7083 #[serde(default)]
7085 pub expression: Option<String>,
7086}
7087
7088#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7090#[cfg_attr(feature = "bindings", derive(TS))]
7091pub enum ParameterStyle {
7092 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7102
7103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7105#[cfg_attr(feature = "bindings", derive(TS))]
7106pub struct Placeholder {
7107 pub index: Option<u32>,
7108}
7109
7110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7112#[cfg_attr(feature = "bindings", derive(TS))]
7113pub struct NamedArgument {
7114 pub name: Identifier,
7115 pub value: Expression,
7116 pub separator: NamedArgSeparator,
7118}
7119
7120#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7122#[cfg_attr(feature = "bindings", derive(TS))]
7123pub enum NamedArgSeparator {
7124 DArrow,
7126 ColonEq,
7128 Eq,
7130}
7131
7132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7135#[cfg_attr(feature = "bindings", derive(TS))]
7136pub struct TableArgument {
7137 pub prefix: String,
7139 pub this: Expression,
7141}
7142
7143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7145#[cfg_attr(feature = "bindings", derive(TS))]
7146pub struct SqlComment {
7147 pub text: String,
7148 pub is_block: bool,
7149}
7150
7151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7157#[cfg_attr(feature = "bindings", derive(TS))]
7158pub struct SimilarToExpr {
7159 pub this: Expression,
7160 pub pattern: Expression,
7161 pub escape: Option<Expression>,
7162 pub not: bool,
7163}
7164
7165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7167#[cfg_attr(feature = "bindings", derive(TS))]
7168pub struct QuantifiedExpr {
7169 pub this: Expression,
7170 pub subquery: Expression,
7171 pub op: Option<QuantifiedOp>,
7172}
7173
7174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7176#[cfg_attr(feature = "bindings", derive(TS))]
7177pub enum QuantifiedOp {
7178 Eq,
7179 Neq,
7180 Lt,
7181 Lte,
7182 Gt,
7183 Gte,
7184}
7185
7186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7191#[cfg_attr(feature = "bindings", derive(TS))]
7192pub struct OverlapsExpr {
7193 #[serde(skip_serializing_if = "Option::is_none")]
7195 pub this: Option<Expression>,
7196 #[serde(skip_serializing_if = "Option::is_none")]
7198 pub expression: Option<Expression>,
7199 #[serde(skip_serializing_if = "Option::is_none")]
7201 pub left_start: Option<Expression>,
7202 #[serde(skip_serializing_if = "Option::is_none")]
7204 pub left_end: Option<Expression>,
7205 #[serde(skip_serializing_if = "Option::is_none")]
7207 pub right_start: Option<Expression>,
7208 #[serde(skip_serializing_if = "Option::is_none")]
7210 pub right_end: Option<Expression>,
7211}
7212
7213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7219#[cfg_attr(feature = "bindings", derive(TS))]
7220pub struct Subscript {
7221 pub this: Expression,
7222 pub index: Expression,
7223}
7224
7225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7227#[cfg_attr(feature = "bindings", derive(TS))]
7228pub struct DotAccess {
7229 pub this: Expression,
7230 pub field: Identifier,
7231}
7232
7233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7235#[cfg_attr(feature = "bindings", derive(TS))]
7236pub struct MethodCall {
7237 pub this: Expression,
7238 pub method: Identifier,
7239 pub args: Vec<Expression>,
7240}
7241
7242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7244#[cfg_attr(feature = "bindings", derive(TS))]
7245pub struct ArraySlice {
7246 pub this: Expression,
7247 pub start: Option<Expression>,
7248 pub end: Option<Expression>,
7249}
7250
7251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7257#[cfg_attr(feature = "bindings", derive(TS))]
7258pub enum OnCommit {
7259 PreserveRows,
7261 DeleteRows,
7263}
7264
7265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7267#[cfg_attr(feature = "bindings", derive(TS))]
7268pub struct CreateTable {
7269 pub name: TableRef,
7270 #[serde(default, skip_serializing_if = "Option::is_none")]
7272 pub on_cluster: Option<OnCluster>,
7273 pub columns: Vec<ColumnDef>,
7274 pub constraints: Vec<TableConstraint>,
7275 pub if_not_exists: bool,
7276 pub temporary: bool,
7277 pub or_replace: bool,
7278 #[serde(default, skip_serializing_if = "Option::is_none")]
7280 pub table_modifier: Option<String>,
7281 pub as_select: Option<Expression>,
7282 #[serde(default)]
7284 pub as_select_parenthesized: bool,
7285 #[serde(default)]
7287 pub on_commit: Option<OnCommit>,
7288 #[serde(default)]
7290 pub clone_source: Option<TableRef>,
7291 #[serde(default, skip_serializing_if = "Option::is_none")]
7293 pub clone_at_clause: Option<Expression>,
7294 #[serde(default)]
7296 pub is_copy: bool,
7297 #[serde(default)]
7299 pub shallow_clone: bool,
7300 #[serde(default)]
7302 pub deep_clone: bool,
7303 #[serde(default)]
7305 pub leading_comments: Vec<String>,
7306 #[serde(default)]
7308 pub with_properties: Vec<(String, String)>,
7309 #[serde(default)]
7311 pub teradata_post_name_options: Vec<String>,
7312 #[serde(default)]
7314 pub with_data: Option<bool>,
7315 #[serde(default)]
7317 pub with_statistics: Option<bool>,
7318 #[serde(default)]
7320 pub teradata_indexes: Vec<TeradataIndex>,
7321 #[serde(default)]
7323 pub with_cte: Option<With>,
7324 #[serde(default)]
7326 pub properties: Vec<Expression>,
7327 #[serde(default, skip_serializing_if = "Option::is_none")]
7329 pub partition_of: Option<Expression>,
7330 #[serde(default)]
7332 pub post_table_properties: Vec<Expression>,
7333 #[serde(default)]
7335 pub mysql_table_options: Vec<(String, String)>,
7336 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7338 pub inherits: Vec<TableRef>,
7339 #[serde(default, skip_serializing_if = "Option::is_none")]
7341 pub on_property: Option<OnProperty>,
7342 #[serde(default)]
7344 pub copy_grants: bool,
7345 #[serde(default, skip_serializing_if = "Option::is_none")]
7347 pub using_template: Option<Box<Expression>>,
7348 #[serde(default, skip_serializing_if = "Option::is_none")]
7350 pub rollup: Option<RollupProperty>,
7351 #[serde(default, skip_serializing_if = "Option::is_none")]
7353 pub uuid: Option<String>,
7354 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7358 pub with_partition_columns: Vec<ColumnDef>,
7359 #[serde(default, skip_serializing_if = "Option::is_none")]
7362 pub with_connection: Option<TableRef>,
7363}
7364
7365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7367#[cfg_attr(feature = "bindings", derive(TS))]
7368pub struct TeradataIndex {
7369 pub kind: TeradataIndexKind,
7371 pub name: Option<String>,
7373 pub columns: Vec<String>,
7375}
7376
7377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7379#[cfg_attr(feature = "bindings", derive(TS))]
7380pub enum TeradataIndexKind {
7381 NoPrimary,
7383 Primary,
7385 PrimaryAmp,
7387 Unique,
7389 UniquePrimary,
7391 Secondary,
7393}
7394
7395impl CreateTable {
7396 pub fn new(name: impl Into<String>) -> Self {
7397 Self {
7398 name: TableRef::new(name),
7399 on_cluster: None,
7400 columns: Vec::new(),
7401 constraints: Vec::new(),
7402 if_not_exists: false,
7403 temporary: false,
7404 or_replace: false,
7405 table_modifier: None,
7406 as_select: None,
7407 as_select_parenthesized: false,
7408 on_commit: None,
7409 clone_source: None,
7410 clone_at_clause: None,
7411 shallow_clone: false,
7412 deep_clone: false,
7413 is_copy: false,
7414 leading_comments: Vec::new(),
7415 with_properties: Vec::new(),
7416 teradata_post_name_options: Vec::new(),
7417 with_data: None,
7418 with_statistics: None,
7419 teradata_indexes: Vec::new(),
7420 with_cte: None,
7421 properties: Vec::new(),
7422 partition_of: None,
7423 post_table_properties: Vec::new(),
7424 mysql_table_options: Vec::new(),
7425 inherits: Vec::new(),
7426 on_property: None,
7427 copy_grants: false,
7428 using_template: None,
7429 rollup: None,
7430 uuid: None,
7431 with_partition_columns: Vec::new(),
7432 with_connection: None,
7433 }
7434 }
7435}
7436
7437#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7439#[cfg_attr(feature = "bindings", derive(TS))]
7440pub enum SortOrder {
7441 Asc,
7442 Desc,
7443}
7444
7445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7447#[cfg_attr(feature = "bindings", derive(TS))]
7448pub enum ConstraintType {
7449 NotNull,
7450 Null,
7451 PrimaryKey,
7452 Unique,
7453 Default,
7454 AutoIncrement,
7455 Collate,
7456 Comment,
7457 References,
7458 Check,
7459 GeneratedAsIdentity,
7460 Tags,
7462 ComputedColumn,
7464 GeneratedAsRow,
7466 OnUpdate,
7468 Path,
7470 Encode,
7472}
7473
7474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7476#[cfg_attr(feature = "bindings", derive(TS))]
7477pub struct ColumnDef {
7478 pub name: Identifier,
7479 pub data_type: DataType,
7480 pub nullable: Option<bool>,
7481 pub default: Option<Expression>,
7482 pub primary_key: bool,
7483 #[serde(default)]
7485 pub primary_key_order: Option<SortOrder>,
7486 pub unique: bool,
7487 #[serde(default)]
7489 pub unique_nulls_not_distinct: bool,
7490 pub auto_increment: bool,
7491 pub comment: Option<String>,
7492 pub constraints: Vec<ColumnConstraint>,
7493 #[serde(default)]
7495 pub constraint_order: Vec<ConstraintType>,
7496 #[serde(default)]
7498 pub format: Option<String>,
7499 #[serde(default)]
7501 pub title: Option<String>,
7502 #[serde(default)]
7504 pub inline_length: Option<u64>,
7505 #[serde(default)]
7507 pub compress: Option<Vec<Expression>>,
7508 #[serde(default)]
7510 pub character_set: Option<String>,
7511 #[serde(default)]
7513 pub uppercase: bool,
7514 #[serde(default)]
7516 pub casespecific: Option<bool>,
7517 #[serde(default)]
7519 pub auto_increment_start: Option<Box<Expression>>,
7520 #[serde(default)]
7522 pub auto_increment_increment: Option<Box<Expression>>,
7523 #[serde(default)]
7525 pub auto_increment_order: Option<bool>,
7526 #[serde(default)]
7528 pub unsigned: bool,
7529 #[serde(default)]
7531 pub zerofill: bool,
7532 #[serde(default, skip_serializing_if = "Option::is_none")]
7534 pub on_update: Option<Expression>,
7535 #[serde(default, skip_serializing_if = "Option::is_none")]
7537 pub visible: Option<bool>,
7538 #[serde(default, skip_serializing_if = "Option::is_none")]
7540 pub unique_constraint_name: Option<String>,
7541 #[serde(default, skip_serializing_if = "Option::is_none")]
7543 pub not_null_constraint_name: Option<String>,
7544 #[serde(default, skip_serializing_if = "Option::is_none")]
7546 pub primary_key_constraint_name: Option<String>,
7547 #[serde(default, skip_serializing_if = "Option::is_none")]
7549 pub check_constraint_name: Option<String>,
7550 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7552 pub options: Vec<Expression>,
7553 #[serde(default)]
7555 pub no_type: bool,
7556 #[serde(default, skip_serializing_if = "Option::is_none")]
7558 pub encoding: Option<String>,
7559 #[serde(default, skip_serializing_if = "Option::is_none")]
7561 pub codec: Option<String>,
7562 #[serde(default, skip_serializing_if = "Option::is_none")]
7564 pub ephemeral: Option<Option<Box<Expression>>>,
7565 #[serde(default, skip_serializing_if = "Option::is_none")]
7567 pub materialized_expr: Option<Box<Expression>>,
7568 #[serde(default, skip_serializing_if = "Option::is_none")]
7570 pub alias_expr: Option<Box<Expression>>,
7571 #[serde(default, skip_serializing_if = "Option::is_none")]
7573 pub ttl_expr: Option<Box<Expression>>,
7574 #[serde(default)]
7576 pub not_for_replication: bool,
7577}
7578
7579impl ColumnDef {
7580 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7581 Self {
7582 name: Identifier::new(name),
7583 data_type,
7584 nullable: None,
7585 default: None,
7586 primary_key: false,
7587 primary_key_order: None,
7588 unique: false,
7589 unique_nulls_not_distinct: false,
7590 auto_increment: false,
7591 comment: None,
7592 constraints: Vec::new(),
7593 constraint_order: Vec::new(),
7594 format: None,
7595 title: None,
7596 inline_length: None,
7597 compress: None,
7598 character_set: None,
7599 uppercase: false,
7600 casespecific: None,
7601 auto_increment_start: None,
7602 auto_increment_increment: None,
7603 auto_increment_order: None,
7604 unsigned: false,
7605 zerofill: false,
7606 on_update: None,
7607 visible: None,
7608 unique_constraint_name: None,
7609 not_null_constraint_name: None,
7610 primary_key_constraint_name: None,
7611 check_constraint_name: None,
7612 options: Vec::new(),
7613 no_type: false,
7614 encoding: None,
7615 codec: None,
7616 ephemeral: None,
7617 materialized_expr: None,
7618 alias_expr: None,
7619 ttl_expr: None,
7620 not_for_replication: false,
7621 }
7622 }
7623}
7624
7625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7627#[cfg_attr(feature = "bindings", derive(TS))]
7628pub enum ColumnConstraint {
7629 NotNull,
7630 Null,
7631 Unique,
7632 PrimaryKey,
7633 Default(Expression),
7634 Check(Expression),
7635 References(ForeignKeyRef),
7636 GeneratedAsIdentity(GeneratedAsIdentity),
7637 Collate(Identifier),
7638 Comment(String),
7639 Tags(Tags),
7641 ComputedColumn(ComputedColumn),
7644 GeneratedAsRow(GeneratedAsRow),
7646 Path(Expression),
7648}
7649
7650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7652#[cfg_attr(feature = "bindings", derive(TS))]
7653pub struct ComputedColumn {
7654 pub expression: Box<Expression>,
7656 #[serde(default)]
7658 pub persisted: bool,
7659 #[serde(default)]
7661 pub not_null: bool,
7662 #[serde(default)]
7665 pub persistence_kind: Option<String>,
7666 #[serde(default, skip_serializing_if = "Option::is_none")]
7668 pub data_type: Option<DataType>,
7669}
7670
7671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7673#[cfg_attr(feature = "bindings", derive(TS))]
7674pub struct GeneratedAsRow {
7675 pub start: bool,
7677 #[serde(default)]
7679 pub hidden: bool,
7680}
7681
7682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7684#[cfg_attr(feature = "bindings", derive(TS))]
7685pub struct GeneratedAsIdentity {
7686 pub always: bool,
7688 pub on_null: bool,
7690 pub start: Option<Box<Expression>>,
7692 pub increment: Option<Box<Expression>>,
7694 pub minvalue: Option<Box<Expression>>,
7696 pub maxvalue: Option<Box<Expression>>,
7698 pub cycle: Option<bool>,
7700}
7701
7702#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7704#[cfg_attr(feature = "bindings", derive(TS))]
7705pub struct ConstraintModifiers {
7706 pub enforced: Option<bool>,
7708 pub deferrable: Option<bool>,
7710 pub initially_deferred: Option<bool>,
7712 pub norely: bool,
7714 pub rely: bool,
7716 #[serde(default)]
7718 pub using: Option<String>,
7719 #[serde(default)]
7721 pub using_before_columns: bool,
7722 #[serde(default, skip_serializing_if = "Option::is_none")]
7724 pub comment: Option<String>,
7725 #[serde(default, skip_serializing_if = "Option::is_none")]
7727 pub visible: Option<bool>,
7728 #[serde(default, skip_serializing_if = "Option::is_none")]
7730 pub engine_attribute: Option<String>,
7731 #[serde(default, skip_serializing_if = "Option::is_none")]
7733 pub with_parser: Option<String>,
7734 #[serde(default)]
7736 pub not_valid: bool,
7737 #[serde(default, skip_serializing_if = "Option::is_none")]
7739 pub clustered: Option<String>,
7740 #[serde(default, skip_serializing_if = "Option::is_none")]
7742 pub on_conflict: Option<String>,
7743 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7745 pub with_options: Vec<(String, String)>,
7746 #[serde(default, skip_serializing_if = "Option::is_none")]
7748 pub on_filegroup: Option<Identifier>,
7749}
7750
7751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7753#[cfg_attr(feature = "bindings", derive(TS))]
7754pub enum TableConstraint {
7755 PrimaryKey {
7756 name: Option<Identifier>,
7757 columns: Vec<Identifier>,
7758 #[serde(default)]
7760 include_columns: Vec<Identifier>,
7761 #[serde(default)]
7762 modifiers: ConstraintModifiers,
7763 #[serde(default)]
7765 has_constraint_keyword: bool,
7766 },
7767 Unique {
7768 name: Option<Identifier>,
7769 columns: Vec<Identifier>,
7770 #[serde(default)]
7772 columns_parenthesized: bool,
7773 #[serde(default)]
7774 modifiers: ConstraintModifiers,
7775 #[serde(default)]
7777 has_constraint_keyword: bool,
7778 #[serde(default)]
7780 nulls_not_distinct: bool,
7781 },
7782 ForeignKey {
7783 name: Option<Identifier>,
7784 columns: Vec<Identifier>,
7785 #[serde(default)]
7786 references: Option<ForeignKeyRef>,
7787 #[serde(default)]
7789 on_delete: Option<ReferentialAction>,
7790 #[serde(default)]
7792 on_update: Option<ReferentialAction>,
7793 #[serde(default)]
7794 modifiers: ConstraintModifiers,
7795 },
7796 Check {
7797 name: Option<Identifier>,
7798 expression: Expression,
7799 #[serde(default)]
7800 modifiers: ConstraintModifiers,
7801 },
7802 Assume {
7804 name: Option<Identifier>,
7805 expression: Expression,
7806 },
7807 Default {
7809 name: Option<Identifier>,
7810 expression: Expression,
7811 column: Identifier,
7812 },
7813 Index {
7815 name: Option<Identifier>,
7816 columns: Vec<Identifier>,
7817 #[serde(default)]
7819 kind: Option<String>,
7820 #[serde(default)]
7821 modifiers: ConstraintModifiers,
7822 #[serde(default)]
7824 use_key_keyword: bool,
7825 #[serde(default, skip_serializing_if = "Option::is_none")]
7827 expression: Option<Box<Expression>>,
7828 #[serde(default, skip_serializing_if = "Option::is_none")]
7830 index_type: Option<Box<Expression>>,
7831 #[serde(default, skip_serializing_if = "Option::is_none")]
7833 granularity: Option<Box<Expression>>,
7834 },
7835 Projection {
7837 name: Identifier,
7838 expression: Expression,
7839 },
7840 Like {
7842 source: TableRef,
7843 options: Vec<(LikeOptionAction, String)>,
7845 },
7846 PeriodForSystemTime {
7848 start_col: Identifier,
7849 end_col: Identifier,
7850 },
7851 Exclude {
7854 name: Option<Identifier>,
7855 #[serde(default)]
7857 using: Option<String>,
7858 elements: Vec<ExcludeElement>,
7860 #[serde(default)]
7862 include_columns: Vec<Identifier>,
7863 #[serde(default)]
7865 where_clause: Option<Box<Expression>>,
7866 #[serde(default)]
7868 with_params: Vec<(String, String)>,
7869 #[serde(default)]
7871 using_index_tablespace: Option<String>,
7872 #[serde(default)]
7873 modifiers: ConstraintModifiers,
7874 },
7875 Tags(Tags),
7877 InitiallyDeferred {
7881 deferred: bool,
7883 },
7884}
7885
7886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7888#[cfg_attr(feature = "bindings", derive(TS))]
7889pub struct ExcludeElement {
7890 pub expression: String,
7892 pub operator: String,
7894}
7895
7896#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7898#[cfg_attr(feature = "bindings", derive(TS))]
7899pub enum LikeOptionAction {
7900 Including,
7901 Excluding,
7902}
7903
7904#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7906#[cfg_attr(feature = "bindings", derive(TS))]
7907pub enum MatchType {
7908 Full,
7909 Partial,
7910 Simple,
7911}
7912
7913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7915#[cfg_attr(feature = "bindings", derive(TS))]
7916pub struct ForeignKeyRef {
7917 pub table: TableRef,
7918 pub columns: Vec<Identifier>,
7919 pub on_delete: Option<ReferentialAction>,
7920 pub on_update: Option<ReferentialAction>,
7921 #[serde(default)]
7923 pub on_update_first: bool,
7924 #[serde(default)]
7926 pub match_type: Option<MatchType>,
7927 #[serde(default)]
7929 pub match_after_actions: bool,
7930 #[serde(default)]
7932 pub constraint_name: Option<String>,
7933 #[serde(default)]
7935 pub deferrable: Option<bool>,
7936 #[serde(default)]
7938 pub has_foreign_key_keywords: bool,
7939}
7940
7941#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7943#[cfg_attr(feature = "bindings", derive(TS))]
7944pub enum ReferentialAction {
7945 Cascade,
7946 SetNull,
7947 SetDefault,
7948 Restrict,
7949 NoAction,
7950}
7951
7952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7954#[cfg_attr(feature = "bindings", derive(TS))]
7955pub struct DropTable {
7956 pub names: Vec<TableRef>,
7957 pub if_exists: bool,
7958 pub cascade: bool,
7959 #[serde(default)]
7961 pub cascade_constraints: bool,
7962 #[serde(default)]
7964 pub purge: bool,
7965 #[serde(default)]
7967 pub leading_comments: Vec<String>,
7968 #[serde(default, skip_serializing_if = "Option::is_none")]
7971 pub object_id_args: Option<String>,
7972 #[serde(default)]
7974 pub sync: bool,
7975 #[serde(default)]
7977 pub iceberg: bool,
7978 #[serde(default)]
7980 pub restrict: bool,
7981}
7982
7983impl DropTable {
7984 pub fn new(name: impl Into<String>) -> Self {
7985 Self {
7986 names: vec![TableRef::new(name)],
7987 if_exists: false,
7988 cascade: false,
7989 cascade_constraints: false,
7990 purge: false,
7991 leading_comments: Vec::new(),
7992 object_id_args: None,
7993 sync: false,
7994 iceberg: false,
7995 restrict: false,
7996 }
7997 }
7998}
7999
8000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8002#[cfg_attr(feature = "bindings", derive(TS))]
8003pub struct Undrop {
8004 pub kind: String,
8006 pub name: TableRef,
8008 #[serde(default)]
8010 pub if_exists: bool,
8011}
8012
8013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8015#[cfg_attr(feature = "bindings", derive(TS))]
8016pub struct AlterTable {
8017 pub name: TableRef,
8018 pub actions: Vec<AlterTableAction>,
8019 #[serde(default)]
8021 pub if_exists: bool,
8022 #[serde(default, skip_serializing_if = "Option::is_none")]
8024 pub algorithm: Option<String>,
8025 #[serde(default, skip_serializing_if = "Option::is_none")]
8027 pub lock: Option<String>,
8028 #[serde(default, skip_serializing_if = "Option::is_none")]
8030 pub with_check: Option<String>,
8031 #[serde(default, skip_serializing_if = "Option::is_none")]
8033 pub partition: Option<Vec<(Identifier, Expression)>>,
8034 #[serde(default, skip_serializing_if = "Option::is_none")]
8036 pub on_cluster: Option<OnCluster>,
8037 #[serde(default, skip_serializing_if = "Option::is_none")]
8039 pub table_modifier: Option<String>,
8040}
8041
8042impl AlterTable {
8043 pub fn new(name: impl Into<String>) -> Self {
8044 Self {
8045 name: TableRef::new(name),
8046 actions: Vec::new(),
8047 if_exists: false,
8048 algorithm: None,
8049 lock: None,
8050 with_check: None,
8051 partition: None,
8052 on_cluster: None,
8053 table_modifier: None,
8054 }
8055 }
8056}
8057
8058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8060#[cfg_attr(feature = "bindings", derive(TS))]
8061pub enum ColumnPosition {
8062 First,
8063 After(Identifier),
8064}
8065
8066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8068#[cfg_attr(feature = "bindings", derive(TS))]
8069pub enum AlterTableAction {
8070 AddColumn {
8071 column: ColumnDef,
8072 if_not_exists: bool,
8073 position: Option<ColumnPosition>,
8074 },
8075 DropColumn {
8076 name: Identifier,
8077 if_exists: bool,
8078 cascade: bool,
8079 },
8080 RenameColumn {
8081 old_name: Identifier,
8082 new_name: Identifier,
8083 if_exists: bool,
8084 },
8085 AlterColumn {
8086 name: Identifier,
8087 action: AlterColumnAction,
8088 #[serde(default)]
8090 use_modify_keyword: bool,
8091 },
8092 RenameTable(TableRef),
8093 AddConstraint(TableConstraint),
8094 DropConstraint {
8095 name: Identifier,
8096 if_exists: bool,
8097 },
8098 DropForeignKey {
8100 name: Identifier,
8101 },
8102 DropPartition {
8104 partitions: Vec<Vec<(Identifier, Expression)>>,
8106 if_exists: bool,
8107 },
8108 AddPartition {
8110 partition: Expression,
8112 if_not_exists: bool,
8113 location: Option<Expression>,
8114 },
8115 Delete {
8117 where_clause: Expression,
8118 },
8119 SwapWith(TableRef),
8121 SetProperty {
8123 properties: Vec<(String, Expression)>,
8124 },
8125 UnsetProperty {
8127 properties: Vec<String>,
8128 },
8129 ClusterBy {
8131 expressions: Vec<Expression>,
8132 },
8133 SetTag {
8135 expressions: Vec<(String, Expression)>,
8136 },
8137 UnsetTag {
8139 names: Vec<String>,
8140 },
8141 SetOptions {
8143 expressions: Vec<Expression>,
8144 },
8145 AlterIndex {
8147 name: Identifier,
8148 visible: bool,
8149 },
8150 SetAttribute {
8152 attribute: String,
8153 },
8154 SetStageFileFormat {
8156 options: Option<Expression>,
8157 },
8158 SetStageCopyOptions {
8160 options: Option<Expression>,
8161 },
8162 AddColumns {
8164 columns: Vec<ColumnDef>,
8165 cascade: bool,
8166 },
8167 DropColumns {
8169 names: Vec<Identifier>,
8170 },
8171 ChangeColumn {
8174 old_name: Identifier,
8175 new_name: Identifier,
8176 #[serde(default, skip_serializing_if = "Option::is_none")]
8177 data_type: Option<DataType>,
8178 comment: Option<String>,
8179 #[serde(default)]
8180 cascade: bool,
8181 },
8182 AlterSortKey {
8185 this: Option<String>,
8187 expressions: Vec<Expression>,
8189 compound: bool,
8191 },
8192 AlterDistStyle {
8196 style: String,
8198 distkey: Option<Identifier>,
8200 },
8201 SetTableProperties {
8203 properties: Vec<(Expression, Expression)>,
8204 },
8205 SetLocation {
8207 location: String,
8208 },
8209 SetFileFormat {
8211 format: String,
8212 },
8213 ReplacePartition {
8215 partition: Expression,
8216 source: Option<Box<Expression>>,
8217 },
8218 Raw {
8220 sql: String,
8221 },
8222}
8223
8224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8226#[cfg_attr(feature = "bindings", derive(TS))]
8227pub enum AlterColumnAction {
8228 SetDataType {
8229 data_type: DataType,
8230 using: Option<Expression>,
8232 #[serde(default, skip_serializing_if = "Option::is_none")]
8234 collate: Option<String>,
8235 },
8236 SetDefault(Expression),
8237 DropDefault,
8238 SetNotNull,
8239 DropNotNull,
8240 Comment(String),
8242 SetVisible,
8244 SetInvisible,
8246}
8247
8248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8250#[cfg_attr(feature = "bindings", derive(TS))]
8251pub struct CreateIndex {
8252 pub name: Identifier,
8253 pub table: TableRef,
8254 pub columns: Vec<IndexColumn>,
8255 pub unique: bool,
8256 pub if_not_exists: bool,
8257 pub using: Option<String>,
8258 #[serde(default)]
8260 pub clustered: Option<String>,
8261 #[serde(default)]
8263 pub concurrently: bool,
8264 #[serde(default)]
8266 pub where_clause: Option<Box<Expression>>,
8267 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8269 pub include_columns: Vec<Identifier>,
8270 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8272 pub with_options: Vec<(String, String)>,
8273 #[serde(default)]
8275 pub on_filegroup: Option<String>,
8276}
8277
8278impl CreateIndex {
8279 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8280 Self {
8281 name: Identifier::new(name),
8282 table: TableRef::new(table),
8283 columns: Vec::new(),
8284 unique: false,
8285 if_not_exists: false,
8286 using: None,
8287 clustered: None,
8288 concurrently: false,
8289 where_clause: None,
8290 include_columns: Vec::new(),
8291 with_options: Vec::new(),
8292 on_filegroup: None,
8293 }
8294 }
8295}
8296
8297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8299#[cfg_attr(feature = "bindings", derive(TS))]
8300pub struct IndexColumn {
8301 pub column: Identifier,
8302 pub desc: bool,
8303 #[serde(default)]
8305 pub asc: bool,
8306 pub nulls_first: Option<bool>,
8307 #[serde(default, skip_serializing_if = "Option::is_none")]
8309 pub opclass: Option<String>,
8310}
8311
8312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8314#[cfg_attr(feature = "bindings", derive(TS))]
8315pub struct DropIndex {
8316 pub name: Identifier,
8317 pub table: Option<TableRef>,
8318 pub if_exists: bool,
8319 #[serde(default)]
8321 pub concurrently: bool,
8322}
8323
8324impl DropIndex {
8325 pub fn new(name: impl Into<String>) -> Self {
8326 Self {
8327 name: Identifier::new(name),
8328 table: None,
8329 if_exists: false,
8330 concurrently: false,
8331 }
8332 }
8333}
8334
8335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8337#[cfg_attr(feature = "bindings", derive(TS))]
8338pub struct ViewColumn {
8339 pub name: Identifier,
8340 pub comment: Option<String>,
8341 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8343 pub options: Vec<Expression>,
8344}
8345
8346impl ViewColumn {
8347 pub fn new(name: impl Into<String>) -> Self {
8348 Self {
8349 name: Identifier::new(name),
8350 comment: None,
8351 options: Vec::new(),
8352 }
8353 }
8354
8355 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8356 Self {
8357 name: Identifier::new(name),
8358 comment: Some(comment.into()),
8359 options: Vec::new(),
8360 }
8361 }
8362}
8363
8364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8366#[cfg_attr(feature = "bindings", derive(TS))]
8367pub struct CreateView {
8368 pub name: TableRef,
8369 pub columns: Vec<ViewColumn>,
8370 pub query: Expression,
8371 pub or_replace: bool,
8372 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8374 pub or_alter: bool,
8375 pub if_not_exists: bool,
8376 pub materialized: bool,
8377 pub temporary: bool,
8378 #[serde(default)]
8380 pub secure: bool,
8381 #[serde(skip_serializing_if = "Option::is_none")]
8383 pub algorithm: Option<String>,
8384 #[serde(skip_serializing_if = "Option::is_none")]
8386 pub definer: Option<String>,
8387 #[serde(skip_serializing_if = "Option::is_none")]
8389 pub security: Option<FunctionSecurity>,
8390 #[serde(default = "default_true")]
8392 pub security_sql_style: bool,
8393 #[serde(default)]
8395 pub security_after_name: bool,
8396 #[serde(default)]
8398 pub query_parenthesized: bool,
8399 #[serde(skip_serializing_if = "Option::is_none")]
8401 pub locking_mode: Option<String>,
8402 #[serde(skip_serializing_if = "Option::is_none")]
8404 pub locking_access: Option<String>,
8405 #[serde(default)]
8407 pub copy_grants: bool,
8408 #[serde(skip_serializing_if = "Option::is_none", default)]
8410 pub comment: Option<String>,
8411 #[serde(skip_serializing_if = "Option::is_none", default)]
8413 pub row_access_policy: Option<String>,
8414 #[serde(default)]
8416 pub tags: Vec<(String, String)>,
8417 #[serde(default)]
8419 pub options: Vec<Expression>,
8420 #[serde(skip_serializing_if = "Option::is_none", default)]
8422 pub build: Option<String>,
8423 #[serde(skip_serializing_if = "Option::is_none", default)]
8425 pub refresh: Option<Box<RefreshTriggerProperty>>,
8426 #[serde(skip_serializing_if = "Option::is_none", default)]
8429 pub schema: Option<Box<Schema>>,
8430 #[serde(skip_serializing_if = "Option::is_none", default)]
8432 pub unique_key: Option<Box<UniqueKeyProperty>>,
8433 #[serde(default)]
8435 pub no_schema_binding: bool,
8436 #[serde(skip_serializing_if = "Option::is_none", default)]
8438 pub auto_refresh: Option<bool>,
8439 #[serde(default, skip_serializing_if = "Option::is_none")]
8441 pub on_cluster: Option<OnCluster>,
8442 #[serde(default, skip_serializing_if = "Option::is_none")]
8444 pub to_table: Option<TableRef>,
8445 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8447 pub table_properties: Vec<Expression>,
8448}
8449
8450impl CreateView {
8451 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8452 Self {
8453 name: TableRef::new(name),
8454 columns: Vec::new(),
8455 query,
8456 or_replace: false,
8457 or_alter: false,
8458 if_not_exists: false,
8459 materialized: false,
8460 temporary: false,
8461 secure: false,
8462 algorithm: None,
8463 definer: None,
8464 security: None,
8465 security_sql_style: true,
8466 security_after_name: false,
8467 query_parenthesized: false,
8468 locking_mode: None,
8469 locking_access: None,
8470 copy_grants: false,
8471 comment: None,
8472 row_access_policy: None,
8473 tags: Vec::new(),
8474 options: Vec::new(),
8475 build: None,
8476 refresh: None,
8477 schema: None,
8478 unique_key: None,
8479 no_schema_binding: false,
8480 auto_refresh: None,
8481 on_cluster: None,
8482 to_table: None,
8483 table_properties: Vec::new(),
8484 }
8485 }
8486}
8487
8488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8490#[cfg_attr(feature = "bindings", derive(TS))]
8491pub struct DropView {
8492 pub name: TableRef,
8493 pub if_exists: bool,
8494 pub materialized: bool,
8495}
8496
8497impl DropView {
8498 pub fn new(name: impl Into<String>) -> Self {
8499 Self {
8500 name: TableRef::new(name),
8501 if_exists: false,
8502 materialized: false,
8503 }
8504 }
8505}
8506
8507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8509#[cfg_attr(feature = "bindings", derive(TS))]
8510pub struct Truncate {
8511 #[serde(default)]
8513 pub target: TruncateTarget,
8514 #[serde(default)]
8516 pub if_exists: bool,
8517 pub table: TableRef,
8518 #[serde(default, skip_serializing_if = "Option::is_none")]
8520 pub on_cluster: Option<OnCluster>,
8521 pub cascade: bool,
8522 #[serde(default)]
8524 pub extra_tables: Vec<TruncateTableEntry>,
8525 #[serde(default)]
8527 pub identity: Option<TruncateIdentity>,
8528 #[serde(default)]
8530 pub restrict: bool,
8531 #[serde(default, skip_serializing_if = "Option::is_none")]
8533 pub partition: Option<Box<Expression>>,
8534}
8535
8536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8538#[cfg_attr(feature = "bindings", derive(TS))]
8539pub struct TruncateTableEntry {
8540 pub table: TableRef,
8541 #[serde(default)]
8543 pub star: bool,
8544}
8545
8546#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8548#[cfg_attr(feature = "bindings", derive(TS))]
8549pub enum TruncateTarget {
8550 Table,
8551 Database,
8552}
8553
8554impl Default for TruncateTarget {
8555 fn default() -> Self {
8556 TruncateTarget::Table
8557 }
8558}
8559
8560#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8562#[cfg_attr(feature = "bindings", derive(TS))]
8563pub enum TruncateIdentity {
8564 Restart,
8565 Continue,
8566}
8567
8568impl Truncate {
8569 pub fn new(table: impl Into<String>) -> Self {
8570 Self {
8571 target: TruncateTarget::Table,
8572 if_exists: false,
8573 table: TableRef::new(table),
8574 on_cluster: None,
8575 cascade: false,
8576 extra_tables: Vec::new(),
8577 identity: None,
8578 restrict: false,
8579 partition: None,
8580 }
8581 }
8582}
8583
8584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8586#[cfg_attr(feature = "bindings", derive(TS))]
8587pub struct Use {
8588 pub kind: Option<UseKind>,
8590 pub this: Identifier,
8592}
8593
8594#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8596#[cfg_attr(feature = "bindings", derive(TS))]
8597pub enum UseKind {
8598 Database,
8599 Schema,
8600 Role,
8601 Warehouse,
8602 Catalog,
8603 SecondaryRoles,
8605}
8606
8607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8609#[cfg_attr(feature = "bindings", derive(TS))]
8610pub struct SetStatement {
8611 pub items: Vec<SetItem>,
8613}
8614
8615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8617#[cfg_attr(feature = "bindings", derive(TS))]
8618pub struct SetItem {
8619 pub name: Expression,
8621 pub value: Expression,
8623 pub kind: Option<String>,
8625 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8627 pub no_equals: bool,
8628}
8629
8630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8632#[cfg_attr(feature = "bindings", derive(TS))]
8633pub struct Cache {
8634 pub table: Identifier,
8636 pub lazy: bool,
8638 pub options: Vec<(Expression, Expression)>,
8640 pub query: Option<Expression>,
8642}
8643
8644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8646#[cfg_attr(feature = "bindings", derive(TS))]
8647pub struct Uncache {
8648 pub table: Identifier,
8650 pub if_exists: bool,
8652}
8653
8654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8656#[cfg_attr(feature = "bindings", derive(TS))]
8657pub struct LoadData {
8658 pub local: bool,
8660 pub inpath: String,
8662 pub overwrite: bool,
8664 pub table: Expression,
8666 pub partition: Vec<(Identifier, Expression)>,
8668 pub input_format: Option<String>,
8670 pub serde: Option<String>,
8672}
8673
8674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8676#[cfg_attr(feature = "bindings", derive(TS))]
8677pub struct Pragma {
8678 pub schema: Option<Identifier>,
8680 pub name: Identifier,
8682 pub value: Option<Expression>,
8684 pub args: Vec<Expression>,
8686 #[serde(default)]
8688 pub use_assignment_syntax: bool,
8689}
8690
8691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8694#[cfg_attr(feature = "bindings", derive(TS))]
8695pub struct Privilege {
8696 pub name: String,
8698 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8700 pub columns: Vec<String>,
8701}
8702
8703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8705#[cfg_attr(feature = "bindings", derive(TS))]
8706pub struct GrantPrincipal {
8707 pub name: Identifier,
8709 pub is_role: bool,
8711 #[serde(default)]
8713 pub is_group: bool,
8714 #[serde(default)]
8716 pub is_share: bool,
8717}
8718
8719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8721#[cfg_attr(feature = "bindings", derive(TS))]
8722pub struct Grant {
8723 pub privileges: Vec<Privilege>,
8725 pub kind: Option<String>,
8727 pub securable: Identifier,
8729 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8731 pub function_params: Vec<String>,
8732 pub principals: Vec<GrantPrincipal>,
8734 pub grant_option: bool,
8736 #[serde(default, skip_serializing_if = "Option::is_none")]
8738 pub as_principal: Option<Identifier>,
8739}
8740
8741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8743#[cfg_attr(feature = "bindings", derive(TS))]
8744pub struct Revoke {
8745 pub privileges: Vec<Privilege>,
8747 pub kind: Option<String>,
8749 pub securable: Identifier,
8751 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8753 pub function_params: Vec<String>,
8754 pub principals: Vec<GrantPrincipal>,
8756 pub grant_option: bool,
8758 pub cascade: bool,
8760 #[serde(default)]
8762 pub restrict: bool,
8763}
8764
8765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8767#[cfg_attr(feature = "bindings", derive(TS))]
8768pub struct Comment {
8769 pub this: Expression,
8771 pub kind: String,
8773 pub expression: Expression,
8775 pub exists: bool,
8777 pub materialized: bool,
8779}
8780
8781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8787#[cfg_attr(feature = "bindings", derive(TS))]
8788pub struct AlterView {
8789 pub name: TableRef,
8790 pub actions: Vec<AlterViewAction>,
8791 #[serde(default, skip_serializing_if = "Option::is_none")]
8793 pub algorithm: Option<String>,
8794 #[serde(default, skip_serializing_if = "Option::is_none")]
8796 pub definer: Option<String>,
8797 #[serde(default, skip_serializing_if = "Option::is_none")]
8799 pub sql_security: Option<String>,
8800 #[serde(default, skip_serializing_if = "Option::is_none")]
8802 pub with_option: Option<String>,
8803 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8805 pub columns: Vec<ViewColumn>,
8806}
8807
8808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8810#[cfg_attr(feature = "bindings", derive(TS))]
8811pub enum AlterViewAction {
8812 Rename(TableRef),
8814 OwnerTo(Identifier),
8816 SetSchema(Identifier),
8818 SetAuthorization(String),
8820 AlterColumn {
8822 name: Identifier,
8823 action: AlterColumnAction,
8824 },
8825 AsSelect(Box<Expression>),
8827 SetTblproperties(Vec<(String, String)>),
8829 UnsetTblproperties(Vec<String>),
8831}
8832
8833impl AlterView {
8834 pub fn new(name: impl Into<String>) -> Self {
8835 Self {
8836 name: TableRef::new(name),
8837 actions: Vec::new(),
8838 algorithm: None,
8839 definer: None,
8840 sql_security: None,
8841 with_option: None,
8842 columns: Vec::new(),
8843 }
8844 }
8845}
8846
8847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8849#[cfg_attr(feature = "bindings", derive(TS))]
8850pub struct AlterIndex {
8851 pub name: Identifier,
8852 pub table: Option<TableRef>,
8853 pub actions: Vec<AlterIndexAction>,
8854}
8855
8856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8858#[cfg_attr(feature = "bindings", derive(TS))]
8859pub enum AlterIndexAction {
8860 Rename(Identifier),
8862 SetTablespace(Identifier),
8864 Visible(bool),
8866}
8867
8868impl AlterIndex {
8869 pub fn new(name: impl Into<String>) -> Self {
8870 Self {
8871 name: Identifier::new(name),
8872 table: None,
8873 actions: Vec::new(),
8874 }
8875 }
8876}
8877
8878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8880#[cfg_attr(feature = "bindings", derive(TS))]
8881pub struct CreateSchema {
8882 pub name: Vec<Identifier>,
8884 pub if_not_exists: bool,
8885 pub authorization: Option<Identifier>,
8886 #[serde(default)]
8888 pub clone_from: Option<Vec<Identifier>>,
8889 #[serde(default)]
8891 pub at_clause: Option<Expression>,
8892 #[serde(default)]
8894 pub properties: Vec<Expression>,
8895 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8897 pub leading_comments: Vec<String>,
8898}
8899
8900impl CreateSchema {
8901 pub fn new(name: impl Into<String>) -> Self {
8902 Self {
8903 name: vec![Identifier::new(name)],
8904 if_not_exists: false,
8905 authorization: None,
8906 clone_from: None,
8907 at_clause: None,
8908 properties: Vec::new(),
8909 leading_comments: Vec::new(),
8910 }
8911 }
8912}
8913
8914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8916#[cfg_attr(feature = "bindings", derive(TS))]
8917pub struct DropSchema {
8918 pub name: Identifier,
8919 pub if_exists: bool,
8920 pub cascade: bool,
8921}
8922
8923impl DropSchema {
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 DropNamespace {
8937 pub name: Identifier,
8938 pub if_exists: bool,
8939 pub cascade: bool,
8940}
8941
8942impl DropNamespace {
8943 pub fn new(name: impl Into<String>) -> Self {
8944 Self {
8945 name: Identifier::new(name),
8946 if_exists: false,
8947 cascade: false,
8948 }
8949 }
8950}
8951
8952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8954#[cfg_attr(feature = "bindings", derive(TS))]
8955pub struct CreateDatabase {
8956 pub name: Identifier,
8957 pub if_not_exists: bool,
8958 pub options: Vec<DatabaseOption>,
8959 #[serde(default)]
8961 pub clone_from: Option<Identifier>,
8962 #[serde(default)]
8964 pub at_clause: Option<Expression>,
8965}
8966
8967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8969#[cfg_attr(feature = "bindings", derive(TS))]
8970pub enum DatabaseOption {
8971 CharacterSet(String),
8972 Collate(String),
8973 Owner(Identifier),
8974 Template(Identifier),
8975 Encoding(String),
8976 Location(String),
8977}
8978
8979impl CreateDatabase {
8980 pub fn new(name: impl Into<String>) -> Self {
8981 Self {
8982 name: Identifier::new(name),
8983 if_not_exists: false,
8984 options: Vec::new(),
8985 clone_from: None,
8986 at_clause: None,
8987 }
8988 }
8989}
8990
8991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8993#[cfg_attr(feature = "bindings", derive(TS))]
8994pub struct DropDatabase {
8995 pub name: Identifier,
8996 pub if_exists: bool,
8997 #[serde(default)]
8999 pub sync: bool,
9000}
9001
9002impl DropDatabase {
9003 pub fn new(name: impl Into<String>) -> Self {
9004 Self {
9005 name: Identifier::new(name),
9006 if_exists: false,
9007 sync: false,
9008 }
9009 }
9010}
9011
9012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9014#[cfg_attr(feature = "bindings", derive(TS))]
9015pub struct CreateFunction {
9016 pub name: TableRef,
9017 pub parameters: Vec<FunctionParameter>,
9018 pub return_type: Option<DataType>,
9019 pub body: Option<FunctionBody>,
9020 pub or_replace: bool,
9021 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9023 pub or_alter: bool,
9024 pub if_not_exists: bool,
9025 pub temporary: bool,
9026 pub language: Option<String>,
9027 pub deterministic: Option<bool>,
9028 pub returns_null_on_null_input: Option<bool>,
9029 pub security: Option<FunctionSecurity>,
9030 #[serde(default = "default_true")]
9032 pub has_parens: bool,
9033 #[serde(default)]
9035 pub sql_data_access: Option<SqlDataAccess>,
9036 #[serde(default, skip_serializing_if = "Option::is_none")]
9038 pub returns_table_body: Option<String>,
9039 #[serde(default)]
9041 pub language_first: bool,
9042 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9044 pub set_options: Vec<FunctionSetOption>,
9045 #[serde(default)]
9047 pub strict: bool,
9048 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9050 pub options: Vec<Expression>,
9051 #[serde(default)]
9053 pub is_table_function: bool,
9054 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9056 pub property_order: Vec<FunctionPropertyKind>,
9057 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9059 pub using_resources: Vec<FunctionUsingResource>,
9060 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9062 pub environment: Vec<Expression>,
9063 #[serde(default, skip_serializing_if = "Option::is_none")]
9065 pub handler: Option<String>,
9066 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9068 pub handler_uses_eq: bool,
9069 #[serde(default, skip_serializing_if = "Option::is_none")]
9071 pub runtime_version: Option<String>,
9072 #[serde(default, skip_serializing_if = "Option::is_none")]
9074 pub packages: Option<Vec<String>>,
9075 #[serde(default, skip_serializing_if = "Option::is_none")]
9077 pub parameter_style: Option<String>,
9078}
9079
9080#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9082#[cfg_attr(feature = "bindings", derive(TS))]
9083pub struct FunctionSetOption {
9084 pub name: String,
9085 pub value: FunctionSetValue,
9086}
9087
9088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9090#[cfg_attr(feature = "bindings", derive(TS))]
9091pub enum FunctionSetValue {
9092 Value { value: String, use_to: bool },
9094 FromCurrent,
9096}
9097
9098#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9100#[cfg_attr(feature = "bindings", derive(TS))]
9101pub enum SqlDataAccess {
9102 NoSql,
9104 ContainsSql,
9106 ReadsSqlData,
9108 ModifiesSqlData,
9110}
9111
9112#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9114#[cfg_attr(feature = "bindings", derive(TS))]
9115pub enum FunctionPropertyKind {
9116 Set,
9118 As,
9120 Using,
9122 Language,
9124 Determinism,
9126 NullInput,
9128 Security,
9130 SqlDataAccess,
9132 Options,
9134 Environment,
9136 Handler,
9138 RuntimeVersion,
9140 Packages,
9142 ParameterStyle,
9144}
9145
9146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9148#[cfg_attr(feature = "bindings", derive(TS))]
9149pub struct FunctionUsingResource {
9150 pub kind: String,
9151 pub uri: String,
9152}
9153
9154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9156#[cfg_attr(feature = "bindings", derive(TS))]
9157pub struct FunctionParameter {
9158 pub name: Option<Identifier>,
9159 pub data_type: DataType,
9160 pub mode: Option<ParameterMode>,
9161 pub default: Option<Expression>,
9162 #[serde(default, skip_serializing_if = "Option::is_none")]
9164 pub mode_text: Option<String>,
9165}
9166
9167#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9169#[cfg_attr(feature = "bindings", derive(TS))]
9170pub enum ParameterMode {
9171 In,
9172 Out,
9173 InOut,
9174 Variadic,
9175}
9176
9177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9179#[cfg_attr(feature = "bindings", derive(TS))]
9180pub enum FunctionBody {
9181 Block(String),
9183 StringLiteral(String),
9185 Expression(Expression),
9187 External(String),
9189 Return(Expression),
9191 Statements(Vec<Expression>),
9193 DollarQuoted {
9196 content: String,
9197 tag: Option<String>,
9198 },
9199 RawBlock(String),
9201}
9202
9203#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9205#[cfg_attr(feature = "bindings", derive(TS))]
9206pub enum FunctionSecurity {
9207 Definer,
9208 Invoker,
9209 None,
9211}
9212
9213impl CreateFunction {
9214 pub fn new(name: impl Into<String>) -> Self {
9215 Self {
9216 name: TableRef::new(name),
9217 parameters: Vec::new(),
9218 return_type: None,
9219 body: None,
9220 or_replace: false,
9221 or_alter: false,
9222 if_not_exists: false,
9223 temporary: false,
9224 language: None,
9225 deterministic: None,
9226 returns_null_on_null_input: None,
9227 security: None,
9228 has_parens: true,
9229 sql_data_access: None,
9230 returns_table_body: None,
9231 language_first: false,
9232 set_options: Vec::new(),
9233 strict: false,
9234 options: Vec::new(),
9235 is_table_function: false,
9236 property_order: Vec::new(),
9237 using_resources: Vec::new(),
9238 environment: Vec::new(),
9239 handler: None,
9240 handler_uses_eq: false,
9241 runtime_version: None,
9242 packages: None,
9243 parameter_style: None,
9244 }
9245 }
9246}
9247
9248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9250#[cfg_attr(feature = "bindings", derive(TS))]
9251pub struct DropFunction {
9252 pub name: TableRef,
9253 pub parameters: Option<Vec<DataType>>,
9254 pub if_exists: bool,
9255 pub cascade: bool,
9256}
9257
9258impl DropFunction {
9259 pub fn new(name: impl Into<String>) -> Self {
9260 Self {
9261 name: TableRef::new(name),
9262 parameters: None,
9263 if_exists: false,
9264 cascade: false,
9265 }
9266 }
9267}
9268
9269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9271#[cfg_attr(feature = "bindings", derive(TS))]
9272pub struct CreateProcedure {
9273 pub name: TableRef,
9274 pub parameters: Vec<FunctionParameter>,
9275 pub body: Option<FunctionBody>,
9276 pub or_replace: bool,
9277 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9279 pub or_alter: bool,
9280 pub if_not_exists: bool,
9281 pub language: Option<String>,
9282 pub security: Option<FunctionSecurity>,
9283 #[serde(default)]
9285 pub return_type: Option<DataType>,
9286 #[serde(default)]
9288 pub execute_as: Option<String>,
9289 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9291 pub with_options: Vec<String>,
9292 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9294 pub has_parens: bool,
9295 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9297 pub use_proc_keyword: bool,
9298}
9299
9300impl CreateProcedure {
9301 pub fn new(name: impl Into<String>) -> Self {
9302 Self {
9303 name: TableRef::new(name),
9304 parameters: Vec::new(),
9305 body: None,
9306 or_replace: false,
9307 or_alter: false,
9308 if_not_exists: false,
9309 language: None,
9310 security: None,
9311 return_type: None,
9312 execute_as: None,
9313 with_options: Vec::new(),
9314 has_parens: true,
9315 use_proc_keyword: false,
9316 }
9317 }
9318}
9319
9320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9322#[cfg_attr(feature = "bindings", derive(TS))]
9323pub struct DropProcedure {
9324 pub name: TableRef,
9325 pub parameters: Option<Vec<DataType>>,
9326 pub if_exists: bool,
9327 pub cascade: bool,
9328}
9329
9330impl DropProcedure {
9331 pub fn new(name: impl Into<String>) -> Self {
9332 Self {
9333 name: TableRef::new(name),
9334 parameters: None,
9335 if_exists: false,
9336 cascade: false,
9337 }
9338 }
9339}
9340
9341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9343#[cfg_attr(feature = "bindings", derive(TS))]
9344pub enum SeqPropKind {
9345 Start,
9346 Increment,
9347 Minvalue,
9348 Maxvalue,
9349 Cache,
9350 NoCache,
9351 Cycle,
9352 NoCycle,
9353 OwnedBy,
9354 Order,
9355 NoOrder,
9356 Comment,
9357 Sharing,
9359 Keep,
9361 NoKeep,
9363 Scale,
9365 NoScale,
9367 Shard,
9369 NoShard,
9371 Session,
9373 Global,
9375 NoCacheWord,
9377 NoCycleWord,
9379 NoMinvalueWord,
9381 NoMaxvalueWord,
9383}
9384
9385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9387#[cfg_attr(feature = "bindings", derive(TS))]
9388pub struct CreateSynonym {
9389 pub name: TableRef,
9391 pub target: TableRef,
9393}
9394
9395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9397#[cfg_attr(feature = "bindings", derive(TS))]
9398pub struct CreateSequence {
9399 pub name: TableRef,
9400 pub if_not_exists: bool,
9401 pub temporary: bool,
9402 #[serde(default)]
9403 pub or_replace: bool,
9404 #[serde(default, skip_serializing_if = "Option::is_none")]
9406 pub as_type: Option<DataType>,
9407 pub increment: Option<i64>,
9408 pub minvalue: Option<SequenceBound>,
9409 pub maxvalue: Option<SequenceBound>,
9410 pub start: Option<i64>,
9411 pub cache: Option<i64>,
9412 pub cycle: bool,
9413 pub owned_by: Option<TableRef>,
9414 #[serde(default)]
9416 pub owned_by_none: bool,
9417 #[serde(default)]
9419 pub order: Option<bool>,
9420 #[serde(default)]
9422 pub comment: Option<String>,
9423 #[serde(default, skip_serializing_if = "Option::is_none")]
9425 pub sharing: Option<String>,
9426 #[serde(default, skip_serializing_if = "Option::is_none")]
9428 pub scale_modifier: Option<String>,
9429 #[serde(default, skip_serializing_if = "Option::is_none")]
9431 pub shard_modifier: Option<String>,
9432 #[serde(default)]
9434 pub property_order: Vec<SeqPropKind>,
9435}
9436
9437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9439#[cfg_attr(feature = "bindings", derive(TS))]
9440pub enum SequenceBound {
9441 Value(i64),
9442 None,
9443}
9444
9445impl CreateSequence {
9446 pub fn new(name: impl Into<String>) -> Self {
9447 Self {
9448 name: TableRef::new(name),
9449 if_not_exists: false,
9450 temporary: false,
9451 or_replace: false,
9452 as_type: None,
9453 increment: None,
9454 minvalue: None,
9455 maxvalue: None,
9456 start: None,
9457 cache: None,
9458 cycle: false,
9459 owned_by: None,
9460 owned_by_none: false,
9461 order: None,
9462 comment: None,
9463 sharing: None,
9464 scale_modifier: None,
9465 shard_modifier: None,
9466 property_order: Vec::new(),
9467 }
9468 }
9469}
9470
9471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9473#[cfg_attr(feature = "bindings", derive(TS))]
9474pub struct DropSequence {
9475 pub name: TableRef,
9476 pub if_exists: bool,
9477 pub cascade: bool,
9478}
9479
9480impl DropSequence {
9481 pub fn new(name: impl Into<String>) -> Self {
9482 Self {
9483 name: TableRef::new(name),
9484 if_exists: false,
9485 cascade: false,
9486 }
9487 }
9488}
9489
9490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9492#[cfg_attr(feature = "bindings", derive(TS))]
9493pub struct AlterSequence {
9494 pub name: TableRef,
9495 pub if_exists: bool,
9496 pub increment: Option<i64>,
9497 pub minvalue: Option<SequenceBound>,
9498 pub maxvalue: Option<SequenceBound>,
9499 pub start: Option<i64>,
9500 pub restart: Option<Option<i64>>,
9501 pub cache: Option<i64>,
9502 pub cycle: Option<bool>,
9503 pub owned_by: Option<Option<TableRef>>,
9504}
9505
9506impl AlterSequence {
9507 pub fn new(name: impl Into<String>) -> Self {
9508 Self {
9509 name: TableRef::new(name),
9510 if_exists: false,
9511 increment: None,
9512 minvalue: None,
9513 maxvalue: None,
9514 start: None,
9515 restart: None,
9516 cache: None,
9517 cycle: None,
9518 owned_by: None,
9519 }
9520 }
9521}
9522
9523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9525#[cfg_attr(feature = "bindings", derive(TS))]
9526pub struct CreateTrigger {
9527 pub name: Identifier,
9528 pub table: TableRef,
9529 pub timing: TriggerTiming,
9530 pub events: Vec<TriggerEvent>,
9531 #[serde(default, skip_serializing_if = "Option::is_none")]
9532 pub for_each: Option<TriggerForEach>,
9533 pub when: Option<Expression>,
9534 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9536 pub when_paren: bool,
9537 pub body: TriggerBody,
9538 pub or_replace: bool,
9539 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9541 pub or_alter: bool,
9542 pub constraint: bool,
9543 pub deferrable: Option<bool>,
9544 pub initially_deferred: Option<bool>,
9545 pub referencing: Option<TriggerReferencing>,
9546}
9547
9548#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9550#[cfg_attr(feature = "bindings", derive(TS))]
9551pub enum TriggerTiming {
9552 Before,
9553 After,
9554 InsteadOf,
9555}
9556
9557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9559#[cfg_attr(feature = "bindings", derive(TS))]
9560pub enum TriggerEvent {
9561 Insert,
9562 Update(Option<Vec<Identifier>>),
9563 Delete,
9564 Truncate,
9565}
9566
9567#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9569#[cfg_attr(feature = "bindings", derive(TS))]
9570pub enum TriggerForEach {
9571 Row,
9572 Statement,
9573}
9574
9575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9577#[cfg_attr(feature = "bindings", derive(TS))]
9578pub enum TriggerBody {
9579 Execute {
9581 function: TableRef,
9582 args: Vec<Expression>,
9583 },
9584 Block(String),
9586}
9587
9588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9590#[cfg_attr(feature = "bindings", derive(TS))]
9591pub struct TriggerReferencing {
9592 pub old_table: Option<Identifier>,
9593 pub new_table: Option<Identifier>,
9594 pub old_row: Option<Identifier>,
9595 pub new_row: Option<Identifier>,
9596}
9597
9598impl CreateTrigger {
9599 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9600 Self {
9601 name: Identifier::new(name),
9602 table: TableRef::new(table),
9603 timing: TriggerTiming::Before,
9604 events: Vec::new(),
9605 for_each: Some(TriggerForEach::Row),
9606 when: None,
9607 when_paren: false,
9608 body: TriggerBody::Execute {
9609 function: TableRef::new(""),
9610 args: Vec::new(),
9611 },
9612 or_replace: false,
9613 or_alter: false,
9614 constraint: false,
9615 deferrable: None,
9616 initially_deferred: None,
9617 referencing: None,
9618 }
9619 }
9620}
9621
9622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9624#[cfg_attr(feature = "bindings", derive(TS))]
9625pub struct DropTrigger {
9626 pub name: Identifier,
9627 pub table: Option<TableRef>,
9628 pub if_exists: bool,
9629 pub cascade: bool,
9630}
9631
9632impl DropTrigger {
9633 pub fn new(name: impl Into<String>) -> Self {
9634 Self {
9635 name: Identifier::new(name),
9636 table: None,
9637 if_exists: false,
9638 cascade: false,
9639 }
9640 }
9641}
9642
9643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9645#[cfg_attr(feature = "bindings", derive(TS))]
9646pub struct CreateType {
9647 pub name: TableRef,
9648 pub definition: TypeDefinition,
9649 pub if_not_exists: bool,
9650}
9651
9652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9654#[cfg_attr(feature = "bindings", derive(TS))]
9655pub enum TypeDefinition {
9656 Enum(Vec<String>),
9658 Composite(Vec<TypeAttribute>),
9660 Range {
9662 subtype: DataType,
9663 subtype_diff: Option<String>,
9664 canonical: Option<String>,
9665 },
9666 Base {
9668 input: String,
9669 output: String,
9670 internallength: Option<i32>,
9671 },
9672 Domain {
9674 base_type: DataType,
9675 default: Option<Expression>,
9676 constraints: Vec<DomainConstraint>,
9677 },
9678}
9679
9680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9682#[cfg_attr(feature = "bindings", derive(TS))]
9683pub struct TypeAttribute {
9684 pub name: Identifier,
9685 pub data_type: DataType,
9686 pub collate: Option<Identifier>,
9687}
9688
9689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9691#[cfg_attr(feature = "bindings", derive(TS))]
9692pub struct DomainConstraint {
9693 pub name: Option<Identifier>,
9694 pub check: Expression,
9695}
9696
9697impl CreateType {
9698 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9699 Self {
9700 name: TableRef::new(name),
9701 definition: TypeDefinition::Enum(values),
9702 if_not_exists: false,
9703 }
9704 }
9705
9706 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9707 Self {
9708 name: TableRef::new(name),
9709 definition: TypeDefinition::Composite(attributes),
9710 if_not_exists: false,
9711 }
9712 }
9713}
9714
9715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9717#[cfg_attr(feature = "bindings", derive(TS))]
9718pub struct DropType {
9719 pub name: TableRef,
9720 pub if_exists: bool,
9721 pub cascade: bool,
9722}
9723
9724impl DropType {
9725 pub fn new(name: impl Into<String>) -> Self {
9726 Self {
9727 name: TableRef::new(name),
9728 if_exists: false,
9729 cascade: false,
9730 }
9731 }
9732}
9733
9734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9736#[cfg_attr(feature = "bindings", derive(TS))]
9737pub struct Describe {
9738 pub target: Expression,
9740 pub extended: bool,
9742 pub formatted: bool,
9744 #[serde(default)]
9746 pub kind: Option<String>,
9747 #[serde(default)]
9749 pub properties: Vec<(String, String)>,
9750 #[serde(default, skip_serializing_if = "Option::is_none")]
9752 pub style: Option<String>,
9753 #[serde(default)]
9755 pub partition: Option<Box<Expression>>,
9756 #[serde(default)]
9758 pub leading_comments: Vec<String>,
9759 #[serde(default)]
9761 pub as_json: bool,
9762 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9764 pub params: Vec<String>,
9765}
9766
9767impl Describe {
9768 pub fn new(target: Expression) -> Self {
9769 Self {
9770 target,
9771 extended: false,
9772 formatted: false,
9773 kind: None,
9774 properties: Vec::new(),
9775 style: None,
9776 partition: None,
9777 leading_comments: Vec::new(),
9778 as_json: false,
9779 params: Vec::new(),
9780 }
9781 }
9782}
9783
9784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9786#[cfg_attr(feature = "bindings", derive(TS))]
9787pub struct Show {
9788 pub this: String,
9790 #[serde(default)]
9792 pub terse: bool,
9793 #[serde(default)]
9795 pub history: bool,
9796 pub like: Option<Expression>,
9798 pub scope_kind: Option<String>,
9800 pub scope: Option<Expression>,
9802 pub starts_with: Option<Expression>,
9804 pub limit: Option<Box<Limit>>,
9806 pub from: Option<Expression>,
9808 #[serde(default, skip_serializing_if = "Option::is_none")]
9810 pub where_clause: Option<Expression>,
9811 #[serde(default, skip_serializing_if = "Option::is_none")]
9813 pub for_target: Option<Expression>,
9814 #[serde(default, skip_serializing_if = "Option::is_none")]
9816 pub db: Option<Expression>,
9817 #[serde(default, skip_serializing_if = "Option::is_none")]
9819 pub target: Option<Expression>,
9820 #[serde(default, skip_serializing_if = "Option::is_none")]
9822 pub mutex: Option<bool>,
9823 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9825 pub privileges: Vec<String>,
9826}
9827
9828impl Show {
9829 pub fn new(this: impl Into<String>) -> Self {
9830 Self {
9831 this: this.into(),
9832 terse: false,
9833 history: false,
9834 like: None,
9835 scope_kind: None,
9836 scope: None,
9837 starts_with: None,
9838 limit: None,
9839 from: None,
9840 where_clause: None,
9841 for_target: None,
9842 db: None,
9843 target: None,
9844 mutex: None,
9845 privileges: Vec::new(),
9846 }
9847 }
9848}
9849
9850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9855#[cfg_attr(feature = "bindings", derive(TS))]
9856pub struct Paren {
9857 pub this: Expression,
9859 #[serde(default)]
9860 pub trailing_comments: Vec<String>,
9861}
9862
9863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9865#[cfg_attr(feature = "bindings", derive(TS))]
9866pub struct Annotated {
9867 pub this: Expression,
9868 pub trailing_comments: Vec<String>,
9869}
9870
9871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9876#[cfg_attr(feature = "bindings", derive(TS))]
9877pub struct Refresh {
9878 pub this: Box<Expression>,
9879 pub kind: String,
9880}
9881
9882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9884#[cfg_attr(feature = "bindings", derive(TS))]
9885pub struct LockingStatement {
9886 pub this: Box<Expression>,
9887 pub expression: Box<Expression>,
9888}
9889
9890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9892#[cfg_attr(feature = "bindings", derive(TS))]
9893pub struct SequenceProperties {
9894 #[serde(default)]
9895 pub increment: Option<Box<Expression>>,
9896 #[serde(default)]
9897 pub minvalue: Option<Box<Expression>>,
9898 #[serde(default)]
9899 pub maxvalue: Option<Box<Expression>>,
9900 #[serde(default)]
9901 pub cache: Option<Box<Expression>>,
9902 #[serde(default)]
9903 pub start: Option<Box<Expression>>,
9904 #[serde(default)]
9905 pub owned: Option<Box<Expression>>,
9906 #[serde(default)]
9907 pub options: Vec<Expression>,
9908}
9909
9910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9912#[cfg_attr(feature = "bindings", derive(TS))]
9913pub struct TruncateTable {
9914 #[serde(default)]
9915 pub expressions: Vec<Expression>,
9916 #[serde(default)]
9917 pub is_database: Option<Box<Expression>>,
9918 #[serde(default)]
9919 pub exists: bool,
9920 #[serde(default)]
9921 pub only: Option<Box<Expression>>,
9922 #[serde(default)]
9923 pub cluster: Option<Box<Expression>>,
9924 #[serde(default)]
9925 pub identity: Option<Box<Expression>>,
9926 #[serde(default)]
9927 pub option: Option<Box<Expression>>,
9928 #[serde(default)]
9929 pub partition: Option<Box<Expression>>,
9930}
9931
9932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9934#[cfg_attr(feature = "bindings", derive(TS))]
9935pub struct Clone {
9936 pub this: Box<Expression>,
9937 #[serde(default)]
9938 pub shallow: Option<Box<Expression>>,
9939 #[serde(default)]
9940 pub copy: Option<Box<Expression>>,
9941}
9942
9943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9945#[cfg_attr(feature = "bindings", derive(TS))]
9946pub struct Attach {
9947 pub this: Box<Expression>,
9948 #[serde(default)]
9949 pub exists: bool,
9950 #[serde(default)]
9951 pub expressions: Vec<Expression>,
9952}
9953
9954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9956#[cfg_attr(feature = "bindings", derive(TS))]
9957pub struct Detach {
9958 pub this: Box<Expression>,
9959 #[serde(default)]
9960 pub exists: bool,
9961}
9962
9963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9965#[cfg_attr(feature = "bindings", derive(TS))]
9966pub struct Install {
9967 pub this: Box<Expression>,
9968 #[serde(default)]
9969 pub from_: Option<Box<Expression>>,
9970 #[serde(default)]
9971 pub force: Option<Box<Expression>>,
9972}
9973
9974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9976#[cfg_attr(feature = "bindings", derive(TS))]
9977pub struct Summarize {
9978 pub this: Box<Expression>,
9979 #[serde(default)]
9980 pub table: Option<Box<Expression>>,
9981}
9982
9983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9985#[cfg_attr(feature = "bindings", derive(TS))]
9986pub struct Declare {
9987 #[serde(default)]
9988 pub expressions: Vec<Expression>,
9989 #[serde(default)]
9990 pub replace: bool,
9991}
9992
9993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9995#[cfg_attr(feature = "bindings", derive(TS))]
9996pub struct DeclareItem {
9997 pub this: Box<Expression>,
9998 #[serde(default)]
9999 pub kind: Option<String>,
10000 #[serde(default)]
10001 pub default: Option<Box<Expression>>,
10002 #[serde(default)]
10003 pub has_as: bool,
10004 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10006 pub additional_names: Vec<Expression>,
10007}
10008
10009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10011#[cfg_attr(feature = "bindings", derive(TS))]
10012pub struct Set {
10013 #[serde(default)]
10014 pub expressions: Vec<Expression>,
10015 #[serde(default)]
10016 pub unset: Option<Box<Expression>>,
10017 #[serde(default)]
10018 pub tag: Option<Box<Expression>>,
10019}
10020
10021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10023#[cfg_attr(feature = "bindings", derive(TS))]
10024pub struct Heredoc {
10025 pub this: Box<Expression>,
10026 #[serde(default)]
10027 pub tag: Option<Box<Expression>>,
10028}
10029
10030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10032#[cfg_attr(feature = "bindings", derive(TS))]
10033pub struct QueryBand {
10034 pub this: Box<Expression>,
10035 #[serde(default)]
10036 pub scope: Option<Box<Expression>>,
10037 #[serde(default)]
10038 pub update: Option<Box<Expression>>,
10039}
10040
10041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10043#[cfg_attr(feature = "bindings", derive(TS))]
10044pub struct UserDefinedFunction {
10045 pub this: Box<Expression>,
10046 #[serde(default)]
10047 pub expressions: Vec<Expression>,
10048 #[serde(default)]
10049 pub wrapped: Option<Box<Expression>>,
10050}
10051
10052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10054#[cfg_attr(feature = "bindings", derive(TS))]
10055pub struct RecursiveWithSearch {
10056 pub kind: String,
10057 pub this: Box<Expression>,
10058 pub expression: Box<Expression>,
10059 #[serde(default)]
10060 pub using: Option<Box<Expression>>,
10061}
10062
10063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10065#[cfg_attr(feature = "bindings", derive(TS))]
10066pub struct ProjectionDef {
10067 pub this: Box<Expression>,
10068 pub expression: Box<Expression>,
10069}
10070
10071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10073#[cfg_attr(feature = "bindings", derive(TS))]
10074pub struct TableAlias {
10075 #[serde(default)]
10076 pub this: Option<Box<Expression>>,
10077 #[serde(default)]
10078 pub columns: Vec<Expression>,
10079}
10080
10081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10083#[cfg_attr(feature = "bindings", derive(TS))]
10084pub struct ByteString {
10085 pub this: Box<Expression>,
10086 #[serde(default)]
10087 pub is_bytes: Option<Box<Expression>>,
10088}
10089
10090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10093#[cfg_attr(feature = "bindings", derive(TS))]
10094pub struct HexStringExpr {
10095 pub this: Box<Expression>,
10096 #[serde(default)]
10097 pub is_integer: Option<bool>,
10098}
10099
10100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10102#[cfg_attr(feature = "bindings", derive(TS))]
10103pub struct UnicodeString {
10104 pub this: Box<Expression>,
10105 #[serde(default)]
10106 pub escape: Option<Box<Expression>>,
10107}
10108
10109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10111#[cfg_attr(feature = "bindings", derive(TS))]
10112pub struct AlterColumn {
10113 pub this: Box<Expression>,
10114 #[serde(default)]
10115 pub dtype: Option<Box<Expression>>,
10116 #[serde(default)]
10117 pub collate: Option<Box<Expression>>,
10118 #[serde(default)]
10119 pub using: Option<Box<Expression>>,
10120 #[serde(default)]
10121 pub default: Option<Box<Expression>>,
10122 #[serde(default)]
10123 pub drop: Option<Box<Expression>>,
10124 #[serde(default)]
10125 pub comment: Option<Box<Expression>>,
10126 #[serde(default)]
10127 pub allow_null: Option<Box<Expression>>,
10128 #[serde(default)]
10129 pub visible: Option<Box<Expression>>,
10130 #[serde(default)]
10131 pub rename_to: Option<Box<Expression>>,
10132}
10133
10134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10136#[cfg_attr(feature = "bindings", derive(TS))]
10137pub struct AlterSortKey {
10138 #[serde(default)]
10139 pub this: Option<Box<Expression>>,
10140 #[serde(default)]
10141 pub expressions: Vec<Expression>,
10142 #[serde(default)]
10143 pub compound: Option<Box<Expression>>,
10144}
10145
10146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10148#[cfg_attr(feature = "bindings", derive(TS))]
10149pub struct AlterSet {
10150 #[serde(default)]
10151 pub expressions: Vec<Expression>,
10152 #[serde(default)]
10153 pub option: Option<Box<Expression>>,
10154 #[serde(default)]
10155 pub tablespace: Option<Box<Expression>>,
10156 #[serde(default)]
10157 pub access_method: Option<Box<Expression>>,
10158 #[serde(default)]
10159 pub file_format: Option<Box<Expression>>,
10160 #[serde(default)]
10161 pub copy_options: Option<Box<Expression>>,
10162 #[serde(default)]
10163 pub tag: Option<Box<Expression>>,
10164 #[serde(default)]
10165 pub location: Option<Box<Expression>>,
10166 #[serde(default)]
10167 pub serde: Option<Box<Expression>>,
10168}
10169
10170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10172#[cfg_attr(feature = "bindings", derive(TS))]
10173pub struct RenameColumn {
10174 pub this: Box<Expression>,
10175 #[serde(default)]
10176 pub to: Option<Box<Expression>>,
10177 #[serde(default)]
10178 pub exists: bool,
10179}
10180
10181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10183#[cfg_attr(feature = "bindings", derive(TS))]
10184pub struct Comprehension {
10185 pub this: Box<Expression>,
10186 pub expression: Box<Expression>,
10187 #[serde(default)]
10188 pub position: Option<Box<Expression>>,
10189 #[serde(default)]
10190 pub iterator: Option<Box<Expression>>,
10191 #[serde(default)]
10192 pub condition: Option<Box<Expression>>,
10193}
10194
10195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10197#[cfg_attr(feature = "bindings", derive(TS))]
10198pub struct MergeTreeTTLAction {
10199 pub this: Box<Expression>,
10200 #[serde(default)]
10201 pub delete: Option<Box<Expression>>,
10202 #[serde(default)]
10203 pub recompress: Option<Box<Expression>>,
10204 #[serde(default)]
10205 pub to_disk: Option<Box<Expression>>,
10206 #[serde(default)]
10207 pub to_volume: Option<Box<Expression>>,
10208}
10209
10210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10212#[cfg_attr(feature = "bindings", derive(TS))]
10213pub struct MergeTreeTTL {
10214 #[serde(default)]
10215 pub expressions: Vec<Expression>,
10216 #[serde(default)]
10217 pub where_: Option<Box<Expression>>,
10218 #[serde(default)]
10219 pub group: Option<Box<Expression>>,
10220 #[serde(default)]
10221 pub aggregates: Option<Box<Expression>>,
10222}
10223
10224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10226#[cfg_attr(feature = "bindings", derive(TS))]
10227pub struct IndexConstraintOption {
10228 #[serde(default)]
10229 pub key_block_size: Option<Box<Expression>>,
10230 #[serde(default)]
10231 pub using: Option<Box<Expression>>,
10232 #[serde(default)]
10233 pub parser: Option<Box<Expression>>,
10234 #[serde(default)]
10235 pub comment: Option<Box<Expression>>,
10236 #[serde(default)]
10237 pub visible: Option<Box<Expression>>,
10238 #[serde(default)]
10239 pub engine_attr: Option<Box<Expression>>,
10240 #[serde(default)]
10241 pub secondary_engine_attr: Option<Box<Expression>>,
10242}
10243
10244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10246#[cfg_attr(feature = "bindings", derive(TS))]
10247pub struct PeriodForSystemTimeConstraint {
10248 pub this: Box<Expression>,
10249 pub expression: Box<Expression>,
10250}
10251
10252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10254#[cfg_attr(feature = "bindings", derive(TS))]
10255pub struct CaseSpecificColumnConstraint {
10256 #[serde(default)]
10257 pub not_: Option<Box<Expression>>,
10258}
10259
10260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10262#[cfg_attr(feature = "bindings", derive(TS))]
10263pub struct CharacterSetColumnConstraint {
10264 pub this: Box<Expression>,
10265}
10266
10267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10269#[cfg_attr(feature = "bindings", derive(TS))]
10270pub struct CheckColumnConstraint {
10271 pub this: Box<Expression>,
10272 #[serde(default)]
10273 pub enforced: Option<Box<Expression>>,
10274}
10275
10276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10278#[cfg_attr(feature = "bindings", derive(TS))]
10279pub struct AssumeColumnConstraint {
10280 pub this: Box<Expression>,
10281}
10282
10283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10285#[cfg_attr(feature = "bindings", derive(TS))]
10286pub struct CompressColumnConstraint {
10287 #[serde(default)]
10288 pub this: Option<Box<Expression>>,
10289}
10290
10291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10293#[cfg_attr(feature = "bindings", derive(TS))]
10294pub struct DateFormatColumnConstraint {
10295 pub this: Box<Expression>,
10296}
10297
10298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10300#[cfg_attr(feature = "bindings", derive(TS))]
10301pub struct EphemeralColumnConstraint {
10302 #[serde(default)]
10303 pub this: Option<Box<Expression>>,
10304}
10305
10306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10308#[cfg_attr(feature = "bindings", derive(TS))]
10309pub struct WithOperator {
10310 pub this: Box<Expression>,
10311 pub op: String,
10312}
10313
10314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10316#[cfg_attr(feature = "bindings", derive(TS))]
10317pub struct GeneratedAsIdentityColumnConstraint {
10318 #[serde(default)]
10319 pub this: Option<Box<Expression>>,
10320 #[serde(default)]
10321 pub expression: Option<Box<Expression>>,
10322 #[serde(default)]
10323 pub on_null: Option<Box<Expression>>,
10324 #[serde(default)]
10325 pub start: Option<Box<Expression>>,
10326 #[serde(default)]
10327 pub increment: Option<Box<Expression>>,
10328 #[serde(default)]
10329 pub minvalue: Option<Box<Expression>>,
10330 #[serde(default)]
10331 pub maxvalue: Option<Box<Expression>>,
10332 #[serde(default)]
10333 pub cycle: Option<Box<Expression>>,
10334 #[serde(default)]
10335 pub order: Option<Box<Expression>>,
10336}
10337
10338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10341#[cfg_attr(feature = "bindings", derive(TS))]
10342pub struct AutoIncrementColumnConstraint;
10343
10344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10346#[cfg_attr(feature = "bindings", derive(TS))]
10347pub struct CommentColumnConstraint;
10348
10349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10351#[cfg_attr(feature = "bindings", derive(TS))]
10352pub struct GeneratedAsRowColumnConstraint {
10353 #[serde(default)]
10354 pub start: Option<Box<Expression>>,
10355 #[serde(default)]
10356 pub hidden: Option<Box<Expression>>,
10357}
10358
10359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10361#[cfg_attr(feature = "bindings", derive(TS))]
10362pub struct IndexColumnConstraint {
10363 #[serde(default)]
10364 pub this: Option<Box<Expression>>,
10365 #[serde(default)]
10366 pub expressions: Vec<Expression>,
10367 #[serde(default)]
10368 pub kind: Option<String>,
10369 #[serde(default)]
10370 pub index_type: Option<Box<Expression>>,
10371 #[serde(default)]
10372 pub options: Vec<Expression>,
10373 #[serde(default)]
10374 pub expression: Option<Box<Expression>>,
10375 #[serde(default)]
10376 pub granularity: Option<Box<Expression>>,
10377}
10378
10379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10381#[cfg_attr(feature = "bindings", derive(TS))]
10382pub struct MaskingPolicyColumnConstraint {
10383 pub this: Box<Expression>,
10384 #[serde(default)]
10385 pub expressions: Vec<Expression>,
10386}
10387
10388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10390#[cfg_attr(feature = "bindings", derive(TS))]
10391pub struct NotNullColumnConstraint {
10392 #[serde(default)]
10393 pub allow_null: Option<Box<Expression>>,
10394}
10395
10396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10398#[cfg_attr(feature = "bindings", derive(TS))]
10399pub struct DefaultColumnConstraint {
10400 pub this: Box<Expression>,
10401 #[serde(default, skip_serializing_if = "Option::is_none")]
10403 pub for_column: Option<Identifier>,
10404}
10405
10406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10408#[cfg_attr(feature = "bindings", derive(TS))]
10409pub struct PrimaryKeyColumnConstraint {
10410 #[serde(default)]
10411 pub desc: Option<Box<Expression>>,
10412 #[serde(default)]
10413 pub options: Vec<Expression>,
10414}
10415
10416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10418#[cfg_attr(feature = "bindings", derive(TS))]
10419pub struct UniqueColumnConstraint {
10420 #[serde(default)]
10421 pub this: Option<Box<Expression>>,
10422 #[serde(default)]
10423 pub index_type: Option<Box<Expression>>,
10424 #[serde(default)]
10425 pub on_conflict: Option<Box<Expression>>,
10426 #[serde(default)]
10427 pub nulls: Option<Box<Expression>>,
10428 #[serde(default)]
10429 pub options: Vec<Expression>,
10430}
10431
10432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10434#[cfg_attr(feature = "bindings", derive(TS))]
10435pub struct WatermarkColumnConstraint {
10436 pub this: Box<Expression>,
10437 pub expression: Box<Expression>,
10438}
10439
10440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10442#[cfg_attr(feature = "bindings", derive(TS))]
10443pub struct ComputedColumnConstraint {
10444 pub this: Box<Expression>,
10445 #[serde(default)]
10446 pub persisted: Option<Box<Expression>>,
10447 #[serde(default)]
10448 pub not_null: Option<Box<Expression>>,
10449 #[serde(default)]
10450 pub data_type: Option<Box<Expression>>,
10451}
10452
10453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10455#[cfg_attr(feature = "bindings", derive(TS))]
10456pub struct InOutColumnConstraint {
10457 #[serde(default)]
10458 pub input_: Option<Box<Expression>>,
10459 #[serde(default)]
10460 pub output: Option<Box<Expression>>,
10461}
10462
10463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10465#[cfg_attr(feature = "bindings", derive(TS))]
10466pub struct PathColumnConstraint {
10467 pub this: Box<Expression>,
10468}
10469
10470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10472#[cfg_attr(feature = "bindings", derive(TS))]
10473pub struct Constraint {
10474 pub this: Box<Expression>,
10475 #[serde(default)]
10476 pub expressions: Vec<Expression>,
10477}
10478
10479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10481#[cfg_attr(feature = "bindings", derive(TS))]
10482pub struct Export {
10483 pub this: Box<Expression>,
10484 #[serde(default)]
10485 pub connection: Option<Box<Expression>>,
10486 #[serde(default)]
10487 pub options: Vec<Expression>,
10488}
10489
10490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10492#[cfg_attr(feature = "bindings", derive(TS))]
10493pub struct Filter {
10494 pub this: Box<Expression>,
10495 pub expression: Box<Expression>,
10496}
10497
10498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10500#[cfg_attr(feature = "bindings", derive(TS))]
10501pub struct Changes {
10502 #[serde(default)]
10503 pub information: Option<Box<Expression>>,
10504 #[serde(default)]
10505 pub at_before: Option<Box<Expression>>,
10506 #[serde(default)]
10507 pub end: Option<Box<Expression>>,
10508}
10509
10510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10512#[cfg_attr(feature = "bindings", derive(TS))]
10513pub struct Directory {
10514 pub this: Box<Expression>,
10515 #[serde(default)]
10516 pub local: Option<Box<Expression>>,
10517 #[serde(default)]
10518 pub row_format: Option<Box<Expression>>,
10519}
10520
10521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10523#[cfg_attr(feature = "bindings", derive(TS))]
10524pub struct ForeignKey {
10525 #[serde(default)]
10526 pub expressions: Vec<Expression>,
10527 #[serde(default)]
10528 pub reference: Option<Box<Expression>>,
10529 #[serde(default)]
10530 pub delete: Option<Box<Expression>>,
10531 #[serde(default)]
10532 pub update: Option<Box<Expression>>,
10533 #[serde(default)]
10534 pub options: Vec<Expression>,
10535}
10536
10537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10539#[cfg_attr(feature = "bindings", derive(TS))]
10540pub struct ColumnPrefix {
10541 pub this: Box<Expression>,
10542 pub expression: Box<Expression>,
10543}
10544
10545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10547#[cfg_attr(feature = "bindings", derive(TS))]
10548pub struct PrimaryKey {
10549 #[serde(default)]
10550 pub this: Option<Box<Expression>>,
10551 #[serde(default)]
10552 pub expressions: Vec<Expression>,
10553 #[serde(default)]
10554 pub options: Vec<Expression>,
10555 #[serde(default)]
10556 pub include: Option<Box<Expression>>,
10557}
10558
10559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10561#[cfg_attr(feature = "bindings", derive(TS))]
10562pub struct IntoClause {
10563 #[serde(default)]
10564 pub this: Option<Box<Expression>>,
10565 #[serde(default)]
10566 pub temporary: bool,
10567 #[serde(default)]
10568 pub unlogged: Option<Box<Expression>>,
10569 #[serde(default)]
10570 pub bulk_collect: Option<Box<Expression>>,
10571 #[serde(default)]
10572 pub expressions: Vec<Expression>,
10573}
10574
10575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10577#[cfg_attr(feature = "bindings", derive(TS))]
10578pub struct JoinHint {
10579 pub this: Box<Expression>,
10580 #[serde(default)]
10581 pub expressions: Vec<Expression>,
10582}
10583
10584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10586#[cfg_attr(feature = "bindings", derive(TS))]
10587pub struct Opclass {
10588 pub this: Box<Expression>,
10589 pub expression: Box<Expression>,
10590}
10591
10592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10594#[cfg_attr(feature = "bindings", derive(TS))]
10595pub struct Index {
10596 #[serde(default)]
10597 pub this: Option<Box<Expression>>,
10598 #[serde(default)]
10599 pub table: Option<Box<Expression>>,
10600 #[serde(default)]
10601 pub unique: bool,
10602 #[serde(default)]
10603 pub primary: Option<Box<Expression>>,
10604 #[serde(default)]
10605 pub amp: Option<Box<Expression>>,
10606 #[serde(default)]
10607 pub params: Vec<Expression>,
10608}
10609
10610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10612#[cfg_attr(feature = "bindings", derive(TS))]
10613pub struct IndexParameters {
10614 #[serde(default)]
10615 pub using: Option<Box<Expression>>,
10616 #[serde(default)]
10617 pub include: Option<Box<Expression>>,
10618 #[serde(default)]
10619 pub columns: Vec<Expression>,
10620 #[serde(default)]
10621 pub with_storage: Option<Box<Expression>>,
10622 #[serde(default)]
10623 pub partition_by: Option<Box<Expression>>,
10624 #[serde(default)]
10625 pub tablespace: Option<Box<Expression>>,
10626 #[serde(default)]
10627 pub where_: Option<Box<Expression>>,
10628 #[serde(default)]
10629 pub on: Option<Box<Expression>>,
10630}
10631
10632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10634#[cfg_attr(feature = "bindings", derive(TS))]
10635pub struct ConditionalInsert {
10636 pub this: Box<Expression>,
10637 #[serde(default)]
10638 pub expression: Option<Box<Expression>>,
10639 #[serde(default)]
10640 pub else_: Option<Box<Expression>>,
10641}
10642
10643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10645#[cfg_attr(feature = "bindings", derive(TS))]
10646pub struct MultitableInserts {
10647 #[serde(default)]
10648 pub expressions: Vec<Expression>,
10649 pub kind: String,
10650 #[serde(default)]
10651 pub source: Option<Box<Expression>>,
10652 #[serde(default)]
10654 pub leading_comments: Vec<String>,
10655 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10657 pub overwrite: bool,
10658}
10659
10660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10662#[cfg_attr(feature = "bindings", derive(TS))]
10663pub struct OnConflict {
10664 #[serde(default)]
10665 pub duplicate: Option<Box<Expression>>,
10666 #[serde(default)]
10667 pub expressions: Vec<Expression>,
10668 #[serde(default)]
10669 pub action: Option<Box<Expression>>,
10670 #[serde(default)]
10671 pub conflict_keys: Option<Box<Expression>>,
10672 #[serde(default)]
10673 pub index_predicate: Option<Box<Expression>>,
10674 #[serde(default)]
10675 pub constraint: Option<Box<Expression>>,
10676 #[serde(default)]
10677 pub where_: Option<Box<Expression>>,
10678}
10679
10680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10682#[cfg_attr(feature = "bindings", derive(TS))]
10683pub struct OnCondition {
10684 #[serde(default)]
10685 pub error: Option<Box<Expression>>,
10686 #[serde(default)]
10687 pub empty: Option<Box<Expression>>,
10688 #[serde(default)]
10689 pub null: Option<Box<Expression>>,
10690}
10691
10692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10694#[cfg_attr(feature = "bindings", derive(TS))]
10695pub struct Returning {
10696 #[serde(default)]
10697 pub expressions: Vec<Expression>,
10698 #[serde(default)]
10699 pub into: Option<Box<Expression>>,
10700}
10701
10702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10704#[cfg_attr(feature = "bindings", derive(TS))]
10705pub struct Introducer {
10706 pub this: Box<Expression>,
10707 pub expression: Box<Expression>,
10708}
10709
10710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10712#[cfg_attr(feature = "bindings", derive(TS))]
10713pub struct PartitionRange {
10714 pub this: Box<Expression>,
10715 #[serde(default)]
10716 pub expression: Option<Box<Expression>>,
10717 #[serde(default)]
10718 pub expressions: Vec<Expression>,
10719}
10720
10721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10723#[cfg_attr(feature = "bindings", derive(TS))]
10724pub struct Group {
10725 #[serde(default)]
10726 pub expressions: Vec<Expression>,
10727 #[serde(default)]
10728 pub grouping_sets: Option<Box<Expression>>,
10729 #[serde(default)]
10730 pub cube: Option<Box<Expression>>,
10731 #[serde(default)]
10732 pub rollup: Option<Box<Expression>>,
10733 #[serde(default)]
10734 pub totals: Option<Box<Expression>>,
10735 #[serde(default)]
10737 pub all: Option<bool>,
10738}
10739
10740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10742#[cfg_attr(feature = "bindings", derive(TS))]
10743pub struct Cube {
10744 #[serde(default)]
10745 pub expressions: Vec<Expression>,
10746}
10747
10748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10750#[cfg_attr(feature = "bindings", derive(TS))]
10751pub struct Rollup {
10752 #[serde(default)]
10753 pub expressions: Vec<Expression>,
10754}
10755
10756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10758#[cfg_attr(feature = "bindings", derive(TS))]
10759pub struct GroupingSets {
10760 #[serde(default)]
10761 pub expressions: Vec<Expression>,
10762}
10763
10764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10766#[cfg_attr(feature = "bindings", derive(TS))]
10767pub struct LimitOptions {
10768 #[serde(default)]
10769 pub percent: Option<Box<Expression>>,
10770 #[serde(default)]
10771 pub rows: Option<Box<Expression>>,
10772 #[serde(default)]
10773 pub with_ties: Option<Box<Expression>>,
10774}
10775
10776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10778#[cfg_attr(feature = "bindings", derive(TS))]
10779pub struct Lateral {
10780 pub this: Box<Expression>,
10781 #[serde(default)]
10782 pub view: Option<Box<Expression>>,
10783 #[serde(default)]
10784 pub outer: Option<Box<Expression>>,
10785 #[serde(default)]
10786 pub alias: Option<String>,
10787 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10789 pub alias_quoted: bool,
10790 #[serde(default)]
10791 pub cross_apply: Option<Box<Expression>>,
10792 #[serde(default)]
10793 pub ordinality: Option<Box<Expression>>,
10794 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10796 pub column_aliases: Vec<String>,
10797}
10798
10799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10801#[cfg_attr(feature = "bindings", derive(TS))]
10802pub struct TableFromRows {
10803 pub this: Box<Expression>,
10804 #[serde(default)]
10805 pub alias: Option<String>,
10806 #[serde(default)]
10807 pub joins: Vec<Expression>,
10808 #[serde(default)]
10809 pub pivots: Option<Box<Expression>>,
10810 #[serde(default)]
10811 pub sample: Option<Box<Expression>>,
10812}
10813
10814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10817#[cfg_attr(feature = "bindings", derive(TS))]
10818pub struct RowsFrom {
10819 pub expressions: Vec<Expression>,
10821 #[serde(default)]
10823 pub ordinality: bool,
10824 #[serde(default)]
10826 pub alias: Option<Box<Expression>>,
10827}
10828
10829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10831#[cfg_attr(feature = "bindings", derive(TS))]
10832pub struct WithFill {
10833 #[serde(default)]
10834 pub from_: Option<Box<Expression>>,
10835 #[serde(default)]
10836 pub to: Option<Box<Expression>>,
10837 #[serde(default)]
10838 pub step: Option<Box<Expression>>,
10839 #[serde(default)]
10840 pub staleness: Option<Box<Expression>>,
10841 #[serde(default)]
10842 pub interpolate: Option<Box<Expression>>,
10843}
10844
10845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10847#[cfg_attr(feature = "bindings", derive(TS))]
10848pub struct Property {
10849 pub this: Box<Expression>,
10850 #[serde(default)]
10851 pub value: Option<Box<Expression>>,
10852}
10853
10854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10856#[cfg_attr(feature = "bindings", derive(TS))]
10857pub struct GrantPrivilege {
10858 pub this: Box<Expression>,
10859 #[serde(default)]
10860 pub expressions: Vec<Expression>,
10861}
10862
10863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10865#[cfg_attr(feature = "bindings", derive(TS))]
10866pub struct AllowedValuesProperty {
10867 #[serde(default)]
10868 pub expressions: Vec<Expression>,
10869}
10870
10871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10873#[cfg_attr(feature = "bindings", derive(TS))]
10874pub struct AlgorithmProperty {
10875 pub this: Box<Expression>,
10876}
10877
10878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10880#[cfg_attr(feature = "bindings", derive(TS))]
10881pub struct AutoIncrementProperty {
10882 pub this: Box<Expression>,
10883}
10884
10885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10887#[cfg_attr(feature = "bindings", derive(TS))]
10888pub struct AutoRefreshProperty {
10889 pub this: Box<Expression>,
10890}
10891
10892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10894#[cfg_attr(feature = "bindings", derive(TS))]
10895pub struct BackupProperty {
10896 pub this: Box<Expression>,
10897}
10898
10899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10901#[cfg_attr(feature = "bindings", derive(TS))]
10902pub struct BuildProperty {
10903 pub this: Box<Expression>,
10904}
10905
10906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10908#[cfg_attr(feature = "bindings", derive(TS))]
10909pub struct BlockCompressionProperty {
10910 #[serde(default)]
10911 pub autotemp: Option<Box<Expression>>,
10912 #[serde(default)]
10913 pub always: Option<Box<Expression>>,
10914 #[serde(default)]
10915 pub default: Option<Box<Expression>>,
10916 #[serde(default)]
10917 pub manual: Option<Box<Expression>>,
10918 #[serde(default)]
10919 pub never: Option<Box<Expression>>,
10920}
10921
10922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10924#[cfg_attr(feature = "bindings", derive(TS))]
10925pub struct CharacterSetProperty {
10926 pub this: Box<Expression>,
10927 #[serde(default)]
10928 pub default: Option<Box<Expression>>,
10929}
10930
10931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10933#[cfg_attr(feature = "bindings", derive(TS))]
10934pub struct ChecksumProperty {
10935 #[serde(default)]
10936 pub on: Option<Box<Expression>>,
10937 #[serde(default)]
10938 pub default: Option<Box<Expression>>,
10939}
10940
10941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10943#[cfg_attr(feature = "bindings", derive(TS))]
10944pub struct CollateProperty {
10945 pub this: Box<Expression>,
10946 #[serde(default)]
10947 pub default: Option<Box<Expression>>,
10948}
10949
10950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10952#[cfg_attr(feature = "bindings", derive(TS))]
10953pub struct DataBlocksizeProperty {
10954 #[serde(default)]
10955 pub size: Option<i64>,
10956 #[serde(default)]
10957 pub units: Option<Box<Expression>>,
10958 #[serde(default)]
10959 pub minimum: Option<Box<Expression>>,
10960 #[serde(default)]
10961 pub maximum: Option<Box<Expression>>,
10962 #[serde(default)]
10963 pub default: Option<Box<Expression>>,
10964}
10965
10966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10968#[cfg_attr(feature = "bindings", derive(TS))]
10969pub struct DataDeletionProperty {
10970 pub on: Box<Expression>,
10971 #[serde(default)]
10972 pub filter_column: Option<Box<Expression>>,
10973 #[serde(default)]
10974 pub retention_period: Option<Box<Expression>>,
10975}
10976
10977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10979#[cfg_attr(feature = "bindings", derive(TS))]
10980pub struct DefinerProperty {
10981 pub this: Box<Expression>,
10982}
10983
10984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10986#[cfg_attr(feature = "bindings", derive(TS))]
10987pub struct DistKeyProperty {
10988 pub this: Box<Expression>,
10989}
10990
10991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10993#[cfg_attr(feature = "bindings", derive(TS))]
10994pub struct DistributedByProperty {
10995 #[serde(default)]
10996 pub expressions: Vec<Expression>,
10997 pub kind: String,
10998 #[serde(default)]
10999 pub buckets: Option<Box<Expression>>,
11000 #[serde(default)]
11001 pub order: Option<Box<Expression>>,
11002}
11003
11004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11006#[cfg_attr(feature = "bindings", derive(TS))]
11007pub struct DistStyleProperty {
11008 pub this: Box<Expression>,
11009}
11010
11011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11013#[cfg_attr(feature = "bindings", derive(TS))]
11014pub struct DuplicateKeyProperty {
11015 #[serde(default)]
11016 pub expressions: Vec<Expression>,
11017}
11018
11019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11021#[cfg_attr(feature = "bindings", derive(TS))]
11022pub struct EngineProperty {
11023 pub this: Box<Expression>,
11024}
11025
11026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11028#[cfg_attr(feature = "bindings", derive(TS))]
11029pub struct ToTableProperty {
11030 pub this: Box<Expression>,
11031}
11032
11033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11035#[cfg_attr(feature = "bindings", derive(TS))]
11036pub struct ExecuteAsProperty {
11037 pub this: Box<Expression>,
11038}
11039
11040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11042#[cfg_attr(feature = "bindings", derive(TS))]
11043pub struct ExternalProperty {
11044 #[serde(default)]
11045 pub this: Option<Box<Expression>>,
11046}
11047
11048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11050#[cfg_attr(feature = "bindings", derive(TS))]
11051pub struct FallbackProperty {
11052 #[serde(default)]
11053 pub no: Option<Box<Expression>>,
11054 #[serde(default)]
11055 pub protection: Option<Box<Expression>>,
11056}
11057
11058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11060#[cfg_attr(feature = "bindings", derive(TS))]
11061pub struct FileFormatProperty {
11062 #[serde(default)]
11063 pub this: Option<Box<Expression>>,
11064 #[serde(default)]
11065 pub expressions: Vec<Expression>,
11066 #[serde(default)]
11067 pub hive_format: Option<Box<Expression>>,
11068}
11069
11070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11072#[cfg_attr(feature = "bindings", derive(TS))]
11073pub struct CredentialsProperty {
11074 #[serde(default)]
11075 pub expressions: Vec<Expression>,
11076}
11077
11078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11080#[cfg_attr(feature = "bindings", derive(TS))]
11081pub struct FreespaceProperty {
11082 pub this: Box<Expression>,
11083 #[serde(default)]
11084 pub percent: Option<Box<Expression>>,
11085}
11086
11087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11089#[cfg_attr(feature = "bindings", derive(TS))]
11090pub struct InheritsProperty {
11091 #[serde(default)]
11092 pub expressions: Vec<Expression>,
11093}
11094
11095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11097#[cfg_attr(feature = "bindings", derive(TS))]
11098pub struct InputModelProperty {
11099 pub this: Box<Expression>,
11100}
11101
11102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11104#[cfg_attr(feature = "bindings", derive(TS))]
11105pub struct OutputModelProperty {
11106 pub this: Box<Expression>,
11107}
11108
11109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11111#[cfg_attr(feature = "bindings", derive(TS))]
11112pub struct IsolatedLoadingProperty {
11113 #[serde(default)]
11114 pub no: Option<Box<Expression>>,
11115 #[serde(default)]
11116 pub concurrent: Option<Box<Expression>>,
11117 #[serde(default)]
11118 pub target: Option<Box<Expression>>,
11119}
11120
11121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11123#[cfg_attr(feature = "bindings", derive(TS))]
11124pub struct JournalProperty {
11125 #[serde(default)]
11126 pub no: Option<Box<Expression>>,
11127 #[serde(default)]
11128 pub dual: Option<Box<Expression>>,
11129 #[serde(default)]
11130 pub before: Option<Box<Expression>>,
11131 #[serde(default)]
11132 pub local: Option<Box<Expression>>,
11133 #[serde(default)]
11134 pub after: Option<Box<Expression>>,
11135}
11136
11137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11139#[cfg_attr(feature = "bindings", derive(TS))]
11140pub struct LanguageProperty {
11141 pub this: Box<Expression>,
11142}
11143
11144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11146#[cfg_attr(feature = "bindings", derive(TS))]
11147pub struct EnviromentProperty {
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 ClusteredByProperty {
11156 #[serde(default)]
11157 pub expressions: Vec<Expression>,
11158 #[serde(default)]
11159 pub sorted_by: Option<Box<Expression>>,
11160 #[serde(default)]
11161 pub buckets: Option<Box<Expression>>,
11162}
11163
11164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11166#[cfg_attr(feature = "bindings", derive(TS))]
11167pub struct DictProperty {
11168 pub this: Box<Expression>,
11169 pub kind: String,
11170 #[serde(default)]
11171 pub settings: Option<Box<Expression>>,
11172}
11173
11174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11176#[cfg_attr(feature = "bindings", derive(TS))]
11177pub struct DictRange {
11178 pub this: Box<Expression>,
11179 #[serde(default)]
11180 pub min: Option<Box<Expression>>,
11181 #[serde(default)]
11182 pub max: Option<Box<Expression>>,
11183}
11184
11185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11187#[cfg_attr(feature = "bindings", derive(TS))]
11188pub struct OnCluster {
11189 pub this: Box<Expression>,
11190}
11191
11192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11194#[cfg_attr(feature = "bindings", derive(TS))]
11195pub struct LikeProperty {
11196 pub this: Box<Expression>,
11197 #[serde(default)]
11198 pub expressions: Vec<Expression>,
11199}
11200
11201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11203#[cfg_attr(feature = "bindings", derive(TS))]
11204pub struct LocationProperty {
11205 pub this: Box<Expression>,
11206}
11207
11208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11210#[cfg_attr(feature = "bindings", derive(TS))]
11211pub struct LockProperty {
11212 pub this: Box<Expression>,
11213}
11214
11215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11217#[cfg_attr(feature = "bindings", derive(TS))]
11218pub struct LockingProperty {
11219 #[serde(default)]
11220 pub this: Option<Box<Expression>>,
11221 pub kind: String,
11222 #[serde(default)]
11223 pub for_or_in: Option<Box<Expression>>,
11224 #[serde(default)]
11225 pub lock_type: Option<Box<Expression>>,
11226 #[serde(default)]
11227 pub override_: Option<Box<Expression>>,
11228}
11229
11230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11232#[cfg_attr(feature = "bindings", derive(TS))]
11233pub struct LogProperty {
11234 #[serde(default)]
11235 pub no: Option<Box<Expression>>,
11236}
11237
11238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11240#[cfg_attr(feature = "bindings", derive(TS))]
11241pub struct MaterializedProperty {
11242 #[serde(default)]
11243 pub this: Option<Box<Expression>>,
11244}
11245
11246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11248#[cfg_attr(feature = "bindings", derive(TS))]
11249pub struct MergeBlockRatioProperty {
11250 #[serde(default)]
11251 pub this: Option<Box<Expression>>,
11252 #[serde(default)]
11253 pub no: Option<Box<Expression>>,
11254 #[serde(default)]
11255 pub default: Option<Box<Expression>>,
11256 #[serde(default)]
11257 pub percent: Option<Box<Expression>>,
11258}
11259
11260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11262#[cfg_attr(feature = "bindings", derive(TS))]
11263pub struct OnProperty {
11264 pub this: Box<Expression>,
11265}
11266
11267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11269#[cfg_attr(feature = "bindings", derive(TS))]
11270pub struct OnCommitProperty {
11271 #[serde(default)]
11272 pub delete: Option<Box<Expression>>,
11273}
11274
11275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11277#[cfg_attr(feature = "bindings", derive(TS))]
11278pub struct PartitionedByProperty {
11279 pub this: Box<Expression>,
11280}
11281
11282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11284#[cfg_attr(feature = "bindings", derive(TS))]
11285pub struct PartitionByProperty {
11286 #[serde(default)]
11287 pub expressions: Vec<Expression>,
11288}
11289
11290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11292#[cfg_attr(feature = "bindings", derive(TS))]
11293pub struct PartitionedByBucket {
11294 pub this: Box<Expression>,
11295 pub expression: Box<Expression>,
11296}
11297
11298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11300#[cfg_attr(feature = "bindings", derive(TS))]
11301pub struct ClusterByColumnsProperty {
11302 #[serde(default)]
11303 pub columns: Vec<Identifier>,
11304}
11305
11306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11308#[cfg_attr(feature = "bindings", derive(TS))]
11309pub struct PartitionByTruncate {
11310 pub this: Box<Expression>,
11311 pub expression: Box<Expression>,
11312}
11313
11314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11316#[cfg_attr(feature = "bindings", derive(TS))]
11317pub struct PartitionByRangeProperty {
11318 #[serde(default)]
11319 pub partition_expressions: Option<Box<Expression>>,
11320 #[serde(default)]
11321 pub create_expressions: Option<Box<Expression>>,
11322}
11323
11324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11326#[cfg_attr(feature = "bindings", derive(TS))]
11327pub struct PartitionByRangePropertyDynamic {
11328 #[serde(default)]
11329 pub this: Option<Box<Expression>>,
11330 #[serde(default)]
11331 pub start: Option<Box<Expression>>,
11332 #[serde(default)]
11334 pub use_start_end: bool,
11335 #[serde(default)]
11336 pub end: Option<Box<Expression>>,
11337 #[serde(default)]
11338 pub every: Option<Box<Expression>>,
11339}
11340
11341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11343#[cfg_attr(feature = "bindings", derive(TS))]
11344pub struct PartitionByListProperty {
11345 #[serde(default)]
11346 pub partition_expressions: Option<Box<Expression>>,
11347 #[serde(default)]
11348 pub create_expressions: Option<Box<Expression>>,
11349}
11350
11351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11353#[cfg_attr(feature = "bindings", derive(TS))]
11354pub struct PartitionList {
11355 pub this: Box<Expression>,
11356 #[serde(default)]
11357 pub expressions: Vec<Expression>,
11358}
11359
11360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11362#[cfg_attr(feature = "bindings", derive(TS))]
11363pub struct Partition {
11364 pub expressions: Vec<Expression>,
11365 #[serde(default)]
11366 pub subpartition: bool,
11367}
11368
11369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11372#[cfg_attr(feature = "bindings", derive(TS))]
11373pub struct RefreshTriggerProperty {
11374 pub method: String,
11376 #[serde(default)]
11378 pub kind: Option<String>,
11379 #[serde(default)]
11381 pub every: Option<Box<Expression>>,
11382 #[serde(default)]
11384 pub unit: Option<String>,
11385 #[serde(default)]
11387 pub starts: Option<Box<Expression>>,
11388}
11389
11390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11392#[cfg_attr(feature = "bindings", derive(TS))]
11393pub struct UniqueKeyProperty {
11394 #[serde(default)]
11395 pub expressions: Vec<Expression>,
11396}
11397
11398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11400#[cfg_attr(feature = "bindings", derive(TS))]
11401pub struct RollupProperty {
11402 pub expressions: Vec<RollupIndex>,
11403}
11404
11405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11407#[cfg_attr(feature = "bindings", derive(TS))]
11408pub struct RollupIndex {
11409 pub name: Identifier,
11410 pub expressions: Vec<Identifier>,
11411}
11412
11413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11415#[cfg_attr(feature = "bindings", derive(TS))]
11416pub struct PartitionBoundSpec {
11417 #[serde(default)]
11418 pub this: Option<Box<Expression>>,
11419 #[serde(default)]
11420 pub expression: Option<Box<Expression>>,
11421 #[serde(default)]
11422 pub from_expressions: Option<Box<Expression>>,
11423 #[serde(default)]
11424 pub to_expressions: Option<Box<Expression>>,
11425}
11426
11427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11429#[cfg_attr(feature = "bindings", derive(TS))]
11430pub struct PartitionedOfProperty {
11431 pub this: Box<Expression>,
11432 pub expression: Box<Expression>,
11433}
11434
11435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11437#[cfg_attr(feature = "bindings", derive(TS))]
11438pub struct RemoteWithConnectionModelProperty {
11439 pub this: Box<Expression>,
11440}
11441
11442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11444#[cfg_attr(feature = "bindings", derive(TS))]
11445pub struct ReturnsProperty {
11446 #[serde(default)]
11447 pub this: Option<Box<Expression>>,
11448 #[serde(default)]
11449 pub is_table: Option<Box<Expression>>,
11450 #[serde(default)]
11451 pub table: Option<Box<Expression>>,
11452 #[serde(default)]
11453 pub null: Option<Box<Expression>>,
11454}
11455
11456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11458#[cfg_attr(feature = "bindings", derive(TS))]
11459pub struct RowFormatProperty {
11460 pub this: Box<Expression>,
11461}
11462
11463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11465#[cfg_attr(feature = "bindings", derive(TS))]
11466pub struct RowFormatDelimitedProperty {
11467 #[serde(default)]
11468 pub fields: Option<Box<Expression>>,
11469 #[serde(default)]
11470 pub escaped: Option<Box<Expression>>,
11471 #[serde(default)]
11472 pub collection_items: Option<Box<Expression>>,
11473 #[serde(default)]
11474 pub map_keys: Option<Box<Expression>>,
11475 #[serde(default)]
11476 pub lines: Option<Box<Expression>>,
11477 #[serde(default)]
11478 pub null: Option<Box<Expression>>,
11479 #[serde(default)]
11480 pub serde: Option<Box<Expression>>,
11481}
11482
11483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11485#[cfg_attr(feature = "bindings", derive(TS))]
11486pub struct RowFormatSerdeProperty {
11487 pub this: Box<Expression>,
11488 #[serde(default)]
11489 pub serde_properties: Option<Box<Expression>>,
11490}
11491
11492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11494#[cfg_attr(feature = "bindings", derive(TS))]
11495pub struct QueryTransform {
11496 #[serde(default)]
11497 pub expressions: Vec<Expression>,
11498 #[serde(default)]
11499 pub command_script: Option<Box<Expression>>,
11500 #[serde(default)]
11501 pub schema: Option<Box<Expression>>,
11502 #[serde(default)]
11503 pub row_format_before: Option<Box<Expression>>,
11504 #[serde(default)]
11505 pub record_writer: Option<Box<Expression>>,
11506 #[serde(default)]
11507 pub row_format_after: Option<Box<Expression>>,
11508 #[serde(default)]
11509 pub record_reader: Option<Box<Expression>>,
11510}
11511
11512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11514#[cfg_attr(feature = "bindings", derive(TS))]
11515pub struct SampleProperty {
11516 pub this: Box<Expression>,
11517}
11518
11519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11521#[cfg_attr(feature = "bindings", derive(TS))]
11522pub struct SecurityProperty {
11523 pub this: Box<Expression>,
11524}
11525
11526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11528#[cfg_attr(feature = "bindings", derive(TS))]
11529pub struct SchemaCommentProperty {
11530 pub this: Box<Expression>,
11531}
11532
11533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11535#[cfg_attr(feature = "bindings", derive(TS))]
11536pub struct SemanticView {
11537 pub this: Box<Expression>,
11538 #[serde(default)]
11539 pub metrics: Option<Box<Expression>>,
11540 #[serde(default)]
11541 pub dimensions: Option<Box<Expression>>,
11542 #[serde(default)]
11543 pub facts: Option<Box<Expression>>,
11544 #[serde(default)]
11545 pub where_: Option<Box<Expression>>,
11546}
11547
11548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11550#[cfg_attr(feature = "bindings", derive(TS))]
11551pub struct SerdeProperties {
11552 #[serde(default)]
11553 pub expressions: Vec<Expression>,
11554 #[serde(default)]
11555 pub with_: Option<Box<Expression>>,
11556}
11557
11558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11560#[cfg_attr(feature = "bindings", derive(TS))]
11561pub struct SetProperty {
11562 #[serde(default)]
11563 pub multi: Option<Box<Expression>>,
11564}
11565
11566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11568#[cfg_attr(feature = "bindings", derive(TS))]
11569pub struct SharingProperty {
11570 #[serde(default)]
11571 pub this: Option<Box<Expression>>,
11572}
11573
11574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11576#[cfg_attr(feature = "bindings", derive(TS))]
11577pub struct SetConfigProperty {
11578 pub this: Box<Expression>,
11579}
11580
11581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11583#[cfg_attr(feature = "bindings", derive(TS))]
11584pub struct SettingsProperty {
11585 #[serde(default)]
11586 pub expressions: Vec<Expression>,
11587}
11588
11589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11591#[cfg_attr(feature = "bindings", derive(TS))]
11592pub struct SortKeyProperty {
11593 pub this: Box<Expression>,
11594 #[serde(default)]
11595 pub compound: Option<Box<Expression>>,
11596}
11597
11598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11600#[cfg_attr(feature = "bindings", derive(TS))]
11601pub struct SqlReadWriteProperty {
11602 pub this: Box<Expression>,
11603}
11604
11605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11607#[cfg_attr(feature = "bindings", derive(TS))]
11608pub struct SqlSecurityProperty {
11609 pub this: Box<Expression>,
11610}
11611
11612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11614#[cfg_attr(feature = "bindings", derive(TS))]
11615pub struct StabilityProperty {
11616 pub this: Box<Expression>,
11617}
11618
11619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11621#[cfg_attr(feature = "bindings", derive(TS))]
11622pub struct StorageHandlerProperty {
11623 pub this: Box<Expression>,
11624}
11625
11626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11628#[cfg_attr(feature = "bindings", derive(TS))]
11629pub struct TemporaryProperty {
11630 #[serde(default)]
11631 pub this: Option<Box<Expression>>,
11632}
11633
11634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11636#[cfg_attr(feature = "bindings", derive(TS))]
11637pub struct Tags {
11638 #[serde(default)]
11639 pub expressions: Vec<Expression>,
11640}
11641
11642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11644#[cfg_attr(feature = "bindings", derive(TS))]
11645pub struct TransformModelProperty {
11646 #[serde(default)]
11647 pub expressions: Vec<Expression>,
11648}
11649
11650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11652#[cfg_attr(feature = "bindings", derive(TS))]
11653pub struct TransientProperty {
11654 #[serde(default)]
11655 pub this: Option<Box<Expression>>,
11656}
11657
11658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11660#[cfg_attr(feature = "bindings", derive(TS))]
11661pub struct UsingTemplateProperty {
11662 pub this: Box<Expression>,
11663}
11664
11665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11667#[cfg_attr(feature = "bindings", derive(TS))]
11668pub struct ViewAttributeProperty {
11669 pub this: Box<Expression>,
11670}
11671
11672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11674#[cfg_attr(feature = "bindings", derive(TS))]
11675pub struct VolatileProperty {
11676 #[serde(default)]
11677 pub this: Option<Box<Expression>>,
11678}
11679
11680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11682#[cfg_attr(feature = "bindings", derive(TS))]
11683pub struct WithDataProperty {
11684 #[serde(default)]
11685 pub no: Option<Box<Expression>>,
11686 #[serde(default)]
11687 pub statistics: Option<Box<Expression>>,
11688}
11689
11690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11692#[cfg_attr(feature = "bindings", derive(TS))]
11693pub struct WithJournalTableProperty {
11694 pub this: Box<Expression>,
11695}
11696
11697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11699#[cfg_attr(feature = "bindings", derive(TS))]
11700pub struct WithSchemaBindingProperty {
11701 pub this: Box<Expression>,
11702}
11703
11704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11706#[cfg_attr(feature = "bindings", derive(TS))]
11707pub struct WithSystemVersioningProperty {
11708 #[serde(default)]
11709 pub on: Option<Box<Expression>>,
11710 #[serde(default)]
11711 pub this: Option<Box<Expression>>,
11712 #[serde(default)]
11713 pub data_consistency: Option<Box<Expression>>,
11714 #[serde(default)]
11715 pub retention_period: Option<Box<Expression>>,
11716 #[serde(default)]
11717 pub with_: Option<Box<Expression>>,
11718}
11719
11720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11722#[cfg_attr(feature = "bindings", derive(TS))]
11723pub struct WithProcedureOptions {
11724 #[serde(default)]
11725 pub expressions: Vec<Expression>,
11726}
11727
11728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11730#[cfg_attr(feature = "bindings", derive(TS))]
11731pub struct EncodeProperty {
11732 pub this: Box<Expression>,
11733 #[serde(default)]
11734 pub properties: Vec<Expression>,
11735 #[serde(default)]
11736 pub key: Option<Box<Expression>>,
11737}
11738
11739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11741#[cfg_attr(feature = "bindings", derive(TS))]
11742pub struct IncludeProperty {
11743 pub this: Box<Expression>,
11744 #[serde(default)]
11745 pub alias: Option<String>,
11746 #[serde(default)]
11747 pub column_def: Option<Box<Expression>>,
11748}
11749
11750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11752#[cfg_attr(feature = "bindings", derive(TS))]
11753pub struct Properties {
11754 #[serde(default)]
11755 pub expressions: Vec<Expression>,
11756}
11757
11758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11760#[cfg_attr(feature = "bindings", derive(TS))]
11761pub struct OptionEntry {
11762 pub key: Identifier,
11763 pub value: Expression,
11764}
11765
11766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11768#[cfg_attr(feature = "bindings", derive(TS))]
11769pub struct OptionsProperty {
11770 #[serde(default)]
11771 pub entries: Vec<OptionEntry>,
11772}
11773
11774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11776#[cfg_attr(feature = "bindings", derive(TS))]
11777pub struct InputOutputFormat {
11778 #[serde(default)]
11779 pub input_format: Option<Box<Expression>>,
11780 #[serde(default)]
11781 pub output_format: Option<Box<Expression>>,
11782}
11783
11784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11786#[cfg_attr(feature = "bindings", derive(TS))]
11787pub struct Reference {
11788 pub this: Box<Expression>,
11789 #[serde(default)]
11790 pub expressions: Vec<Expression>,
11791 #[serde(default)]
11792 pub options: Vec<Expression>,
11793}
11794
11795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11797#[cfg_attr(feature = "bindings", derive(TS))]
11798pub struct QueryOption {
11799 pub this: Box<Expression>,
11800 #[serde(default)]
11801 pub expression: Option<Box<Expression>>,
11802}
11803
11804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11806#[cfg_attr(feature = "bindings", derive(TS))]
11807pub struct WithTableHint {
11808 #[serde(default)]
11809 pub expressions: Vec<Expression>,
11810}
11811
11812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11814#[cfg_attr(feature = "bindings", derive(TS))]
11815pub struct IndexTableHint {
11816 pub this: Box<Expression>,
11817 #[serde(default)]
11818 pub expressions: Vec<Expression>,
11819 #[serde(default)]
11820 pub target: Option<Box<Expression>>,
11821}
11822
11823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11825#[cfg_attr(feature = "bindings", derive(TS))]
11826pub struct Get {
11827 pub this: Box<Expression>,
11828 #[serde(default)]
11829 pub target: Option<Box<Expression>>,
11830 #[serde(default)]
11831 pub properties: Vec<Expression>,
11832}
11833
11834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11836#[cfg_attr(feature = "bindings", derive(TS))]
11837pub struct SetOperation {
11838 #[serde(default)]
11839 pub with_: Option<Box<Expression>>,
11840 pub this: Box<Expression>,
11841 pub expression: Box<Expression>,
11842 #[serde(default)]
11843 pub distinct: bool,
11844 #[serde(default)]
11845 pub by_name: Option<Box<Expression>>,
11846 #[serde(default)]
11847 pub side: Option<Box<Expression>>,
11848 #[serde(default)]
11849 pub kind: Option<String>,
11850 #[serde(default)]
11851 pub on: Option<Box<Expression>>,
11852}
11853
11854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11856#[cfg_attr(feature = "bindings", derive(TS))]
11857pub struct Var {
11858 pub this: String,
11859}
11860
11861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11863#[cfg_attr(feature = "bindings", derive(TS))]
11864pub struct Variadic {
11865 pub this: Box<Expression>,
11866}
11867
11868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11870#[cfg_attr(feature = "bindings", derive(TS))]
11871pub struct Version {
11872 pub this: Box<Expression>,
11873 pub kind: String,
11874 #[serde(default)]
11875 pub expression: Option<Box<Expression>>,
11876}
11877
11878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11880#[cfg_attr(feature = "bindings", derive(TS))]
11881pub struct Schema {
11882 #[serde(default)]
11883 pub this: Option<Box<Expression>>,
11884 #[serde(default)]
11885 pub expressions: Vec<Expression>,
11886}
11887
11888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11890#[cfg_attr(feature = "bindings", derive(TS))]
11891pub struct Lock {
11892 #[serde(default)]
11893 pub update: Option<Box<Expression>>,
11894 #[serde(default)]
11895 pub expressions: Vec<Expression>,
11896 #[serde(default)]
11897 pub wait: Option<Box<Expression>>,
11898 #[serde(default)]
11899 pub key: Option<Box<Expression>>,
11900}
11901
11902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11905#[cfg_attr(feature = "bindings", derive(TS))]
11906pub struct TableSample {
11907 #[serde(default, skip_serializing_if = "Option::is_none")]
11909 pub this: Option<Box<Expression>>,
11910 #[serde(default, skip_serializing_if = "Option::is_none")]
11912 pub sample: Option<Box<Sample>>,
11913 #[serde(default)]
11914 pub expressions: Vec<Expression>,
11915 #[serde(default)]
11916 pub method: Option<String>,
11917 #[serde(default)]
11918 pub bucket_numerator: Option<Box<Expression>>,
11919 #[serde(default)]
11920 pub bucket_denominator: Option<Box<Expression>>,
11921 #[serde(default)]
11922 pub bucket_field: Option<Box<Expression>>,
11923 #[serde(default)]
11924 pub percent: Option<Box<Expression>>,
11925 #[serde(default)]
11926 pub rows: Option<Box<Expression>>,
11927 #[serde(default)]
11928 pub size: Option<i64>,
11929 #[serde(default)]
11930 pub seed: Option<Box<Expression>>,
11931}
11932
11933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11935#[cfg_attr(feature = "bindings", derive(TS))]
11936pub struct Tag {
11937 #[serde(default)]
11938 pub this: Option<Box<Expression>>,
11939 #[serde(default)]
11940 pub prefix: Option<Box<Expression>>,
11941 #[serde(default)]
11942 pub postfix: Option<Box<Expression>>,
11943}
11944
11945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11947#[cfg_attr(feature = "bindings", derive(TS))]
11948pub struct UnpivotColumns {
11949 pub this: Box<Expression>,
11950 #[serde(default)]
11951 pub expressions: Vec<Expression>,
11952}
11953
11954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11956#[cfg_attr(feature = "bindings", derive(TS))]
11957pub struct SessionParameter {
11958 pub this: Box<Expression>,
11959 #[serde(default)]
11960 pub kind: Option<String>,
11961}
11962
11963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11965#[cfg_attr(feature = "bindings", derive(TS))]
11966pub struct PseudoType {
11967 pub this: Box<Expression>,
11968}
11969
11970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11972#[cfg_attr(feature = "bindings", derive(TS))]
11973pub struct ObjectIdentifier {
11974 pub this: Box<Expression>,
11975}
11976
11977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11979#[cfg_attr(feature = "bindings", derive(TS))]
11980pub struct Transaction {
11981 #[serde(default)]
11982 pub this: Option<Box<Expression>>,
11983 #[serde(default)]
11984 pub modes: Option<Box<Expression>>,
11985 #[serde(default)]
11986 pub mark: Option<Box<Expression>>,
11987}
11988
11989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11991#[cfg_attr(feature = "bindings", derive(TS))]
11992pub struct Commit {
11993 #[serde(default)]
11994 pub chain: Option<Box<Expression>>,
11995 #[serde(default)]
11996 pub this: Option<Box<Expression>>,
11997 #[serde(default)]
11998 pub durability: Option<Box<Expression>>,
11999}
12000
12001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12003#[cfg_attr(feature = "bindings", derive(TS))]
12004pub struct Rollback {
12005 #[serde(default)]
12006 pub savepoint: Option<Box<Expression>>,
12007 #[serde(default)]
12008 pub this: Option<Box<Expression>>,
12009}
12010
12011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12013#[cfg_attr(feature = "bindings", derive(TS))]
12014pub struct AlterSession {
12015 #[serde(default)]
12016 pub expressions: Vec<Expression>,
12017 #[serde(default)]
12018 pub unset: Option<Box<Expression>>,
12019}
12020
12021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12023#[cfg_attr(feature = "bindings", derive(TS))]
12024pub struct Analyze {
12025 #[serde(default)]
12026 pub kind: Option<String>,
12027 #[serde(default)]
12028 pub this: Option<Box<Expression>>,
12029 #[serde(default)]
12030 pub options: Vec<Expression>,
12031 #[serde(default)]
12032 pub mode: Option<Box<Expression>>,
12033 #[serde(default)]
12034 pub partition: Option<Box<Expression>>,
12035 #[serde(default)]
12036 pub expression: Option<Box<Expression>>,
12037 #[serde(default)]
12038 pub properties: Vec<Expression>,
12039 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12041 pub columns: Vec<String>,
12042}
12043
12044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12046#[cfg_attr(feature = "bindings", derive(TS))]
12047pub struct AnalyzeStatistics {
12048 pub kind: String,
12049 #[serde(default)]
12050 pub option: Option<Box<Expression>>,
12051 #[serde(default)]
12052 pub this: Option<Box<Expression>>,
12053 #[serde(default)]
12054 pub expressions: Vec<Expression>,
12055}
12056
12057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12059#[cfg_attr(feature = "bindings", derive(TS))]
12060pub struct AnalyzeHistogram {
12061 pub this: Box<Expression>,
12062 #[serde(default)]
12063 pub expressions: Vec<Expression>,
12064 #[serde(default)]
12065 pub expression: Option<Box<Expression>>,
12066 #[serde(default)]
12067 pub update_options: Option<Box<Expression>>,
12068}
12069
12070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12072#[cfg_attr(feature = "bindings", derive(TS))]
12073pub struct AnalyzeSample {
12074 pub kind: String,
12075 #[serde(default)]
12076 pub sample: Option<Box<Expression>>,
12077}
12078
12079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12081#[cfg_attr(feature = "bindings", derive(TS))]
12082pub struct AnalyzeListChainedRows {
12083 #[serde(default)]
12084 pub expression: Option<Box<Expression>>,
12085}
12086
12087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12089#[cfg_attr(feature = "bindings", derive(TS))]
12090pub struct AnalyzeDelete {
12091 #[serde(default)]
12092 pub kind: Option<String>,
12093}
12094
12095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12097#[cfg_attr(feature = "bindings", derive(TS))]
12098pub struct AnalyzeWith {
12099 #[serde(default)]
12100 pub expressions: Vec<Expression>,
12101}
12102
12103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12105#[cfg_attr(feature = "bindings", derive(TS))]
12106pub struct AnalyzeValidate {
12107 pub kind: String,
12108 #[serde(default)]
12109 pub this: Option<Box<Expression>>,
12110 #[serde(default)]
12111 pub expression: Option<Box<Expression>>,
12112}
12113
12114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12116#[cfg_attr(feature = "bindings", derive(TS))]
12117pub struct AddPartition {
12118 pub this: Box<Expression>,
12119 #[serde(default)]
12120 pub exists: bool,
12121 #[serde(default)]
12122 pub location: Option<Box<Expression>>,
12123}
12124
12125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12127#[cfg_attr(feature = "bindings", derive(TS))]
12128pub struct AttachOption {
12129 pub this: Box<Expression>,
12130 #[serde(default)]
12131 pub expression: Option<Box<Expression>>,
12132}
12133
12134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12136#[cfg_attr(feature = "bindings", derive(TS))]
12137pub struct DropPartition {
12138 #[serde(default)]
12139 pub expressions: Vec<Expression>,
12140 #[serde(default)]
12141 pub exists: bool,
12142}
12143
12144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12146#[cfg_attr(feature = "bindings", derive(TS))]
12147pub struct ReplacePartition {
12148 pub expression: Box<Expression>,
12149 #[serde(default)]
12150 pub source: Option<Box<Expression>>,
12151}
12152
12153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12155#[cfg_attr(feature = "bindings", derive(TS))]
12156pub struct DPipe {
12157 pub this: Box<Expression>,
12158 pub expression: Box<Expression>,
12159 #[serde(default)]
12160 pub safe: Option<Box<Expression>>,
12161}
12162
12163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12165#[cfg_attr(feature = "bindings", derive(TS))]
12166pub struct Operator {
12167 pub this: Box<Expression>,
12168 #[serde(default)]
12169 pub operator: Option<Box<Expression>>,
12170 pub expression: Box<Expression>,
12171 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12173 pub comments: Vec<String>,
12174}
12175
12176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12178#[cfg_attr(feature = "bindings", derive(TS))]
12179pub struct PivotAny {
12180 #[serde(default)]
12181 pub this: Option<Box<Expression>>,
12182}
12183
12184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12186#[cfg_attr(feature = "bindings", derive(TS))]
12187pub struct Aliases {
12188 pub this: Box<Expression>,
12189 #[serde(default)]
12190 pub expressions: Vec<Expression>,
12191}
12192
12193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12195#[cfg_attr(feature = "bindings", derive(TS))]
12196pub struct AtIndex {
12197 pub this: Box<Expression>,
12198 pub expression: Box<Expression>,
12199}
12200
12201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12203#[cfg_attr(feature = "bindings", derive(TS))]
12204pub struct FromTimeZone {
12205 pub this: Box<Expression>,
12206 #[serde(default)]
12207 pub zone: Option<Box<Expression>>,
12208}
12209
12210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12212#[cfg_attr(feature = "bindings", derive(TS))]
12213pub struct FormatPhrase {
12214 pub this: Box<Expression>,
12215 pub format: String,
12216}
12217
12218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12220#[cfg_attr(feature = "bindings", derive(TS))]
12221pub struct ForIn {
12222 pub this: Box<Expression>,
12223 pub expression: Box<Expression>,
12224}
12225
12226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12228#[cfg_attr(feature = "bindings", derive(TS))]
12229pub struct TimeUnit {
12230 #[serde(default)]
12231 pub unit: Option<String>,
12232}
12233
12234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12236#[cfg_attr(feature = "bindings", derive(TS))]
12237pub struct IntervalOp {
12238 #[serde(default)]
12239 pub unit: Option<String>,
12240 pub expression: Box<Expression>,
12241}
12242
12243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12245#[cfg_attr(feature = "bindings", derive(TS))]
12246pub struct HavingMax {
12247 pub this: Box<Expression>,
12248 pub expression: Box<Expression>,
12249 #[serde(default)]
12250 pub max: Option<Box<Expression>>,
12251}
12252
12253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12255#[cfg_attr(feature = "bindings", derive(TS))]
12256pub struct CosineDistance {
12257 pub this: Box<Expression>,
12258 pub expression: Box<Expression>,
12259}
12260
12261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12263#[cfg_attr(feature = "bindings", derive(TS))]
12264pub struct DotProduct {
12265 pub this: Box<Expression>,
12266 pub expression: Box<Expression>,
12267}
12268
12269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12271#[cfg_attr(feature = "bindings", derive(TS))]
12272pub struct EuclideanDistance {
12273 pub this: Box<Expression>,
12274 pub expression: Box<Expression>,
12275}
12276
12277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12279#[cfg_attr(feature = "bindings", derive(TS))]
12280pub struct ManhattanDistance {
12281 pub this: Box<Expression>,
12282 pub expression: Box<Expression>,
12283}
12284
12285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12287#[cfg_attr(feature = "bindings", derive(TS))]
12288pub struct JarowinklerSimilarity {
12289 pub this: Box<Expression>,
12290 pub expression: Box<Expression>,
12291}
12292
12293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12295#[cfg_attr(feature = "bindings", derive(TS))]
12296pub struct Booland {
12297 pub this: Box<Expression>,
12298 pub expression: Box<Expression>,
12299}
12300
12301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12303#[cfg_attr(feature = "bindings", derive(TS))]
12304pub struct Boolor {
12305 pub this: Box<Expression>,
12306 pub expression: Box<Expression>,
12307}
12308
12309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12311#[cfg_attr(feature = "bindings", derive(TS))]
12312pub struct ParameterizedAgg {
12313 pub this: Box<Expression>,
12314 #[serde(default)]
12315 pub expressions: Vec<Expression>,
12316 #[serde(default)]
12317 pub params: Vec<Expression>,
12318}
12319
12320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12322#[cfg_attr(feature = "bindings", derive(TS))]
12323pub struct ArgMax {
12324 pub this: Box<Expression>,
12325 pub expression: Box<Expression>,
12326 #[serde(default)]
12327 pub count: Option<Box<Expression>>,
12328}
12329
12330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12332#[cfg_attr(feature = "bindings", derive(TS))]
12333pub struct ArgMin {
12334 pub this: Box<Expression>,
12335 pub expression: Box<Expression>,
12336 #[serde(default)]
12337 pub count: Option<Box<Expression>>,
12338}
12339
12340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12342#[cfg_attr(feature = "bindings", derive(TS))]
12343pub struct ApproxTopK {
12344 pub this: Box<Expression>,
12345 #[serde(default)]
12346 pub expression: Option<Box<Expression>>,
12347 #[serde(default)]
12348 pub counters: Option<Box<Expression>>,
12349}
12350
12351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12353#[cfg_attr(feature = "bindings", derive(TS))]
12354pub struct ApproxTopKAccumulate {
12355 pub this: Box<Expression>,
12356 #[serde(default)]
12357 pub expression: Option<Box<Expression>>,
12358}
12359
12360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12362#[cfg_attr(feature = "bindings", derive(TS))]
12363pub struct ApproxTopKCombine {
12364 pub this: Box<Expression>,
12365 #[serde(default)]
12366 pub expression: Option<Box<Expression>>,
12367}
12368
12369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12371#[cfg_attr(feature = "bindings", derive(TS))]
12372pub struct ApproxTopKEstimate {
12373 pub this: Box<Expression>,
12374 #[serde(default)]
12375 pub expression: Option<Box<Expression>>,
12376}
12377
12378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12380#[cfg_attr(feature = "bindings", derive(TS))]
12381pub struct ApproxTopSum {
12382 pub this: Box<Expression>,
12383 pub expression: Box<Expression>,
12384 #[serde(default)]
12385 pub count: Option<Box<Expression>>,
12386}
12387
12388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12390#[cfg_attr(feature = "bindings", derive(TS))]
12391pub struct ApproxQuantiles {
12392 pub this: Box<Expression>,
12393 #[serde(default)]
12394 pub expression: Option<Box<Expression>>,
12395}
12396
12397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12399#[cfg_attr(feature = "bindings", derive(TS))]
12400pub struct Minhash {
12401 pub this: Box<Expression>,
12402 #[serde(default)]
12403 pub expressions: Vec<Expression>,
12404}
12405
12406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12408#[cfg_attr(feature = "bindings", derive(TS))]
12409pub struct FarmFingerprint {
12410 #[serde(default)]
12411 pub expressions: Vec<Expression>,
12412}
12413
12414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12416#[cfg_attr(feature = "bindings", derive(TS))]
12417pub struct Float64 {
12418 pub this: Box<Expression>,
12419 #[serde(default)]
12420 pub expression: Option<Box<Expression>>,
12421}
12422
12423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12425#[cfg_attr(feature = "bindings", derive(TS))]
12426pub struct Transform {
12427 pub this: Box<Expression>,
12428 pub expression: Box<Expression>,
12429}
12430
12431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12433#[cfg_attr(feature = "bindings", derive(TS))]
12434pub struct Translate {
12435 pub this: Box<Expression>,
12436 #[serde(default)]
12437 pub from_: Option<Box<Expression>>,
12438 #[serde(default)]
12439 pub to: Option<Box<Expression>>,
12440}
12441
12442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12444#[cfg_attr(feature = "bindings", derive(TS))]
12445pub struct Grouping {
12446 #[serde(default)]
12447 pub expressions: Vec<Expression>,
12448}
12449
12450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12452#[cfg_attr(feature = "bindings", derive(TS))]
12453pub struct GroupingId {
12454 #[serde(default)]
12455 pub expressions: Vec<Expression>,
12456}
12457
12458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12460#[cfg_attr(feature = "bindings", derive(TS))]
12461pub struct Anonymous {
12462 pub this: Box<Expression>,
12463 #[serde(default)]
12464 pub expressions: Vec<Expression>,
12465}
12466
12467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12469#[cfg_attr(feature = "bindings", derive(TS))]
12470pub struct AnonymousAggFunc {
12471 pub this: Box<Expression>,
12472 #[serde(default)]
12473 pub expressions: Vec<Expression>,
12474}
12475
12476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12478#[cfg_attr(feature = "bindings", derive(TS))]
12479pub struct CombinedAggFunc {
12480 pub this: Box<Expression>,
12481 #[serde(default)]
12482 pub expressions: Vec<Expression>,
12483}
12484
12485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12487#[cfg_attr(feature = "bindings", derive(TS))]
12488pub struct CombinedParameterizedAgg {
12489 pub this: Box<Expression>,
12490 #[serde(default)]
12491 pub expressions: Vec<Expression>,
12492 #[serde(default)]
12493 pub params: Vec<Expression>,
12494}
12495
12496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12498#[cfg_attr(feature = "bindings", derive(TS))]
12499pub struct HashAgg {
12500 pub this: Box<Expression>,
12501 #[serde(default)]
12502 pub expressions: Vec<Expression>,
12503}
12504
12505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12507#[cfg_attr(feature = "bindings", derive(TS))]
12508pub struct Hll {
12509 pub this: Box<Expression>,
12510 #[serde(default)]
12511 pub expressions: Vec<Expression>,
12512}
12513
12514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12516#[cfg_attr(feature = "bindings", derive(TS))]
12517pub struct Apply {
12518 pub this: Box<Expression>,
12519 pub expression: Box<Expression>,
12520}
12521
12522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12524#[cfg_attr(feature = "bindings", derive(TS))]
12525pub struct ToBoolean {
12526 pub this: Box<Expression>,
12527 #[serde(default)]
12528 pub safe: Option<Box<Expression>>,
12529}
12530
12531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12533#[cfg_attr(feature = "bindings", derive(TS))]
12534pub struct List {
12535 #[serde(default)]
12536 pub expressions: Vec<Expression>,
12537}
12538
12539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12544#[cfg_attr(feature = "bindings", derive(TS))]
12545pub struct ToMap {
12546 pub this: Box<Expression>,
12548}
12549
12550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12552#[cfg_attr(feature = "bindings", derive(TS))]
12553pub struct Pad {
12554 pub this: Box<Expression>,
12555 pub expression: Box<Expression>,
12556 #[serde(default)]
12557 pub fill_pattern: Option<Box<Expression>>,
12558 #[serde(default)]
12559 pub is_left: Option<Box<Expression>>,
12560}
12561
12562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12564#[cfg_attr(feature = "bindings", derive(TS))]
12565pub struct ToChar {
12566 pub this: Box<Expression>,
12567 #[serde(default)]
12568 pub format: Option<String>,
12569 #[serde(default)]
12570 pub nlsparam: Option<Box<Expression>>,
12571 #[serde(default)]
12572 pub is_numeric: Option<Box<Expression>>,
12573}
12574
12575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12577#[cfg_attr(feature = "bindings", derive(TS))]
12578pub struct StringFunc {
12579 pub this: Box<Expression>,
12580 #[serde(default)]
12581 pub zone: Option<Box<Expression>>,
12582}
12583
12584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12586#[cfg_attr(feature = "bindings", derive(TS))]
12587pub struct ToNumber {
12588 pub this: Box<Expression>,
12589 #[serde(default)]
12590 pub format: Option<Box<Expression>>,
12591 #[serde(default)]
12592 pub nlsparam: Option<Box<Expression>>,
12593 #[serde(default)]
12594 pub precision: Option<Box<Expression>>,
12595 #[serde(default)]
12596 pub scale: Option<Box<Expression>>,
12597 #[serde(default)]
12598 pub safe: Option<Box<Expression>>,
12599 #[serde(default)]
12600 pub safe_name: Option<Box<Expression>>,
12601}
12602
12603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12605#[cfg_attr(feature = "bindings", derive(TS))]
12606pub struct ToDouble {
12607 pub this: Box<Expression>,
12608 #[serde(default)]
12609 pub format: Option<String>,
12610 #[serde(default)]
12611 pub safe: Option<Box<Expression>>,
12612}
12613
12614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12616#[cfg_attr(feature = "bindings", derive(TS))]
12617pub struct ToDecfloat {
12618 pub this: Box<Expression>,
12619 #[serde(default)]
12620 pub format: Option<String>,
12621}
12622
12623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12625#[cfg_attr(feature = "bindings", derive(TS))]
12626pub struct TryToDecfloat {
12627 pub this: Box<Expression>,
12628 #[serde(default)]
12629 pub format: Option<String>,
12630}
12631
12632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12634#[cfg_attr(feature = "bindings", derive(TS))]
12635pub struct ToFile {
12636 pub this: Box<Expression>,
12637 #[serde(default)]
12638 pub path: Option<Box<Expression>>,
12639 #[serde(default)]
12640 pub safe: Option<Box<Expression>>,
12641}
12642
12643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12645#[cfg_attr(feature = "bindings", derive(TS))]
12646pub struct Columns {
12647 pub this: Box<Expression>,
12648 #[serde(default)]
12649 pub unpack: Option<Box<Expression>>,
12650}
12651
12652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12654#[cfg_attr(feature = "bindings", derive(TS))]
12655pub struct ConvertToCharset {
12656 pub this: Box<Expression>,
12657 #[serde(default)]
12658 pub dest: Option<Box<Expression>>,
12659 #[serde(default)]
12660 pub source: Option<Box<Expression>>,
12661}
12662
12663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12665#[cfg_attr(feature = "bindings", derive(TS))]
12666pub struct ConvertTimezone {
12667 #[serde(default)]
12668 pub source_tz: Option<Box<Expression>>,
12669 #[serde(default)]
12670 pub target_tz: Option<Box<Expression>>,
12671 #[serde(default)]
12672 pub timestamp: Option<Box<Expression>>,
12673 #[serde(default)]
12674 pub options: Vec<Expression>,
12675}
12676
12677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12679#[cfg_attr(feature = "bindings", derive(TS))]
12680pub struct GenerateSeries {
12681 #[serde(default)]
12682 pub start: Option<Box<Expression>>,
12683 #[serde(default)]
12684 pub end: Option<Box<Expression>>,
12685 #[serde(default)]
12686 pub step: Option<Box<Expression>>,
12687 #[serde(default)]
12688 pub is_end_exclusive: Option<Box<Expression>>,
12689}
12690
12691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12693#[cfg_attr(feature = "bindings", derive(TS))]
12694pub struct AIAgg {
12695 pub this: Box<Expression>,
12696 pub expression: Box<Expression>,
12697}
12698
12699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12701#[cfg_attr(feature = "bindings", derive(TS))]
12702pub struct AIClassify {
12703 pub this: Box<Expression>,
12704 #[serde(default)]
12705 pub categories: Option<Box<Expression>>,
12706 #[serde(default)]
12707 pub config: Option<Box<Expression>>,
12708}
12709
12710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12712#[cfg_attr(feature = "bindings", derive(TS))]
12713pub struct ArrayAll {
12714 pub this: Box<Expression>,
12715 pub expression: Box<Expression>,
12716}
12717
12718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12720#[cfg_attr(feature = "bindings", derive(TS))]
12721pub struct ArrayAny {
12722 pub this: Box<Expression>,
12723 pub expression: Box<Expression>,
12724}
12725
12726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12728#[cfg_attr(feature = "bindings", derive(TS))]
12729pub struct ArrayConstructCompact {
12730 #[serde(default)]
12731 pub expressions: Vec<Expression>,
12732}
12733
12734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12736#[cfg_attr(feature = "bindings", derive(TS))]
12737pub struct StPoint {
12738 pub this: Box<Expression>,
12739 pub expression: Box<Expression>,
12740 #[serde(default)]
12741 pub null: Option<Box<Expression>>,
12742}
12743
12744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12746#[cfg_attr(feature = "bindings", derive(TS))]
12747pub struct StDistance {
12748 pub this: Box<Expression>,
12749 pub expression: Box<Expression>,
12750 #[serde(default)]
12751 pub use_spheroid: Option<Box<Expression>>,
12752}
12753
12754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12756#[cfg_attr(feature = "bindings", derive(TS))]
12757pub struct StringToArray {
12758 pub this: Box<Expression>,
12759 #[serde(default)]
12760 pub expression: Option<Box<Expression>>,
12761 #[serde(default)]
12762 pub null: Option<Box<Expression>>,
12763}
12764
12765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12767#[cfg_attr(feature = "bindings", derive(TS))]
12768pub struct ArraySum {
12769 pub this: Box<Expression>,
12770 #[serde(default)]
12771 pub expression: Option<Box<Expression>>,
12772}
12773
12774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12776#[cfg_attr(feature = "bindings", derive(TS))]
12777pub struct ObjectAgg {
12778 pub this: Box<Expression>,
12779 pub expression: Box<Expression>,
12780}
12781
12782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12784#[cfg_attr(feature = "bindings", derive(TS))]
12785pub struct CastToStrType {
12786 pub this: Box<Expression>,
12787 #[serde(default)]
12788 pub to: Option<Box<Expression>>,
12789}
12790
12791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12793#[cfg_attr(feature = "bindings", derive(TS))]
12794pub struct CheckJson {
12795 pub this: Box<Expression>,
12796}
12797
12798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12800#[cfg_attr(feature = "bindings", derive(TS))]
12801pub struct CheckXml {
12802 pub this: Box<Expression>,
12803 #[serde(default)]
12804 pub disable_auto_convert: Option<Box<Expression>>,
12805}
12806
12807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12809#[cfg_attr(feature = "bindings", derive(TS))]
12810pub struct TranslateCharacters {
12811 pub this: Box<Expression>,
12812 pub expression: Box<Expression>,
12813 #[serde(default)]
12814 pub with_error: Option<Box<Expression>>,
12815}
12816
12817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12819#[cfg_attr(feature = "bindings", derive(TS))]
12820pub struct CurrentSchemas {
12821 #[serde(default)]
12822 pub this: Option<Box<Expression>>,
12823}
12824
12825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12827#[cfg_attr(feature = "bindings", derive(TS))]
12828pub struct CurrentDatetime {
12829 #[serde(default)]
12830 pub this: Option<Box<Expression>>,
12831}
12832
12833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12835#[cfg_attr(feature = "bindings", derive(TS))]
12836pub struct Localtime {
12837 #[serde(default)]
12838 pub this: Option<Box<Expression>>,
12839}
12840
12841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12843#[cfg_attr(feature = "bindings", derive(TS))]
12844pub struct Localtimestamp {
12845 #[serde(default)]
12846 pub this: Option<Box<Expression>>,
12847}
12848
12849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12851#[cfg_attr(feature = "bindings", derive(TS))]
12852pub struct Systimestamp {
12853 #[serde(default)]
12854 pub this: Option<Box<Expression>>,
12855}
12856
12857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12859#[cfg_attr(feature = "bindings", derive(TS))]
12860pub struct CurrentSchema {
12861 #[serde(default)]
12862 pub this: Option<Box<Expression>>,
12863}
12864
12865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12867#[cfg_attr(feature = "bindings", derive(TS))]
12868pub struct CurrentUser {
12869 #[serde(default)]
12870 pub this: Option<Box<Expression>>,
12871}
12872
12873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12875#[cfg_attr(feature = "bindings", derive(TS))]
12876pub struct SessionUser;
12877
12878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12880#[cfg_attr(feature = "bindings", derive(TS))]
12881pub struct JSONPathRoot;
12882
12883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12885#[cfg_attr(feature = "bindings", derive(TS))]
12886pub struct UtcTime {
12887 #[serde(default)]
12888 pub this: Option<Box<Expression>>,
12889}
12890
12891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12893#[cfg_attr(feature = "bindings", derive(TS))]
12894pub struct UtcTimestamp {
12895 #[serde(default)]
12896 pub this: Option<Box<Expression>>,
12897}
12898
12899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12901#[cfg_attr(feature = "bindings", derive(TS))]
12902pub struct TimestampFunc {
12903 #[serde(default)]
12904 pub this: Option<Box<Expression>>,
12905 #[serde(default)]
12906 pub zone: Option<Box<Expression>>,
12907 #[serde(default)]
12908 pub with_tz: Option<bool>,
12909 #[serde(default)]
12910 pub safe: Option<bool>,
12911}
12912
12913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12915#[cfg_attr(feature = "bindings", derive(TS))]
12916pub struct DateBin {
12917 pub this: Box<Expression>,
12918 pub expression: Box<Expression>,
12919 #[serde(default)]
12920 pub unit: Option<String>,
12921 #[serde(default)]
12922 pub zone: Option<Box<Expression>>,
12923 #[serde(default)]
12924 pub origin: Option<Box<Expression>>,
12925}
12926
12927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12929#[cfg_attr(feature = "bindings", derive(TS))]
12930pub struct Datetime {
12931 pub this: Box<Expression>,
12932 #[serde(default)]
12933 pub expression: Option<Box<Expression>>,
12934}
12935
12936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12938#[cfg_attr(feature = "bindings", derive(TS))]
12939pub struct DatetimeAdd {
12940 pub this: Box<Expression>,
12941 pub expression: Box<Expression>,
12942 #[serde(default)]
12943 pub unit: Option<String>,
12944}
12945
12946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12948#[cfg_attr(feature = "bindings", derive(TS))]
12949pub struct DatetimeSub {
12950 pub this: Box<Expression>,
12951 pub expression: Box<Expression>,
12952 #[serde(default)]
12953 pub unit: Option<String>,
12954}
12955
12956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12958#[cfg_attr(feature = "bindings", derive(TS))]
12959pub struct DatetimeDiff {
12960 pub this: Box<Expression>,
12961 pub expression: Box<Expression>,
12962 #[serde(default)]
12963 pub unit: Option<String>,
12964}
12965
12966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12968#[cfg_attr(feature = "bindings", derive(TS))]
12969pub struct DatetimeTrunc {
12970 pub this: Box<Expression>,
12971 pub unit: String,
12972 #[serde(default)]
12973 pub zone: Option<Box<Expression>>,
12974}
12975
12976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12978#[cfg_attr(feature = "bindings", derive(TS))]
12979pub struct Dayname {
12980 pub this: Box<Expression>,
12981 #[serde(default)]
12982 pub abbreviated: Option<Box<Expression>>,
12983}
12984
12985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12987#[cfg_attr(feature = "bindings", derive(TS))]
12988pub struct MakeInterval {
12989 #[serde(default)]
12990 pub year: Option<Box<Expression>>,
12991 #[serde(default)]
12992 pub month: Option<Box<Expression>>,
12993 #[serde(default)]
12994 pub week: Option<Box<Expression>>,
12995 #[serde(default)]
12996 pub day: Option<Box<Expression>>,
12997 #[serde(default)]
12998 pub hour: Option<Box<Expression>>,
12999 #[serde(default)]
13000 pub minute: Option<Box<Expression>>,
13001 #[serde(default)]
13002 pub second: Option<Box<Expression>>,
13003}
13004
13005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13007#[cfg_attr(feature = "bindings", derive(TS))]
13008pub struct PreviousDay {
13009 pub this: Box<Expression>,
13010 pub expression: Box<Expression>,
13011}
13012
13013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13015#[cfg_attr(feature = "bindings", derive(TS))]
13016pub struct Elt {
13017 pub this: Box<Expression>,
13018 #[serde(default)]
13019 pub expressions: Vec<Expression>,
13020}
13021
13022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13024#[cfg_attr(feature = "bindings", derive(TS))]
13025pub struct TimestampAdd {
13026 pub this: Box<Expression>,
13027 pub expression: Box<Expression>,
13028 #[serde(default)]
13029 pub unit: Option<String>,
13030}
13031
13032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13034#[cfg_attr(feature = "bindings", derive(TS))]
13035pub struct TimestampSub {
13036 pub this: Box<Expression>,
13037 pub expression: Box<Expression>,
13038 #[serde(default)]
13039 pub unit: Option<String>,
13040}
13041
13042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13044#[cfg_attr(feature = "bindings", derive(TS))]
13045pub struct TimestampDiff {
13046 pub this: Box<Expression>,
13047 pub expression: Box<Expression>,
13048 #[serde(default)]
13049 pub unit: Option<String>,
13050}
13051
13052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13054#[cfg_attr(feature = "bindings", derive(TS))]
13055pub struct TimeSlice {
13056 pub this: Box<Expression>,
13057 pub expression: Box<Expression>,
13058 pub unit: String,
13059 #[serde(default)]
13060 pub kind: Option<String>,
13061}
13062
13063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13065#[cfg_attr(feature = "bindings", derive(TS))]
13066pub struct TimeAdd {
13067 pub this: Box<Expression>,
13068 pub expression: Box<Expression>,
13069 #[serde(default)]
13070 pub unit: Option<String>,
13071}
13072
13073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13075#[cfg_attr(feature = "bindings", derive(TS))]
13076pub struct TimeSub {
13077 pub this: Box<Expression>,
13078 pub expression: Box<Expression>,
13079 #[serde(default)]
13080 pub unit: Option<String>,
13081}
13082
13083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13085#[cfg_attr(feature = "bindings", derive(TS))]
13086pub struct TimeDiff {
13087 pub this: Box<Expression>,
13088 pub expression: Box<Expression>,
13089 #[serde(default)]
13090 pub unit: Option<String>,
13091}
13092
13093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13095#[cfg_attr(feature = "bindings", derive(TS))]
13096pub struct TimeTrunc {
13097 pub this: Box<Expression>,
13098 pub unit: String,
13099 #[serde(default)]
13100 pub zone: Option<Box<Expression>>,
13101}
13102
13103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13105#[cfg_attr(feature = "bindings", derive(TS))]
13106pub struct DateFromParts {
13107 #[serde(default)]
13108 pub year: Option<Box<Expression>>,
13109 #[serde(default)]
13110 pub month: Option<Box<Expression>>,
13111 #[serde(default)]
13112 pub day: Option<Box<Expression>>,
13113 #[serde(default)]
13114 pub allow_overflow: Option<Box<Expression>>,
13115}
13116
13117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13119#[cfg_attr(feature = "bindings", derive(TS))]
13120pub struct TimeFromParts {
13121 #[serde(default)]
13122 pub hour: Option<Box<Expression>>,
13123 #[serde(default)]
13124 pub min: Option<Box<Expression>>,
13125 #[serde(default)]
13126 pub sec: Option<Box<Expression>>,
13127 #[serde(default)]
13128 pub nano: Option<Box<Expression>>,
13129 #[serde(default)]
13130 pub fractions: Option<Box<Expression>>,
13131 #[serde(default)]
13132 pub precision: Option<i64>,
13133}
13134
13135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13137#[cfg_attr(feature = "bindings", derive(TS))]
13138pub struct DecodeCase {
13139 #[serde(default)]
13140 pub expressions: Vec<Expression>,
13141}
13142
13143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13145#[cfg_attr(feature = "bindings", derive(TS))]
13146pub struct Decrypt {
13147 pub this: Box<Expression>,
13148 #[serde(default)]
13149 pub passphrase: Option<Box<Expression>>,
13150 #[serde(default)]
13151 pub aad: Option<Box<Expression>>,
13152 #[serde(default)]
13153 pub encryption_method: Option<Box<Expression>>,
13154 #[serde(default)]
13155 pub safe: Option<Box<Expression>>,
13156}
13157
13158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13160#[cfg_attr(feature = "bindings", derive(TS))]
13161pub struct DecryptRaw {
13162 pub this: Box<Expression>,
13163 #[serde(default)]
13164 pub key: Option<Box<Expression>>,
13165 #[serde(default)]
13166 pub iv: Option<Box<Expression>>,
13167 #[serde(default)]
13168 pub aad: Option<Box<Expression>>,
13169 #[serde(default)]
13170 pub encryption_method: Option<Box<Expression>>,
13171 #[serde(default)]
13172 pub aead: Option<Box<Expression>>,
13173 #[serde(default)]
13174 pub safe: Option<Box<Expression>>,
13175}
13176
13177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13179#[cfg_attr(feature = "bindings", derive(TS))]
13180pub struct Encode {
13181 pub this: Box<Expression>,
13182 #[serde(default)]
13183 pub charset: Option<Box<Expression>>,
13184}
13185
13186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13188#[cfg_attr(feature = "bindings", derive(TS))]
13189pub struct Encrypt {
13190 pub this: Box<Expression>,
13191 #[serde(default)]
13192 pub passphrase: Option<Box<Expression>>,
13193 #[serde(default)]
13194 pub aad: Option<Box<Expression>>,
13195 #[serde(default)]
13196 pub encryption_method: Option<Box<Expression>>,
13197}
13198
13199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13201#[cfg_attr(feature = "bindings", derive(TS))]
13202pub struct EncryptRaw {
13203 pub this: Box<Expression>,
13204 #[serde(default)]
13205 pub key: Option<Box<Expression>>,
13206 #[serde(default)]
13207 pub iv: Option<Box<Expression>>,
13208 #[serde(default)]
13209 pub aad: Option<Box<Expression>>,
13210 #[serde(default)]
13211 pub encryption_method: Option<Box<Expression>>,
13212}
13213
13214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13216#[cfg_attr(feature = "bindings", derive(TS))]
13217pub struct EqualNull {
13218 pub this: Box<Expression>,
13219 pub expression: Box<Expression>,
13220}
13221
13222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13224#[cfg_attr(feature = "bindings", derive(TS))]
13225pub struct ToBinary {
13226 pub this: Box<Expression>,
13227 #[serde(default)]
13228 pub format: Option<String>,
13229 #[serde(default)]
13230 pub safe: Option<Box<Expression>>,
13231}
13232
13233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13235#[cfg_attr(feature = "bindings", derive(TS))]
13236pub struct Base64DecodeBinary {
13237 pub this: Box<Expression>,
13238 #[serde(default)]
13239 pub alphabet: Option<Box<Expression>>,
13240}
13241
13242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13244#[cfg_attr(feature = "bindings", derive(TS))]
13245pub struct Base64DecodeString {
13246 pub this: Box<Expression>,
13247 #[serde(default)]
13248 pub alphabet: Option<Box<Expression>>,
13249}
13250
13251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13253#[cfg_attr(feature = "bindings", derive(TS))]
13254pub struct Base64Encode {
13255 pub this: Box<Expression>,
13256 #[serde(default)]
13257 pub max_line_length: Option<Box<Expression>>,
13258 #[serde(default)]
13259 pub alphabet: Option<Box<Expression>>,
13260}
13261
13262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13264#[cfg_attr(feature = "bindings", derive(TS))]
13265pub struct TryBase64DecodeBinary {
13266 pub this: Box<Expression>,
13267 #[serde(default)]
13268 pub alphabet: Option<Box<Expression>>,
13269}
13270
13271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13273#[cfg_attr(feature = "bindings", derive(TS))]
13274pub struct TryBase64DecodeString {
13275 pub this: Box<Expression>,
13276 #[serde(default)]
13277 pub alphabet: Option<Box<Expression>>,
13278}
13279
13280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13282#[cfg_attr(feature = "bindings", derive(TS))]
13283pub struct GapFill {
13284 pub this: Box<Expression>,
13285 #[serde(default)]
13286 pub ts_column: Option<Box<Expression>>,
13287 #[serde(default)]
13288 pub bucket_width: Option<Box<Expression>>,
13289 #[serde(default)]
13290 pub partitioning_columns: Option<Box<Expression>>,
13291 #[serde(default)]
13292 pub value_columns: Option<Box<Expression>>,
13293 #[serde(default)]
13294 pub origin: Option<Box<Expression>>,
13295 #[serde(default)]
13296 pub ignore_nulls: Option<Box<Expression>>,
13297}
13298
13299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13301#[cfg_attr(feature = "bindings", derive(TS))]
13302pub struct GenerateDateArray {
13303 #[serde(default)]
13304 pub start: Option<Box<Expression>>,
13305 #[serde(default)]
13306 pub end: Option<Box<Expression>>,
13307 #[serde(default)]
13308 pub step: Option<Box<Expression>>,
13309}
13310
13311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13313#[cfg_attr(feature = "bindings", derive(TS))]
13314pub struct GenerateTimestampArray {
13315 #[serde(default)]
13316 pub start: Option<Box<Expression>>,
13317 #[serde(default)]
13318 pub end: Option<Box<Expression>>,
13319 #[serde(default)]
13320 pub step: Option<Box<Expression>>,
13321}
13322
13323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13325#[cfg_attr(feature = "bindings", derive(TS))]
13326pub struct GetExtract {
13327 pub this: Box<Expression>,
13328 pub expression: Box<Expression>,
13329}
13330
13331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13333#[cfg_attr(feature = "bindings", derive(TS))]
13334pub struct Getbit {
13335 pub this: Box<Expression>,
13336 pub expression: Box<Expression>,
13337 #[serde(default)]
13338 pub zero_is_msb: Option<Box<Expression>>,
13339}
13340
13341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13343#[cfg_attr(feature = "bindings", derive(TS))]
13344pub struct OverflowTruncateBehavior {
13345 #[serde(default)]
13346 pub this: Option<Box<Expression>>,
13347 #[serde(default)]
13348 pub with_count: Option<Box<Expression>>,
13349}
13350
13351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13353#[cfg_attr(feature = "bindings", derive(TS))]
13354pub struct HexEncode {
13355 pub this: Box<Expression>,
13356 #[serde(default)]
13357 pub case: Option<Box<Expression>>,
13358}
13359
13360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13362#[cfg_attr(feature = "bindings", derive(TS))]
13363pub struct Compress {
13364 pub this: Box<Expression>,
13365 #[serde(default)]
13366 pub method: Option<String>,
13367}
13368
13369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13371#[cfg_attr(feature = "bindings", derive(TS))]
13372pub struct DecompressBinary {
13373 pub this: Box<Expression>,
13374 pub method: String,
13375}
13376
13377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13379#[cfg_attr(feature = "bindings", derive(TS))]
13380pub struct DecompressString {
13381 pub this: Box<Expression>,
13382 pub method: String,
13383}
13384
13385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13387#[cfg_attr(feature = "bindings", derive(TS))]
13388pub struct Xor {
13389 #[serde(default)]
13390 pub this: Option<Box<Expression>>,
13391 #[serde(default)]
13392 pub expression: Option<Box<Expression>>,
13393 #[serde(default)]
13394 pub expressions: Vec<Expression>,
13395}
13396
13397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13399#[cfg_attr(feature = "bindings", derive(TS))]
13400pub struct Nullif {
13401 pub this: Box<Expression>,
13402 pub expression: Box<Expression>,
13403}
13404
13405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13407#[cfg_attr(feature = "bindings", derive(TS))]
13408pub struct JSON {
13409 #[serde(default)]
13410 pub this: Option<Box<Expression>>,
13411 #[serde(default)]
13412 pub with_: Option<Box<Expression>>,
13413 #[serde(default)]
13414 pub unique: bool,
13415}
13416
13417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13419#[cfg_attr(feature = "bindings", derive(TS))]
13420pub struct JSONPath {
13421 #[serde(default)]
13422 pub expressions: Vec<Expression>,
13423 #[serde(default)]
13424 pub escape: Option<Box<Expression>>,
13425}
13426
13427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13429#[cfg_attr(feature = "bindings", derive(TS))]
13430pub struct JSONPathFilter {
13431 pub this: Box<Expression>,
13432}
13433
13434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13436#[cfg_attr(feature = "bindings", derive(TS))]
13437pub struct JSONPathKey {
13438 pub this: Box<Expression>,
13439}
13440
13441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13443#[cfg_attr(feature = "bindings", derive(TS))]
13444pub struct JSONPathRecursive {
13445 #[serde(default)]
13446 pub this: Option<Box<Expression>>,
13447}
13448
13449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13451#[cfg_attr(feature = "bindings", derive(TS))]
13452pub struct JSONPathScript {
13453 pub this: Box<Expression>,
13454}
13455
13456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13458#[cfg_attr(feature = "bindings", derive(TS))]
13459pub struct JSONPathSlice {
13460 #[serde(default)]
13461 pub start: Option<Box<Expression>>,
13462 #[serde(default)]
13463 pub end: Option<Box<Expression>>,
13464 #[serde(default)]
13465 pub step: Option<Box<Expression>>,
13466}
13467
13468#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13470#[cfg_attr(feature = "bindings", derive(TS))]
13471pub struct JSONPathSelector {
13472 pub this: Box<Expression>,
13473}
13474
13475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13477#[cfg_attr(feature = "bindings", derive(TS))]
13478pub struct JSONPathSubscript {
13479 pub this: Box<Expression>,
13480}
13481
13482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13484#[cfg_attr(feature = "bindings", derive(TS))]
13485pub struct JSONPathUnion {
13486 #[serde(default)]
13487 pub expressions: Vec<Expression>,
13488}
13489
13490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13492#[cfg_attr(feature = "bindings", derive(TS))]
13493pub struct Format {
13494 pub this: Box<Expression>,
13495 #[serde(default)]
13496 pub expressions: Vec<Expression>,
13497}
13498
13499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13501#[cfg_attr(feature = "bindings", derive(TS))]
13502pub struct JSONKeys {
13503 pub this: Box<Expression>,
13504 #[serde(default)]
13505 pub expression: Option<Box<Expression>>,
13506 #[serde(default)]
13507 pub expressions: Vec<Expression>,
13508}
13509
13510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13512#[cfg_attr(feature = "bindings", derive(TS))]
13513pub struct JSONKeyValue {
13514 pub this: Box<Expression>,
13515 pub expression: Box<Expression>,
13516}
13517
13518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13520#[cfg_attr(feature = "bindings", derive(TS))]
13521pub struct JSONKeysAtDepth {
13522 pub this: Box<Expression>,
13523 #[serde(default)]
13524 pub expression: Option<Box<Expression>>,
13525 #[serde(default)]
13526 pub mode: Option<Box<Expression>>,
13527}
13528
13529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13531#[cfg_attr(feature = "bindings", derive(TS))]
13532pub struct JSONObject {
13533 #[serde(default)]
13534 pub expressions: Vec<Expression>,
13535 #[serde(default)]
13536 pub null_handling: Option<Box<Expression>>,
13537 #[serde(default)]
13538 pub unique_keys: Option<Box<Expression>>,
13539 #[serde(default)]
13540 pub return_type: Option<Box<Expression>>,
13541 #[serde(default)]
13542 pub encoding: Option<Box<Expression>>,
13543}
13544
13545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13547#[cfg_attr(feature = "bindings", derive(TS))]
13548pub struct JSONObjectAgg {
13549 #[serde(default)]
13550 pub expressions: Vec<Expression>,
13551 #[serde(default)]
13552 pub null_handling: Option<Box<Expression>>,
13553 #[serde(default)]
13554 pub unique_keys: Option<Box<Expression>>,
13555 #[serde(default)]
13556 pub return_type: Option<Box<Expression>>,
13557 #[serde(default)]
13558 pub encoding: Option<Box<Expression>>,
13559}
13560
13561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13563#[cfg_attr(feature = "bindings", derive(TS))]
13564pub struct JSONBObjectAgg {
13565 pub this: Box<Expression>,
13566 pub expression: Box<Expression>,
13567}
13568
13569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13571#[cfg_attr(feature = "bindings", derive(TS))]
13572pub struct JSONArray {
13573 #[serde(default)]
13574 pub expressions: Vec<Expression>,
13575 #[serde(default)]
13576 pub null_handling: Option<Box<Expression>>,
13577 #[serde(default)]
13578 pub return_type: Option<Box<Expression>>,
13579 #[serde(default)]
13580 pub strict: Option<Box<Expression>>,
13581}
13582
13583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13585#[cfg_attr(feature = "bindings", derive(TS))]
13586pub struct JSONArrayAgg {
13587 pub this: Box<Expression>,
13588 #[serde(default)]
13589 pub order: Option<Box<Expression>>,
13590 #[serde(default)]
13591 pub null_handling: Option<Box<Expression>>,
13592 #[serde(default)]
13593 pub return_type: Option<Box<Expression>>,
13594 #[serde(default)]
13595 pub strict: Option<Box<Expression>>,
13596}
13597
13598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13600#[cfg_attr(feature = "bindings", derive(TS))]
13601pub struct JSONExists {
13602 pub this: Box<Expression>,
13603 #[serde(default)]
13604 pub path: Option<Box<Expression>>,
13605 #[serde(default)]
13606 pub passing: Option<Box<Expression>>,
13607 #[serde(default)]
13608 pub on_condition: Option<Box<Expression>>,
13609 #[serde(default)]
13610 pub from_dcolonqmark: Option<Box<Expression>>,
13611}
13612
13613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13615#[cfg_attr(feature = "bindings", derive(TS))]
13616pub struct JSONColumnDef {
13617 #[serde(default)]
13618 pub this: Option<Box<Expression>>,
13619 #[serde(default)]
13620 pub kind: Option<String>,
13621 #[serde(default)]
13622 pub path: Option<Box<Expression>>,
13623 #[serde(default)]
13624 pub nested_schema: Option<Box<Expression>>,
13625 #[serde(default)]
13626 pub ordinality: Option<Box<Expression>>,
13627}
13628
13629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13631#[cfg_attr(feature = "bindings", derive(TS))]
13632pub struct JSONSchema {
13633 #[serde(default)]
13634 pub expressions: Vec<Expression>,
13635}
13636
13637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13639#[cfg_attr(feature = "bindings", derive(TS))]
13640pub struct JSONSet {
13641 pub this: Box<Expression>,
13642 #[serde(default)]
13643 pub expressions: Vec<Expression>,
13644}
13645
13646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13648#[cfg_attr(feature = "bindings", derive(TS))]
13649pub struct JSONStripNulls {
13650 pub this: Box<Expression>,
13651 #[serde(default)]
13652 pub expression: Option<Box<Expression>>,
13653 #[serde(default)]
13654 pub include_arrays: Option<Box<Expression>>,
13655 #[serde(default)]
13656 pub remove_empty: Option<Box<Expression>>,
13657}
13658
13659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13661#[cfg_attr(feature = "bindings", derive(TS))]
13662pub struct JSONValue {
13663 pub this: Box<Expression>,
13664 #[serde(default)]
13665 pub path: Option<Box<Expression>>,
13666 #[serde(default)]
13667 pub returning: Option<Box<Expression>>,
13668 #[serde(default)]
13669 pub on_condition: Option<Box<Expression>>,
13670}
13671
13672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13674#[cfg_attr(feature = "bindings", derive(TS))]
13675pub struct JSONValueArray {
13676 pub this: Box<Expression>,
13677 #[serde(default)]
13678 pub expression: Option<Box<Expression>>,
13679}
13680
13681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13683#[cfg_attr(feature = "bindings", derive(TS))]
13684pub struct JSONRemove {
13685 pub this: Box<Expression>,
13686 #[serde(default)]
13687 pub expressions: Vec<Expression>,
13688}
13689
13690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13692#[cfg_attr(feature = "bindings", derive(TS))]
13693pub struct JSONTable {
13694 pub this: Box<Expression>,
13695 #[serde(default)]
13696 pub schema: Option<Box<Expression>>,
13697 #[serde(default)]
13698 pub path: Option<Box<Expression>>,
13699 #[serde(default)]
13700 pub error_handling: Option<Box<Expression>>,
13701 #[serde(default)]
13702 pub empty_handling: Option<Box<Expression>>,
13703}
13704
13705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13707#[cfg_attr(feature = "bindings", derive(TS))]
13708pub struct JSONType {
13709 pub this: Box<Expression>,
13710 #[serde(default)]
13711 pub expression: Option<Box<Expression>>,
13712}
13713
13714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13716#[cfg_attr(feature = "bindings", derive(TS))]
13717pub struct ObjectInsert {
13718 pub this: Box<Expression>,
13719 #[serde(default)]
13720 pub key: Option<Box<Expression>>,
13721 #[serde(default)]
13722 pub value: Option<Box<Expression>>,
13723 #[serde(default)]
13724 pub update_flag: Option<Box<Expression>>,
13725}
13726
13727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13729#[cfg_attr(feature = "bindings", derive(TS))]
13730pub struct OpenJSONColumnDef {
13731 pub this: Box<Expression>,
13732 pub kind: String,
13733 #[serde(default)]
13734 pub path: Option<Box<Expression>>,
13735 #[serde(default)]
13736 pub as_json: Option<Box<Expression>>,
13737 #[serde(default, skip_serializing_if = "Option::is_none")]
13739 pub data_type: Option<DataType>,
13740}
13741
13742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13744#[cfg_attr(feature = "bindings", derive(TS))]
13745pub struct OpenJSON {
13746 pub this: Box<Expression>,
13747 #[serde(default)]
13748 pub path: Option<Box<Expression>>,
13749 #[serde(default)]
13750 pub expressions: Vec<Expression>,
13751}
13752
13753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13755#[cfg_attr(feature = "bindings", derive(TS))]
13756pub struct JSONBExists {
13757 pub this: Box<Expression>,
13758 #[serde(default)]
13759 pub path: Option<Box<Expression>>,
13760}
13761
13762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13764#[cfg_attr(feature = "bindings", derive(TS))]
13765pub struct JSONCast {
13766 pub this: Box<Expression>,
13767 pub to: DataType,
13768}
13769
13770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13772#[cfg_attr(feature = "bindings", derive(TS))]
13773pub struct JSONExtract {
13774 pub this: Box<Expression>,
13775 pub expression: Box<Expression>,
13776 #[serde(default)]
13777 pub only_json_types: Option<Box<Expression>>,
13778 #[serde(default)]
13779 pub expressions: Vec<Expression>,
13780 #[serde(default)]
13781 pub variant_extract: Option<Box<Expression>>,
13782 #[serde(default)]
13783 pub json_query: Option<Box<Expression>>,
13784 #[serde(default)]
13785 pub option: Option<Box<Expression>>,
13786 #[serde(default)]
13787 pub quote: Option<Box<Expression>>,
13788 #[serde(default)]
13789 pub on_condition: Option<Box<Expression>>,
13790 #[serde(default)]
13791 pub requires_json: Option<Box<Expression>>,
13792}
13793
13794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13796#[cfg_attr(feature = "bindings", derive(TS))]
13797pub struct JSONExtractQuote {
13798 #[serde(default)]
13799 pub option: Option<Box<Expression>>,
13800 #[serde(default)]
13801 pub scalar: Option<Box<Expression>>,
13802}
13803
13804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13806#[cfg_attr(feature = "bindings", derive(TS))]
13807pub struct JSONExtractArray {
13808 pub this: Box<Expression>,
13809 #[serde(default)]
13810 pub expression: Option<Box<Expression>>,
13811}
13812
13813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13815#[cfg_attr(feature = "bindings", derive(TS))]
13816pub struct JSONExtractScalar {
13817 pub this: Box<Expression>,
13818 pub expression: Box<Expression>,
13819 #[serde(default)]
13820 pub only_json_types: Option<Box<Expression>>,
13821 #[serde(default)]
13822 pub expressions: Vec<Expression>,
13823 #[serde(default)]
13824 pub json_type: Option<Box<Expression>>,
13825 #[serde(default)]
13826 pub scalar_only: Option<Box<Expression>>,
13827}
13828
13829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13831#[cfg_attr(feature = "bindings", derive(TS))]
13832pub struct JSONBExtractScalar {
13833 pub this: Box<Expression>,
13834 pub expression: Box<Expression>,
13835 #[serde(default)]
13836 pub json_type: Option<Box<Expression>>,
13837}
13838
13839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13841#[cfg_attr(feature = "bindings", derive(TS))]
13842pub struct JSONFormat {
13843 #[serde(default)]
13844 pub this: Option<Box<Expression>>,
13845 #[serde(default)]
13846 pub options: Vec<Expression>,
13847 #[serde(default)]
13848 pub is_json: Option<Box<Expression>>,
13849 #[serde(default)]
13850 pub to_json: Option<Box<Expression>>,
13851}
13852
13853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13855#[cfg_attr(feature = "bindings", derive(TS))]
13856pub struct JSONArrayAppend {
13857 pub this: Box<Expression>,
13858 #[serde(default)]
13859 pub expressions: Vec<Expression>,
13860}
13861
13862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13864#[cfg_attr(feature = "bindings", derive(TS))]
13865pub struct JSONArrayContains {
13866 pub this: Box<Expression>,
13867 pub expression: Box<Expression>,
13868 #[serde(default)]
13869 pub json_type: Option<Box<Expression>>,
13870}
13871
13872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13874#[cfg_attr(feature = "bindings", derive(TS))]
13875pub struct JSONArrayInsert {
13876 pub this: Box<Expression>,
13877 #[serde(default)]
13878 pub expressions: Vec<Expression>,
13879}
13880
13881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13883#[cfg_attr(feature = "bindings", derive(TS))]
13884pub struct ParseJSON {
13885 pub this: Box<Expression>,
13886 #[serde(default)]
13887 pub expression: Option<Box<Expression>>,
13888 #[serde(default)]
13889 pub safe: Option<Box<Expression>>,
13890}
13891
13892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13894#[cfg_attr(feature = "bindings", derive(TS))]
13895pub struct ParseUrl {
13896 pub this: Box<Expression>,
13897 #[serde(default)]
13898 pub part_to_extract: Option<Box<Expression>>,
13899 #[serde(default)]
13900 pub key: Option<Box<Expression>>,
13901 #[serde(default)]
13902 pub permissive: Option<Box<Expression>>,
13903}
13904
13905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13907#[cfg_attr(feature = "bindings", derive(TS))]
13908pub struct ParseIp {
13909 pub this: Box<Expression>,
13910 #[serde(default)]
13911 pub type_: Option<Box<Expression>>,
13912 #[serde(default)]
13913 pub permissive: Option<Box<Expression>>,
13914}
13915
13916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13918#[cfg_attr(feature = "bindings", derive(TS))]
13919pub struct ParseTime {
13920 pub this: Box<Expression>,
13921 pub format: String,
13922}
13923
13924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13926#[cfg_attr(feature = "bindings", derive(TS))]
13927pub struct ParseDatetime {
13928 pub this: Box<Expression>,
13929 #[serde(default)]
13930 pub format: Option<String>,
13931 #[serde(default)]
13932 pub zone: Option<Box<Expression>>,
13933}
13934
13935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13937#[cfg_attr(feature = "bindings", derive(TS))]
13938pub struct Map {
13939 #[serde(default)]
13940 pub keys: Vec<Expression>,
13941 #[serde(default)]
13942 pub values: Vec<Expression>,
13943}
13944
13945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13947#[cfg_attr(feature = "bindings", derive(TS))]
13948pub struct MapCat {
13949 pub this: Box<Expression>,
13950 pub expression: Box<Expression>,
13951}
13952
13953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13955#[cfg_attr(feature = "bindings", derive(TS))]
13956pub struct MapDelete {
13957 pub this: Box<Expression>,
13958 #[serde(default)]
13959 pub expressions: Vec<Expression>,
13960}
13961
13962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13964#[cfg_attr(feature = "bindings", derive(TS))]
13965pub struct MapInsert {
13966 pub this: Box<Expression>,
13967 #[serde(default)]
13968 pub key: Option<Box<Expression>>,
13969 #[serde(default)]
13970 pub value: Option<Box<Expression>>,
13971 #[serde(default)]
13972 pub update_flag: Option<Box<Expression>>,
13973}
13974
13975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13977#[cfg_attr(feature = "bindings", derive(TS))]
13978pub struct MapPick {
13979 pub this: Box<Expression>,
13980 #[serde(default)]
13981 pub expressions: Vec<Expression>,
13982}
13983
13984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13986#[cfg_attr(feature = "bindings", derive(TS))]
13987pub struct ScopeResolution {
13988 #[serde(default)]
13989 pub this: Option<Box<Expression>>,
13990 pub expression: Box<Expression>,
13991}
13992
13993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13995#[cfg_attr(feature = "bindings", derive(TS))]
13996pub struct Slice {
13997 #[serde(default)]
13998 pub this: Option<Box<Expression>>,
13999 #[serde(default)]
14000 pub expression: Option<Box<Expression>>,
14001 #[serde(default)]
14002 pub step: Option<Box<Expression>>,
14003}
14004
14005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14007#[cfg_attr(feature = "bindings", derive(TS))]
14008pub struct VarMap {
14009 #[serde(default)]
14010 pub keys: Vec<Expression>,
14011 #[serde(default)]
14012 pub values: Vec<Expression>,
14013}
14014
14015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14017#[cfg_attr(feature = "bindings", derive(TS))]
14018pub struct MatchAgainst {
14019 pub this: Box<Expression>,
14020 #[serde(default)]
14021 pub expressions: Vec<Expression>,
14022 #[serde(default)]
14023 pub modifier: Option<Box<Expression>>,
14024}
14025
14026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14028#[cfg_attr(feature = "bindings", derive(TS))]
14029pub struct MD5Digest {
14030 pub this: Box<Expression>,
14031 #[serde(default)]
14032 pub expressions: Vec<Expression>,
14033}
14034
14035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14037#[cfg_attr(feature = "bindings", derive(TS))]
14038pub struct Monthname {
14039 pub this: Box<Expression>,
14040 #[serde(default)]
14041 pub abbreviated: Option<Box<Expression>>,
14042}
14043
14044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14046#[cfg_attr(feature = "bindings", derive(TS))]
14047pub struct Ntile {
14048 #[serde(default)]
14049 pub this: Option<Box<Expression>>,
14050}
14051
14052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14054#[cfg_attr(feature = "bindings", derive(TS))]
14055pub struct Normalize {
14056 pub this: Box<Expression>,
14057 #[serde(default)]
14058 pub form: Option<Box<Expression>>,
14059 #[serde(default)]
14060 pub is_casefold: Option<Box<Expression>>,
14061}
14062
14063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14065#[cfg_attr(feature = "bindings", derive(TS))]
14066pub struct Normal {
14067 pub this: Box<Expression>,
14068 #[serde(default)]
14069 pub stddev: Option<Box<Expression>>,
14070 #[serde(default)]
14071 pub gen: Option<Box<Expression>>,
14072}
14073
14074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14076#[cfg_attr(feature = "bindings", derive(TS))]
14077pub struct Predict {
14078 pub this: Box<Expression>,
14079 pub expression: Box<Expression>,
14080 #[serde(default)]
14081 pub params_struct: Option<Box<Expression>>,
14082}
14083
14084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14086#[cfg_attr(feature = "bindings", derive(TS))]
14087pub struct MLTranslate {
14088 pub this: Box<Expression>,
14089 pub expression: Box<Expression>,
14090 #[serde(default)]
14091 pub params_struct: Option<Box<Expression>>,
14092}
14093
14094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14096#[cfg_attr(feature = "bindings", derive(TS))]
14097pub struct FeaturesAtTime {
14098 pub this: Box<Expression>,
14099 #[serde(default)]
14100 pub time: Option<Box<Expression>>,
14101 #[serde(default)]
14102 pub num_rows: Option<Box<Expression>>,
14103 #[serde(default)]
14104 pub ignore_feature_nulls: Option<Box<Expression>>,
14105}
14106
14107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14109#[cfg_attr(feature = "bindings", derive(TS))]
14110pub struct GenerateEmbedding {
14111 pub this: Box<Expression>,
14112 pub expression: Box<Expression>,
14113 #[serde(default)]
14114 pub params_struct: Option<Box<Expression>>,
14115 #[serde(default)]
14116 pub is_text: Option<Box<Expression>>,
14117}
14118
14119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14121#[cfg_attr(feature = "bindings", derive(TS))]
14122pub struct MLForecast {
14123 pub this: Box<Expression>,
14124 #[serde(default)]
14125 pub expression: Option<Box<Expression>>,
14126 #[serde(default)]
14127 pub params_struct: Option<Box<Expression>>,
14128}
14129
14130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14132#[cfg_attr(feature = "bindings", derive(TS))]
14133pub struct ModelAttribute {
14134 pub this: Box<Expression>,
14135 pub expression: Box<Expression>,
14136}
14137
14138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14140#[cfg_attr(feature = "bindings", derive(TS))]
14141pub struct VectorSearch {
14142 pub this: Box<Expression>,
14143 #[serde(default)]
14144 pub column_to_search: Option<Box<Expression>>,
14145 #[serde(default)]
14146 pub query_table: Option<Box<Expression>>,
14147 #[serde(default)]
14148 pub query_column_to_search: Option<Box<Expression>>,
14149 #[serde(default)]
14150 pub top_k: Option<Box<Expression>>,
14151 #[serde(default)]
14152 pub distance_type: Option<Box<Expression>>,
14153 #[serde(default)]
14154 pub options: Vec<Expression>,
14155}
14156
14157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14159#[cfg_attr(feature = "bindings", derive(TS))]
14160pub struct Quantile {
14161 pub this: Box<Expression>,
14162 #[serde(default)]
14163 pub quantile: Option<Box<Expression>>,
14164}
14165
14166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14168#[cfg_attr(feature = "bindings", derive(TS))]
14169pub struct ApproxQuantile {
14170 pub this: Box<Expression>,
14171 #[serde(default)]
14172 pub quantile: Option<Box<Expression>>,
14173 #[serde(default)]
14174 pub accuracy: Option<Box<Expression>>,
14175 #[serde(default)]
14176 pub weight: Option<Box<Expression>>,
14177 #[serde(default)]
14178 pub error_tolerance: Option<Box<Expression>>,
14179}
14180
14181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14183#[cfg_attr(feature = "bindings", derive(TS))]
14184pub struct ApproxPercentileEstimate {
14185 pub this: Box<Expression>,
14186 #[serde(default)]
14187 pub percentile: Option<Box<Expression>>,
14188}
14189
14190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14192#[cfg_attr(feature = "bindings", derive(TS))]
14193pub struct Randn {
14194 #[serde(default)]
14195 pub this: Option<Box<Expression>>,
14196}
14197
14198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14200#[cfg_attr(feature = "bindings", derive(TS))]
14201pub struct Randstr {
14202 pub this: Box<Expression>,
14203 #[serde(default)]
14204 pub generator: Option<Box<Expression>>,
14205}
14206
14207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14209#[cfg_attr(feature = "bindings", derive(TS))]
14210pub struct RangeN {
14211 pub this: Box<Expression>,
14212 #[serde(default)]
14213 pub expressions: Vec<Expression>,
14214 #[serde(default)]
14215 pub each: Option<Box<Expression>>,
14216}
14217
14218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14220#[cfg_attr(feature = "bindings", derive(TS))]
14221pub struct RangeBucket {
14222 pub this: Box<Expression>,
14223 pub expression: Box<Expression>,
14224}
14225
14226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14228#[cfg_attr(feature = "bindings", derive(TS))]
14229pub struct ReadCSV {
14230 pub this: Box<Expression>,
14231 #[serde(default)]
14232 pub expressions: Vec<Expression>,
14233}
14234
14235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14237#[cfg_attr(feature = "bindings", derive(TS))]
14238pub struct ReadParquet {
14239 #[serde(default)]
14240 pub expressions: Vec<Expression>,
14241}
14242
14243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14245#[cfg_attr(feature = "bindings", derive(TS))]
14246pub struct Reduce {
14247 pub this: Box<Expression>,
14248 #[serde(default)]
14249 pub initial: Option<Box<Expression>>,
14250 #[serde(default)]
14251 pub merge: Option<Box<Expression>>,
14252 #[serde(default)]
14253 pub finish: Option<Box<Expression>>,
14254}
14255
14256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14258#[cfg_attr(feature = "bindings", derive(TS))]
14259pub struct RegexpExtractAll {
14260 pub this: Box<Expression>,
14261 pub expression: Box<Expression>,
14262 #[serde(default)]
14263 pub group: Option<Box<Expression>>,
14264 #[serde(default)]
14265 pub parameters: Option<Box<Expression>>,
14266 #[serde(default)]
14267 pub position: Option<Box<Expression>>,
14268 #[serde(default)]
14269 pub occurrence: Option<Box<Expression>>,
14270}
14271
14272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14274#[cfg_attr(feature = "bindings", derive(TS))]
14275pub struct RegexpILike {
14276 pub this: Box<Expression>,
14277 pub expression: Box<Expression>,
14278 #[serde(default)]
14279 pub flag: Option<Box<Expression>>,
14280}
14281
14282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14284#[cfg_attr(feature = "bindings", derive(TS))]
14285pub struct RegexpFullMatch {
14286 pub this: Box<Expression>,
14287 pub expression: Box<Expression>,
14288 #[serde(default)]
14289 pub options: Vec<Expression>,
14290}
14291
14292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14294#[cfg_attr(feature = "bindings", derive(TS))]
14295pub struct RegexpInstr {
14296 pub this: Box<Expression>,
14297 pub expression: Box<Expression>,
14298 #[serde(default)]
14299 pub position: Option<Box<Expression>>,
14300 #[serde(default)]
14301 pub occurrence: Option<Box<Expression>>,
14302 #[serde(default)]
14303 pub option: Option<Box<Expression>>,
14304 #[serde(default)]
14305 pub parameters: Option<Box<Expression>>,
14306 #[serde(default)]
14307 pub group: Option<Box<Expression>>,
14308}
14309
14310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14312#[cfg_attr(feature = "bindings", derive(TS))]
14313pub struct RegexpSplit {
14314 pub this: Box<Expression>,
14315 pub expression: Box<Expression>,
14316 #[serde(default)]
14317 pub limit: Option<Box<Expression>>,
14318}
14319
14320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14322#[cfg_attr(feature = "bindings", derive(TS))]
14323pub struct RegexpCount {
14324 pub this: Box<Expression>,
14325 pub expression: Box<Expression>,
14326 #[serde(default)]
14327 pub position: Option<Box<Expression>>,
14328 #[serde(default)]
14329 pub parameters: Option<Box<Expression>>,
14330}
14331
14332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14334#[cfg_attr(feature = "bindings", derive(TS))]
14335pub struct RegrValx {
14336 pub this: Box<Expression>,
14337 pub expression: Box<Expression>,
14338}
14339
14340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14342#[cfg_attr(feature = "bindings", derive(TS))]
14343pub struct RegrValy {
14344 pub this: Box<Expression>,
14345 pub expression: Box<Expression>,
14346}
14347
14348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14350#[cfg_attr(feature = "bindings", derive(TS))]
14351pub struct RegrAvgy {
14352 pub this: Box<Expression>,
14353 pub expression: Box<Expression>,
14354}
14355
14356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14358#[cfg_attr(feature = "bindings", derive(TS))]
14359pub struct RegrAvgx {
14360 pub this: Box<Expression>,
14361 pub expression: Box<Expression>,
14362}
14363
14364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14366#[cfg_attr(feature = "bindings", derive(TS))]
14367pub struct RegrCount {
14368 pub this: Box<Expression>,
14369 pub expression: Box<Expression>,
14370}
14371
14372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14374#[cfg_attr(feature = "bindings", derive(TS))]
14375pub struct RegrIntercept {
14376 pub this: Box<Expression>,
14377 pub expression: Box<Expression>,
14378}
14379
14380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14382#[cfg_attr(feature = "bindings", derive(TS))]
14383pub struct RegrR2 {
14384 pub this: Box<Expression>,
14385 pub expression: Box<Expression>,
14386}
14387
14388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14390#[cfg_attr(feature = "bindings", derive(TS))]
14391pub struct RegrSxx {
14392 pub this: Box<Expression>,
14393 pub expression: Box<Expression>,
14394}
14395
14396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14398#[cfg_attr(feature = "bindings", derive(TS))]
14399pub struct RegrSxy {
14400 pub this: Box<Expression>,
14401 pub expression: Box<Expression>,
14402}
14403
14404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14406#[cfg_attr(feature = "bindings", derive(TS))]
14407pub struct RegrSyy {
14408 pub this: Box<Expression>,
14409 pub expression: Box<Expression>,
14410}
14411
14412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14414#[cfg_attr(feature = "bindings", derive(TS))]
14415pub struct RegrSlope {
14416 pub this: Box<Expression>,
14417 pub expression: Box<Expression>,
14418}
14419
14420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14422#[cfg_attr(feature = "bindings", derive(TS))]
14423pub struct SafeAdd {
14424 pub this: Box<Expression>,
14425 pub expression: Box<Expression>,
14426}
14427
14428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14430#[cfg_attr(feature = "bindings", derive(TS))]
14431pub struct SafeDivide {
14432 pub this: Box<Expression>,
14433 pub expression: Box<Expression>,
14434}
14435
14436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14438#[cfg_attr(feature = "bindings", derive(TS))]
14439pub struct SafeMultiply {
14440 pub this: Box<Expression>,
14441 pub expression: Box<Expression>,
14442}
14443
14444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14446#[cfg_attr(feature = "bindings", derive(TS))]
14447pub struct SafeSubtract {
14448 pub this: Box<Expression>,
14449 pub expression: Box<Expression>,
14450}
14451
14452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14454#[cfg_attr(feature = "bindings", derive(TS))]
14455pub struct SHA2 {
14456 pub this: Box<Expression>,
14457 #[serde(default)]
14458 pub length: Option<i64>,
14459}
14460
14461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14463#[cfg_attr(feature = "bindings", derive(TS))]
14464pub struct SHA2Digest {
14465 pub this: Box<Expression>,
14466 #[serde(default)]
14467 pub length: Option<i64>,
14468}
14469
14470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14472#[cfg_attr(feature = "bindings", derive(TS))]
14473pub struct SortArray {
14474 pub this: Box<Expression>,
14475 #[serde(default)]
14476 pub asc: Option<Box<Expression>>,
14477 #[serde(default)]
14478 pub nulls_first: Option<Box<Expression>>,
14479}
14480
14481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14483#[cfg_attr(feature = "bindings", derive(TS))]
14484pub struct SplitPart {
14485 pub this: Box<Expression>,
14486 #[serde(default)]
14487 pub delimiter: Option<Box<Expression>>,
14488 #[serde(default)]
14489 pub part_index: Option<Box<Expression>>,
14490}
14491
14492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14494#[cfg_attr(feature = "bindings", derive(TS))]
14495pub struct SubstringIndex {
14496 pub this: Box<Expression>,
14497 #[serde(default)]
14498 pub delimiter: Option<Box<Expression>>,
14499 #[serde(default)]
14500 pub count: Option<Box<Expression>>,
14501}
14502
14503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14505#[cfg_attr(feature = "bindings", derive(TS))]
14506pub struct StandardHash {
14507 pub this: Box<Expression>,
14508 #[serde(default)]
14509 pub expression: Option<Box<Expression>>,
14510}
14511
14512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14514#[cfg_attr(feature = "bindings", derive(TS))]
14515pub struct StrPosition {
14516 pub this: Box<Expression>,
14517 #[serde(default)]
14518 pub substr: Option<Box<Expression>>,
14519 #[serde(default)]
14520 pub position: Option<Box<Expression>>,
14521 #[serde(default)]
14522 pub occurrence: Option<Box<Expression>>,
14523}
14524
14525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14527#[cfg_attr(feature = "bindings", derive(TS))]
14528pub struct Search {
14529 pub this: Box<Expression>,
14530 pub expression: Box<Expression>,
14531 #[serde(default)]
14532 pub json_scope: Option<Box<Expression>>,
14533 #[serde(default)]
14534 pub analyzer: Option<Box<Expression>>,
14535 #[serde(default)]
14536 pub analyzer_options: Option<Box<Expression>>,
14537 #[serde(default)]
14538 pub search_mode: Option<Box<Expression>>,
14539}
14540
14541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14543#[cfg_attr(feature = "bindings", derive(TS))]
14544pub struct SearchIp {
14545 pub this: Box<Expression>,
14546 pub expression: Box<Expression>,
14547}
14548
14549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14551#[cfg_attr(feature = "bindings", derive(TS))]
14552pub struct StrToDate {
14553 pub this: Box<Expression>,
14554 #[serde(default)]
14555 pub format: Option<String>,
14556 #[serde(default)]
14557 pub safe: Option<Box<Expression>>,
14558}
14559
14560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14562#[cfg_attr(feature = "bindings", derive(TS))]
14563pub struct StrToTime {
14564 pub this: Box<Expression>,
14565 pub format: String,
14566 #[serde(default)]
14567 pub zone: Option<Box<Expression>>,
14568 #[serde(default)]
14569 pub safe: Option<Box<Expression>>,
14570 #[serde(default)]
14571 pub target_type: Option<Box<Expression>>,
14572}
14573
14574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14576#[cfg_attr(feature = "bindings", derive(TS))]
14577pub struct StrToUnix {
14578 #[serde(default)]
14579 pub this: Option<Box<Expression>>,
14580 #[serde(default)]
14581 pub format: Option<String>,
14582}
14583
14584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14586#[cfg_attr(feature = "bindings", derive(TS))]
14587pub struct StrToMap {
14588 pub this: Box<Expression>,
14589 #[serde(default)]
14590 pub pair_delim: Option<Box<Expression>>,
14591 #[serde(default)]
14592 pub key_value_delim: Option<Box<Expression>>,
14593 #[serde(default)]
14594 pub duplicate_resolution_callback: Option<Box<Expression>>,
14595}
14596
14597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14599#[cfg_attr(feature = "bindings", derive(TS))]
14600pub struct NumberToStr {
14601 pub this: Box<Expression>,
14602 pub format: String,
14603 #[serde(default)]
14604 pub culture: Option<Box<Expression>>,
14605}
14606
14607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14609#[cfg_attr(feature = "bindings", derive(TS))]
14610pub struct FromBase {
14611 pub this: Box<Expression>,
14612 pub expression: Box<Expression>,
14613}
14614
14615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14617#[cfg_attr(feature = "bindings", derive(TS))]
14618pub struct Stuff {
14619 pub this: Box<Expression>,
14620 #[serde(default)]
14621 pub start: Option<Box<Expression>>,
14622 #[serde(default)]
14623 pub length: Option<i64>,
14624 pub expression: Box<Expression>,
14625}
14626
14627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14629#[cfg_attr(feature = "bindings", derive(TS))]
14630pub struct TimeToStr {
14631 pub this: Box<Expression>,
14632 pub format: String,
14633 #[serde(default)]
14634 pub culture: Option<Box<Expression>>,
14635 #[serde(default)]
14636 pub zone: Option<Box<Expression>>,
14637}
14638
14639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14641#[cfg_attr(feature = "bindings", derive(TS))]
14642pub struct TimeStrToTime {
14643 pub this: Box<Expression>,
14644 #[serde(default)]
14645 pub zone: Option<Box<Expression>>,
14646}
14647
14648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14650#[cfg_attr(feature = "bindings", derive(TS))]
14651pub struct TsOrDsAdd {
14652 pub this: Box<Expression>,
14653 pub expression: Box<Expression>,
14654 #[serde(default)]
14655 pub unit: Option<String>,
14656 #[serde(default)]
14657 pub return_type: Option<Box<Expression>>,
14658}
14659
14660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14662#[cfg_attr(feature = "bindings", derive(TS))]
14663pub struct TsOrDsDiff {
14664 pub this: Box<Expression>,
14665 pub expression: Box<Expression>,
14666 #[serde(default)]
14667 pub unit: Option<String>,
14668}
14669
14670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14672#[cfg_attr(feature = "bindings", derive(TS))]
14673pub struct TsOrDsToDate {
14674 pub this: Box<Expression>,
14675 #[serde(default)]
14676 pub format: Option<String>,
14677 #[serde(default)]
14678 pub safe: Option<Box<Expression>>,
14679}
14680
14681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14683#[cfg_attr(feature = "bindings", derive(TS))]
14684pub struct TsOrDsToTime {
14685 pub this: Box<Expression>,
14686 #[serde(default)]
14687 pub format: Option<String>,
14688 #[serde(default)]
14689 pub safe: Option<Box<Expression>>,
14690}
14691
14692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14694#[cfg_attr(feature = "bindings", derive(TS))]
14695pub struct Unhex {
14696 pub this: Box<Expression>,
14697 #[serde(default)]
14698 pub expression: Option<Box<Expression>>,
14699}
14700
14701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14703#[cfg_attr(feature = "bindings", derive(TS))]
14704pub struct Uniform {
14705 pub this: Box<Expression>,
14706 pub expression: Box<Expression>,
14707 #[serde(default)]
14708 pub gen: Option<Box<Expression>>,
14709 #[serde(default)]
14710 pub seed: Option<Box<Expression>>,
14711}
14712
14713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14715#[cfg_attr(feature = "bindings", derive(TS))]
14716pub struct UnixToStr {
14717 pub this: Box<Expression>,
14718 #[serde(default)]
14719 pub format: Option<String>,
14720}
14721
14722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14724#[cfg_attr(feature = "bindings", derive(TS))]
14725pub struct UnixToTime {
14726 pub this: Box<Expression>,
14727 #[serde(default)]
14728 pub scale: Option<i64>,
14729 #[serde(default)]
14730 pub zone: Option<Box<Expression>>,
14731 #[serde(default)]
14732 pub hours: Option<Box<Expression>>,
14733 #[serde(default)]
14734 pub minutes: Option<Box<Expression>>,
14735 #[serde(default)]
14736 pub format: Option<String>,
14737 #[serde(default)]
14738 pub target_type: Option<Box<Expression>>,
14739}
14740
14741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14743#[cfg_attr(feature = "bindings", derive(TS))]
14744pub struct Uuid {
14745 #[serde(default)]
14746 pub this: Option<Box<Expression>>,
14747 #[serde(default)]
14748 pub name: Option<String>,
14749 #[serde(default)]
14750 pub is_string: Option<Box<Expression>>,
14751}
14752
14753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14755#[cfg_attr(feature = "bindings", derive(TS))]
14756pub struct TimestampFromParts {
14757 #[serde(default)]
14758 pub zone: Option<Box<Expression>>,
14759 #[serde(default)]
14760 pub milli: Option<Box<Expression>>,
14761 #[serde(default)]
14762 pub this: Option<Box<Expression>>,
14763 #[serde(default)]
14764 pub expression: Option<Box<Expression>>,
14765}
14766
14767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14769#[cfg_attr(feature = "bindings", derive(TS))]
14770pub struct TimestampTzFromParts {
14771 #[serde(default)]
14772 pub zone: Option<Box<Expression>>,
14773}
14774
14775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14777#[cfg_attr(feature = "bindings", derive(TS))]
14778pub struct Corr {
14779 pub this: Box<Expression>,
14780 pub expression: Box<Expression>,
14781 #[serde(default)]
14782 pub null_on_zero_variance: Option<Box<Expression>>,
14783}
14784
14785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14787#[cfg_attr(feature = "bindings", derive(TS))]
14788pub struct WidthBucket {
14789 pub this: Box<Expression>,
14790 #[serde(default)]
14791 pub min_value: Option<Box<Expression>>,
14792 #[serde(default)]
14793 pub max_value: Option<Box<Expression>>,
14794 #[serde(default)]
14795 pub num_buckets: Option<Box<Expression>>,
14796 #[serde(default)]
14797 pub threshold: Option<Box<Expression>>,
14798}
14799
14800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14802#[cfg_attr(feature = "bindings", derive(TS))]
14803pub struct CovarSamp {
14804 pub this: Box<Expression>,
14805 pub expression: Box<Expression>,
14806}
14807
14808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14810#[cfg_attr(feature = "bindings", derive(TS))]
14811pub struct CovarPop {
14812 pub this: Box<Expression>,
14813 pub expression: Box<Expression>,
14814}
14815
14816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14818#[cfg_attr(feature = "bindings", derive(TS))]
14819pub struct Week {
14820 pub this: Box<Expression>,
14821 #[serde(default)]
14822 pub mode: Option<Box<Expression>>,
14823}
14824
14825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14827#[cfg_attr(feature = "bindings", derive(TS))]
14828pub struct XMLElement {
14829 pub this: Box<Expression>,
14830 #[serde(default)]
14831 pub expressions: Vec<Expression>,
14832 #[serde(default)]
14833 pub evalname: Option<Box<Expression>>,
14834}
14835
14836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14838#[cfg_attr(feature = "bindings", derive(TS))]
14839pub struct XMLGet {
14840 pub this: Box<Expression>,
14841 pub expression: Box<Expression>,
14842 #[serde(default)]
14843 pub instance: Option<Box<Expression>>,
14844}
14845
14846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14848#[cfg_attr(feature = "bindings", derive(TS))]
14849pub struct XMLTable {
14850 pub this: Box<Expression>,
14851 #[serde(default)]
14852 pub namespaces: Option<Box<Expression>>,
14853 #[serde(default)]
14854 pub passing: Option<Box<Expression>>,
14855 #[serde(default)]
14856 pub columns: Vec<Expression>,
14857 #[serde(default)]
14858 pub by_ref: Option<Box<Expression>>,
14859}
14860
14861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14863#[cfg_attr(feature = "bindings", derive(TS))]
14864pub struct XMLKeyValueOption {
14865 pub this: Box<Expression>,
14866 #[serde(default)]
14867 pub expression: Option<Box<Expression>>,
14868}
14869
14870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14872#[cfg_attr(feature = "bindings", derive(TS))]
14873pub struct Zipf {
14874 pub this: Box<Expression>,
14875 #[serde(default)]
14876 pub elementcount: Option<Box<Expression>>,
14877 #[serde(default)]
14878 pub gen: Option<Box<Expression>>,
14879}
14880
14881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14883#[cfg_attr(feature = "bindings", derive(TS))]
14884pub struct Merge {
14885 pub this: Box<Expression>,
14886 pub using: Box<Expression>,
14887 #[serde(default)]
14888 pub on: Option<Box<Expression>>,
14889 #[serde(default)]
14890 pub using_cond: Option<Box<Expression>>,
14891 #[serde(default)]
14892 pub whens: Option<Box<Expression>>,
14893 #[serde(default)]
14894 pub with_: Option<Box<Expression>>,
14895 #[serde(default)]
14896 pub returning: Option<Box<Expression>>,
14897}
14898
14899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14901#[cfg_attr(feature = "bindings", derive(TS))]
14902pub struct When {
14903 #[serde(default)]
14904 pub matched: Option<Box<Expression>>,
14905 #[serde(default)]
14906 pub source: Option<Box<Expression>>,
14907 #[serde(default)]
14908 pub condition: Option<Box<Expression>>,
14909 pub then: Box<Expression>,
14910}
14911
14912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14914#[cfg_attr(feature = "bindings", derive(TS))]
14915pub struct Whens {
14916 #[serde(default)]
14917 pub expressions: Vec<Expression>,
14918}
14919
14920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14922#[cfg_attr(feature = "bindings", derive(TS))]
14923pub struct NextValueFor {
14924 pub this: Box<Expression>,
14925 #[serde(default)]
14926 pub order: Option<Box<Expression>>,
14927}
14928
14929#[cfg(test)]
14930mod tests {
14931 use super::*;
14932
14933 #[test]
14934 #[cfg(feature = "bindings")]
14935 fn export_typescript_types() {
14936 Expression::export_all(&ts_rs::Config::default())
14939 .expect("Failed to export Expression types");
14940 }
14941
14942 #[test]
14943 fn test_simple_select_builder() {
14944 let select = Select::new()
14945 .column(Expression::star())
14946 .from(Expression::Table(Box::new(TableRef::new("users"))));
14947
14948 assert_eq!(select.expressions.len(), 1);
14949 assert!(select.from.is_some());
14950 }
14951
14952 #[test]
14953 fn test_expression_alias() {
14954 let expr = Expression::column("id").alias("user_id");
14955
14956 match expr {
14957 Expression::Alias(a) => {
14958 assert_eq!(a.alias.name, "user_id");
14959 }
14960 _ => panic!("Expected Alias"),
14961 }
14962 }
14963
14964 #[test]
14965 fn test_literal_creation() {
14966 let num = Expression::number(42);
14967 let str = Expression::string("hello");
14968
14969 match num {
14970 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14971 let Literal::Number(n) = lit.as_ref() else {
14972 unreachable!()
14973 };
14974 assert_eq!(n, "42")
14975 }
14976 _ => panic!("Expected Number"),
14977 }
14978
14979 match str {
14980 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
14981 let Literal::String(s) = lit.as_ref() else {
14982 unreachable!()
14983 };
14984 assert_eq!(s, "hello")
14985 }
14986 _ => panic!("Expected String"),
14987 }
14988 }
14989
14990 #[test]
14991 fn test_expression_sql() {
14992 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14993 assert_eq!(expr.sql(), "SELECT 1 + 2");
14994 }
14995
14996 #[test]
14997 fn test_expression_sql_for() {
14998 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14999 let sql = expr.sql_for(crate::DialectType::Generic);
15000 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15002 }
15003}