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 AlterTable(Box<AlterTable>),
548 CreateIndex(Box<CreateIndex>),
549 DropIndex(Box<DropIndex>),
550 CreateView(Box<CreateView>),
551 DropView(Box<DropView>),
552 AlterView(Box<AlterView>),
553 AlterIndex(Box<AlterIndex>),
554 Truncate(Box<Truncate>),
555 Use(Box<Use>),
556 Cache(Box<Cache>),
557 Uncache(Box<Uncache>),
558 LoadData(Box<LoadData>),
559 Pragma(Box<Pragma>),
560 Grant(Box<Grant>),
561 Revoke(Box<Revoke>),
562 Comment(Box<Comment>),
563 SetStatement(Box<SetStatement>),
564 CreateSchema(Box<CreateSchema>),
566 DropSchema(Box<DropSchema>),
567 DropNamespace(Box<DropNamespace>),
568 CreateDatabase(Box<CreateDatabase>),
569 DropDatabase(Box<DropDatabase>),
570 CreateFunction(Box<CreateFunction>),
571 DropFunction(Box<DropFunction>),
572 CreateProcedure(Box<CreateProcedure>),
573 DropProcedure(Box<DropProcedure>),
574 CreateSequence(Box<CreateSequence>),
575 CreateSynonym(Box<CreateSynonym>),
576 DropSequence(Box<DropSequence>),
577 AlterSequence(Box<AlterSequence>),
578 CreateTrigger(Box<CreateTrigger>),
579 DropTrigger(Box<DropTrigger>),
580 CreateType(Box<CreateType>),
581 DropType(Box<DropType>),
582 Describe(Box<Describe>),
583 Show(Box<Show>),
584
585 Command(Box<Command>),
587 Kill(Box<Kill>),
588 Execute(Box<ExecuteStatement>),
590
591 CreateTask(Box<CreateTask>),
593
594 Raw(Raw),
596
597 Paren(Box<Paren>),
599
600 Annotated(Box<Annotated>),
602
603 Refresh(Box<Refresh>),
606 LockingStatement(Box<LockingStatement>),
607 SequenceProperties(Box<SequenceProperties>),
608 TruncateTable(Box<TruncateTable>),
609 Clone(Box<Clone>),
610 Attach(Box<Attach>),
611 Detach(Box<Detach>),
612 Install(Box<Install>),
613 Summarize(Box<Summarize>),
614 Declare(Box<Declare>),
615 DeclareItem(Box<DeclareItem>),
616 Set(Box<Set>),
617 Heredoc(Box<Heredoc>),
618 SetItem(Box<SetItem>),
619 QueryBand(Box<QueryBand>),
620 UserDefinedFunction(Box<UserDefinedFunction>),
621 RecursiveWithSearch(Box<RecursiveWithSearch>),
622 ProjectionDef(Box<ProjectionDef>),
623 TableAlias(Box<TableAlias>),
624 ByteString(Box<ByteString>),
625 HexStringExpr(Box<HexStringExpr>),
626 UnicodeString(Box<UnicodeString>),
627 ColumnPosition(Box<ColumnPosition>),
628 ColumnDef(Box<ColumnDef>),
629 AlterColumn(Box<AlterColumn>),
630 AlterSortKey(Box<AlterSortKey>),
631 AlterSet(Box<AlterSet>),
632 RenameColumn(Box<RenameColumn>),
633 Comprehension(Box<Comprehension>),
634 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
635 MergeTreeTTL(Box<MergeTreeTTL>),
636 IndexConstraintOption(Box<IndexConstraintOption>),
637 ColumnConstraint(Box<ColumnConstraint>),
638 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
639 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
640 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
641 CheckColumnConstraint(Box<CheckColumnConstraint>),
642 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
643 CompressColumnConstraint(Box<CompressColumnConstraint>),
644 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
645 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
646 WithOperator(Box<WithOperator>),
647 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
648 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
649 CommentColumnConstraint(CommentColumnConstraint),
650 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
651 IndexColumnConstraint(Box<IndexColumnConstraint>),
652 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
653 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
654 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
655 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
656 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
657 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
658 InOutColumnConstraint(Box<InOutColumnConstraint>),
659 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
660 PathColumnConstraint(Box<PathColumnConstraint>),
661 Constraint(Box<Constraint>),
662 Export(Box<Export>),
663 Filter(Box<Filter>),
664 Changes(Box<Changes>),
665 CopyParameter(Box<CopyParameter>),
666 Credentials(Box<Credentials>),
667 Directory(Box<Directory>),
668 ForeignKey(Box<ForeignKey>),
669 ColumnPrefix(Box<ColumnPrefix>),
670 PrimaryKey(Box<PrimaryKey>),
671 IntoClause(Box<IntoClause>),
672 JoinHint(Box<JoinHint>),
673 Opclass(Box<Opclass>),
674 Index(Box<Index>),
675 IndexParameters(Box<IndexParameters>),
676 ConditionalInsert(Box<ConditionalInsert>),
677 MultitableInserts(Box<MultitableInserts>),
678 OnConflict(Box<OnConflict>),
679 OnCondition(Box<OnCondition>),
680 Returning(Box<Returning>),
681 Introducer(Box<Introducer>),
682 PartitionRange(Box<PartitionRange>),
683 Fetch(Box<Fetch>),
684 Group(Box<Group>),
685 Cube(Box<Cube>),
686 Rollup(Box<Rollup>),
687 GroupingSets(Box<GroupingSets>),
688 LimitOptions(Box<LimitOptions>),
689 Lateral(Box<Lateral>),
690 TableFromRows(Box<TableFromRows>),
691 RowsFrom(Box<RowsFrom>),
692 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
693 WithFill(Box<WithFill>),
694 Property(Box<Property>),
695 GrantPrivilege(Box<GrantPrivilege>),
696 GrantPrincipal(Box<GrantPrincipal>),
697 AllowedValuesProperty(Box<AllowedValuesProperty>),
698 AlgorithmProperty(Box<AlgorithmProperty>),
699 AutoIncrementProperty(Box<AutoIncrementProperty>),
700 AutoRefreshProperty(Box<AutoRefreshProperty>),
701 BackupProperty(Box<BackupProperty>),
702 BuildProperty(Box<BuildProperty>),
703 BlockCompressionProperty(Box<BlockCompressionProperty>),
704 CharacterSetProperty(Box<CharacterSetProperty>),
705 ChecksumProperty(Box<ChecksumProperty>),
706 CollateProperty(Box<CollateProperty>),
707 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
708 DataDeletionProperty(Box<DataDeletionProperty>),
709 DefinerProperty(Box<DefinerProperty>),
710 DistKeyProperty(Box<DistKeyProperty>),
711 DistributedByProperty(Box<DistributedByProperty>),
712 DistStyleProperty(Box<DistStyleProperty>),
713 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
714 EngineProperty(Box<EngineProperty>),
715 ToTableProperty(Box<ToTableProperty>),
716 ExecuteAsProperty(Box<ExecuteAsProperty>),
717 ExternalProperty(Box<ExternalProperty>),
718 FallbackProperty(Box<FallbackProperty>),
719 FileFormatProperty(Box<FileFormatProperty>),
720 CredentialsProperty(Box<CredentialsProperty>),
721 FreespaceProperty(Box<FreespaceProperty>),
722 InheritsProperty(Box<InheritsProperty>),
723 InputModelProperty(Box<InputModelProperty>),
724 OutputModelProperty(Box<OutputModelProperty>),
725 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
726 JournalProperty(Box<JournalProperty>),
727 LanguageProperty(Box<LanguageProperty>),
728 EnviromentProperty(Box<EnviromentProperty>),
729 ClusteredByProperty(Box<ClusteredByProperty>),
730 DictProperty(Box<DictProperty>),
731 DictRange(Box<DictRange>),
732 OnCluster(Box<OnCluster>),
733 LikeProperty(Box<LikeProperty>),
734 LocationProperty(Box<LocationProperty>),
735 LockProperty(Box<LockProperty>),
736 LockingProperty(Box<LockingProperty>),
737 LogProperty(Box<LogProperty>),
738 MaterializedProperty(Box<MaterializedProperty>),
739 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
740 OnProperty(Box<OnProperty>),
741 OnCommitProperty(Box<OnCommitProperty>),
742 PartitionedByProperty(Box<PartitionedByProperty>),
743 PartitionByProperty(Box<PartitionByProperty>),
744 PartitionedByBucket(Box<PartitionedByBucket>),
745 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
746 PartitionByTruncate(Box<PartitionByTruncate>),
747 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
748 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
749 PartitionByListProperty(Box<PartitionByListProperty>),
750 PartitionList(Box<PartitionList>),
751 Partition(Box<Partition>),
752 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
753 UniqueKeyProperty(Box<UniqueKeyProperty>),
754 RollupProperty(Box<RollupProperty>),
755 PartitionBoundSpec(Box<PartitionBoundSpec>),
756 PartitionedOfProperty(Box<PartitionedOfProperty>),
757 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
758 ReturnsProperty(Box<ReturnsProperty>),
759 RowFormatProperty(Box<RowFormatProperty>),
760 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
761 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
762 QueryTransform(Box<QueryTransform>),
763 SampleProperty(Box<SampleProperty>),
764 SecurityProperty(Box<SecurityProperty>),
765 SchemaCommentProperty(Box<SchemaCommentProperty>),
766 SemanticView(Box<SemanticView>),
767 SerdeProperties(Box<SerdeProperties>),
768 SetProperty(Box<SetProperty>),
769 SharingProperty(Box<SharingProperty>),
770 SetConfigProperty(Box<SetConfigProperty>),
771 SettingsProperty(Box<SettingsProperty>),
772 SortKeyProperty(Box<SortKeyProperty>),
773 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
774 SqlSecurityProperty(Box<SqlSecurityProperty>),
775 StabilityProperty(Box<StabilityProperty>),
776 StorageHandlerProperty(Box<StorageHandlerProperty>),
777 TemporaryProperty(Box<TemporaryProperty>),
778 Tags(Box<Tags>),
779 TransformModelProperty(Box<TransformModelProperty>),
780 TransientProperty(Box<TransientProperty>),
781 UsingTemplateProperty(Box<UsingTemplateProperty>),
782 ViewAttributeProperty(Box<ViewAttributeProperty>),
783 VolatileProperty(Box<VolatileProperty>),
784 WithDataProperty(Box<WithDataProperty>),
785 WithJournalTableProperty(Box<WithJournalTableProperty>),
786 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
787 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
788 WithProcedureOptions(Box<WithProcedureOptions>),
789 EncodeProperty(Box<EncodeProperty>),
790 IncludeProperty(Box<IncludeProperty>),
791 Properties(Box<Properties>),
792 OptionsProperty(Box<OptionsProperty>),
793 InputOutputFormat(Box<InputOutputFormat>),
794 Reference(Box<Reference>),
795 QueryOption(Box<QueryOption>),
796 WithTableHint(Box<WithTableHint>),
797 IndexTableHint(Box<IndexTableHint>),
798 HistoricalData(Box<HistoricalData>),
799 Get(Box<Get>),
800 SetOperation(Box<SetOperation>),
801 Var(Box<Var>),
802 Variadic(Box<Variadic>),
803 Version(Box<Version>),
804 Schema(Box<Schema>),
805 Lock(Box<Lock>),
806 TableSample(Box<TableSample>),
807 Tag(Box<Tag>),
808 UnpivotColumns(Box<UnpivotColumns>),
809 WindowSpec(Box<WindowSpec>),
810 SessionParameter(Box<SessionParameter>),
811 PseudoType(Box<PseudoType>),
812 ObjectIdentifier(Box<ObjectIdentifier>),
813 Transaction(Box<Transaction>),
814 Commit(Box<Commit>),
815 Rollback(Box<Rollback>),
816 AlterSession(Box<AlterSession>),
817 Analyze(Box<Analyze>),
818 AnalyzeStatistics(Box<AnalyzeStatistics>),
819 AnalyzeHistogram(Box<AnalyzeHistogram>),
820 AnalyzeSample(Box<AnalyzeSample>),
821 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
822 AnalyzeDelete(Box<AnalyzeDelete>),
823 AnalyzeWith(Box<AnalyzeWith>),
824 AnalyzeValidate(Box<AnalyzeValidate>),
825 AddPartition(Box<AddPartition>),
826 AttachOption(Box<AttachOption>),
827 DropPartition(Box<DropPartition>),
828 ReplacePartition(Box<ReplacePartition>),
829 DPipe(Box<DPipe>),
830 Operator(Box<Operator>),
831 PivotAny(Box<PivotAny>),
832 Aliases(Box<Aliases>),
833 AtIndex(Box<AtIndex>),
834 FromTimeZone(Box<FromTimeZone>),
835 FormatPhrase(Box<FormatPhrase>),
836 ForIn(Box<ForIn>),
837 TimeUnit(Box<TimeUnit>),
838 IntervalOp(Box<IntervalOp>),
839 IntervalSpan(Box<IntervalSpan>),
840 HavingMax(Box<HavingMax>),
841 CosineDistance(Box<CosineDistance>),
842 DotProduct(Box<DotProduct>),
843 EuclideanDistance(Box<EuclideanDistance>),
844 ManhattanDistance(Box<ManhattanDistance>),
845 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
846 Booland(Box<Booland>),
847 Boolor(Box<Boolor>),
848 ParameterizedAgg(Box<ParameterizedAgg>),
849 ArgMax(Box<ArgMax>),
850 ArgMin(Box<ArgMin>),
851 ApproxTopK(Box<ApproxTopK>),
852 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
853 ApproxTopKCombine(Box<ApproxTopKCombine>),
854 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
855 ApproxTopSum(Box<ApproxTopSum>),
856 ApproxQuantiles(Box<ApproxQuantiles>),
857 Minhash(Box<Minhash>),
858 FarmFingerprint(Box<FarmFingerprint>),
859 Float64(Box<Float64>),
860 Transform(Box<Transform>),
861 Translate(Box<Translate>),
862 Grouping(Box<Grouping>),
863 GroupingId(Box<GroupingId>),
864 Anonymous(Box<Anonymous>),
865 AnonymousAggFunc(Box<AnonymousAggFunc>),
866 CombinedAggFunc(Box<CombinedAggFunc>),
867 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
868 HashAgg(Box<HashAgg>),
869 Hll(Box<Hll>),
870 Apply(Box<Apply>),
871 ToBoolean(Box<ToBoolean>),
872 List(Box<List>),
873 ToMap(Box<ToMap>),
874 Pad(Box<Pad>),
875 ToChar(Box<ToChar>),
876 ToNumber(Box<ToNumber>),
877 ToDouble(Box<ToDouble>),
878 Int64(Box<UnaryFunc>),
879 StringFunc(Box<StringFunc>),
880 ToDecfloat(Box<ToDecfloat>),
881 TryToDecfloat(Box<TryToDecfloat>),
882 ToFile(Box<ToFile>),
883 Columns(Box<Columns>),
884 ConvertToCharset(Box<ConvertToCharset>),
885 ConvertTimezone(Box<ConvertTimezone>),
886 GenerateSeries(Box<GenerateSeries>),
887 AIAgg(Box<AIAgg>),
888 AIClassify(Box<AIClassify>),
889 ArrayAll(Box<ArrayAll>),
890 ArrayAny(Box<ArrayAny>),
891 ArrayConstructCompact(Box<ArrayConstructCompact>),
892 StPoint(Box<StPoint>),
893 StDistance(Box<StDistance>),
894 StringToArray(Box<StringToArray>),
895 ArraySum(Box<ArraySum>),
896 ObjectAgg(Box<ObjectAgg>),
897 CastToStrType(Box<CastToStrType>),
898 CheckJson(Box<CheckJson>),
899 CheckXml(Box<CheckXml>),
900 TranslateCharacters(Box<TranslateCharacters>),
901 CurrentSchemas(Box<CurrentSchemas>),
902 CurrentDatetime(Box<CurrentDatetime>),
903 Localtime(Box<Localtime>),
904 Localtimestamp(Box<Localtimestamp>),
905 Systimestamp(Box<Systimestamp>),
906 CurrentSchema(Box<CurrentSchema>),
907 CurrentUser(Box<CurrentUser>),
908 UtcTime(Box<UtcTime>),
909 UtcTimestamp(Box<UtcTimestamp>),
910 Timestamp(Box<TimestampFunc>),
911 DateBin(Box<DateBin>),
912 Datetime(Box<Datetime>),
913 DatetimeAdd(Box<DatetimeAdd>),
914 DatetimeSub(Box<DatetimeSub>),
915 DatetimeDiff(Box<DatetimeDiff>),
916 DatetimeTrunc(Box<DatetimeTrunc>),
917 Dayname(Box<Dayname>),
918 MakeInterval(Box<MakeInterval>),
919 PreviousDay(Box<PreviousDay>),
920 Elt(Box<Elt>),
921 TimestampAdd(Box<TimestampAdd>),
922 TimestampSub(Box<TimestampSub>),
923 TimestampDiff(Box<TimestampDiff>),
924 TimeSlice(Box<TimeSlice>),
925 TimeAdd(Box<TimeAdd>),
926 TimeSub(Box<TimeSub>),
927 TimeDiff(Box<TimeDiff>),
928 TimeTrunc(Box<TimeTrunc>),
929 DateFromParts(Box<DateFromParts>),
930 TimeFromParts(Box<TimeFromParts>),
931 DecodeCase(Box<DecodeCase>),
932 Decrypt(Box<Decrypt>),
933 DecryptRaw(Box<DecryptRaw>),
934 Encode(Box<Encode>),
935 Encrypt(Box<Encrypt>),
936 EncryptRaw(Box<EncryptRaw>),
937 EqualNull(Box<EqualNull>),
938 ToBinary(Box<ToBinary>),
939 Base64DecodeBinary(Box<Base64DecodeBinary>),
940 Base64DecodeString(Box<Base64DecodeString>),
941 Base64Encode(Box<Base64Encode>),
942 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
943 TryBase64DecodeString(Box<TryBase64DecodeString>),
944 GapFill(Box<GapFill>),
945 GenerateDateArray(Box<GenerateDateArray>),
946 GenerateTimestampArray(Box<GenerateTimestampArray>),
947 GetExtract(Box<GetExtract>),
948 Getbit(Box<Getbit>),
949 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
950 HexEncode(Box<HexEncode>),
951 Compress(Box<Compress>),
952 DecompressBinary(Box<DecompressBinary>),
953 DecompressString(Box<DecompressString>),
954 Xor(Box<Xor>),
955 Nullif(Box<Nullif>),
956 JSON(Box<JSON>),
957 JSONPath(Box<JSONPath>),
958 JSONPathFilter(Box<JSONPathFilter>),
959 JSONPathKey(Box<JSONPathKey>),
960 JSONPathRecursive(Box<JSONPathRecursive>),
961 JSONPathScript(Box<JSONPathScript>),
962 JSONPathSlice(Box<JSONPathSlice>),
963 JSONPathSelector(Box<JSONPathSelector>),
964 JSONPathSubscript(Box<JSONPathSubscript>),
965 JSONPathUnion(Box<JSONPathUnion>),
966 Format(Box<Format>),
967 JSONKeys(Box<JSONKeys>),
968 JSONKeyValue(Box<JSONKeyValue>),
969 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
970 JSONObject(Box<JSONObject>),
971 JSONObjectAgg(Box<JSONObjectAgg>),
972 JSONBObjectAgg(Box<JSONBObjectAgg>),
973 JSONArray(Box<JSONArray>),
974 JSONArrayAgg(Box<JSONArrayAgg>),
975 JSONExists(Box<JSONExists>),
976 JSONColumnDef(Box<JSONColumnDef>),
977 JSONSchema(Box<JSONSchema>),
978 JSONSet(Box<JSONSet>),
979 JSONStripNulls(Box<JSONStripNulls>),
980 JSONValue(Box<JSONValue>),
981 JSONValueArray(Box<JSONValueArray>),
982 JSONRemove(Box<JSONRemove>),
983 JSONTable(Box<JSONTable>),
984 JSONType(Box<JSONType>),
985 ObjectInsert(Box<ObjectInsert>),
986 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
987 OpenJSON(Box<OpenJSON>),
988 JSONBExists(Box<JSONBExists>),
989 JSONBContains(Box<BinaryFunc>),
990 JSONBExtract(Box<BinaryFunc>),
991 JSONCast(Box<JSONCast>),
992 JSONExtract(Box<JSONExtract>),
993 JSONExtractQuote(Box<JSONExtractQuote>),
994 JSONExtractArray(Box<JSONExtractArray>),
995 JSONExtractScalar(Box<JSONExtractScalar>),
996 JSONBExtractScalar(Box<JSONBExtractScalar>),
997 JSONFormat(Box<JSONFormat>),
998 JSONBool(Box<UnaryFunc>),
999 JSONPathRoot(JSONPathRoot),
1000 JSONArrayAppend(Box<JSONArrayAppend>),
1001 JSONArrayContains(Box<JSONArrayContains>),
1002 JSONArrayInsert(Box<JSONArrayInsert>),
1003 ParseJSON(Box<ParseJSON>),
1004 ParseUrl(Box<ParseUrl>),
1005 ParseIp(Box<ParseIp>),
1006 ParseTime(Box<ParseTime>),
1007 ParseDatetime(Box<ParseDatetime>),
1008 Map(Box<Map>),
1009 MapCat(Box<MapCat>),
1010 MapDelete(Box<MapDelete>),
1011 MapInsert(Box<MapInsert>),
1012 MapPick(Box<MapPick>),
1013 ScopeResolution(Box<ScopeResolution>),
1014 Slice(Box<Slice>),
1015 VarMap(Box<VarMap>),
1016 MatchAgainst(Box<MatchAgainst>),
1017 MD5Digest(Box<MD5Digest>),
1018 MD5NumberLower64(Box<UnaryFunc>),
1019 MD5NumberUpper64(Box<UnaryFunc>),
1020 Monthname(Box<Monthname>),
1021 Ntile(Box<Ntile>),
1022 Normalize(Box<Normalize>),
1023 Normal(Box<Normal>),
1024 Predict(Box<Predict>),
1025 MLTranslate(Box<MLTranslate>),
1026 FeaturesAtTime(Box<FeaturesAtTime>),
1027 GenerateEmbedding(Box<GenerateEmbedding>),
1028 MLForecast(Box<MLForecast>),
1029 ModelAttribute(Box<ModelAttribute>),
1030 VectorSearch(Box<VectorSearch>),
1031 Quantile(Box<Quantile>),
1032 ApproxQuantile(Box<ApproxQuantile>),
1033 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1034 Randn(Box<Randn>),
1035 Randstr(Box<Randstr>),
1036 RangeN(Box<RangeN>),
1037 RangeBucket(Box<RangeBucket>),
1038 ReadCSV(Box<ReadCSV>),
1039 ReadParquet(Box<ReadParquet>),
1040 Reduce(Box<Reduce>),
1041 RegexpExtractAll(Box<RegexpExtractAll>),
1042 RegexpILike(Box<RegexpILike>),
1043 RegexpFullMatch(Box<RegexpFullMatch>),
1044 RegexpInstr(Box<RegexpInstr>),
1045 RegexpSplit(Box<RegexpSplit>),
1046 RegexpCount(Box<RegexpCount>),
1047 RegrValx(Box<RegrValx>),
1048 RegrValy(Box<RegrValy>),
1049 RegrAvgy(Box<RegrAvgy>),
1050 RegrAvgx(Box<RegrAvgx>),
1051 RegrCount(Box<RegrCount>),
1052 RegrIntercept(Box<RegrIntercept>),
1053 RegrR2(Box<RegrR2>),
1054 RegrSxx(Box<RegrSxx>),
1055 RegrSxy(Box<RegrSxy>),
1056 RegrSyy(Box<RegrSyy>),
1057 RegrSlope(Box<RegrSlope>),
1058 SafeAdd(Box<SafeAdd>),
1059 SafeDivide(Box<SafeDivide>),
1060 SafeMultiply(Box<SafeMultiply>),
1061 SafeSubtract(Box<SafeSubtract>),
1062 SHA2(Box<SHA2>),
1063 SHA2Digest(Box<SHA2Digest>),
1064 SortArray(Box<SortArray>),
1065 SplitPart(Box<SplitPart>),
1066 SubstringIndex(Box<SubstringIndex>),
1067 StandardHash(Box<StandardHash>),
1068 StrPosition(Box<StrPosition>),
1069 Search(Box<Search>),
1070 SearchIp(Box<SearchIp>),
1071 StrToDate(Box<StrToDate>),
1072 DateStrToDate(Box<UnaryFunc>),
1073 DateToDateStr(Box<UnaryFunc>),
1074 StrToTime(Box<StrToTime>),
1075 StrToUnix(Box<StrToUnix>),
1076 StrToMap(Box<StrToMap>),
1077 NumberToStr(Box<NumberToStr>),
1078 FromBase(Box<FromBase>),
1079 Stuff(Box<Stuff>),
1080 TimeToStr(Box<TimeToStr>),
1081 TimeStrToTime(Box<TimeStrToTime>),
1082 TsOrDsAdd(Box<TsOrDsAdd>),
1083 TsOrDsDiff(Box<TsOrDsDiff>),
1084 TsOrDsToDate(Box<TsOrDsToDate>),
1085 TsOrDsToTime(Box<TsOrDsToTime>),
1086 Unhex(Box<Unhex>),
1087 Uniform(Box<Uniform>),
1088 UnixToStr(Box<UnixToStr>),
1089 UnixToTime(Box<UnixToTime>),
1090 Uuid(Box<Uuid>),
1091 TimestampFromParts(Box<TimestampFromParts>),
1092 TimestampTzFromParts(Box<TimestampTzFromParts>),
1093 Corr(Box<Corr>),
1094 WidthBucket(Box<WidthBucket>),
1095 CovarSamp(Box<CovarSamp>),
1096 CovarPop(Box<CovarPop>),
1097 Week(Box<Week>),
1098 XMLElement(Box<XMLElement>),
1099 XMLGet(Box<XMLGet>),
1100 XMLTable(Box<XMLTable>),
1101 XMLKeyValueOption(Box<XMLKeyValueOption>),
1102 Zipf(Box<Zipf>),
1103 Merge(Box<Merge>),
1104 When(Box<When>),
1105 Whens(Box<Whens>),
1106 NextValueFor(Box<NextValueFor>),
1107 ReturnStmt(Box<Expression>),
1109}
1110
1111impl Expression {
1112 #[inline]
1114 pub fn boxed_column(col: Column) -> Self {
1115 Expression::Column(Box::new(col))
1116 }
1117
1118 #[inline]
1120 pub fn boxed_table(t: TableRef) -> Self {
1121 Expression::Table(Box::new(t))
1122 }
1123
1124 pub fn is_statement(&self) -> bool {
1131 match self {
1132 Expression::Select(_)
1134 | Expression::Union(_)
1135 | Expression::Intersect(_)
1136 | Expression::Except(_)
1137 | Expression::Subquery(_)
1138 | Expression::Values(_)
1139 | Expression::PipeOperator(_)
1140
1141 | Expression::Insert(_)
1143 | Expression::Update(_)
1144 | Expression::Delete(_)
1145 | Expression::Copy(_)
1146 | Expression::Put(_)
1147 | Expression::Merge(_)
1148
1149 | Expression::CreateTable(_)
1151 | Expression::DropTable(_)
1152 | Expression::AlterTable(_)
1153 | Expression::CreateIndex(_)
1154 | Expression::DropIndex(_)
1155 | Expression::CreateView(_)
1156 | Expression::DropView(_)
1157 | Expression::AlterView(_)
1158 | Expression::AlterIndex(_)
1159 | Expression::Truncate(_)
1160 | Expression::TruncateTable(_)
1161 | Expression::CreateSchema(_)
1162 | Expression::DropSchema(_)
1163 | Expression::DropNamespace(_)
1164 | Expression::CreateDatabase(_)
1165 | Expression::DropDatabase(_)
1166 | Expression::CreateFunction(_)
1167 | Expression::DropFunction(_)
1168 | Expression::CreateProcedure(_)
1169 | Expression::DropProcedure(_)
1170 | Expression::CreateSequence(_)
1171 | Expression::DropSequence(_)
1172 | Expression::AlterSequence(_)
1173 | Expression::CreateTrigger(_)
1174 | Expression::DropTrigger(_)
1175 | Expression::CreateType(_)
1176 | Expression::DropType(_)
1177 | Expression::Comment(_)
1178
1179 | Expression::Use(_)
1181 | Expression::Set(_)
1182 | Expression::SetStatement(_)
1183 | Expression::Transaction(_)
1184 | Expression::Commit(_)
1185 | Expression::Rollback(_)
1186 | Expression::Grant(_)
1187 | Expression::Revoke(_)
1188 | Expression::Cache(_)
1189 | Expression::Uncache(_)
1190 | Expression::LoadData(_)
1191 | Expression::Pragma(_)
1192 | Expression::Describe(_)
1193 | Expression::Show(_)
1194 | Expression::Kill(_)
1195 | Expression::Execute(_)
1196 | Expression::Declare(_)
1197 | Expression::Refresh(_)
1198 | Expression::AlterSession(_)
1199 | Expression::LockingStatement(_)
1200
1201 | Expression::Analyze(_)
1203 | Expression::AnalyzeStatistics(_)
1204 | Expression::AnalyzeHistogram(_)
1205 | Expression::AnalyzeSample(_)
1206 | Expression::AnalyzeListChainedRows(_)
1207 | Expression::AnalyzeDelete(_)
1208
1209 | Expression::Attach(_)
1211 | Expression::Detach(_)
1212 | Expression::Install(_)
1213 | Expression::Summarize(_)
1214
1215 | Expression::Pivot(_)
1217 | Expression::Unpivot(_)
1218
1219 | Expression::Command(_)
1221 | Expression::Raw(_)
1222 | Expression::CreateTask(_)
1223
1224 | Expression::ReturnStmt(_) => true,
1226
1227 Expression::Annotated(a) => a.this.is_statement(),
1229
1230 Expression::Alias(a) => a.this.is_statement(),
1232
1233 _ => false,
1235 }
1236 }
1237
1238 pub fn number(n: i64) -> Self {
1240 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1241 }
1242
1243 pub fn string(s: impl Into<String>) -> Self {
1245 Expression::Literal(Box::new(Literal::String(s.into())))
1246 }
1247
1248 pub fn float(f: f64) -> Self {
1250 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1251 }
1252
1253 pub fn inferred_type(&self) -> Option<&DataType> {
1259 match self {
1260 Expression::And(op)
1262 | Expression::Or(op)
1263 | Expression::Add(op)
1264 | Expression::Sub(op)
1265 | Expression::Mul(op)
1266 | Expression::Div(op)
1267 | Expression::Mod(op)
1268 | Expression::Eq(op)
1269 | Expression::Neq(op)
1270 | Expression::Lt(op)
1271 | Expression::Lte(op)
1272 | Expression::Gt(op)
1273 | Expression::Gte(op)
1274 | Expression::Concat(op)
1275 | Expression::BitwiseAnd(op)
1276 | Expression::BitwiseOr(op)
1277 | Expression::BitwiseXor(op)
1278 | Expression::Adjacent(op)
1279 | Expression::TsMatch(op)
1280 | Expression::PropertyEQ(op)
1281 | Expression::ArrayContainsAll(op)
1282 | Expression::ArrayContainedBy(op)
1283 | Expression::ArrayOverlaps(op)
1284 | Expression::JSONBContainsAllTopKeys(op)
1285 | Expression::JSONBContainsAnyTopKeys(op)
1286 | Expression::JSONBDeleteAtPath(op)
1287 | Expression::ExtendsLeft(op)
1288 | Expression::ExtendsRight(op)
1289 | Expression::Is(op)
1290 | Expression::MemberOf(op)
1291 | Expression::Match(op)
1292 | Expression::NullSafeEq(op)
1293 | Expression::NullSafeNeq(op)
1294 | Expression::Glob(op)
1295 | Expression::BitwiseLeftShift(op)
1296 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1297
1298 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1299 op.inferred_type.as_ref()
1300 }
1301
1302 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1303
1304 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1305 c.inferred_type.as_ref()
1306 }
1307
1308 Expression::Column(c) => c.inferred_type.as_ref(),
1309 Expression::Function(f) => f.inferred_type.as_ref(),
1310 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1311 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1312 Expression::Case(c) => c.inferred_type.as_ref(),
1313 Expression::Subquery(s) => s.inferred_type.as_ref(),
1314 Expression::Alias(a) => a.inferred_type.as_ref(),
1315 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1316 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1317 Expression::Count(f) => f.inferred_type.as_ref(),
1318 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1319 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1320 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1321 Expression::SumIf(f) => f.inferred_type.as_ref(),
1322
1323 Expression::Upper(f)
1325 | Expression::Lower(f)
1326 | Expression::Length(f)
1327 | Expression::LTrim(f)
1328 | Expression::RTrim(f)
1329 | Expression::Reverse(f)
1330 | Expression::Abs(f)
1331 | Expression::Sqrt(f)
1332 | Expression::Cbrt(f)
1333 | Expression::Ln(f)
1334 | Expression::Exp(f)
1335 | Expression::Sign(f)
1336 | Expression::Date(f)
1337 | Expression::Time(f)
1338 | Expression::Initcap(f)
1339 | Expression::Ascii(f)
1340 | Expression::Chr(f)
1341 | Expression::Soundex(f)
1342 | Expression::ByteLength(f)
1343 | Expression::Hex(f)
1344 | Expression::LowerHex(f)
1345 | Expression::Unicode(f)
1346 | Expression::Typeof(f)
1347 | Expression::Explode(f)
1348 | Expression::ExplodeOuter(f)
1349 | Expression::MapFromEntries(f)
1350 | Expression::MapKeys(f)
1351 | Expression::MapValues(f)
1352 | Expression::ArrayLength(f)
1353 | Expression::ArraySize(f)
1354 | Expression::Cardinality(f)
1355 | Expression::ArrayReverse(f)
1356 | Expression::ArrayDistinct(f)
1357 | Expression::ArrayFlatten(f)
1358 | Expression::ArrayCompact(f)
1359 | Expression::ToArray(f)
1360 | Expression::JsonArrayLength(f)
1361 | Expression::JsonKeys(f)
1362 | Expression::JsonType(f)
1363 | Expression::ParseJson(f)
1364 | Expression::ToJson(f)
1365 | Expression::Radians(f)
1366 | Expression::Degrees(f)
1367 | Expression::Sin(f)
1368 | Expression::Cos(f)
1369 | Expression::Tan(f)
1370 | Expression::Asin(f)
1371 | Expression::Acos(f)
1372 | Expression::Atan(f)
1373 | Expression::IsNan(f)
1374 | Expression::IsInf(f)
1375 | Expression::Year(f)
1376 | Expression::Month(f)
1377 | Expression::Day(f)
1378 | Expression::Hour(f)
1379 | Expression::Minute(f)
1380 | Expression::Second(f)
1381 | Expression::DayOfWeek(f)
1382 | Expression::DayOfWeekIso(f)
1383 | Expression::DayOfMonth(f)
1384 | Expression::DayOfYear(f)
1385 | Expression::WeekOfYear(f)
1386 | Expression::Quarter(f)
1387 | Expression::Epoch(f)
1388 | Expression::EpochMs(f)
1389 | Expression::BitwiseCount(f)
1390 | Expression::DateFromUnixDate(f)
1391 | Expression::UnixDate(f)
1392 | Expression::UnixSeconds(f)
1393 | Expression::UnixMillis(f)
1394 | Expression::UnixMicros(f)
1395 | Expression::TimeStrToDate(f)
1396 | Expression::DateToDi(f)
1397 | Expression::DiToDate(f)
1398 | Expression::TsOrDiToDi(f)
1399 | Expression::TsOrDsToDatetime(f)
1400 | Expression::TsOrDsToTimestamp(f)
1401 | Expression::YearOfWeek(f)
1402 | Expression::YearOfWeekIso(f)
1403 | Expression::SHA(f)
1404 | Expression::SHA1Digest(f)
1405 | Expression::TimeToUnix(f)
1406 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1407
1408 Expression::Power(f)
1410 | Expression::NullIf(f)
1411 | Expression::IfNull(f)
1412 | Expression::Nvl(f)
1413 | Expression::Contains(f)
1414 | Expression::StartsWith(f)
1415 | Expression::EndsWith(f)
1416 | Expression::Levenshtein(f)
1417 | Expression::ModFunc(f)
1418 | Expression::IntDiv(f)
1419 | Expression::Atan2(f)
1420 | Expression::AddMonths(f)
1421 | Expression::MonthsBetween(f)
1422 | Expression::NextDay(f)
1423 | Expression::UnixToTimeStr(f)
1424 | Expression::ArrayContains(f)
1425 | Expression::ArrayPosition(f)
1426 | Expression::ArrayAppend(f)
1427 | Expression::ArrayPrepend(f)
1428 | Expression::ArrayUnion(f)
1429 | Expression::ArrayExcept(f)
1430 | Expression::ArrayRemove(f)
1431 | Expression::StarMap(f)
1432 | Expression::MapFromArrays(f)
1433 | Expression::MapContainsKey(f)
1434 | Expression::ElementAt(f)
1435 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1436
1437 Expression::Coalesce(f)
1439 | Expression::Greatest(f)
1440 | Expression::Least(f)
1441 | Expression::ArrayConcat(f)
1442 | Expression::ArrayIntersect(f)
1443 | Expression::ArrayZip(f)
1444 | Expression::MapConcat(f)
1445 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1446
1447 Expression::Sum(f)
1449 | Expression::Avg(f)
1450 | Expression::Min(f)
1451 | Expression::Max(f)
1452 | Expression::ArrayAgg(f)
1453 | Expression::CountIf(f)
1454 | Expression::Stddev(f)
1455 | Expression::StddevPop(f)
1456 | Expression::StddevSamp(f)
1457 | Expression::Variance(f)
1458 | Expression::VarPop(f)
1459 | Expression::VarSamp(f)
1460 | Expression::Median(f)
1461 | Expression::Mode(f)
1462 | Expression::First(f)
1463 | Expression::Last(f)
1464 | Expression::AnyValue(f)
1465 | Expression::ApproxDistinct(f)
1466 | Expression::ApproxCountDistinct(f)
1467 | Expression::LogicalAnd(f)
1468 | Expression::LogicalOr(f)
1469 | Expression::Skewness(f)
1470 | Expression::ArrayConcatAgg(f)
1471 | Expression::ArrayUniqueAgg(f)
1472 | Expression::BoolXorAgg(f)
1473 | Expression::BitwiseAndAgg(f)
1474 | Expression::BitwiseOrAgg(f)
1475 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1476
1477 _ => None,
1479 }
1480 }
1481
1482 pub fn set_inferred_type(&mut self, dt: DataType) {
1487 match self {
1488 Expression::And(op)
1489 | Expression::Or(op)
1490 | Expression::Add(op)
1491 | Expression::Sub(op)
1492 | Expression::Mul(op)
1493 | Expression::Div(op)
1494 | Expression::Mod(op)
1495 | Expression::Eq(op)
1496 | Expression::Neq(op)
1497 | Expression::Lt(op)
1498 | Expression::Lte(op)
1499 | Expression::Gt(op)
1500 | Expression::Gte(op)
1501 | Expression::Concat(op)
1502 | Expression::BitwiseAnd(op)
1503 | Expression::BitwiseOr(op)
1504 | Expression::BitwiseXor(op)
1505 | Expression::Adjacent(op)
1506 | Expression::TsMatch(op)
1507 | Expression::PropertyEQ(op)
1508 | Expression::ArrayContainsAll(op)
1509 | Expression::ArrayContainedBy(op)
1510 | Expression::ArrayOverlaps(op)
1511 | Expression::JSONBContainsAllTopKeys(op)
1512 | Expression::JSONBContainsAnyTopKeys(op)
1513 | Expression::JSONBDeleteAtPath(op)
1514 | Expression::ExtendsLeft(op)
1515 | Expression::ExtendsRight(op)
1516 | Expression::Is(op)
1517 | Expression::MemberOf(op)
1518 | Expression::Match(op)
1519 | Expression::NullSafeEq(op)
1520 | Expression::NullSafeNeq(op)
1521 | Expression::Glob(op)
1522 | Expression::BitwiseLeftShift(op)
1523 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1524
1525 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1526 op.inferred_type = Some(dt)
1527 }
1528
1529 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1530
1531 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1532 c.inferred_type = Some(dt)
1533 }
1534
1535 Expression::Column(c) => c.inferred_type = Some(dt),
1536 Expression::Function(f) => f.inferred_type = Some(dt),
1537 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1538 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1539 Expression::Case(c) => c.inferred_type = Some(dt),
1540 Expression::Subquery(s) => s.inferred_type = Some(dt),
1541 Expression::Alias(a) => a.inferred_type = Some(dt),
1542 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1543 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1544 Expression::Count(f) => f.inferred_type = Some(dt),
1545 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1546 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1547 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1548 Expression::SumIf(f) => f.inferred_type = Some(dt),
1549
1550 Expression::Upper(f)
1552 | Expression::Lower(f)
1553 | Expression::Length(f)
1554 | Expression::LTrim(f)
1555 | Expression::RTrim(f)
1556 | Expression::Reverse(f)
1557 | Expression::Abs(f)
1558 | Expression::Sqrt(f)
1559 | Expression::Cbrt(f)
1560 | Expression::Ln(f)
1561 | Expression::Exp(f)
1562 | Expression::Sign(f)
1563 | Expression::Date(f)
1564 | Expression::Time(f)
1565 | Expression::Initcap(f)
1566 | Expression::Ascii(f)
1567 | Expression::Chr(f)
1568 | Expression::Soundex(f)
1569 | Expression::ByteLength(f)
1570 | Expression::Hex(f)
1571 | Expression::LowerHex(f)
1572 | Expression::Unicode(f)
1573 | Expression::Typeof(f)
1574 | Expression::Explode(f)
1575 | Expression::ExplodeOuter(f)
1576 | Expression::MapFromEntries(f)
1577 | Expression::MapKeys(f)
1578 | Expression::MapValues(f)
1579 | Expression::ArrayLength(f)
1580 | Expression::ArraySize(f)
1581 | Expression::Cardinality(f)
1582 | Expression::ArrayReverse(f)
1583 | Expression::ArrayDistinct(f)
1584 | Expression::ArrayFlatten(f)
1585 | Expression::ArrayCompact(f)
1586 | Expression::ToArray(f)
1587 | Expression::JsonArrayLength(f)
1588 | Expression::JsonKeys(f)
1589 | Expression::JsonType(f)
1590 | Expression::ParseJson(f)
1591 | Expression::ToJson(f)
1592 | Expression::Radians(f)
1593 | Expression::Degrees(f)
1594 | Expression::Sin(f)
1595 | Expression::Cos(f)
1596 | Expression::Tan(f)
1597 | Expression::Asin(f)
1598 | Expression::Acos(f)
1599 | Expression::Atan(f)
1600 | Expression::IsNan(f)
1601 | Expression::IsInf(f)
1602 | Expression::Year(f)
1603 | Expression::Month(f)
1604 | Expression::Day(f)
1605 | Expression::Hour(f)
1606 | Expression::Minute(f)
1607 | Expression::Second(f)
1608 | Expression::DayOfWeek(f)
1609 | Expression::DayOfWeekIso(f)
1610 | Expression::DayOfMonth(f)
1611 | Expression::DayOfYear(f)
1612 | Expression::WeekOfYear(f)
1613 | Expression::Quarter(f)
1614 | Expression::Epoch(f)
1615 | Expression::EpochMs(f)
1616 | Expression::BitwiseCount(f)
1617 | Expression::DateFromUnixDate(f)
1618 | Expression::UnixDate(f)
1619 | Expression::UnixSeconds(f)
1620 | Expression::UnixMillis(f)
1621 | Expression::UnixMicros(f)
1622 | Expression::TimeStrToDate(f)
1623 | Expression::DateToDi(f)
1624 | Expression::DiToDate(f)
1625 | Expression::TsOrDiToDi(f)
1626 | Expression::TsOrDsToDatetime(f)
1627 | Expression::TsOrDsToTimestamp(f)
1628 | Expression::YearOfWeek(f)
1629 | Expression::YearOfWeekIso(f)
1630 | Expression::SHA(f)
1631 | Expression::SHA1Digest(f)
1632 | Expression::TimeToUnix(f)
1633 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1634
1635 Expression::Power(f)
1637 | Expression::NullIf(f)
1638 | Expression::IfNull(f)
1639 | Expression::Nvl(f)
1640 | Expression::Contains(f)
1641 | Expression::StartsWith(f)
1642 | Expression::EndsWith(f)
1643 | Expression::Levenshtein(f)
1644 | Expression::ModFunc(f)
1645 | Expression::IntDiv(f)
1646 | Expression::Atan2(f)
1647 | Expression::AddMonths(f)
1648 | Expression::MonthsBetween(f)
1649 | Expression::NextDay(f)
1650 | Expression::UnixToTimeStr(f)
1651 | Expression::ArrayContains(f)
1652 | Expression::ArrayPosition(f)
1653 | Expression::ArrayAppend(f)
1654 | Expression::ArrayPrepend(f)
1655 | Expression::ArrayUnion(f)
1656 | Expression::ArrayExcept(f)
1657 | Expression::ArrayRemove(f)
1658 | Expression::StarMap(f)
1659 | Expression::MapFromArrays(f)
1660 | Expression::MapContainsKey(f)
1661 | Expression::ElementAt(f)
1662 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1663
1664 Expression::Coalesce(f)
1666 | Expression::Greatest(f)
1667 | Expression::Least(f)
1668 | Expression::ArrayConcat(f)
1669 | Expression::ArrayIntersect(f)
1670 | Expression::ArrayZip(f)
1671 | Expression::MapConcat(f)
1672 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1673
1674 Expression::Sum(f)
1676 | Expression::Avg(f)
1677 | Expression::Min(f)
1678 | Expression::Max(f)
1679 | Expression::ArrayAgg(f)
1680 | Expression::CountIf(f)
1681 | Expression::Stddev(f)
1682 | Expression::StddevPop(f)
1683 | Expression::StddevSamp(f)
1684 | Expression::Variance(f)
1685 | Expression::VarPop(f)
1686 | Expression::VarSamp(f)
1687 | Expression::Median(f)
1688 | Expression::Mode(f)
1689 | Expression::First(f)
1690 | Expression::Last(f)
1691 | Expression::AnyValue(f)
1692 | Expression::ApproxDistinct(f)
1693 | Expression::ApproxCountDistinct(f)
1694 | Expression::LogicalAnd(f)
1695 | Expression::LogicalOr(f)
1696 | Expression::Skewness(f)
1697 | Expression::ArrayConcatAgg(f)
1698 | Expression::ArrayUniqueAgg(f)
1699 | Expression::BoolXorAgg(f)
1700 | Expression::BitwiseAndAgg(f)
1701 | Expression::BitwiseOrAgg(f)
1702 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1703
1704 _ => {}
1706 }
1707 }
1708
1709 pub fn column(name: impl Into<String>) -> Self {
1711 Expression::Column(Box::new(Column {
1712 name: Identifier::new(name),
1713 table: None,
1714 join_mark: false,
1715 trailing_comments: Vec::new(),
1716 span: None,
1717 inferred_type: None,
1718 }))
1719 }
1720
1721 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1723 Expression::Column(Box::new(Column {
1724 name: Identifier::new(column),
1725 table: Some(Identifier::new(table)),
1726 join_mark: false,
1727 trailing_comments: Vec::new(),
1728 span: None,
1729 inferred_type: None,
1730 }))
1731 }
1732
1733 pub fn identifier(name: impl Into<String>) -> Self {
1735 Expression::Identifier(Identifier::new(name))
1736 }
1737
1738 pub fn null() -> Self {
1740 Expression::Null(Null)
1741 }
1742
1743 pub fn true_() -> Self {
1745 Expression::Boolean(BooleanLiteral { value: true })
1746 }
1747
1748 pub fn false_() -> Self {
1750 Expression::Boolean(BooleanLiteral { value: false })
1751 }
1752
1753 pub fn star() -> Self {
1755 Expression::Star(Star {
1756 table: None,
1757 except: None,
1758 replace: None,
1759 rename: None,
1760 trailing_comments: Vec::new(),
1761 span: None,
1762 })
1763 }
1764
1765 pub fn alias(self, name: impl Into<String>) -> Self {
1767 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1768 }
1769
1770 pub fn is_select(&self) -> bool {
1772 matches!(self, Expression::Select(_))
1773 }
1774
1775 pub fn as_select(&self) -> Option<&Select> {
1777 match self {
1778 Expression::Select(s) => Some(s),
1779 _ => None,
1780 }
1781 }
1782
1783 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1785 match self {
1786 Expression::Select(s) => Some(s),
1787 _ => None,
1788 }
1789 }
1790
1791 pub fn sql(&self) -> String {
1796 crate::generator::Generator::sql(self).unwrap_or_default()
1797 }
1798
1799 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1805 crate::generate(self, dialect).unwrap_or_default()
1806 }
1807}
1808
1809impl Expression {
1812 pub fn variant_name(&self) -> &'static str {
1815 match self {
1816 Expression::Literal(_) => "literal",
1817 Expression::Boolean(_) => "boolean",
1818 Expression::Null(_) => "null",
1819 Expression::Identifier(_) => "identifier",
1820 Expression::Column(_) => "column",
1821 Expression::Table(_) => "table",
1822 Expression::Star(_) => "star",
1823 Expression::BracedWildcard(_) => "braced_wildcard",
1824 Expression::Select(_) => "select",
1825 Expression::Union(_) => "union",
1826 Expression::Intersect(_) => "intersect",
1827 Expression::Except(_) => "except",
1828 Expression::Subquery(_) => "subquery",
1829 Expression::PipeOperator(_) => "pipe_operator",
1830 Expression::Pivot(_) => "pivot",
1831 Expression::PivotAlias(_) => "pivot_alias",
1832 Expression::Unpivot(_) => "unpivot",
1833 Expression::Values(_) => "values",
1834 Expression::PreWhere(_) => "pre_where",
1835 Expression::Stream(_) => "stream",
1836 Expression::UsingData(_) => "using_data",
1837 Expression::XmlNamespace(_) => "xml_namespace",
1838 Expression::Insert(_) => "insert",
1839 Expression::Update(_) => "update",
1840 Expression::Delete(_) => "delete",
1841 Expression::Copy(_) => "copy",
1842 Expression::Put(_) => "put",
1843 Expression::StageReference(_) => "stage_reference",
1844 Expression::Alias(_) => "alias",
1845 Expression::Cast(_) => "cast",
1846 Expression::Collation(_) => "collation",
1847 Expression::Case(_) => "case",
1848 Expression::And(_) => "and",
1849 Expression::Or(_) => "or",
1850 Expression::Add(_) => "add",
1851 Expression::Sub(_) => "sub",
1852 Expression::Mul(_) => "mul",
1853 Expression::Div(_) => "div",
1854 Expression::Mod(_) => "mod",
1855 Expression::Eq(_) => "eq",
1856 Expression::Neq(_) => "neq",
1857 Expression::Lt(_) => "lt",
1858 Expression::Lte(_) => "lte",
1859 Expression::Gt(_) => "gt",
1860 Expression::Gte(_) => "gte",
1861 Expression::Like(_) => "like",
1862 Expression::ILike(_) => "i_like",
1863 Expression::Match(_) => "match",
1864 Expression::BitwiseAnd(_) => "bitwise_and",
1865 Expression::BitwiseOr(_) => "bitwise_or",
1866 Expression::BitwiseXor(_) => "bitwise_xor",
1867 Expression::Concat(_) => "concat",
1868 Expression::Adjacent(_) => "adjacent",
1869 Expression::TsMatch(_) => "ts_match",
1870 Expression::PropertyEQ(_) => "property_e_q",
1871 Expression::ArrayContainsAll(_) => "array_contains_all",
1872 Expression::ArrayContainedBy(_) => "array_contained_by",
1873 Expression::ArrayOverlaps(_) => "array_overlaps",
1874 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1875 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1876 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1877 Expression::ExtendsLeft(_) => "extends_left",
1878 Expression::ExtendsRight(_) => "extends_right",
1879 Expression::Not(_) => "not",
1880 Expression::Neg(_) => "neg",
1881 Expression::BitwiseNot(_) => "bitwise_not",
1882 Expression::In(_) => "in",
1883 Expression::Between(_) => "between",
1884 Expression::IsNull(_) => "is_null",
1885 Expression::IsTrue(_) => "is_true",
1886 Expression::IsFalse(_) => "is_false",
1887 Expression::IsJson(_) => "is_json",
1888 Expression::Is(_) => "is",
1889 Expression::Exists(_) => "exists",
1890 Expression::MemberOf(_) => "member_of",
1891 Expression::Function(_) => "function",
1892 Expression::AggregateFunction(_) => "aggregate_function",
1893 Expression::WindowFunction(_) => "window_function",
1894 Expression::From(_) => "from",
1895 Expression::Join(_) => "join",
1896 Expression::JoinedTable(_) => "joined_table",
1897 Expression::Where(_) => "where",
1898 Expression::GroupBy(_) => "group_by",
1899 Expression::Having(_) => "having",
1900 Expression::OrderBy(_) => "order_by",
1901 Expression::Limit(_) => "limit",
1902 Expression::Offset(_) => "offset",
1903 Expression::Qualify(_) => "qualify",
1904 Expression::With(_) => "with",
1905 Expression::Cte(_) => "cte",
1906 Expression::DistributeBy(_) => "distribute_by",
1907 Expression::ClusterBy(_) => "cluster_by",
1908 Expression::SortBy(_) => "sort_by",
1909 Expression::LateralView(_) => "lateral_view",
1910 Expression::Hint(_) => "hint",
1911 Expression::Pseudocolumn(_) => "pseudocolumn",
1912 Expression::Connect(_) => "connect",
1913 Expression::Prior(_) => "prior",
1914 Expression::ConnectByRoot(_) => "connect_by_root",
1915 Expression::MatchRecognize(_) => "match_recognize",
1916 Expression::Ordered(_) => "ordered",
1917 Expression::Window(_) => "window",
1918 Expression::Over(_) => "over",
1919 Expression::WithinGroup(_) => "within_group",
1920 Expression::DataType(_) => "data_type",
1921 Expression::Array(_) => "array",
1922 Expression::Struct(_) => "struct",
1923 Expression::Tuple(_) => "tuple",
1924 Expression::Interval(_) => "interval",
1925 Expression::ConcatWs(_) => "concat_ws",
1926 Expression::Substring(_) => "substring",
1927 Expression::Upper(_) => "upper",
1928 Expression::Lower(_) => "lower",
1929 Expression::Length(_) => "length",
1930 Expression::Trim(_) => "trim",
1931 Expression::LTrim(_) => "l_trim",
1932 Expression::RTrim(_) => "r_trim",
1933 Expression::Replace(_) => "replace",
1934 Expression::Reverse(_) => "reverse",
1935 Expression::Left(_) => "left",
1936 Expression::Right(_) => "right",
1937 Expression::Repeat(_) => "repeat",
1938 Expression::Lpad(_) => "lpad",
1939 Expression::Rpad(_) => "rpad",
1940 Expression::Split(_) => "split",
1941 Expression::RegexpLike(_) => "regexp_like",
1942 Expression::RegexpReplace(_) => "regexp_replace",
1943 Expression::RegexpExtract(_) => "regexp_extract",
1944 Expression::Overlay(_) => "overlay",
1945 Expression::Abs(_) => "abs",
1946 Expression::Round(_) => "round",
1947 Expression::Floor(_) => "floor",
1948 Expression::Ceil(_) => "ceil",
1949 Expression::Power(_) => "power",
1950 Expression::Sqrt(_) => "sqrt",
1951 Expression::Cbrt(_) => "cbrt",
1952 Expression::Ln(_) => "ln",
1953 Expression::Log(_) => "log",
1954 Expression::Exp(_) => "exp",
1955 Expression::Sign(_) => "sign",
1956 Expression::Greatest(_) => "greatest",
1957 Expression::Least(_) => "least",
1958 Expression::CurrentDate(_) => "current_date",
1959 Expression::CurrentTime(_) => "current_time",
1960 Expression::CurrentTimestamp(_) => "current_timestamp",
1961 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1962 Expression::AtTimeZone(_) => "at_time_zone",
1963 Expression::DateAdd(_) => "date_add",
1964 Expression::DateSub(_) => "date_sub",
1965 Expression::DateDiff(_) => "date_diff",
1966 Expression::DateTrunc(_) => "date_trunc",
1967 Expression::Extract(_) => "extract",
1968 Expression::ToDate(_) => "to_date",
1969 Expression::ToTimestamp(_) => "to_timestamp",
1970 Expression::Date(_) => "date",
1971 Expression::Time(_) => "time",
1972 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1973 Expression::UnixDate(_) => "unix_date",
1974 Expression::UnixSeconds(_) => "unix_seconds",
1975 Expression::UnixMillis(_) => "unix_millis",
1976 Expression::UnixMicros(_) => "unix_micros",
1977 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1978 Expression::TimeStrToDate(_) => "time_str_to_date",
1979 Expression::DateToDi(_) => "date_to_di",
1980 Expression::DiToDate(_) => "di_to_date",
1981 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1982 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1983 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1984 Expression::YearOfWeek(_) => "year_of_week",
1985 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1986 Expression::Coalesce(_) => "coalesce",
1987 Expression::NullIf(_) => "null_if",
1988 Expression::IfFunc(_) => "if_func",
1989 Expression::IfNull(_) => "if_null",
1990 Expression::Nvl(_) => "nvl",
1991 Expression::Nvl2(_) => "nvl2",
1992 Expression::TryCast(_) => "try_cast",
1993 Expression::SafeCast(_) => "safe_cast",
1994 Expression::Count(_) => "count",
1995 Expression::Sum(_) => "sum",
1996 Expression::Avg(_) => "avg",
1997 Expression::Min(_) => "min",
1998 Expression::Max(_) => "max",
1999 Expression::GroupConcat(_) => "group_concat",
2000 Expression::StringAgg(_) => "string_agg",
2001 Expression::ListAgg(_) => "list_agg",
2002 Expression::ArrayAgg(_) => "array_agg",
2003 Expression::CountIf(_) => "count_if",
2004 Expression::SumIf(_) => "sum_if",
2005 Expression::Stddev(_) => "stddev",
2006 Expression::StddevPop(_) => "stddev_pop",
2007 Expression::StddevSamp(_) => "stddev_samp",
2008 Expression::Variance(_) => "variance",
2009 Expression::VarPop(_) => "var_pop",
2010 Expression::VarSamp(_) => "var_samp",
2011 Expression::Median(_) => "median",
2012 Expression::Mode(_) => "mode",
2013 Expression::First(_) => "first",
2014 Expression::Last(_) => "last",
2015 Expression::AnyValue(_) => "any_value",
2016 Expression::ApproxDistinct(_) => "approx_distinct",
2017 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2018 Expression::ApproxPercentile(_) => "approx_percentile",
2019 Expression::Percentile(_) => "percentile",
2020 Expression::LogicalAnd(_) => "logical_and",
2021 Expression::LogicalOr(_) => "logical_or",
2022 Expression::Skewness(_) => "skewness",
2023 Expression::BitwiseCount(_) => "bitwise_count",
2024 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2025 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2026 Expression::BoolXorAgg(_) => "bool_xor_agg",
2027 Expression::RowNumber(_) => "row_number",
2028 Expression::Rank(_) => "rank",
2029 Expression::DenseRank(_) => "dense_rank",
2030 Expression::NTile(_) => "n_tile",
2031 Expression::Lead(_) => "lead",
2032 Expression::Lag(_) => "lag",
2033 Expression::FirstValue(_) => "first_value",
2034 Expression::LastValue(_) => "last_value",
2035 Expression::NthValue(_) => "nth_value",
2036 Expression::PercentRank(_) => "percent_rank",
2037 Expression::CumeDist(_) => "cume_dist",
2038 Expression::PercentileCont(_) => "percentile_cont",
2039 Expression::PercentileDisc(_) => "percentile_disc",
2040 Expression::Contains(_) => "contains",
2041 Expression::StartsWith(_) => "starts_with",
2042 Expression::EndsWith(_) => "ends_with",
2043 Expression::Position(_) => "position",
2044 Expression::Initcap(_) => "initcap",
2045 Expression::Ascii(_) => "ascii",
2046 Expression::Chr(_) => "chr",
2047 Expression::CharFunc(_) => "char_func",
2048 Expression::Soundex(_) => "soundex",
2049 Expression::Levenshtein(_) => "levenshtein",
2050 Expression::ByteLength(_) => "byte_length",
2051 Expression::Hex(_) => "hex",
2052 Expression::LowerHex(_) => "lower_hex",
2053 Expression::Unicode(_) => "unicode",
2054 Expression::ModFunc(_) => "mod_func",
2055 Expression::Random(_) => "random",
2056 Expression::Rand(_) => "rand",
2057 Expression::TruncFunc(_) => "trunc_func",
2058 Expression::Pi(_) => "pi",
2059 Expression::Radians(_) => "radians",
2060 Expression::Degrees(_) => "degrees",
2061 Expression::Sin(_) => "sin",
2062 Expression::Cos(_) => "cos",
2063 Expression::Tan(_) => "tan",
2064 Expression::Asin(_) => "asin",
2065 Expression::Acos(_) => "acos",
2066 Expression::Atan(_) => "atan",
2067 Expression::Atan2(_) => "atan2",
2068 Expression::IsNan(_) => "is_nan",
2069 Expression::IsInf(_) => "is_inf",
2070 Expression::IntDiv(_) => "int_div",
2071 Expression::Decode(_) => "decode",
2072 Expression::DateFormat(_) => "date_format",
2073 Expression::FormatDate(_) => "format_date",
2074 Expression::Year(_) => "year",
2075 Expression::Month(_) => "month",
2076 Expression::Day(_) => "day",
2077 Expression::Hour(_) => "hour",
2078 Expression::Minute(_) => "minute",
2079 Expression::Second(_) => "second",
2080 Expression::DayOfWeek(_) => "day_of_week",
2081 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2082 Expression::DayOfMonth(_) => "day_of_month",
2083 Expression::DayOfYear(_) => "day_of_year",
2084 Expression::WeekOfYear(_) => "week_of_year",
2085 Expression::Quarter(_) => "quarter",
2086 Expression::AddMonths(_) => "add_months",
2087 Expression::MonthsBetween(_) => "months_between",
2088 Expression::LastDay(_) => "last_day",
2089 Expression::NextDay(_) => "next_day",
2090 Expression::Epoch(_) => "epoch",
2091 Expression::EpochMs(_) => "epoch_ms",
2092 Expression::FromUnixtime(_) => "from_unixtime",
2093 Expression::UnixTimestamp(_) => "unix_timestamp",
2094 Expression::MakeDate(_) => "make_date",
2095 Expression::MakeTimestamp(_) => "make_timestamp",
2096 Expression::TimestampTrunc(_) => "timestamp_trunc",
2097 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2098 Expression::SessionUser(_) => "session_user",
2099 Expression::SHA(_) => "s_h_a",
2100 Expression::SHA1Digest(_) => "s_h_a1_digest",
2101 Expression::TimeToUnix(_) => "time_to_unix",
2102 Expression::ArrayFunc(_) => "array_func",
2103 Expression::ArrayLength(_) => "array_length",
2104 Expression::ArraySize(_) => "array_size",
2105 Expression::Cardinality(_) => "cardinality",
2106 Expression::ArrayContains(_) => "array_contains",
2107 Expression::ArrayPosition(_) => "array_position",
2108 Expression::ArrayAppend(_) => "array_append",
2109 Expression::ArrayPrepend(_) => "array_prepend",
2110 Expression::ArrayConcat(_) => "array_concat",
2111 Expression::ArraySort(_) => "array_sort",
2112 Expression::ArrayReverse(_) => "array_reverse",
2113 Expression::ArrayDistinct(_) => "array_distinct",
2114 Expression::ArrayJoin(_) => "array_join",
2115 Expression::ArrayToString(_) => "array_to_string",
2116 Expression::Unnest(_) => "unnest",
2117 Expression::Explode(_) => "explode",
2118 Expression::ExplodeOuter(_) => "explode_outer",
2119 Expression::ArrayFilter(_) => "array_filter",
2120 Expression::ArrayTransform(_) => "array_transform",
2121 Expression::ArrayFlatten(_) => "array_flatten",
2122 Expression::ArrayCompact(_) => "array_compact",
2123 Expression::ArrayIntersect(_) => "array_intersect",
2124 Expression::ArrayUnion(_) => "array_union",
2125 Expression::ArrayExcept(_) => "array_except",
2126 Expression::ArrayRemove(_) => "array_remove",
2127 Expression::ArrayZip(_) => "array_zip",
2128 Expression::Sequence(_) => "sequence",
2129 Expression::Generate(_) => "generate",
2130 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2131 Expression::ToArray(_) => "to_array",
2132 Expression::StarMap(_) => "star_map",
2133 Expression::StructFunc(_) => "struct_func",
2134 Expression::StructExtract(_) => "struct_extract",
2135 Expression::NamedStruct(_) => "named_struct",
2136 Expression::MapFunc(_) => "map_func",
2137 Expression::MapFromEntries(_) => "map_from_entries",
2138 Expression::MapFromArrays(_) => "map_from_arrays",
2139 Expression::MapKeys(_) => "map_keys",
2140 Expression::MapValues(_) => "map_values",
2141 Expression::MapContainsKey(_) => "map_contains_key",
2142 Expression::MapConcat(_) => "map_concat",
2143 Expression::ElementAt(_) => "element_at",
2144 Expression::TransformKeys(_) => "transform_keys",
2145 Expression::TransformValues(_) => "transform_values",
2146 Expression::FunctionEmits(_) => "function_emits",
2147 Expression::JsonExtract(_) => "json_extract",
2148 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2149 Expression::JsonExtractPath(_) => "json_extract_path",
2150 Expression::JsonArray(_) => "json_array",
2151 Expression::JsonObject(_) => "json_object",
2152 Expression::JsonQuery(_) => "json_query",
2153 Expression::JsonValue(_) => "json_value",
2154 Expression::JsonArrayLength(_) => "json_array_length",
2155 Expression::JsonKeys(_) => "json_keys",
2156 Expression::JsonType(_) => "json_type",
2157 Expression::ParseJson(_) => "parse_json",
2158 Expression::ToJson(_) => "to_json",
2159 Expression::JsonSet(_) => "json_set",
2160 Expression::JsonInsert(_) => "json_insert",
2161 Expression::JsonRemove(_) => "json_remove",
2162 Expression::JsonMergePatch(_) => "json_merge_patch",
2163 Expression::JsonArrayAgg(_) => "json_array_agg",
2164 Expression::JsonObjectAgg(_) => "json_object_agg",
2165 Expression::Convert(_) => "convert",
2166 Expression::Typeof(_) => "typeof",
2167 Expression::Lambda(_) => "lambda",
2168 Expression::Parameter(_) => "parameter",
2169 Expression::Placeholder(_) => "placeholder",
2170 Expression::NamedArgument(_) => "named_argument",
2171 Expression::TableArgument(_) => "table_argument",
2172 Expression::SqlComment(_) => "sql_comment",
2173 Expression::NullSafeEq(_) => "null_safe_eq",
2174 Expression::NullSafeNeq(_) => "null_safe_neq",
2175 Expression::Glob(_) => "glob",
2176 Expression::SimilarTo(_) => "similar_to",
2177 Expression::Any(_) => "any",
2178 Expression::All(_) => "all",
2179 Expression::Overlaps(_) => "overlaps",
2180 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2181 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2182 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2183 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2184 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2185 Expression::Subscript(_) => "subscript",
2186 Expression::Dot(_) => "dot",
2187 Expression::MethodCall(_) => "method_call",
2188 Expression::ArraySlice(_) => "array_slice",
2189 Expression::CreateTable(_) => "create_table",
2190 Expression::DropTable(_) => "drop_table",
2191 Expression::AlterTable(_) => "alter_table",
2192 Expression::CreateIndex(_) => "create_index",
2193 Expression::DropIndex(_) => "drop_index",
2194 Expression::CreateView(_) => "create_view",
2195 Expression::DropView(_) => "drop_view",
2196 Expression::AlterView(_) => "alter_view",
2197 Expression::AlterIndex(_) => "alter_index",
2198 Expression::Truncate(_) => "truncate",
2199 Expression::Use(_) => "use",
2200 Expression::Cache(_) => "cache",
2201 Expression::Uncache(_) => "uncache",
2202 Expression::LoadData(_) => "load_data",
2203 Expression::Pragma(_) => "pragma",
2204 Expression::Grant(_) => "grant",
2205 Expression::Revoke(_) => "revoke",
2206 Expression::Comment(_) => "comment",
2207 Expression::SetStatement(_) => "set_statement",
2208 Expression::CreateSchema(_) => "create_schema",
2209 Expression::DropSchema(_) => "drop_schema",
2210 Expression::DropNamespace(_) => "drop_namespace",
2211 Expression::CreateDatabase(_) => "create_database",
2212 Expression::DropDatabase(_) => "drop_database",
2213 Expression::CreateFunction(_) => "create_function",
2214 Expression::DropFunction(_) => "drop_function",
2215 Expression::CreateProcedure(_) => "create_procedure",
2216 Expression::DropProcedure(_) => "drop_procedure",
2217 Expression::CreateSequence(_) => "create_sequence",
2218 Expression::CreateSynonym(_) => "create_synonym",
2219 Expression::DropSequence(_) => "drop_sequence",
2220 Expression::AlterSequence(_) => "alter_sequence",
2221 Expression::CreateTrigger(_) => "create_trigger",
2222 Expression::DropTrigger(_) => "drop_trigger",
2223 Expression::CreateType(_) => "create_type",
2224 Expression::DropType(_) => "drop_type",
2225 Expression::Describe(_) => "describe",
2226 Expression::Show(_) => "show",
2227 Expression::Command(_) => "command",
2228 Expression::Kill(_) => "kill",
2229 Expression::Execute(_) => "execute",
2230 Expression::Raw(_) => "raw",
2231 Expression::CreateTask(_) => "create_task",
2232 Expression::Paren(_) => "paren",
2233 Expression::Annotated(_) => "annotated",
2234 Expression::Refresh(_) => "refresh",
2235 Expression::LockingStatement(_) => "locking_statement",
2236 Expression::SequenceProperties(_) => "sequence_properties",
2237 Expression::TruncateTable(_) => "truncate_table",
2238 Expression::Clone(_) => "clone",
2239 Expression::Attach(_) => "attach",
2240 Expression::Detach(_) => "detach",
2241 Expression::Install(_) => "install",
2242 Expression::Summarize(_) => "summarize",
2243 Expression::Declare(_) => "declare",
2244 Expression::DeclareItem(_) => "declare_item",
2245 Expression::Set(_) => "set",
2246 Expression::Heredoc(_) => "heredoc",
2247 Expression::SetItem(_) => "set_item",
2248 Expression::QueryBand(_) => "query_band",
2249 Expression::UserDefinedFunction(_) => "user_defined_function",
2250 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2251 Expression::ProjectionDef(_) => "projection_def",
2252 Expression::TableAlias(_) => "table_alias",
2253 Expression::ByteString(_) => "byte_string",
2254 Expression::HexStringExpr(_) => "hex_string_expr",
2255 Expression::UnicodeString(_) => "unicode_string",
2256 Expression::ColumnPosition(_) => "column_position",
2257 Expression::ColumnDef(_) => "column_def",
2258 Expression::AlterColumn(_) => "alter_column",
2259 Expression::AlterSortKey(_) => "alter_sort_key",
2260 Expression::AlterSet(_) => "alter_set",
2261 Expression::RenameColumn(_) => "rename_column",
2262 Expression::Comprehension(_) => "comprehension",
2263 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2264 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2265 Expression::IndexConstraintOption(_) => "index_constraint_option",
2266 Expression::ColumnConstraint(_) => "column_constraint",
2267 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2268 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2269 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2270 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2271 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2272 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2273 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2274 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2275 Expression::WithOperator(_) => "with_operator",
2276 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2277 "generated_as_identity_column_constraint"
2278 }
2279 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2280 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2281 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2282 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2283 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2284 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2285 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2286 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2287 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2288 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2289 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2290 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2291 Expression::PathColumnConstraint(_) => "path_column_constraint",
2292 Expression::Constraint(_) => "constraint",
2293 Expression::Export(_) => "export",
2294 Expression::Filter(_) => "filter",
2295 Expression::Changes(_) => "changes",
2296 Expression::CopyParameter(_) => "copy_parameter",
2297 Expression::Credentials(_) => "credentials",
2298 Expression::Directory(_) => "directory",
2299 Expression::ForeignKey(_) => "foreign_key",
2300 Expression::ColumnPrefix(_) => "column_prefix",
2301 Expression::PrimaryKey(_) => "primary_key",
2302 Expression::IntoClause(_) => "into_clause",
2303 Expression::JoinHint(_) => "join_hint",
2304 Expression::Opclass(_) => "opclass",
2305 Expression::Index(_) => "index",
2306 Expression::IndexParameters(_) => "index_parameters",
2307 Expression::ConditionalInsert(_) => "conditional_insert",
2308 Expression::MultitableInserts(_) => "multitable_inserts",
2309 Expression::OnConflict(_) => "on_conflict",
2310 Expression::OnCondition(_) => "on_condition",
2311 Expression::Returning(_) => "returning",
2312 Expression::Introducer(_) => "introducer",
2313 Expression::PartitionRange(_) => "partition_range",
2314 Expression::Fetch(_) => "fetch",
2315 Expression::Group(_) => "group",
2316 Expression::Cube(_) => "cube",
2317 Expression::Rollup(_) => "rollup",
2318 Expression::GroupingSets(_) => "grouping_sets",
2319 Expression::LimitOptions(_) => "limit_options",
2320 Expression::Lateral(_) => "lateral",
2321 Expression::TableFromRows(_) => "table_from_rows",
2322 Expression::RowsFrom(_) => "rows_from",
2323 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2324 Expression::WithFill(_) => "with_fill",
2325 Expression::Property(_) => "property",
2326 Expression::GrantPrivilege(_) => "grant_privilege",
2327 Expression::GrantPrincipal(_) => "grant_principal",
2328 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2329 Expression::AlgorithmProperty(_) => "algorithm_property",
2330 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2331 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2332 Expression::BackupProperty(_) => "backup_property",
2333 Expression::BuildProperty(_) => "build_property",
2334 Expression::BlockCompressionProperty(_) => "block_compression_property",
2335 Expression::CharacterSetProperty(_) => "character_set_property",
2336 Expression::ChecksumProperty(_) => "checksum_property",
2337 Expression::CollateProperty(_) => "collate_property",
2338 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2339 Expression::DataDeletionProperty(_) => "data_deletion_property",
2340 Expression::DefinerProperty(_) => "definer_property",
2341 Expression::DistKeyProperty(_) => "dist_key_property",
2342 Expression::DistributedByProperty(_) => "distributed_by_property",
2343 Expression::DistStyleProperty(_) => "dist_style_property",
2344 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2345 Expression::EngineProperty(_) => "engine_property",
2346 Expression::ToTableProperty(_) => "to_table_property",
2347 Expression::ExecuteAsProperty(_) => "execute_as_property",
2348 Expression::ExternalProperty(_) => "external_property",
2349 Expression::FallbackProperty(_) => "fallback_property",
2350 Expression::FileFormatProperty(_) => "file_format_property",
2351 Expression::CredentialsProperty(_) => "credentials_property",
2352 Expression::FreespaceProperty(_) => "freespace_property",
2353 Expression::InheritsProperty(_) => "inherits_property",
2354 Expression::InputModelProperty(_) => "input_model_property",
2355 Expression::OutputModelProperty(_) => "output_model_property",
2356 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2357 Expression::JournalProperty(_) => "journal_property",
2358 Expression::LanguageProperty(_) => "language_property",
2359 Expression::EnviromentProperty(_) => "enviroment_property",
2360 Expression::ClusteredByProperty(_) => "clustered_by_property",
2361 Expression::DictProperty(_) => "dict_property",
2362 Expression::DictRange(_) => "dict_range",
2363 Expression::OnCluster(_) => "on_cluster",
2364 Expression::LikeProperty(_) => "like_property",
2365 Expression::LocationProperty(_) => "location_property",
2366 Expression::LockProperty(_) => "lock_property",
2367 Expression::LockingProperty(_) => "locking_property",
2368 Expression::LogProperty(_) => "log_property",
2369 Expression::MaterializedProperty(_) => "materialized_property",
2370 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2371 Expression::OnProperty(_) => "on_property",
2372 Expression::OnCommitProperty(_) => "on_commit_property",
2373 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2374 Expression::PartitionByProperty(_) => "partition_by_property",
2375 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2376 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2377 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2378 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2379 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2380 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2381 Expression::PartitionList(_) => "partition_list",
2382 Expression::Partition(_) => "partition",
2383 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2384 Expression::UniqueKeyProperty(_) => "unique_key_property",
2385 Expression::RollupProperty(_) => "rollup_property",
2386 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2387 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2388 Expression::RemoteWithConnectionModelProperty(_) => {
2389 "remote_with_connection_model_property"
2390 }
2391 Expression::ReturnsProperty(_) => "returns_property",
2392 Expression::RowFormatProperty(_) => "row_format_property",
2393 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2394 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2395 Expression::QueryTransform(_) => "query_transform",
2396 Expression::SampleProperty(_) => "sample_property",
2397 Expression::SecurityProperty(_) => "security_property",
2398 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2399 Expression::SemanticView(_) => "semantic_view",
2400 Expression::SerdeProperties(_) => "serde_properties",
2401 Expression::SetProperty(_) => "set_property",
2402 Expression::SharingProperty(_) => "sharing_property",
2403 Expression::SetConfigProperty(_) => "set_config_property",
2404 Expression::SettingsProperty(_) => "settings_property",
2405 Expression::SortKeyProperty(_) => "sort_key_property",
2406 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2407 Expression::SqlSecurityProperty(_) => "sql_security_property",
2408 Expression::StabilityProperty(_) => "stability_property",
2409 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2410 Expression::TemporaryProperty(_) => "temporary_property",
2411 Expression::Tags(_) => "tags",
2412 Expression::TransformModelProperty(_) => "transform_model_property",
2413 Expression::TransientProperty(_) => "transient_property",
2414 Expression::UsingTemplateProperty(_) => "using_template_property",
2415 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2416 Expression::VolatileProperty(_) => "volatile_property",
2417 Expression::WithDataProperty(_) => "with_data_property",
2418 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2419 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2420 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2421 Expression::WithProcedureOptions(_) => "with_procedure_options",
2422 Expression::EncodeProperty(_) => "encode_property",
2423 Expression::IncludeProperty(_) => "include_property",
2424 Expression::Properties(_) => "properties",
2425 Expression::OptionsProperty(_) => "options_property",
2426 Expression::InputOutputFormat(_) => "input_output_format",
2427 Expression::Reference(_) => "reference",
2428 Expression::QueryOption(_) => "query_option",
2429 Expression::WithTableHint(_) => "with_table_hint",
2430 Expression::IndexTableHint(_) => "index_table_hint",
2431 Expression::HistoricalData(_) => "historical_data",
2432 Expression::Get(_) => "get",
2433 Expression::SetOperation(_) => "set_operation",
2434 Expression::Var(_) => "var",
2435 Expression::Variadic(_) => "variadic",
2436 Expression::Version(_) => "version",
2437 Expression::Schema(_) => "schema",
2438 Expression::Lock(_) => "lock",
2439 Expression::TableSample(_) => "table_sample",
2440 Expression::Tag(_) => "tag",
2441 Expression::UnpivotColumns(_) => "unpivot_columns",
2442 Expression::WindowSpec(_) => "window_spec",
2443 Expression::SessionParameter(_) => "session_parameter",
2444 Expression::PseudoType(_) => "pseudo_type",
2445 Expression::ObjectIdentifier(_) => "object_identifier",
2446 Expression::Transaction(_) => "transaction",
2447 Expression::Commit(_) => "commit",
2448 Expression::Rollback(_) => "rollback",
2449 Expression::AlterSession(_) => "alter_session",
2450 Expression::Analyze(_) => "analyze",
2451 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2452 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2453 Expression::AnalyzeSample(_) => "analyze_sample",
2454 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2455 Expression::AnalyzeDelete(_) => "analyze_delete",
2456 Expression::AnalyzeWith(_) => "analyze_with",
2457 Expression::AnalyzeValidate(_) => "analyze_validate",
2458 Expression::AddPartition(_) => "add_partition",
2459 Expression::AttachOption(_) => "attach_option",
2460 Expression::DropPartition(_) => "drop_partition",
2461 Expression::ReplacePartition(_) => "replace_partition",
2462 Expression::DPipe(_) => "d_pipe",
2463 Expression::Operator(_) => "operator",
2464 Expression::PivotAny(_) => "pivot_any",
2465 Expression::Aliases(_) => "aliases",
2466 Expression::AtIndex(_) => "at_index",
2467 Expression::FromTimeZone(_) => "from_time_zone",
2468 Expression::FormatPhrase(_) => "format_phrase",
2469 Expression::ForIn(_) => "for_in",
2470 Expression::TimeUnit(_) => "time_unit",
2471 Expression::IntervalOp(_) => "interval_op",
2472 Expression::IntervalSpan(_) => "interval_span",
2473 Expression::HavingMax(_) => "having_max",
2474 Expression::CosineDistance(_) => "cosine_distance",
2475 Expression::DotProduct(_) => "dot_product",
2476 Expression::EuclideanDistance(_) => "euclidean_distance",
2477 Expression::ManhattanDistance(_) => "manhattan_distance",
2478 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2479 Expression::Booland(_) => "booland",
2480 Expression::Boolor(_) => "boolor",
2481 Expression::ParameterizedAgg(_) => "parameterized_agg",
2482 Expression::ArgMax(_) => "arg_max",
2483 Expression::ArgMin(_) => "arg_min",
2484 Expression::ApproxTopK(_) => "approx_top_k",
2485 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2486 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2487 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2488 Expression::ApproxTopSum(_) => "approx_top_sum",
2489 Expression::ApproxQuantiles(_) => "approx_quantiles",
2490 Expression::Minhash(_) => "minhash",
2491 Expression::FarmFingerprint(_) => "farm_fingerprint",
2492 Expression::Float64(_) => "float64",
2493 Expression::Transform(_) => "transform",
2494 Expression::Translate(_) => "translate",
2495 Expression::Grouping(_) => "grouping",
2496 Expression::GroupingId(_) => "grouping_id",
2497 Expression::Anonymous(_) => "anonymous",
2498 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2499 Expression::CombinedAggFunc(_) => "combined_agg_func",
2500 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2501 Expression::HashAgg(_) => "hash_agg",
2502 Expression::Hll(_) => "hll",
2503 Expression::Apply(_) => "apply",
2504 Expression::ToBoolean(_) => "to_boolean",
2505 Expression::List(_) => "list",
2506 Expression::ToMap(_) => "to_map",
2507 Expression::Pad(_) => "pad",
2508 Expression::ToChar(_) => "to_char",
2509 Expression::ToNumber(_) => "to_number",
2510 Expression::ToDouble(_) => "to_double",
2511 Expression::Int64(_) => "int64",
2512 Expression::StringFunc(_) => "string_func",
2513 Expression::ToDecfloat(_) => "to_decfloat",
2514 Expression::TryToDecfloat(_) => "try_to_decfloat",
2515 Expression::ToFile(_) => "to_file",
2516 Expression::Columns(_) => "columns",
2517 Expression::ConvertToCharset(_) => "convert_to_charset",
2518 Expression::ConvertTimezone(_) => "convert_timezone",
2519 Expression::GenerateSeries(_) => "generate_series",
2520 Expression::AIAgg(_) => "a_i_agg",
2521 Expression::AIClassify(_) => "a_i_classify",
2522 Expression::ArrayAll(_) => "array_all",
2523 Expression::ArrayAny(_) => "array_any",
2524 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2525 Expression::StPoint(_) => "st_point",
2526 Expression::StDistance(_) => "st_distance",
2527 Expression::StringToArray(_) => "string_to_array",
2528 Expression::ArraySum(_) => "array_sum",
2529 Expression::ObjectAgg(_) => "object_agg",
2530 Expression::CastToStrType(_) => "cast_to_str_type",
2531 Expression::CheckJson(_) => "check_json",
2532 Expression::CheckXml(_) => "check_xml",
2533 Expression::TranslateCharacters(_) => "translate_characters",
2534 Expression::CurrentSchemas(_) => "current_schemas",
2535 Expression::CurrentDatetime(_) => "current_datetime",
2536 Expression::Localtime(_) => "localtime",
2537 Expression::Localtimestamp(_) => "localtimestamp",
2538 Expression::Systimestamp(_) => "systimestamp",
2539 Expression::CurrentSchema(_) => "current_schema",
2540 Expression::CurrentUser(_) => "current_user",
2541 Expression::UtcTime(_) => "utc_time",
2542 Expression::UtcTimestamp(_) => "utc_timestamp",
2543 Expression::Timestamp(_) => "timestamp",
2544 Expression::DateBin(_) => "date_bin",
2545 Expression::Datetime(_) => "datetime",
2546 Expression::DatetimeAdd(_) => "datetime_add",
2547 Expression::DatetimeSub(_) => "datetime_sub",
2548 Expression::DatetimeDiff(_) => "datetime_diff",
2549 Expression::DatetimeTrunc(_) => "datetime_trunc",
2550 Expression::Dayname(_) => "dayname",
2551 Expression::MakeInterval(_) => "make_interval",
2552 Expression::PreviousDay(_) => "previous_day",
2553 Expression::Elt(_) => "elt",
2554 Expression::TimestampAdd(_) => "timestamp_add",
2555 Expression::TimestampSub(_) => "timestamp_sub",
2556 Expression::TimestampDiff(_) => "timestamp_diff",
2557 Expression::TimeSlice(_) => "time_slice",
2558 Expression::TimeAdd(_) => "time_add",
2559 Expression::TimeSub(_) => "time_sub",
2560 Expression::TimeDiff(_) => "time_diff",
2561 Expression::TimeTrunc(_) => "time_trunc",
2562 Expression::DateFromParts(_) => "date_from_parts",
2563 Expression::TimeFromParts(_) => "time_from_parts",
2564 Expression::DecodeCase(_) => "decode_case",
2565 Expression::Decrypt(_) => "decrypt",
2566 Expression::DecryptRaw(_) => "decrypt_raw",
2567 Expression::Encode(_) => "encode",
2568 Expression::Encrypt(_) => "encrypt",
2569 Expression::EncryptRaw(_) => "encrypt_raw",
2570 Expression::EqualNull(_) => "equal_null",
2571 Expression::ToBinary(_) => "to_binary",
2572 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2573 Expression::Base64DecodeString(_) => "base64_decode_string",
2574 Expression::Base64Encode(_) => "base64_encode",
2575 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2576 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2577 Expression::GapFill(_) => "gap_fill",
2578 Expression::GenerateDateArray(_) => "generate_date_array",
2579 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2580 Expression::GetExtract(_) => "get_extract",
2581 Expression::Getbit(_) => "getbit",
2582 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2583 Expression::HexEncode(_) => "hex_encode",
2584 Expression::Compress(_) => "compress",
2585 Expression::DecompressBinary(_) => "decompress_binary",
2586 Expression::DecompressString(_) => "decompress_string",
2587 Expression::Xor(_) => "xor",
2588 Expression::Nullif(_) => "nullif",
2589 Expression::JSON(_) => "j_s_o_n",
2590 Expression::JSONPath(_) => "j_s_o_n_path",
2591 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2592 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2593 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2594 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2595 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2596 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2597 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2598 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2599 Expression::Format(_) => "format",
2600 Expression::JSONKeys(_) => "j_s_o_n_keys",
2601 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2602 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2603 Expression::JSONObject(_) => "j_s_o_n_object",
2604 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2605 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2606 Expression::JSONArray(_) => "j_s_o_n_array",
2607 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2608 Expression::JSONExists(_) => "j_s_o_n_exists",
2609 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2610 Expression::JSONSchema(_) => "j_s_o_n_schema",
2611 Expression::JSONSet(_) => "j_s_o_n_set",
2612 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2613 Expression::JSONValue(_) => "j_s_o_n_value",
2614 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2615 Expression::JSONRemove(_) => "j_s_o_n_remove",
2616 Expression::JSONTable(_) => "j_s_o_n_table",
2617 Expression::JSONType(_) => "j_s_o_n_type",
2618 Expression::ObjectInsert(_) => "object_insert",
2619 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2620 Expression::OpenJSON(_) => "open_j_s_o_n",
2621 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2622 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2623 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2624 Expression::JSONCast(_) => "j_s_o_n_cast",
2625 Expression::JSONExtract(_) => "j_s_o_n_extract",
2626 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2627 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2628 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2629 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2630 Expression::JSONFormat(_) => "j_s_o_n_format",
2631 Expression::JSONBool(_) => "j_s_o_n_bool",
2632 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2633 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2634 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2635 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2636 Expression::ParseJSON(_) => "parse_j_s_o_n",
2637 Expression::ParseUrl(_) => "parse_url",
2638 Expression::ParseIp(_) => "parse_ip",
2639 Expression::ParseTime(_) => "parse_time",
2640 Expression::ParseDatetime(_) => "parse_datetime",
2641 Expression::Map(_) => "map",
2642 Expression::MapCat(_) => "map_cat",
2643 Expression::MapDelete(_) => "map_delete",
2644 Expression::MapInsert(_) => "map_insert",
2645 Expression::MapPick(_) => "map_pick",
2646 Expression::ScopeResolution(_) => "scope_resolution",
2647 Expression::Slice(_) => "slice",
2648 Expression::VarMap(_) => "var_map",
2649 Expression::MatchAgainst(_) => "match_against",
2650 Expression::MD5Digest(_) => "m_d5_digest",
2651 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2652 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2653 Expression::Monthname(_) => "monthname",
2654 Expression::Ntile(_) => "ntile",
2655 Expression::Normalize(_) => "normalize",
2656 Expression::Normal(_) => "normal",
2657 Expression::Predict(_) => "predict",
2658 Expression::MLTranslate(_) => "m_l_translate",
2659 Expression::FeaturesAtTime(_) => "features_at_time",
2660 Expression::GenerateEmbedding(_) => "generate_embedding",
2661 Expression::MLForecast(_) => "m_l_forecast",
2662 Expression::ModelAttribute(_) => "model_attribute",
2663 Expression::VectorSearch(_) => "vector_search",
2664 Expression::Quantile(_) => "quantile",
2665 Expression::ApproxQuantile(_) => "approx_quantile",
2666 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2667 Expression::Randn(_) => "randn",
2668 Expression::Randstr(_) => "randstr",
2669 Expression::RangeN(_) => "range_n",
2670 Expression::RangeBucket(_) => "range_bucket",
2671 Expression::ReadCSV(_) => "read_c_s_v",
2672 Expression::ReadParquet(_) => "read_parquet",
2673 Expression::Reduce(_) => "reduce",
2674 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2675 Expression::RegexpILike(_) => "regexp_i_like",
2676 Expression::RegexpFullMatch(_) => "regexp_full_match",
2677 Expression::RegexpInstr(_) => "regexp_instr",
2678 Expression::RegexpSplit(_) => "regexp_split",
2679 Expression::RegexpCount(_) => "regexp_count",
2680 Expression::RegrValx(_) => "regr_valx",
2681 Expression::RegrValy(_) => "regr_valy",
2682 Expression::RegrAvgy(_) => "regr_avgy",
2683 Expression::RegrAvgx(_) => "regr_avgx",
2684 Expression::RegrCount(_) => "regr_count",
2685 Expression::RegrIntercept(_) => "regr_intercept",
2686 Expression::RegrR2(_) => "regr_r2",
2687 Expression::RegrSxx(_) => "regr_sxx",
2688 Expression::RegrSxy(_) => "regr_sxy",
2689 Expression::RegrSyy(_) => "regr_syy",
2690 Expression::RegrSlope(_) => "regr_slope",
2691 Expression::SafeAdd(_) => "safe_add",
2692 Expression::SafeDivide(_) => "safe_divide",
2693 Expression::SafeMultiply(_) => "safe_multiply",
2694 Expression::SafeSubtract(_) => "safe_subtract",
2695 Expression::SHA2(_) => "s_h_a2",
2696 Expression::SHA2Digest(_) => "s_h_a2_digest",
2697 Expression::SortArray(_) => "sort_array",
2698 Expression::SplitPart(_) => "split_part",
2699 Expression::SubstringIndex(_) => "substring_index",
2700 Expression::StandardHash(_) => "standard_hash",
2701 Expression::StrPosition(_) => "str_position",
2702 Expression::Search(_) => "search",
2703 Expression::SearchIp(_) => "search_ip",
2704 Expression::StrToDate(_) => "str_to_date",
2705 Expression::DateStrToDate(_) => "date_str_to_date",
2706 Expression::DateToDateStr(_) => "date_to_date_str",
2707 Expression::StrToTime(_) => "str_to_time",
2708 Expression::StrToUnix(_) => "str_to_unix",
2709 Expression::StrToMap(_) => "str_to_map",
2710 Expression::NumberToStr(_) => "number_to_str",
2711 Expression::FromBase(_) => "from_base",
2712 Expression::Stuff(_) => "stuff",
2713 Expression::TimeToStr(_) => "time_to_str",
2714 Expression::TimeStrToTime(_) => "time_str_to_time",
2715 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2716 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2717 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2718 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2719 Expression::Unhex(_) => "unhex",
2720 Expression::Uniform(_) => "uniform",
2721 Expression::UnixToStr(_) => "unix_to_str",
2722 Expression::UnixToTime(_) => "unix_to_time",
2723 Expression::Uuid(_) => "uuid",
2724 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2725 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2726 Expression::Corr(_) => "corr",
2727 Expression::WidthBucket(_) => "width_bucket",
2728 Expression::CovarSamp(_) => "covar_samp",
2729 Expression::CovarPop(_) => "covar_pop",
2730 Expression::Week(_) => "week",
2731 Expression::XMLElement(_) => "x_m_l_element",
2732 Expression::XMLGet(_) => "x_m_l_get",
2733 Expression::XMLTable(_) => "x_m_l_table",
2734 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2735 Expression::Zipf(_) => "zipf",
2736 Expression::Merge(_) => "merge",
2737 Expression::When(_) => "when",
2738 Expression::Whens(_) => "whens",
2739 Expression::NextValueFor(_) => "next_value_for",
2740 Expression::ReturnStmt(_) => "return_stmt",
2741 }
2742 }
2743
2744 pub fn get_this(&self) -> Option<&Expression> {
2746 match self {
2747 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2749 Expression::Upper(f)
2751 | Expression::Lower(f)
2752 | Expression::Length(f)
2753 | Expression::LTrim(f)
2754 | Expression::RTrim(f)
2755 | Expression::Reverse(f)
2756 | Expression::Abs(f)
2757 | Expression::Sqrt(f)
2758 | Expression::Cbrt(f)
2759 | Expression::Ln(f)
2760 | Expression::Exp(f)
2761 | Expression::Sign(f)
2762 | Expression::Date(f)
2763 | Expression::Time(f)
2764 | Expression::Initcap(f)
2765 | Expression::Ascii(f)
2766 | Expression::Chr(f)
2767 | Expression::Soundex(f)
2768 | Expression::ByteLength(f)
2769 | Expression::Hex(f)
2770 | Expression::LowerHex(f)
2771 | Expression::Unicode(f)
2772 | Expression::Typeof(f)
2773 | Expression::Explode(f)
2774 | Expression::ExplodeOuter(f)
2775 | Expression::MapFromEntries(f)
2776 | Expression::MapKeys(f)
2777 | Expression::MapValues(f)
2778 | Expression::ArrayLength(f)
2779 | Expression::ArraySize(f)
2780 | Expression::Cardinality(f)
2781 | Expression::ArrayReverse(f)
2782 | Expression::ArrayDistinct(f)
2783 | Expression::ArrayFlatten(f)
2784 | Expression::ArrayCompact(f)
2785 | Expression::ToArray(f)
2786 | Expression::JsonArrayLength(f)
2787 | Expression::JsonKeys(f)
2788 | Expression::JsonType(f)
2789 | Expression::ParseJson(f)
2790 | Expression::ToJson(f)
2791 | Expression::Radians(f)
2792 | Expression::Degrees(f)
2793 | Expression::Sin(f)
2794 | Expression::Cos(f)
2795 | Expression::Tan(f)
2796 | Expression::Asin(f)
2797 | Expression::Acos(f)
2798 | Expression::Atan(f)
2799 | Expression::IsNan(f)
2800 | Expression::IsInf(f)
2801 | Expression::Year(f)
2802 | Expression::Month(f)
2803 | Expression::Day(f)
2804 | Expression::Hour(f)
2805 | Expression::Minute(f)
2806 | Expression::Second(f)
2807 | Expression::DayOfWeek(f)
2808 | Expression::DayOfWeekIso(f)
2809 | Expression::DayOfMonth(f)
2810 | Expression::DayOfYear(f)
2811 | Expression::WeekOfYear(f)
2812 | Expression::Quarter(f)
2813 | Expression::Epoch(f)
2814 | Expression::EpochMs(f)
2815 | Expression::BitwiseCount(f)
2816 | Expression::DateFromUnixDate(f)
2817 | Expression::UnixDate(f)
2818 | Expression::UnixSeconds(f)
2819 | Expression::UnixMillis(f)
2820 | Expression::UnixMicros(f)
2821 | Expression::TimeStrToDate(f)
2822 | Expression::DateToDi(f)
2823 | Expression::DiToDate(f)
2824 | Expression::TsOrDiToDi(f)
2825 | Expression::TsOrDsToDatetime(f)
2826 | Expression::TsOrDsToTimestamp(f)
2827 | Expression::YearOfWeek(f)
2828 | Expression::YearOfWeekIso(f)
2829 | Expression::SHA(f)
2830 | Expression::SHA1Digest(f)
2831 | Expression::TimeToUnix(f)
2832 | Expression::TimeStrToUnix(f)
2833 | Expression::Int64(f)
2834 | Expression::JSONBool(f)
2835 | Expression::MD5NumberLower64(f)
2836 | Expression::MD5NumberUpper64(f)
2837 | Expression::DateStrToDate(f)
2838 | Expression::DateToDateStr(f) => Some(&f.this),
2839 Expression::Power(f)
2841 | Expression::NullIf(f)
2842 | Expression::IfNull(f)
2843 | Expression::Nvl(f)
2844 | Expression::Contains(f)
2845 | Expression::StartsWith(f)
2846 | Expression::EndsWith(f)
2847 | Expression::Levenshtein(f)
2848 | Expression::ModFunc(f)
2849 | Expression::IntDiv(f)
2850 | Expression::Atan2(f)
2851 | Expression::AddMonths(f)
2852 | Expression::MonthsBetween(f)
2853 | Expression::NextDay(f)
2854 | Expression::UnixToTimeStr(f)
2855 | Expression::ArrayContains(f)
2856 | Expression::ArrayPosition(f)
2857 | Expression::ArrayAppend(f)
2858 | Expression::ArrayPrepend(f)
2859 | Expression::ArrayUnion(f)
2860 | Expression::ArrayExcept(f)
2861 | Expression::ArrayRemove(f)
2862 | Expression::StarMap(f)
2863 | Expression::MapFromArrays(f)
2864 | Expression::MapContainsKey(f)
2865 | Expression::ElementAt(f)
2866 | Expression::JsonMergePatch(f)
2867 | Expression::JSONBContains(f)
2868 | Expression::JSONBExtract(f) => Some(&f.this),
2869 Expression::Sum(af)
2871 | Expression::Avg(af)
2872 | Expression::Min(af)
2873 | Expression::Max(af)
2874 | Expression::ArrayAgg(af)
2875 | Expression::CountIf(af)
2876 | Expression::Stddev(af)
2877 | Expression::StddevPop(af)
2878 | Expression::StddevSamp(af)
2879 | Expression::Variance(af)
2880 | Expression::VarPop(af)
2881 | Expression::VarSamp(af)
2882 | Expression::Median(af)
2883 | Expression::Mode(af)
2884 | Expression::First(af)
2885 | Expression::Last(af)
2886 | Expression::AnyValue(af)
2887 | Expression::ApproxDistinct(af)
2888 | Expression::ApproxCountDistinct(af)
2889 | Expression::LogicalAnd(af)
2890 | Expression::LogicalOr(af)
2891 | Expression::Skewness(af)
2892 | Expression::ArrayConcatAgg(af)
2893 | Expression::ArrayUniqueAgg(af)
2894 | Expression::BoolXorAgg(af)
2895 | Expression::BitwiseAndAgg(af)
2896 | Expression::BitwiseOrAgg(af)
2897 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2898 Expression::And(op)
2900 | Expression::Or(op)
2901 | Expression::Add(op)
2902 | Expression::Sub(op)
2903 | Expression::Mul(op)
2904 | Expression::Div(op)
2905 | Expression::Mod(op)
2906 | Expression::Eq(op)
2907 | Expression::Neq(op)
2908 | Expression::Lt(op)
2909 | Expression::Lte(op)
2910 | Expression::Gt(op)
2911 | Expression::Gte(op)
2912 | Expression::BitwiseAnd(op)
2913 | Expression::BitwiseOr(op)
2914 | Expression::BitwiseXor(op)
2915 | Expression::Concat(op)
2916 | Expression::Adjacent(op)
2917 | Expression::TsMatch(op)
2918 | Expression::PropertyEQ(op)
2919 | Expression::ArrayContainsAll(op)
2920 | Expression::ArrayContainedBy(op)
2921 | Expression::ArrayOverlaps(op)
2922 | Expression::JSONBContainsAllTopKeys(op)
2923 | Expression::JSONBContainsAnyTopKeys(op)
2924 | Expression::JSONBDeleteAtPath(op)
2925 | Expression::ExtendsLeft(op)
2926 | Expression::ExtendsRight(op)
2927 | Expression::Is(op)
2928 | Expression::MemberOf(op)
2929 | Expression::Match(op)
2930 | Expression::NullSafeEq(op)
2931 | Expression::NullSafeNeq(op)
2932 | Expression::Glob(op)
2933 | Expression::BitwiseLeftShift(op)
2934 | Expression::BitwiseRightShift(op) => Some(&op.left),
2935 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2937 Expression::Alias(a) => Some(&a.this),
2939 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2940 Expression::Paren(p) => Some(&p.this),
2941 Expression::Annotated(a) => Some(&a.this),
2942 Expression::Subquery(s) => Some(&s.this),
2943 Expression::Where(w) => Some(&w.this),
2944 Expression::Having(h) => Some(&h.this),
2945 Expression::Qualify(q) => Some(&q.this),
2946 Expression::IsNull(i) => Some(&i.this),
2947 Expression::Exists(e) => Some(&e.this),
2948 Expression::Ordered(o) => Some(&o.this),
2949 Expression::WindowFunction(wf) => Some(&wf.this),
2950 Expression::Cte(cte) => Some(&cte.this),
2951 Expression::Between(b) => Some(&b.this),
2952 Expression::In(i) => Some(&i.this),
2953 Expression::ReturnStmt(e) => Some(e),
2954 _ => None,
2955 }
2956 }
2957
2958 pub fn get_expression(&self) -> Option<&Expression> {
2960 match self {
2961 Expression::And(op)
2963 | Expression::Or(op)
2964 | Expression::Add(op)
2965 | Expression::Sub(op)
2966 | Expression::Mul(op)
2967 | Expression::Div(op)
2968 | Expression::Mod(op)
2969 | Expression::Eq(op)
2970 | Expression::Neq(op)
2971 | Expression::Lt(op)
2972 | Expression::Lte(op)
2973 | Expression::Gt(op)
2974 | Expression::Gte(op)
2975 | Expression::BitwiseAnd(op)
2976 | Expression::BitwiseOr(op)
2977 | Expression::BitwiseXor(op)
2978 | Expression::Concat(op)
2979 | Expression::Adjacent(op)
2980 | Expression::TsMatch(op)
2981 | Expression::PropertyEQ(op)
2982 | Expression::ArrayContainsAll(op)
2983 | Expression::ArrayContainedBy(op)
2984 | Expression::ArrayOverlaps(op)
2985 | Expression::JSONBContainsAllTopKeys(op)
2986 | Expression::JSONBContainsAnyTopKeys(op)
2987 | Expression::JSONBDeleteAtPath(op)
2988 | Expression::ExtendsLeft(op)
2989 | Expression::ExtendsRight(op)
2990 | Expression::Is(op)
2991 | Expression::MemberOf(op)
2992 | Expression::Match(op)
2993 | Expression::NullSafeEq(op)
2994 | Expression::NullSafeNeq(op)
2995 | Expression::Glob(op)
2996 | Expression::BitwiseLeftShift(op)
2997 | Expression::BitwiseRightShift(op) => Some(&op.right),
2998 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3000 Expression::Power(f)
3002 | Expression::NullIf(f)
3003 | Expression::IfNull(f)
3004 | Expression::Nvl(f)
3005 | Expression::Contains(f)
3006 | Expression::StartsWith(f)
3007 | Expression::EndsWith(f)
3008 | Expression::Levenshtein(f)
3009 | Expression::ModFunc(f)
3010 | Expression::IntDiv(f)
3011 | Expression::Atan2(f)
3012 | Expression::AddMonths(f)
3013 | Expression::MonthsBetween(f)
3014 | Expression::NextDay(f)
3015 | Expression::UnixToTimeStr(f)
3016 | Expression::ArrayContains(f)
3017 | Expression::ArrayPosition(f)
3018 | Expression::ArrayAppend(f)
3019 | Expression::ArrayPrepend(f)
3020 | Expression::ArrayUnion(f)
3021 | Expression::ArrayExcept(f)
3022 | Expression::ArrayRemove(f)
3023 | Expression::StarMap(f)
3024 | Expression::MapFromArrays(f)
3025 | Expression::MapContainsKey(f)
3026 | Expression::ElementAt(f)
3027 | Expression::JsonMergePatch(f)
3028 | Expression::JSONBContains(f)
3029 | Expression::JSONBExtract(f) => Some(&f.expression),
3030 _ => None,
3031 }
3032 }
3033
3034 pub fn get_expressions(&self) -> &[Expression] {
3036 match self {
3037 Expression::Select(s) => &s.expressions,
3038 Expression::Function(f) => &f.args,
3039 Expression::AggregateFunction(f) => &f.args,
3040 Expression::From(f) => &f.expressions,
3041 Expression::GroupBy(g) => &g.expressions,
3042 Expression::In(i) => &i.expressions,
3043 Expression::Array(a) => &a.expressions,
3044 Expression::Tuple(t) => &t.expressions,
3045 Expression::Coalesce(f)
3046 | Expression::Greatest(f)
3047 | Expression::Least(f)
3048 | Expression::ArrayConcat(f)
3049 | Expression::ArrayIntersect(f)
3050 | Expression::ArrayZip(f)
3051 | Expression::MapConcat(f)
3052 | Expression::JsonArray(f) => &f.expressions,
3053 _ => &[],
3054 }
3055 }
3056
3057 pub fn get_name(&self) -> &str {
3059 match self {
3060 Expression::Identifier(id) => &id.name,
3061 Expression::Column(col) => &col.name.name,
3062 Expression::Table(t) => &t.name.name,
3063 Expression::Literal(lit) => lit.value_str(),
3064 Expression::Star(_) => "*",
3065 Expression::Function(f) => &f.name,
3066 Expression::AggregateFunction(f) => &f.name,
3067 Expression::Alias(a) => a.this.get_name(),
3068 Expression::Boolean(b) => {
3069 if b.value {
3070 "TRUE"
3071 } else {
3072 "FALSE"
3073 }
3074 }
3075 Expression::Null(_) => "NULL",
3076 _ => "",
3077 }
3078 }
3079
3080 pub fn get_alias(&self) -> &str {
3082 match self {
3083 Expression::Alias(a) => &a.alias.name,
3084 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3085 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3086 _ => "",
3087 }
3088 }
3089
3090 pub fn get_output_name(&self) -> &str {
3092 match self {
3093 Expression::Alias(a) => &a.alias.name,
3094 Expression::Column(c) => &c.name.name,
3095 Expression::Identifier(id) => &id.name,
3096 Expression::Literal(lit) => lit.value_str(),
3097 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3098 Expression::Star(_) => "*",
3099 _ => "",
3100 }
3101 }
3102
3103 pub fn get_comments(&self) -> Vec<&str> {
3105 match self {
3106 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3107 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3108 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3109 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3110 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3111 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3112 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3113 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3114 }
3115 Expression::And(op)
3116 | Expression::Or(op)
3117 | Expression::Add(op)
3118 | Expression::Sub(op)
3119 | Expression::Mul(op)
3120 | Expression::Div(op)
3121 | Expression::Mod(op)
3122 | Expression::Eq(op)
3123 | Expression::Neq(op)
3124 | Expression::Lt(op)
3125 | Expression::Lte(op)
3126 | Expression::Gt(op)
3127 | Expression::Gte(op)
3128 | Expression::Concat(op)
3129 | Expression::BitwiseAnd(op)
3130 | Expression::BitwiseOr(op)
3131 | Expression::BitwiseXor(op) => {
3132 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3133 }
3134 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3135 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3136 _ => Vec::new(),
3137 }
3138 }
3139}
3140
3141impl fmt::Display for Expression {
3142 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3143 match self {
3145 Expression::Literal(lit) => write!(f, "{}", lit),
3146 Expression::Identifier(id) => write!(f, "{}", id),
3147 Expression::Column(col) => write!(f, "{}", col),
3148 Expression::Star(_) => write!(f, "*"),
3149 Expression::Null(_) => write!(f, "NULL"),
3150 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3151 Expression::Select(_) => write!(f, "SELECT ..."),
3152 _ => write!(f, "{:?}", self),
3153 }
3154 }
3155}
3156
3157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3167#[cfg_attr(feature = "bindings", derive(TS))]
3168#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3169pub enum Literal {
3170 String(String),
3172 Number(String),
3174 HexString(String),
3176 HexNumber(String),
3178 BitString(String),
3179 ByteString(String),
3181 NationalString(String),
3183 Date(String),
3185 Time(String),
3187 Timestamp(String),
3189 Datetime(String),
3191 TripleQuotedString(String, char),
3194 EscapeString(String),
3196 DollarString(String),
3198 RawString(String),
3202}
3203
3204impl Literal {
3205 pub fn value_str(&self) -> &str {
3207 match self {
3208 Literal::String(s)
3209 | Literal::Number(s)
3210 | Literal::HexString(s)
3211 | Literal::HexNumber(s)
3212 | Literal::BitString(s)
3213 | Literal::ByteString(s)
3214 | Literal::NationalString(s)
3215 | Literal::Date(s)
3216 | Literal::Time(s)
3217 | Literal::Timestamp(s)
3218 | Literal::Datetime(s)
3219 | Literal::EscapeString(s)
3220 | Literal::DollarString(s)
3221 | Literal::RawString(s) => s.as_str(),
3222 Literal::TripleQuotedString(s, _) => s.as_str(),
3223 }
3224 }
3225
3226 pub fn is_string(&self) -> bool {
3228 matches!(
3229 self,
3230 Literal::String(_)
3231 | Literal::NationalString(_)
3232 | Literal::EscapeString(_)
3233 | Literal::DollarString(_)
3234 | Literal::RawString(_)
3235 | Literal::TripleQuotedString(_, _)
3236 )
3237 }
3238
3239 pub fn is_number(&self) -> bool {
3241 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3242 }
3243}
3244
3245impl fmt::Display for Literal {
3246 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3247 match self {
3248 Literal::String(s) => write!(f, "'{}'", s),
3249 Literal::Number(n) => write!(f, "{}", n),
3250 Literal::HexString(h) => write!(f, "X'{}'", h),
3251 Literal::HexNumber(h) => write!(f, "0x{}", h),
3252 Literal::BitString(b) => write!(f, "B'{}'", b),
3253 Literal::ByteString(b) => write!(f, "b'{}'", b),
3254 Literal::NationalString(s) => write!(f, "N'{}'", s),
3255 Literal::Date(d) => write!(f, "DATE '{}'", d),
3256 Literal::Time(t) => write!(f, "TIME '{}'", t),
3257 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3258 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3259 Literal::TripleQuotedString(s, q) => {
3260 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3261 }
3262 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3263 Literal::DollarString(s) => write!(f, "$${}$$", s),
3264 Literal::RawString(s) => write!(f, "r'{}'", s),
3265 }
3266 }
3267}
3268
3269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3271#[cfg_attr(feature = "bindings", derive(TS))]
3272pub struct BooleanLiteral {
3273 pub value: bool,
3274}
3275
3276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3278#[cfg_attr(feature = "bindings", derive(TS))]
3279pub struct Null;
3280
3281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3288#[cfg_attr(feature = "bindings", derive(TS))]
3289pub struct Identifier {
3290 pub name: String,
3292 pub quoted: bool,
3294 #[serde(default)]
3295 pub trailing_comments: Vec<String>,
3296 #[serde(default, skip_serializing_if = "Option::is_none")]
3298 pub span: Option<Span>,
3299}
3300
3301impl Identifier {
3302 pub fn new(name: impl Into<String>) -> Self {
3303 Self {
3304 name: name.into(),
3305 quoted: false,
3306 trailing_comments: Vec::new(),
3307 span: None,
3308 }
3309 }
3310
3311 pub fn quoted(name: impl Into<String>) -> Self {
3312 Self {
3313 name: name.into(),
3314 quoted: true,
3315 trailing_comments: Vec::new(),
3316 span: None,
3317 }
3318 }
3319
3320 pub fn empty() -> Self {
3321 Self {
3322 name: String::new(),
3323 quoted: false,
3324 trailing_comments: Vec::new(),
3325 span: None,
3326 }
3327 }
3328
3329 pub fn is_empty(&self) -> bool {
3330 self.name.is_empty()
3331 }
3332
3333 pub fn with_span(mut self, span: Span) -> Self {
3335 self.span = Some(span);
3336 self
3337 }
3338}
3339
3340impl fmt::Display for Identifier {
3341 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3342 if self.quoted {
3343 write!(f, "\"{}\"", self.name)
3344 } else {
3345 write!(f, "{}", self.name)
3346 }
3347 }
3348}
3349
3350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3356#[cfg_attr(feature = "bindings", derive(TS))]
3357pub struct Column {
3358 pub name: Identifier,
3360 pub table: Option<Identifier>,
3362 #[serde(default)]
3364 pub join_mark: bool,
3365 #[serde(default)]
3367 pub trailing_comments: Vec<String>,
3368 #[serde(default, skip_serializing_if = "Option::is_none")]
3370 pub span: Option<Span>,
3371 #[serde(default, skip_serializing_if = "Option::is_none")]
3373 pub inferred_type: Option<DataType>,
3374}
3375
3376impl fmt::Display for Column {
3377 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3378 if let Some(table) = &self.table {
3379 write!(f, "{}.{}", table, self.name)
3380 } else {
3381 write!(f, "{}", self.name)
3382 }
3383 }
3384}
3385
3386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3393#[cfg_attr(feature = "bindings", derive(TS))]
3394pub struct TableRef {
3395 pub name: Identifier,
3397 pub schema: Option<Identifier>,
3399 pub catalog: Option<Identifier>,
3401 pub alias: Option<Identifier>,
3403 #[serde(default)]
3405 pub alias_explicit_as: bool,
3406 #[serde(default)]
3408 pub column_aliases: Vec<Identifier>,
3409 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3411 pub leading_comments: Vec<String>,
3412 #[serde(default)]
3414 pub trailing_comments: Vec<String>,
3415 #[serde(default)]
3417 pub when: Option<Box<HistoricalData>>,
3418 #[serde(default)]
3420 pub only: bool,
3421 #[serde(default)]
3423 pub final_: bool,
3424 #[serde(default, skip_serializing_if = "Option::is_none")]
3426 pub table_sample: Option<Box<Sample>>,
3427 #[serde(default)]
3429 pub hints: Vec<Expression>,
3430 #[serde(default, skip_serializing_if = "Option::is_none")]
3433 pub system_time: Option<String>,
3434 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3436 pub partitions: Vec<Identifier>,
3437 #[serde(default, skip_serializing_if = "Option::is_none")]
3440 pub identifier_func: Option<Box<Expression>>,
3441 #[serde(default, skip_serializing_if = "Option::is_none")]
3443 pub changes: Option<Box<Changes>>,
3444 #[serde(default, skip_serializing_if = "Option::is_none")]
3446 pub version: Option<Box<Version>>,
3447 #[serde(default, skip_serializing_if = "Option::is_none")]
3449 pub span: Option<Span>,
3450}
3451
3452impl TableRef {
3453 pub fn new(name: impl Into<String>) -> Self {
3454 Self {
3455 name: Identifier::new(name),
3456 schema: None,
3457 catalog: None,
3458 alias: None,
3459 alias_explicit_as: false,
3460 column_aliases: Vec::new(),
3461 leading_comments: Vec::new(),
3462 trailing_comments: Vec::new(),
3463 when: None,
3464 only: false,
3465 final_: false,
3466 table_sample: None,
3467 hints: Vec::new(),
3468 system_time: None,
3469 partitions: Vec::new(),
3470 identifier_func: None,
3471 changes: None,
3472 version: None,
3473 span: None,
3474 }
3475 }
3476
3477 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3479 let mut t = Self::new(name);
3480 t.schema = Some(Identifier::new(schema));
3481 t
3482 }
3483
3484 pub fn new_with_catalog(
3486 name: impl Into<String>,
3487 schema: impl Into<String>,
3488 catalog: impl Into<String>,
3489 ) -> Self {
3490 let mut t = Self::new(name);
3491 t.schema = Some(Identifier::new(schema));
3492 t.catalog = Some(Identifier::new(catalog));
3493 t
3494 }
3495
3496 pub fn from_identifier(name: Identifier) -> Self {
3498 Self {
3499 name,
3500 schema: None,
3501 catalog: None,
3502 alias: None,
3503 alias_explicit_as: false,
3504 column_aliases: Vec::new(),
3505 leading_comments: Vec::new(),
3506 trailing_comments: Vec::new(),
3507 when: None,
3508 only: false,
3509 final_: false,
3510 table_sample: None,
3511 hints: Vec::new(),
3512 system_time: None,
3513 partitions: Vec::new(),
3514 identifier_func: None,
3515 changes: None,
3516 version: None,
3517 span: None,
3518 }
3519 }
3520
3521 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3522 self.alias = Some(Identifier::new(alias));
3523 self
3524 }
3525
3526 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3527 self.schema = Some(Identifier::new(schema));
3528 self
3529 }
3530}
3531
3532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3537#[cfg_attr(feature = "bindings", derive(TS))]
3538pub struct Star {
3539 pub table: Option<Identifier>,
3541 pub except: Option<Vec<Identifier>>,
3543 pub replace: Option<Vec<Alias>>,
3545 pub rename: Option<Vec<(Identifier, Identifier)>>,
3547 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3549 pub trailing_comments: Vec<String>,
3550 #[serde(default, skip_serializing_if = "Option::is_none")]
3552 pub span: Option<Span>,
3553}
3554
3555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3579#[cfg_attr(feature = "bindings", derive(TS))]
3580pub struct Select {
3581 pub expressions: Vec<Expression>,
3583 pub from: Option<From>,
3585 pub joins: Vec<Join>,
3587 pub lateral_views: Vec<LateralView>,
3588 #[serde(default, skip_serializing_if = "Option::is_none")]
3590 pub prewhere: Option<Expression>,
3591 pub where_clause: Option<Where>,
3592 pub group_by: Option<GroupBy>,
3593 pub having: Option<Having>,
3594 pub qualify: Option<Qualify>,
3595 pub order_by: Option<OrderBy>,
3596 pub distribute_by: Option<DistributeBy>,
3597 pub cluster_by: Option<ClusterBy>,
3598 pub sort_by: Option<SortBy>,
3599 pub limit: Option<Limit>,
3600 pub offset: Option<Offset>,
3601 #[serde(default, skip_serializing_if = "Option::is_none")]
3603 pub limit_by: Option<Vec<Expression>>,
3604 pub fetch: Option<Fetch>,
3605 pub distinct: bool,
3606 pub distinct_on: Option<Vec<Expression>>,
3607 pub top: Option<Top>,
3608 pub with: Option<With>,
3609 pub sample: Option<Sample>,
3610 #[serde(default, skip_serializing_if = "Option::is_none")]
3612 pub settings: Option<Vec<Expression>>,
3613 #[serde(default, skip_serializing_if = "Option::is_none")]
3615 pub format: Option<Expression>,
3616 pub windows: Option<Vec<NamedWindow>>,
3617 pub hint: Option<Hint>,
3618 pub connect: Option<Connect>,
3620 pub into: Option<SelectInto>,
3622 #[serde(default)]
3624 pub locks: Vec<Lock>,
3625 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3627 pub for_xml: Vec<Expression>,
3628 #[serde(default)]
3630 pub leading_comments: Vec<String>,
3631 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub post_select_comments: Vec<String>,
3635 #[serde(default, skip_serializing_if = "Option::is_none")]
3637 pub kind: Option<String>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3640 pub operation_modifiers: Vec<String>,
3641 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3643 pub qualify_after_window: bool,
3644 #[serde(default, skip_serializing_if = "Option::is_none")]
3646 pub option: Option<String>,
3647 #[serde(default, skip_serializing_if = "Option::is_none")]
3650 pub exclude: Option<Vec<Expression>>,
3651}
3652
3653impl Select {
3654 pub fn new() -> Self {
3655 Self {
3656 expressions: Vec::new(),
3657 from: None,
3658 joins: Vec::new(),
3659 lateral_views: Vec::new(),
3660 prewhere: None,
3661 where_clause: None,
3662 group_by: None,
3663 having: None,
3664 qualify: None,
3665 order_by: None,
3666 distribute_by: None,
3667 cluster_by: None,
3668 sort_by: None,
3669 limit: None,
3670 offset: None,
3671 limit_by: None,
3672 fetch: None,
3673 distinct: false,
3674 distinct_on: None,
3675 top: None,
3676 with: None,
3677 sample: None,
3678 settings: None,
3679 format: None,
3680 windows: None,
3681 hint: None,
3682 connect: None,
3683 into: None,
3684 locks: Vec::new(),
3685 for_xml: Vec::new(),
3686 leading_comments: Vec::new(),
3687 post_select_comments: Vec::new(),
3688 kind: None,
3689 operation_modifiers: Vec::new(),
3690 qualify_after_window: false,
3691 option: None,
3692 exclude: None,
3693 }
3694 }
3695
3696 pub fn column(mut self, expr: Expression) -> Self {
3698 self.expressions.push(expr);
3699 self
3700 }
3701
3702 pub fn from(mut self, table: Expression) -> Self {
3704 self.from = Some(From {
3705 expressions: vec![table],
3706 });
3707 self
3708 }
3709
3710 pub fn where_(mut self, condition: Expression) -> Self {
3712 self.where_clause = Some(Where { this: condition });
3713 self
3714 }
3715
3716 pub fn distinct(mut self) -> Self {
3718 self.distinct = true;
3719 self
3720 }
3721
3722 pub fn join(mut self, join: Join) -> Self {
3724 self.joins.push(join);
3725 self
3726 }
3727
3728 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3730 self.order_by = Some(OrderBy {
3731 expressions,
3732 siblings: false,
3733 comments: Vec::new(),
3734 });
3735 self
3736 }
3737
3738 pub fn limit(mut self, n: Expression) -> Self {
3740 self.limit = Some(Limit {
3741 this: n,
3742 percent: false,
3743 comments: Vec::new(),
3744 });
3745 self
3746 }
3747
3748 pub fn offset(mut self, n: Expression) -> Self {
3750 self.offset = Some(Offset {
3751 this: n,
3752 rows: None,
3753 });
3754 self
3755 }
3756}
3757
3758impl Default for Select {
3759 fn default() -> Self {
3760 Self::new()
3761 }
3762}
3763
3764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3770#[cfg_attr(feature = "bindings", derive(TS))]
3771pub struct Union {
3772 pub left: Expression,
3774 pub right: Expression,
3776 pub all: bool,
3778 #[serde(default)]
3780 pub distinct: bool,
3781 pub with: Option<With>,
3783 pub order_by: Option<OrderBy>,
3785 pub limit: Option<Box<Expression>>,
3787 pub offset: Option<Box<Expression>>,
3789 #[serde(default, skip_serializing_if = "Option::is_none")]
3791 pub distribute_by: Option<DistributeBy>,
3792 #[serde(default, skip_serializing_if = "Option::is_none")]
3794 pub sort_by: Option<SortBy>,
3795 #[serde(default, skip_serializing_if = "Option::is_none")]
3797 pub cluster_by: Option<ClusterBy>,
3798 #[serde(default)]
3800 pub by_name: bool,
3801 #[serde(default, skip_serializing_if = "Option::is_none")]
3803 pub side: Option<String>,
3804 #[serde(default, skip_serializing_if = "Option::is_none")]
3806 pub kind: Option<String>,
3807 #[serde(default)]
3809 pub corresponding: bool,
3810 #[serde(default)]
3812 pub strict: bool,
3813 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3815 pub on_columns: Vec<Expression>,
3816}
3817
3818impl Drop for Union {
3821 fn drop(&mut self) {
3822 loop {
3823 if let Expression::Union(ref mut inner) = self.left {
3824 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3825 let old_left = std::mem::replace(&mut self.left, next_left);
3826 drop(old_left);
3827 } else {
3828 break;
3829 }
3830 }
3831 }
3832}
3833
3834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3839#[cfg_attr(feature = "bindings", derive(TS))]
3840pub struct Intersect {
3841 pub left: Expression,
3843 pub right: Expression,
3845 pub all: bool,
3847 #[serde(default)]
3849 pub distinct: bool,
3850 pub with: Option<With>,
3852 pub order_by: Option<OrderBy>,
3854 pub limit: Option<Box<Expression>>,
3856 pub offset: Option<Box<Expression>>,
3858 #[serde(default, skip_serializing_if = "Option::is_none")]
3860 pub distribute_by: Option<DistributeBy>,
3861 #[serde(default, skip_serializing_if = "Option::is_none")]
3863 pub sort_by: Option<SortBy>,
3864 #[serde(default, skip_serializing_if = "Option::is_none")]
3866 pub cluster_by: Option<ClusterBy>,
3867 #[serde(default)]
3869 pub by_name: bool,
3870 #[serde(default, skip_serializing_if = "Option::is_none")]
3872 pub side: Option<String>,
3873 #[serde(default, skip_serializing_if = "Option::is_none")]
3875 pub kind: Option<String>,
3876 #[serde(default)]
3878 pub corresponding: bool,
3879 #[serde(default)]
3881 pub strict: bool,
3882 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3884 pub on_columns: Vec<Expression>,
3885}
3886
3887impl Drop for Intersect {
3888 fn drop(&mut self) {
3889 loop {
3890 if let Expression::Intersect(ref mut inner) = self.left {
3891 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3892 let old_left = std::mem::replace(&mut self.left, next_left);
3893 drop(old_left);
3894 } else {
3895 break;
3896 }
3897 }
3898 }
3899}
3900
3901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3906#[cfg_attr(feature = "bindings", derive(TS))]
3907pub struct Except {
3908 pub left: Expression,
3910 pub right: Expression,
3912 pub all: bool,
3914 #[serde(default)]
3916 pub distinct: bool,
3917 pub with: Option<With>,
3919 pub order_by: Option<OrderBy>,
3921 pub limit: Option<Box<Expression>>,
3923 pub offset: Option<Box<Expression>>,
3925 #[serde(default, skip_serializing_if = "Option::is_none")]
3927 pub distribute_by: Option<DistributeBy>,
3928 #[serde(default, skip_serializing_if = "Option::is_none")]
3930 pub sort_by: Option<SortBy>,
3931 #[serde(default, skip_serializing_if = "Option::is_none")]
3933 pub cluster_by: Option<ClusterBy>,
3934 #[serde(default)]
3936 pub by_name: bool,
3937 #[serde(default, skip_serializing_if = "Option::is_none")]
3939 pub side: Option<String>,
3940 #[serde(default, skip_serializing_if = "Option::is_none")]
3942 pub kind: Option<String>,
3943 #[serde(default)]
3945 pub corresponding: bool,
3946 #[serde(default)]
3948 pub strict: bool,
3949 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3951 pub on_columns: Vec<Expression>,
3952}
3953
3954impl Drop for Except {
3955 fn drop(&mut self) {
3956 loop {
3957 if let Expression::Except(ref mut inner) = self.left {
3958 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3959 let old_left = std::mem::replace(&mut self.left, next_left);
3960 drop(old_left);
3961 } else {
3962 break;
3963 }
3964 }
3965 }
3966}
3967
3968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3970#[cfg_attr(feature = "bindings", derive(TS))]
3971pub struct SelectInto {
3972 pub this: Expression,
3974 #[serde(default)]
3976 pub temporary: bool,
3977 #[serde(default)]
3979 pub unlogged: bool,
3980 #[serde(default)]
3982 pub bulk_collect: bool,
3983 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3985 pub expressions: Vec<Expression>,
3986}
3987
3988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3998#[cfg_attr(feature = "bindings", derive(TS))]
3999pub struct Subquery {
4000 pub this: Expression,
4002 pub alias: Option<Identifier>,
4004 pub column_aliases: Vec<Identifier>,
4006 pub order_by: Option<OrderBy>,
4008 pub limit: Option<Limit>,
4010 pub offset: Option<Offset>,
4012 #[serde(default, skip_serializing_if = "Option::is_none")]
4014 pub distribute_by: Option<DistributeBy>,
4015 #[serde(default, skip_serializing_if = "Option::is_none")]
4017 pub sort_by: Option<SortBy>,
4018 #[serde(default, skip_serializing_if = "Option::is_none")]
4020 pub cluster_by: Option<ClusterBy>,
4021 #[serde(default)]
4023 pub lateral: bool,
4024 #[serde(default)]
4028 pub modifiers_inside: bool,
4029 #[serde(default)]
4031 pub trailing_comments: Vec<String>,
4032 #[serde(default, skip_serializing_if = "Option::is_none")]
4034 pub inferred_type: Option<DataType>,
4035}
4036
4037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4042#[cfg_attr(feature = "bindings", derive(TS))]
4043pub struct PipeOperator {
4044 pub this: Expression,
4046 pub expression: Expression,
4048}
4049
4050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4052#[cfg_attr(feature = "bindings", derive(TS))]
4053pub struct Values {
4054 pub expressions: Vec<Tuple>,
4056 pub alias: Option<Identifier>,
4058 pub column_aliases: Vec<Identifier>,
4060}
4061
4062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4072#[cfg_attr(feature = "bindings", derive(TS))]
4073pub struct Pivot {
4074 pub this: Expression,
4076 #[serde(default)]
4079 pub expressions: Vec<Expression>,
4080 #[serde(default)]
4082 pub fields: Vec<Expression>,
4083 #[serde(default)]
4085 pub using: Vec<Expression>,
4086 #[serde(default)]
4088 pub group: Option<Box<Expression>>,
4089 #[serde(default)]
4091 pub unpivot: bool,
4092 #[serde(default)]
4094 pub into: Option<Box<Expression>>,
4095 #[serde(default)]
4097 pub alias: Option<Identifier>,
4098 #[serde(default)]
4100 pub include_nulls: Option<bool>,
4101 #[serde(default)]
4103 pub default_on_null: Option<Box<Expression>>,
4104 #[serde(default, skip_serializing_if = "Option::is_none")]
4106 pub with: Option<With>,
4107}
4108
4109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4111#[cfg_attr(feature = "bindings", derive(TS))]
4112pub struct Unpivot {
4113 pub this: Expression,
4114 pub value_column: Identifier,
4115 pub name_column: Identifier,
4116 pub columns: Vec<Expression>,
4117 pub alias: Option<Identifier>,
4118 #[serde(default)]
4120 pub value_column_parenthesized: bool,
4121 #[serde(default)]
4123 pub include_nulls: Option<bool>,
4124 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4126 pub extra_value_columns: Vec<Identifier>,
4127}
4128
4129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4132#[cfg_attr(feature = "bindings", derive(TS))]
4133pub struct PivotAlias {
4134 pub this: Expression,
4135 pub alias: Expression,
4136}
4137
4138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4140#[cfg_attr(feature = "bindings", derive(TS))]
4141pub struct PreWhere {
4142 pub this: Expression,
4143}
4144
4145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4147#[cfg_attr(feature = "bindings", derive(TS))]
4148pub struct Stream {
4149 pub this: Expression,
4150 #[serde(skip_serializing_if = "Option::is_none")]
4151 pub on: Option<Expression>,
4152 #[serde(skip_serializing_if = "Option::is_none")]
4153 pub show_initial_rows: Option<bool>,
4154}
4155
4156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4158#[cfg_attr(feature = "bindings", derive(TS))]
4159pub struct UsingData {
4160 pub this: Expression,
4161}
4162
4163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4165#[cfg_attr(feature = "bindings", derive(TS))]
4166pub struct XmlNamespace {
4167 pub this: Expression,
4168 #[serde(skip_serializing_if = "Option::is_none")]
4169 pub alias: Option<Identifier>,
4170}
4171
4172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4174#[cfg_attr(feature = "bindings", derive(TS))]
4175pub struct RowFormat {
4176 pub delimited: bool,
4177 pub fields_terminated_by: Option<String>,
4178 pub collection_items_terminated_by: Option<String>,
4179 pub map_keys_terminated_by: Option<String>,
4180 pub lines_terminated_by: Option<String>,
4181 pub null_defined_as: Option<String>,
4182}
4183
4184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4186#[cfg_attr(feature = "bindings", derive(TS))]
4187pub struct DirectoryInsert {
4188 pub local: bool,
4189 pub path: String,
4190 pub row_format: Option<RowFormat>,
4191 #[serde(default)]
4193 pub stored_as: Option<String>,
4194}
4195
4196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4198#[cfg_attr(feature = "bindings", derive(TS))]
4199pub struct Insert {
4200 pub table: TableRef,
4201 pub columns: Vec<Identifier>,
4202 pub values: Vec<Vec<Expression>>,
4203 pub query: Option<Expression>,
4204 pub overwrite: bool,
4206 pub partition: Vec<(Identifier, Option<Expression>)>,
4208 #[serde(default)]
4210 pub directory: Option<DirectoryInsert>,
4211 #[serde(default)]
4213 pub returning: Vec<Expression>,
4214 #[serde(default)]
4216 pub output: Option<OutputClause>,
4217 #[serde(default)]
4219 pub on_conflict: Option<Box<Expression>>,
4220 #[serde(default)]
4222 pub leading_comments: Vec<String>,
4223 #[serde(default)]
4225 pub if_exists: bool,
4226 #[serde(default)]
4228 pub with: Option<With>,
4229 #[serde(default)]
4231 pub ignore: bool,
4232 #[serde(default)]
4234 pub source_alias: Option<Identifier>,
4235 #[serde(default)]
4237 pub alias: Option<Identifier>,
4238 #[serde(default)]
4240 pub alias_explicit_as: bool,
4241 #[serde(default)]
4243 pub default_values: bool,
4244 #[serde(default)]
4246 pub by_name: bool,
4247 #[serde(default, skip_serializing_if = "Option::is_none")]
4249 pub conflict_action: Option<String>,
4250 #[serde(default)]
4252 pub is_replace: bool,
4253 #[serde(default, skip_serializing_if = "Option::is_none")]
4255 pub hint: Option<Hint>,
4256 #[serde(default)]
4258 pub replace_where: Option<Box<Expression>>,
4259 #[serde(default)]
4261 pub source: Option<Box<Expression>>,
4262 #[serde(default, skip_serializing_if = "Option::is_none")]
4264 pub function_target: Option<Box<Expression>>,
4265 #[serde(default, skip_serializing_if = "Option::is_none")]
4267 pub partition_by: Option<Box<Expression>>,
4268 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4270 pub settings: Vec<Expression>,
4271}
4272
4273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4275#[cfg_attr(feature = "bindings", derive(TS))]
4276pub struct OutputClause {
4277 pub columns: Vec<Expression>,
4279 #[serde(default)]
4281 pub into_table: Option<Expression>,
4282}
4283
4284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4286#[cfg_attr(feature = "bindings", derive(TS))]
4287pub struct Update {
4288 pub table: TableRef,
4289 #[serde(default)]
4291 pub extra_tables: Vec<TableRef>,
4292 #[serde(default)]
4294 pub table_joins: Vec<Join>,
4295 pub set: Vec<(Identifier, Expression)>,
4296 pub from_clause: Option<From>,
4297 #[serde(default)]
4299 pub from_joins: Vec<Join>,
4300 pub where_clause: Option<Where>,
4301 #[serde(default)]
4303 pub returning: Vec<Expression>,
4304 #[serde(default)]
4306 pub output: Option<OutputClause>,
4307 #[serde(default)]
4309 pub with: Option<With>,
4310 #[serde(default)]
4312 pub leading_comments: Vec<String>,
4313 #[serde(default)]
4315 pub limit: Option<Expression>,
4316 #[serde(default)]
4318 pub order_by: Option<OrderBy>,
4319 #[serde(default)]
4321 pub from_before_set: bool,
4322}
4323
4324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4326#[cfg_attr(feature = "bindings", derive(TS))]
4327pub struct Delete {
4328 pub table: TableRef,
4329 #[serde(default, skip_serializing_if = "Option::is_none")]
4331 pub on_cluster: Option<OnCluster>,
4332 pub alias: Option<Identifier>,
4334 #[serde(default)]
4336 pub alias_explicit_as: bool,
4337 pub using: Vec<TableRef>,
4339 pub where_clause: Option<Where>,
4340 #[serde(default)]
4342 pub output: Option<OutputClause>,
4343 #[serde(default)]
4345 pub leading_comments: Vec<String>,
4346 #[serde(default)]
4348 pub with: Option<With>,
4349 #[serde(default)]
4351 pub limit: Option<Expression>,
4352 #[serde(default)]
4354 pub order_by: Option<OrderBy>,
4355 #[serde(default)]
4357 pub returning: Vec<Expression>,
4358 #[serde(default)]
4361 pub tables: Vec<TableRef>,
4362 #[serde(default)]
4365 pub tables_from_using: bool,
4366 #[serde(default)]
4368 pub joins: Vec<Join>,
4369 #[serde(default)]
4371 pub force_index: Option<String>,
4372 #[serde(default)]
4374 pub no_from: bool,
4375}
4376
4377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4379#[cfg_attr(feature = "bindings", derive(TS))]
4380pub struct CopyStmt {
4381 pub this: Expression,
4383 pub kind: bool,
4385 pub files: Vec<Expression>,
4387 #[serde(default)]
4389 pub params: Vec<CopyParameter>,
4390 #[serde(default)]
4392 pub credentials: Option<Box<Credentials>>,
4393 #[serde(default)]
4395 pub is_into: bool,
4396 #[serde(default)]
4398 pub with_wrapped: bool,
4399}
4400
4401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4403#[cfg_attr(feature = "bindings", derive(TS))]
4404pub struct CopyParameter {
4405 pub name: String,
4406 pub value: Option<Expression>,
4407 pub values: Vec<Expression>,
4408 #[serde(default)]
4410 pub eq: bool,
4411}
4412
4413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4415#[cfg_attr(feature = "bindings", derive(TS))]
4416pub struct Credentials {
4417 pub credentials: Vec<(String, String)>,
4418 pub encryption: Option<String>,
4419 pub storage: Option<String>,
4420}
4421
4422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4424#[cfg_attr(feature = "bindings", derive(TS))]
4425pub struct PutStmt {
4426 pub source: String,
4428 #[serde(default)]
4430 pub source_quoted: bool,
4431 pub target: Expression,
4433 #[serde(default)]
4435 pub params: Vec<CopyParameter>,
4436}
4437
4438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4440#[cfg_attr(feature = "bindings", derive(TS))]
4441pub struct StageReference {
4442 pub name: String,
4444 #[serde(default)]
4446 pub path: Option<String>,
4447 #[serde(default)]
4449 pub file_format: Option<Expression>,
4450 #[serde(default)]
4452 pub pattern: Option<String>,
4453 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4455 pub quoted: bool,
4456}
4457
4458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4460#[cfg_attr(feature = "bindings", derive(TS))]
4461pub struct HistoricalData {
4462 pub this: Box<Expression>,
4464 pub kind: String,
4466 pub expression: Box<Expression>,
4468}
4469
4470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4475#[cfg_attr(feature = "bindings", derive(TS))]
4476pub struct Alias {
4477 pub this: Expression,
4479 pub alias: Identifier,
4481 #[serde(default)]
4483 pub column_aliases: Vec<Identifier>,
4484 #[serde(default)]
4486 pub pre_alias_comments: Vec<String>,
4487 #[serde(default)]
4489 pub trailing_comments: Vec<String>,
4490 #[serde(default, skip_serializing_if = "Option::is_none")]
4492 pub inferred_type: Option<DataType>,
4493}
4494
4495impl Alias {
4496 pub fn new(this: Expression, alias: Identifier) -> Self {
4498 Self {
4499 this,
4500 alias,
4501 column_aliases: Vec::new(),
4502 pre_alias_comments: Vec::new(),
4503 trailing_comments: Vec::new(),
4504 inferred_type: None,
4505 }
4506 }
4507
4508 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4510 Self {
4511 this,
4512 alias: Identifier::empty(),
4513 column_aliases,
4514 pre_alias_comments: Vec::new(),
4515 trailing_comments: Vec::new(),
4516 inferred_type: None,
4517 }
4518 }
4519}
4520
4521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4528#[cfg_attr(feature = "bindings", derive(TS))]
4529pub struct Cast {
4530 pub this: Expression,
4532 pub to: DataType,
4534 #[serde(default)]
4535 pub trailing_comments: Vec<String>,
4536 #[serde(default)]
4538 pub double_colon_syntax: bool,
4539 #[serde(skip_serializing_if = "Option::is_none", default)]
4541 pub format: Option<Box<Expression>>,
4542 #[serde(skip_serializing_if = "Option::is_none", default)]
4544 pub default: Option<Box<Expression>>,
4545 #[serde(default, skip_serializing_if = "Option::is_none")]
4547 pub inferred_type: Option<DataType>,
4548}
4549
4550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4552#[cfg_attr(feature = "bindings", derive(TS))]
4553pub struct CollationExpr {
4554 pub this: Expression,
4555 pub collation: String,
4556 #[serde(default)]
4558 pub quoted: bool,
4559 #[serde(default)]
4561 pub double_quoted: bool,
4562}
4563
4564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4570#[cfg_attr(feature = "bindings", derive(TS))]
4571pub struct Case {
4572 pub operand: Option<Expression>,
4574 pub whens: Vec<(Expression, Expression)>,
4576 pub else_: Option<Expression>,
4578 #[serde(default)]
4580 #[serde(skip_serializing_if = "Vec::is_empty")]
4581 pub comments: Vec<String>,
4582 #[serde(default, skip_serializing_if = "Option::is_none")]
4584 pub inferred_type: Option<DataType>,
4585}
4586
4587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4595#[cfg_attr(feature = "bindings", derive(TS))]
4596pub struct BinaryOp {
4597 pub left: Expression,
4598 pub right: Expression,
4599 #[serde(default)]
4601 pub left_comments: Vec<String>,
4602 #[serde(default)]
4604 pub operator_comments: Vec<String>,
4605 #[serde(default)]
4607 pub trailing_comments: Vec<String>,
4608 #[serde(default, skip_serializing_if = "Option::is_none")]
4610 pub inferred_type: Option<DataType>,
4611}
4612
4613impl BinaryOp {
4614 pub fn new(left: Expression, right: Expression) -> Self {
4615 Self {
4616 left,
4617 right,
4618 left_comments: Vec::new(),
4619 operator_comments: Vec::new(),
4620 trailing_comments: Vec::new(),
4621 inferred_type: None,
4622 }
4623 }
4624}
4625
4626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4628#[cfg_attr(feature = "bindings", derive(TS))]
4629pub struct LikeOp {
4630 pub left: Expression,
4631 pub right: Expression,
4632 #[serde(default)]
4634 pub escape: Option<Expression>,
4635 #[serde(default)]
4637 pub quantifier: Option<String>,
4638 #[serde(default, skip_serializing_if = "Option::is_none")]
4640 pub inferred_type: Option<DataType>,
4641}
4642
4643impl LikeOp {
4644 pub fn new(left: Expression, right: Expression) -> Self {
4645 Self {
4646 left,
4647 right,
4648 escape: None,
4649 quantifier: None,
4650 inferred_type: None,
4651 }
4652 }
4653
4654 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4655 Self {
4656 left,
4657 right,
4658 escape: Some(escape),
4659 quantifier: None,
4660 inferred_type: None,
4661 }
4662 }
4663}
4664
4665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4669#[cfg_attr(feature = "bindings", derive(TS))]
4670pub struct UnaryOp {
4671 pub this: Expression,
4673 #[serde(default, skip_serializing_if = "Option::is_none")]
4675 pub inferred_type: Option<DataType>,
4676}
4677
4678impl UnaryOp {
4679 pub fn new(this: Expression) -> Self {
4680 Self {
4681 this,
4682 inferred_type: None,
4683 }
4684 }
4685}
4686
4687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4692#[cfg_attr(feature = "bindings", derive(TS))]
4693pub struct In {
4694 pub this: Expression,
4696 pub expressions: Vec<Expression>,
4698 pub query: Option<Expression>,
4700 pub not: bool,
4702 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4703 pub global: bool,
4704 #[serde(default, skip_serializing_if = "Option::is_none")]
4706 pub unnest: Option<Box<Expression>>,
4707 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4711 pub is_field: bool,
4712}
4713
4714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4716#[cfg_attr(feature = "bindings", derive(TS))]
4717pub struct Between {
4718 pub this: Expression,
4720 pub low: Expression,
4722 pub high: Expression,
4724 pub not: bool,
4726 #[serde(default)]
4728 pub symmetric: Option<bool>,
4729}
4730
4731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4733#[cfg_attr(feature = "bindings", derive(TS))]
4734pub struct IsNull {
4735 pub this: Expression,
4736 pub not: bool,
4737 #[serde(default)]
4739 pub postfix_form: bool,
4740}
4741
4742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4744#[cfg_attr(feature = "bindings", derive(TS))]
4745pub struct IsTrueFalse {
4746 pub this: Expression,
4747 pub not: bool,
4748}
4749
4750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4753#[cfg_attr(feature = "bindings", derive(TS))]
4754pub struct IsJson {
4755 pub this: Expression,
4756 pub json_type: Option<String>,
4758 pub unique_keys: Option<JsonUniqueKeys>,
4760 pub negated: bool,
4762}
4763
4764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4766#[cfg_attr(feature = "bindings", derive(TS))]
4767pub enum JsonUniqueKeys {
4768 With,
4770 Without,
4772 Shorthand,
4774}
4775
4776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4778#[cfg_attr(feature = "bindings", derive(TS))]
4779pub struct Exists {
4780 pub this: Expression,
4782 pub not: bool,
4784}
4785
4786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4793#[cfg_attr(feature = "bindings", derive(TS))]
4794pub struct Function {
4795 pub name: String,
4797 pub args: Vec<Expression>,
4799 pub distinct: bool,
4801 #[serde(default)]
4802 pub trailing_comments: Vec<String>,
4803 #[serde(default)]
4805 pub use_bracket_syntax: bool,
4806 #[serde(default)]
4808 pub no_parens: bool,
4809 #[serde(default)]
4811 pub quoted: bool,
4812 #[serde(default, skip_serializing_if = "Option::is_none")]
4814 pub span: Option<Span>,
4815 #[serde(default, skip_serializing_if = "Option::is_none")]
4817 pub inferred_type: Option<DataType>,
4818}
4819
4820impl Default for Function {
4821 fn default() -> Self {
4822 Self {
4823 name: String::new(),
4824 args: Vec::new(),
4825 distinct: false,
4826 trailing_comments: Vec::new(),
4827 use_bracket_syntax: false,
4828 no_parens: false,
4829 quoted: false,
4830 span: None,
4831 inferred_type: None,
4832 }
4833 }
4834}
4835
4836impl Function {
4837 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4838 Self {
4839 name: name.into(),
4840 args,
4841 distinct: false,
4842 trailing_comments: Vec::new(),
4843 use_bracket_syntax: false,
4844 no_parens: false,
4845 quoted: false,
4846 span: None,
4847 inferred_type: None,
4848 }
4849 }
4850}
4851
4852#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4859#[cfg_attr(feature = "bindings", derive(TS))]
4860pub struct AggregateFunction {
4861 pub name: String,
4863 pub args: Vec<Expression>,
4865 pub distinct: bool,
4867 pub filter: Option<Expression>,
4869 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4871 pub order_by: Vec<Ordered>,
4872 #[serde(default, skip_serializing_if = "Option::is_none")]
4874 pub limit: Option<Box<Expression>>,
4875 #[serde(default, skip_serializing_if = "Option::is_none")]
4877 pub ignore_nulls: Option<bool>,
4878 #[serde(default, skip_serializing_if = "Option::is_none")]
4880 pub inferred_type: Option<DataType>,
4881}
4882
4883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4890#[cfg_attr(feature = "bindings", derive(TS))]
4891pub struct WindowFunction {
4892 pub this: Expression,
4894 pub over: Over,
4896 #[serde(default, skip_serializing_if = "Option::is_none")]
4898 pub keep: Option<Keep>,
4899 #[serde(default, skip_serializing_if = "Option::is_none")]
4901 pub inferred_type: Option<DataType>,
4902}
4903
4904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4907#[cfg_attr(feature = "bindings", derive(TS))]
4908pub struct Keep {
4909 pub first: bool,
4911 pub order_by: Vec<Ordered>,
4913}
4914
4915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4917#[cfg_attr(feature = "bindings", derive(TS))]
4918pub struct WithinGroup {
4919 pub this: Expression,
4921 pub order_by: Vec<Ordered>,
4923}
4924
4925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4930#[cfg_attr(feature = "bindings", derive(TS))]
4931pub struct From {
4932 pub expressions: Vec<Expression>,
4934}
4935
4936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4942#[cfg_attr(feature = "bindings", derive(TS))]
4943pub struct Join {
4944 pub this: Expression,
4946 pub on: Option<Expression>,
4948 pub using: Vec<Identifier>,
4950 pub kind: JoinKind,
4952 pub use_inner_keyword: bool,
4954 pub use_outer_keyword: bool,
4956 pub deferred_condition: bool,
4958 #[serde(default, skip_serializing_if = "Option::is_none")]
4960 pub join_hint: Option<String>,
4961 #[serde(default, skip_serializing_if = "Option::is_none")]
4963 pub match_condition: Option<Expression>,
4964 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4966 pub pivots: Vec<Expression>,
4967 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4969 pub comments: Vec<String>,
4970 #[serde(default)]
4974 pub nesting_group: usize,
4975 #[serde(default)]
4977 pub directed: bool,
4978}
4979
4980#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4987#[cfg_attr(feature = "bindings", derive(TS))]
4988pub enum JoinKind {
4989 Inner,
4990 Left,
4991 Right,
4992 Full,
4993 Outer, Cross,
4995 Natural,
4996 NaturalLeft,
4997 NaturalRight,
4998 NaturalFull,
4999 Semi,
5000 Anti,
5001 LeftSemi,
5003 LeftAnti,
5004 RightSemi,
5005 RightAnti,
5006 CrossApply,
5008 OuterApply,
5009 AsOf,
5011 AsOfLeft,
5012 AsOfRight,
5013 Lateral,
5015 LeftLateral,
5016 Straight,
5018 Implicit,
5020 Array,
5022 LeftArray,
5023 Paste,
5025 Positional,
5027}
5028
5029impl Default for JoinKind {
5030 fn default() -> Self {
5031 JoinKind::Inner
5032 }
5033}
5034
5035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5038#[cfg_attr(feature = "bindings", derive(TS))]
5039pub struct JoinedTable {
5040 pub left: Expression,
5042 pub joins: Vec<Join>,
5044 pub lateral_views: Vec<LateralView>,
5046 pub alias: Option<Identifier>,
5048}
5049
5050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5052#[cfg_attr(feature = "bindings", derive(TS))]
5053pub struct Where {
5054 pub this: Expression,
5056}
5057
5058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5063#[cfg_attr(feature = "bindings", derive(TS))]
5064pub struct GroupBy {
5065 pub expressions: Vec<Expression>,
5067 #[serde(default)]
5069 pub all: Option<bool>,
5070 #[serde(default)]
5072 pub totals: bool,
5073 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5075 pub comments: Vec<String>,
5076}
5077
5078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5080#[cfg_attr(feature = "bindings", derive(TS))]
5081pub struct Having {
5082 pub this: Expression,
5084 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5086 pub comments: Vec<String>,
5087}
5088
5089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5091#[cfg_attr(feature = "bindings", derive(TS))]
5092pub struct OrderBy {
5093 pub expressions: Vec<Ordered>,
5095 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5097 pub siblings: bool,
5098 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5100 pub comments: Vec<String>,
5101}
5102
5103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5110#[cfg_attr(feature = "bindings", derive(TS))]
5111pub struct Ordered {
5112 pub this: Expression,
5114 pub desc: bool,
5116 pub nulls_first: Option<bool>,
5118 #[serde(default)]
5120 pub explicit_asc: bool,
5121 #[serde(default, skip_serializing_if = "Option::is_none")]
5123 pub with_fill: Option<Box<WithFill>>,
5124}
5125
5126impl Ordered {
5127 pub fn asc(expr: Expression) -> Self {
5128 Self {
5129 this: expr,
5130 desc: false,
5131 nulls_first: None,
5132 explicit_asc: false,
5133 with_fill: None,
5134 }
5135 }
5136
5137 pub fn desc(expr: Expression) -> Self {
5138 Self {
5139 this: expr,
5140 desc: true,
5141 nulls_first: None,
5142 explicit_asc: false,
5143 with_fill: None,
5144 }
5145 }
5146}
5147
5148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5151#[cfg_attr(feature = "bindings", derive(TS))]
5152#[cfg_attr(feature = "bindings", ts(export))]
5153pub struct DistributeBy {
5154 pub expressions: Vec<Expression>,
5155}
5156
5157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5160#[cfg_attr(feature = "bindings", derive(TS))]
5161#[cfg_attr(feature = "bindings", ts(export))]
5162pub struct ClusterBy {
5163 pub expressions: Vec<Ordered>,
5164}
5165
5166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5169#[cfg_attr(feature = "bindings", derive(TS))]
5170#[cfg_attr(feature = "bindings", ts(export))]
5171pub struct SortBy {
5172 pub expressions: Vec<Ordered>,
5173}
5174
5175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5178#[cfg_attr(feature = "bindings", derive(TS))]
5179#[cfg_attr(feature = "bindings", ts(export))]
5180pub struct LateralView {
5181 pub this: Expression,
5183 pub table_alias: Option<Identifier>,
5185 pub column_aliases: Vec<Identifier>,
5187 pub outer: bool,
5189}
5190
5191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5193#[cfg_attr(feature = "bindings", derive(TS))]
5194#[cfg_attr(feature = "bindings", ts(export))]
5195pub struct Hint {
5196 pub expressions: Vec<HintExpression>,
5197}
5198
5199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5201#[cfg_attr(feature = "bindings", derive(TS))]
5202#[cfg_attr(feature = "bindings", ts(export))]
5203pub enum HintExpression {
5204 Function { name: String, args: Vec<Expression> },
5206 Identifier(String),
5208 Raw(String),
5210}
5211
5212#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5214#[cfg_attr(feature = "bindings", derive(TS))]
5215#[cfg_attr(feature = "bindings", ts(export))]
5216pub enum PseudocolumnType {
5217 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5224
5225impl PseudocolumnType {
5226 pub fn as_str(&self) -> &'static str {
5227 match self {
5228 PseudocolumnType::Rownum => "ROWNUM",
5229 PseudocolumnType::Rowid => "ROWID",
5230 PseudocolumnType::Level => "LEVEL",
5231 PseudocolumnType::Sysdate => "SYSDATE",
5232 PseudocolumnType::ObjectId => "OBJECT_ID",
5233 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5234 }
5235 }
5236
5237 pub fn from_str(s: &str) -> Option<Self> {
5238 match s.to_uppercase().as_str() {
5239 "ROWNUM" => Some(PseudocolumnType::Rownum),
5240 "ROWID" => Some(PseudocolumnType::Rowid),
5241 "LEVEL" => Some(PseudocolumnType::Level),
5242 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5243 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5244 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5245 _ => None,
5246 }
5247 }
5248}
5249
5250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5253#[cfg_attr(feature = "bindings", derive(TS))]
5254#[cfg_attr(feature = "bindings", ts(export))]
5255pub struct Pseudocolumn {
5256 pub kind: PseudocolumnType,
5257}
5258
5259impl Pseudocolumn {
5260 pub fn rownum() -> Self {
5261 Self {
5262 kind: PseudocolumnType::Rownum,
5263 }
5264 }
5265
5266 pub fn rowid() -> Self {
5267 Self {
5268 kind: PseudocolumnType::Rowid,
5269 }
5270 }
5271
5272 pub fn level() -> Self {
5273 Self {
5274 kind: PseudocolumnType::Level,
5275 }
5276 }
5277}
5278
5279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5281#[cfg_attr(feature = "bindings", derive(TS))]
5282#[cfg_attr(feature = "bindings", ts(export))]
5283pub struct Connect {
5284 pub start: Option<Expression>,
5286 pub connect: Expression,
5288 pub nocycle: bool,
5290}
5291
5292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5294#[cfg_attr(feature = "bindings", derive(TS))]
5295#[cfg_attr(feature = "bindings", ts(export))]
5296pub struct Prior {
5297 pub this: Expression,
5298}
5299
5300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5302#[cfg_attr(feature = "bindings", derive(TS))]
5303#[cfg_attr(feature = "bindings", ts(export))]
5304pub struct ConnectByRoot {
5305 pub this: Expression,
5306}
5307
5308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5310#[cfg_attr(feature = "bindings", derive(TS))]
5311#[cfg_attr(feature = "bindings", ts(export))]
5312pub struct MatchRecognize {
5313 pub this: Option<Box<Expression>>,
5315 pub partition_by: Option<Vec<Expression>>,
5317 pub order_by: Option<Vec<Ordered>>,
5319 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5321 pub rows: Option<MatchRecognizeRows>,
5323 pub after: Option<MatchRecognizeAfter>,
5325 pub pattern: Option<String>,
5327 pub define: Option<Vec<(Identifier, Expression)>>,
5329 pub alias: Option<Identifier>,
5331 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5333 pub alias_explicit_as: bool,
5334}
5335
5336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5338#[cfg_attr(feature = "bindings", derive(TS))]
5339#[cfg_attr(feature = "bindings", ts(export))]
5340pub struct MatchRecognizeMeasure {
5341 pub this: Expression,
5343 pub window_frame: Option<MatchRecognizeSemantics>,
5345}
5346
5347#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5349#[cfg_attr(feature = "bindings", derive(TS))]
5350#[cfg_attr(feature = "bindings", ts(export))]
5351pub enum MatchRecognizeSemantics {
5352 Running,
5353 Final,
5354}
5355
5356#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5358#[cfg_attr(feature = "bindings", derive(TS))]
5359#[cfg_attr(feature = "bindings", ts(export))]
5360pub enum MatchRecognizeRows {
5361 OneRowPerMatch,
5362 AllRowsPerMatch,
5363 AllRowsPerMatchShowEmptyMatches,
5364 AllRowsPerMatchOmitEmptyMatches,
5365 AllRowsPerMatchWithUnmatchedRows,
5366}
5367
5368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5370#[cfg_attr(feature = "bindings", derive(TS))]
5371#[cfg_attr(feature = "bindings", ts(export))]
5372pub enum MatchRecognizeAfter {
5373 PastLastRow,
5374 ToNextRow,
5375 ToFirst(Identifier),
5376 ToLast(Identifier),
5377}
5378
5379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5381#[cfg_attr(feature = "bindings", derive(TS))]
5382pub struct Limit {
5383 pub this: Expression,
5385 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5387 pub percent: bool,
5388 #[serde(default)]
5390 #[serde(skip_serializing_if = "Vec::is_empty")]
5391 pub comments: Vec<String>,
5392}
5393
5394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5396#[cfg_attr(feature = "bindings", derive(TS))]
5397pub struct Offset {
5398 pub this: Expression,
5399 #[serde(skip_serializing_if = "Option::is_none", default)]
5401 pub rows: Option<bool>,
5402}
5403
5404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5406#[cfg_attr(feature = "bindings", derive(TS))]
5407pub struct Top {
5408 pub this: Expression,
5409 pub percent: bool,
5410 pub with_ties: bool,
5411 #[serde(default)]
5413 pub parenthesized: bool,
5414}
5415
5416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5418#[cfg_attr(feature = "bindings", derive(TS))]
5419pub struct Fetch {
5420 pub direction: String,
5422 pub count: Option<Expression>,
5424 pub percent: bool,
5426 pub rows: bool,
5428 pub with_ties: bool,
5430}
5431
5432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5438#[cfg_attr(feature = "bindings", derive(TS))]
5439pub struct Qualify {
5440 pub this: Expression,
5442}
5443
5444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5446#[cfg_attr(feature = "bindings", derive(TS))]
5447pub struct Sample {
5448 pub method: SampleMethod,
5449 pub size: Expression,
5450 pub seed: Option<Expression>,
5451 #[serde(default)]
5453 pub offset: Option<Expression>,
5454 pub unit_after_size: bool,
5456 #[serde(default)]
5458 pub use_sample_keyword: bool,
5459 #[serde(default)]
5461 pub explicit_method: bool,
5462 #[serde(default)]
5464 pub method_before_size: bool,
5465 #[serde(default)]
5467 pub use_seed_keyword: bool,
5468 pub bucket_numerator: Option<Box<Expression>>,
5470 pub bucket_denominator: Option<Box<Expression>>,
5472 pub bucket_field: Option<Box<Expression>>,
5474 #[serde(default)]
5476 pub is_using_sample: bool,
5477 #[serde(default)]
5479 pub is_percent: bool,
5480 #[serde(default)]
5482 pub suppress_method_output: bool,
5483}
5484
5485#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5487#[cfg_attr(feature = "bindings", derive(TS))]
5488pub enum SampleMethod {
5489 Bernoulli,
5490 System,
5491 Block,
5492 Row,
5493 Percent,
5494 Bucket,
5496 Reservoir,
5498}
5499
5500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5502#[cfg_attr(feature = "bindings", derive(TS))]
5503pub struct NamedWindow {
5504 pub name: Identifier,
5505 pub spec: Over,
5506}
5507
5508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5514#[cfg_attr(feature = "bindings", derive(TS))]
5515pub struct With {
5516 pub ctes: Vec<Cte>,
5518 pub recursive: bool,
5520 #[serde(default)]
5522 pub leading_comments: Vec<String>,
5523 #[serde(default, skip_serializing_if = "Option::is_none")]
5525 pub search: Option<Box<Expression>>,
5526}
5527
5528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5535#[cfg_attr(feature = "bindings", derive(TS))]
5536pub struct Cte {
5537 pub alias: Identifier,
5539 pub this: Expression,
5541 pub columns: Vec<Identifier>,
5543 pub materialized: Option<bool>,
5545 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5547 pub key_expressions: Vec<Identifier>,
5548 #[serde(default)]
5550 pub alias_first: bool,
5551 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5553 pub comments: Vec<String>,
5554}
5555
5556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5558#[cfg_attr(feature = "bindings", derive(TS))]
5559pub struct WindowSpec {
5560 pub partition_by: Vec<Expression>,
5561 pub order_by: Vec<Ordered>,
5562 pub frame: Option<WindowFrame>,
5563}
5564
5565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5567#[cfg_attr(feature = "bindings", derive(TS))]
5568pub struct Over {
5569 pub window_name: Option<Identifier>,
5571 pub partition_by: Vec<Expression>,
5572 pub order_by: Vec<Ordered>,
5573 pub frame: Option<WindowFrame>,
5574 pub alias: Option<Identifier>,
5575}
5576
5577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5579#[cfg_attr(feature = "bindings", derive(TS))]
5580pub struct WindowFrame {
5581 pub kind: WindowFrameKind,
5582 pub start: WindowFrameBound,
5583 pub end: Option<WindowFrameBound>,
5584 pub exclude: Option<WindowFrameExclude>,
5585 #[serde(default, skip_serializing_if = "Option::is_none")]
5587 pub kind_text: Option<String>,
5588 #[serde(default, skip_serializing_if = "Option::is_none")]
5590 pub start_side_text: Option<String>,
5591 #[serde(default, skip_serializing_if = "Option::is_none")]
5593 pub end_side_text: Option<String>,
5594}
5595
5596#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5597#[cfg_attr(feature = "bindings", derive(TS))]
5598pub enum WindowFrameKind {
5599 Rows,
5600 Range,
5601 Groups,
5602}
5603
5604#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5606#[cfg_attr(feature = "bindings", derive(TS))]
5607pub enum WindowFrameExclude {
5608 CurrentRow,
5609 Group,
5610 Ties,
5611 NoOthers,
5612}
5613
5614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5615#[cfg_attr(feature = "bindings", derive(TS))]
5616pub enum WindowFrameBound {
5617 CurrentRow,
5618 UnboundedPreceding,
5619 UnboundedFollowing,
5620 Preceding(Box<Expression>),
5621 Following(Box<Expression>),
5622 BarePreceding,
5624 BareFollowing,
5626 Value(Box<Expression>),
5628}
5629
5630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5632#[cfg_attr(feature = "bindings", derive(TS))]
5633pub struct StructField {
5634 pub name: String,
5635 pub data_type: DataType,
5636 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5637 pub options: Vec<Expression>,
5638 #[serde(default, skip_serializing_if = "Option::is_none")]
5639 pub comment: Option<String>,
5640}
5641
5642impl StructField {
5643 pub fn new(name: String, data_type: DataType) -> Self {
5645 Self {
5646 name,
5647 data_type,
5648 options: Vec::new(),
5649 comment: None,
5650 }
5651 }
5652
5653 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5655 Self {
5656 name,
5657 data_type,
5658 options,
5659 comment: None,
5660 }
5661 }
5662
5663 pub fn with_options_and_comment(
5665 name: String,
5666 data_type: DataType,
5667 options: Vec<Expression>,
5668 comment: Option<String>,
5669 ) -> Self {
5670 Self {
5671 name,
5672 data_type,
5673 options,
5674 comment,
5675 }
5676 }
5677}
5678
5679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5691#[cfg_attr(feature = "bindings", derive(TS))]
5692#[serde(tag = "data_type", rename_all = "snake_case")]
5693pub enum DataType {
5694 Boolean,
5696 TinyInt {
5697 length: Option<u32>,
5698 },
5699 SmallInt {
5700 length: Option<u32>,
5701 },
5702 Int {
5706 length: Option<u32>,
5707 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5708 integer_spelling: bool,
5709 },
5710 BigInt {
5711 length: Option<u32>,
5712 },
5713 Float {
5717 precision: Option<u32>,
5718 scale: Option<u32>,
5719 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5720 real_spelling: bool,
5721 },
5722 Double {
5723 precision: Option<u32>,
5724 scale: Option<u32>,
5725 },
5726 Decimal {
5727 precision: Option<u32>,
5728 scale: Option<u32>,
5729 },
5730
5731 Char {
5733 length: Option<u32>,
5734 },
5735 VarChar {
5738 length: Option<u32>,
5739 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5740 parenthesized_length: bool,
5741 },
5742 String {
5744 length: Option<u32>,
5745 },
5746 Text,
5747 TextWithLength {
5749 length: u32,
5750 },
5751
5752 Binary {
5754 length: Option<u32>,
5755 },
5756 VarBinary {
5757 length: Option<u32>,
5758 },
5759 Blob,
5760
5761 Bit {
5763 length: Option<u32>,
5764 },
5765 VarBit {
5766 length: Option<u32>,
5767 },
5768
5769 Date,
5771 Time {
5772 precision: Option<u32>,
5773 #[serde(default)]
5774 timezone: bool,
5775 },
5776 Timestamp {
5777 precision: Option<u32>,
5778 timezone: bool,
5779 },
5780 Interval {
5781 unit: Option<String>,
5782 #[serde(default, skip_serializing_if = "Option::is_none")]
5784 to: Option<String>,
5785 },
5786
5787 Json,
5789 JsonB,
5790
5791 Uuid,
5793
5794 Array {
5796 element_type: Box<DataType>,
5797 #[serde(default, skip_serializing_if = "Option::is_none")]
5799 dimension: Option<u32>,
5800 },
5801
5802 List {
5805 element_type: Box<DataType>,
5806 },
5807
5808 Struct {
5812 fields: Vec<StructField>,
5813 nested: bool,
5814 },
5815 Map {
5816 key_type: Box<DataType>,
5817 value_type: Box<DataType>,
5818 },
5819
5820 Enum {
5822 values: Vec<String>,
5823 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5824 assignments: Vec<Option<String>>,
5825 },
5826
5827 Set {
5829 values: Vec<String>,
5830 },
5831
5832 Union {
5834 fields: Vec<(String, DataType)>,
5835 },
5836
5837 Vector {
5839 #[serde(default)]
5840 element_type: Option<Box<DataType>>,
5841 dimension: Option<u32>,
5842 },
5843
5844 Object {
5847 fields: Vec<(String, DataType, bool)>,
5848 modifier: Option<String>,
5849 },
5850
5851 Nullable {
5853 inner: Box<DataType>,
5854 },
5855
5856 Custom {
5858 name: String,
5859 },
5860
5861 Geometry {
5863 subtype: Option<String>,
5864 srid: Option<u32>,
5865 },
5866 Geography {
5867 subtype: Option<String>,
5868 srid: Option<u32>,
5869 },
5870
5871 CharacterSet {
5874 name: String,
5875 },
5876
5877 Unknown,
5879}
5880
5881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5883#[cfg_attr(feature = "bindings", derive(TS))]
5884#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5885pub struct Array {
5886 pub expressions: Vec<Expression>,
5887}
5888
5889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5891#[cfg_attr(feature = "bindings", derive(TS))]
5892pub struct Struct {
5893 pub fields: Vec<(Option<String>, Expression)>,
5894}
5895
5896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5898#[cfg_attr(feature = "bindings", derive(TS))]
5899pub struct Tuple {
5900 pub expressions: Vec<Expression>,
5901}
5902
5903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5905#[cfg_attr(feature = "bindings", derive(TS))]
5906pub struct Interval {
5907 pub this: Option<Expression>,
5909 pub unit: Option<IntervalUnitSpec>,
5911}
5912
5913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5915#[cfg_attr(feature = "bindings", derive(TS))]
5916#[serde(tag = "type", rename_all = "snake_case")]
5917pub enum IntervalUnitSpec {
5918 Simple {
5920 unit: IntervalUnit,
5921 use_plural: bool,
5923 },
5924 Span(IntervalSpan),
5926 ExprSpan(IntervalSpanExpr),
5929 Expr(Box<Expression>),
5931}
5932
5933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5935#[cfg_attr(feature = "bindings", derive(TS))]
5936pub struct IntervalSpan {
5937 pub this: IntervalUnit,
5939 pub expression: IntervalUnit,
5941}
5942
5943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5946#[cfg_attr(feature = "bindings", derive(TS))]
5947pub struct IntervalSpanExpr {
5948 pub this: Box<Expression>,
5950 pub expression: Box<Expression>,
5952}
5953
5954#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5955#[cfg_attr(feature = "bindings", derive(TS))]
5956pub enum IntervalUnit {
5957 Year,
5958 Quarter,
5959 Month,
5960 Week,
5961 Day,
5962 Hour,
5963 Minute,
5964 Second,
5965 Millisecond,
5966 Microsecond,
5967 Nanosecond,
5968}
5969
5970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5972#[cfg_attr(feature = "bindings", derive(TS))]
5973pub struct Command {
5974 pub this: String,
5976}
5977
5978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5981#[cfg_attr(feature = "bindings", derive(TS))]
5982pub struct ExecuteStatement {
5983 pub this: Expression,
5985 #[serde(default)]
5987 pub parameters: Vec<ExecuteParameter>,
5988 #[serde(default, skip_serializing_if = "Option::is_none")]
5990 pub suffix: Option<String>,
5991}
5992
5993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5995#[cfg_attr(feature = "bindings", derive(TS))]
5996pub struct ExecuteParameter {
5997 pub name: String,
5999 pub value: Expression,
6001 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6003 pub positional: bool,
6004 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6006 pub output: bool,
6007}
6008
6009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6012#[cfg_attr(feature = "bindings", derive(TS))]
6013pub struct Kill {
6014 pub this: Expression,
6016 pub kind: Option<String>,
6018}
6019
6020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6022#[cfg_attr(feature = "bindings", derive(TS))]
6023pub struct CreateTask {
6024 pub or_replace: bool,
6025 pub if_not_exists: bool,
6026 pub name: String,
6028 pub properties: String,
6030 pub body: Expression,
6032}
6033
6034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6036#[cfg_attr(feature = "bindings", derive(TS))]
6037pub struct Raw {
6038 pub sql: String,
6039}
6040
6041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6047#[cfg_attr(feature = "bindings", derive(TS))]
6048pub struct UnaryFunc {
6049 pub this: Expression,
6050 #[serde(skip_serializing_if = "Option::is_none", default)]
6052 pub original_name: Option<String>,
6053 #[serde(default, skip_serializing_if = "Option::is_none")]
6055 pub inferred_type: Option<DataType>,
6056}
6057
6058impl UnaryFunc {
6059 pub fn new(this: Expression) -> Self {
6061 Self {
6062 this,
6063 original_name: None,
6064 inferred_type: None,
6065 }
6066 }
6067
6068 pub fn with_name(this: Expression, name: String) -> Self {
6070 Self {
6071 this,
6072 original_name: Some(name),
6073 inferred_type: None,
6074 }
6075 }
6076}
6077
6078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6082#[cfg_attr(feature = "bindings", derive(TS))]
6083pub struct CharFunc {
6084 pub args: Vec<Expression>,
6085 #[serde(skip_serializing_if = "Option::is_none", default)]
6086 pub charset: Option<String>,
6087 #[serde(skip_serializing_if = "Option::is_none", default)]
6089 pub name: Option<String>,
6090}
6091
6092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6094#[cfg_attr(feature = "bindings", derive(TS))]
6095pub struct BinaryFunc {
6096 pub this: Expression,
6097 pub expression: Expression,
6098 #[serde(skip_serializing_if = "Option::is_none", default)]
6100 pub original_name: Option<String>,
6101 #[serde(default, skip_serializing_if = "Option::is_none")]
6103 pub inferred_type: Option<DataType>,
6104}
6105
6106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6108#[cfg_attr(feature = "bindings", derive(TS))]
6109pub struct VarArgFunc {
6110 pub expressions: Vec<Expression>,
6111 #[serde(skip_serializing_if = "Option::is_none", default)]
6113 pub original_name: Option<String>,
6114 #[serde(default, skip_serializing_if = "Option::is_none")]
6116 pub inferred_type: Option<DataType>,
6117}
6118
6119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6121#[cfg_attr(feature = "bindings", derive(TS))]
6122pub struct ConcatWs {
6123 pub separator: Expression,
6124 pub expressions: Vec<Expression>,
6125}
6126
6127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6129#[cfg_attr(feature = "bindings", derive(TS))]
6130pub struct SubstringFunc {
6131 pub this: Expression,
6132 pub start: Expression,
6133 pub length: Option<Expression>,
6134 #[serde(default)]
6136 pub from_for_syntax: bool,
6137}
6138
6139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6141#[cfg_attr(feature = "bindings", derive(TS))]
6142pub struct OverlayFunc {
6143 pub this: Expression,
6144 pub replacement: Expression,
6145 pub from: Expression,
6146 pub length: Option<Expression>,
6147}
6148
6149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6151#[cfg_attr(feature = "bindings", derive(TS))]
6152pub struct TrimFunc {
6153 pub this: Expression,
6154 pub characters: Option<Expression>,
6155 pub position: TrimPosition,
6156 #[serde(default)]
6158 pub sql_standard_syntax: bool,
6159 #[serde(default)]
6161 pub position_explicit: bool,
6162}
6163
6164#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6165#[cfg_attr(feature = "bindings", derive(TS))]
6166pub enum TrimPosition {
6167 Both,
6168 Leading,
6169 Trailing,
6170}
6171
6172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6174#[cfg_attr(feature = "bindings", derive(TS))]
6175pub struct ReplaceFunc {
6176 pub this: Expression,
6177 pub old: Expression,
6178 pub new: Expression,
6179}
6180
6181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6183#[cfg_attr(feature = "bindings", derive(TS))]
6184pub struct LeftRightFunc {
6185 pub this: Expression,
6186 pub length: Expression,
6187}
6188
6189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6191#[cfg_attr(feature = "bindings", derive(TS))]
6192pub struct RepeatFunc {
6193 pub this: Expression,
6194 pub times: Expression,
6195}
6196
6197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6199#[cfg_attr(feature = "bindings", derive(TS))]
6200pub struct PadFunc {
6201 pub this: Expression,
6202 pub length: Expression,
6203 pub fill: Option<Expression>,
6204}
6205
6206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6208#[cfg_attr(feature = "bindings", derive(TS))]
6209pub struct SplitFunc {
6210 pub this: Expression,
6211 pub delimiter: Expression,
6212}
6213
6214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6216#[cfg_attr(feature = "bindings", derive(TS))]
6217pub struct RegexpFunc {
6218 pub this: Expression,
6219 pub pattern: Expression,
6220 pub flags: Option<Expression>,
6221}
6222
6223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6225#[cfg_attr(feature = "bindings", derive(TS))]
6226pub struct RegexpReplaceFunc {
6227 pub this: Expression,
6228 pub pattern: Expression,
6229 pub replacement: Expression,
6230 pub flags: Option<Expression>,
6231}
6232
6233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6235#[cfg_attr(feature = "bindings", derive(TS))]
6236pub struct RegexpExtractFunc {
6237 pub this: Expression,
6238 pub pattern: Expression,
6239 pub group: Option<Expression>,
6240}
6241
6242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6244#[cfg_attr(feature = "bindings", derive(TS))]
6245pub struct RoundFunc {
6246 pub this: Expression,
6247 pub decimals: Option<Expression>,
6248}
6249
6250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6252#[cfg_attr(feature = "bindings", derive(TS))]
6253pub struct FloorFunc {
6254 pub this: Expression,
6255 pub scale: Option<Expression>,
6256 #[serde(skip_serializing_if = "Option::is_none", default)]
6258 pub to: Option<Expression>,
6259}
6260
6261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6263#[cfg_attr(feature = "bindings", derive(TS))]
6264pub struct CeilFunc {
6265 pub this: Expression,
6266 #[serde(skip_serializing_if = "Option::is_none", default)]
6267 pub decimals: 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 LogFunc {
6277 pub this: Expression,
6278 pub base: Option<Expression>,
6279}
6280
6281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6283#[cfg_attr(feature = "bindings", derive(TS))]
6284pub struct CurrentDate;
6285
6286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6288#[cfg_attr(feature = "bindings", derive(TS))]
6289pub struct CurrentTime {
6290 pub precision: Option<u32>,
6291}
6292
6293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6295#[cfg_attr(feature = "bindings", derive(TS))]
6296pub struct CurrentTimestamp {
6297 pub precision: Option<u32>,
6298 #[serde(default)]
6300 pub sysdate: bool,
6301}
6302
6303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6305#[cfg_attr(feature = "bindings", derive(TS))]
6306pub struct CurrentTimestampLTZ {
6307 pub precision: Option<u32>,
6308}
6309
6310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6312#[cfg_attr(feature = "bindings", derive(TS))]
6313pub struct AtTimeZone {
6314 pub this: Expression,
6316 pub zone: Expression,
6318}
6319
6320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6322#[cfg_attr(feature = "bindings", derive(TS))]
6323pub struct DateAddFunc {
6324 pub this: Expression,
6325 pub interval: Expression,
6326 pub unit: IntervalUnit,
6327}
6328
6329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6331#[cfg_attr(feature = "bindings", derive(TS))]
6332pub struct DateDiffFunc {
6333 pub this: Expression,
6334 pub expression: Expression,
6335 pub unit: Option<IntervalUnit>,
6336}
6337
6338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6340#[cfg_attr(feature = "bindings", derive(TS))]
6341pub struct DateTruncFunc {
6342 pub this: Expression,
6343 pub unit: DateTimeField,
6344}
6345
6346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6348#[cfg_attr(feature = "bindings", derive(TS))]
6349pub struct ExtractFunc {
6350 pub this: Expression,
6351 pub field: DateTimeField,
6352}
6353
6354#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6355#[cfg_attr(feature = "bindings", derive(TS))]
6356pub enum DateTimeField {
6357 Year,
6358 Month,
6359 Day,
6360 Hour,
6361 Minute,
6362 Second,
6363 Millisecond,
6364 Microsecond,
6365 DayOfWeek,
6366 DayOfYear,
6367 Week,
6368 WeekWithModifier(String),
6370 Quarter,
6371 Epoch,
6372 Timezone,
6373 TimezoneHour,
6374 TimezoneMinute,
6375 Date,
6376 Time,
6377 Custom(String),
6379}
6380
6381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6383#[cfg_attr(feature = "bindings", derive(TS))]
6384pub struct ToDateFunc {
6385 pub this: Expression,
6386 pub format: Option<Expression>,
6387}
6388
6389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6391#[cfg_attr(feature = "bindings", derive(TS))]
6392pub struct ToTimestampFunc {
6393 pub this: Expression,
6394 pub format: Option<Expression>,
6395}
6396
6397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6399#[cfg_attr(feature = "bindings", derive(TS))]
6400pub struct IfFunc {
6401 pub condition: Expression,
6402 pub true_value: Expression,
6403 pub false_value: Option<Expression>,
6404 #[serde(skip_serializing_if = "Option::is_none", default)]
6406 pub original_name: Option<String>,
6407 #[serde(default, skip_serializing_if = "Option::is_none")]
6409 pub inferred_type: Option<DataType>,
6410}
6411
6412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6414#[cfg_attr(feature = "bindings", derive(TS))]
6415pub struct Nvl2Func {
6416 pub this: Expression,
6417 pub true_value: Expression,
6418 pub false_value: Expression,
6419 #[serde(default, skip_serializing_if = "Option::is_none")]
6421 pub inferred_type: Option<DataType>,
6422}
6423
6424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6430#[cfg_attr(feature = "bindings", derive(TS))]
6431pub struct AggFunc {
6432 pub this: Expression,
6433 pub distinct: bool,
6434 pub filter: Option<Expression>,
6435 pub order_by: Vec<Ordered>,
6436 #[serde(skip_serializing_if = "Option::is_none", default)]
6438 pub name: Option<String>,
6439 #[serde(skip_serializing_if = "Option::is_none", default)]
6441 pub ignore_nulls: Option<bool>,
6442 #[serde(skip_serializing_if = "Option::is_none", default)]
6445 pub having_max: Option<(Box<Expression>, bool)>,
6446 #[serde(skip_serializing_if = "Option::is_none", default)]
6448 pub limit: Option<Box<Expression>>,
6449 #[serde(default, skip_serializing_if = "Option::is_none")]
6451 pub inferred_type: Option<DataType>,
6452}
6453
6454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6456#[cfg_attr(feature = "bindings", derive(TS))]
6457pub struct CountFunc {
6458 pub this: Option<Expression>,
6459 pub star: bool,
6460 pub distinct: bool,
6461 pub filter: Option<Expression>,
6462 #[serde(default, skip_serializing_if = "Option::is_none")]
6464 pub ignore_nulls: Option<bool>,
6465 #[serde(default, skip_serializing_if = "Option::is_none")]
6467 pub original_name: Option<String>,
6468 #[serde(default, skip_serializing_if = "Option::is_none")]
6470 pub inferred_type: Option<DataType>,
6471}
6472
6473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6475#[cfg_attr(feature = "bindings", derive(TS))]
6476pub struct GroupConcatFunc {
6477 pub this: Expression,
6478 pub separator: Option<Expression>,
6479 pub order_by: Option<Vec<Ordered>>,
6480 pub distinct: bool,
6481 pub filter: Option<Expression>,
6482 #[serde(default, skip_serializing_if = "Option::is_none")]
6484 pub inferred_type: Option<DataType>,
6485}
6486
6487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6489#[cfg_attr(feature = "bindings", derive(TS))]
6490pub struct StringAggFunc {
6491 pub this: Expression,
6492 #[serde(default)]
6493 pub separator: Option<Expression>,
6494 #[serde(default)]
6495 pub order_by: Option<Vec<Ordered>>,
6496 #[serde(default)]
6497 pub distinct: bool,
6498 #[serde(default)]
6499 pub filter: Option<Expression>,
6500 #[serde(default, skip_serializing_if = "Option::is_none")]
6502 pub limit: Option<Box<Expression>>,
6503 #[serde(default, skip_serializing_if = "Option::is_none")]
6505 pub inferred_type: Option<DataType>,
6506}
6507
6508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6510#[cfg_attr(feature = "bindings", derive(TS))]
6511pub struct ListAggFunc {
6512 pub this: Expression,
6513 pub separator: Option<Expression>,
6514 pub on_overflow: Option<ListAggOverflow>,
6515 pub order_by: Option<Vec<Ordered>>,
6516 pub distinct: bool,
6517 pub filter: Option<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 enum ListAggOverflow {
6527 Error,
6528 Truncate {
6529 filler: Option<Expression>,
6530 with_count: bool,
6531 },
6532}
6533
6534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6536#[cfg_attr(feature = "bindings", derive(TS))]
6537pub struct SumIfFunc {
6538 pub this: Expression,
6539 pub condition: Expression,
6540 pub filter: Option<Expression>,
6541 #[serde(default, skip_serializing_if = "Option::is_none")]
6543 pub inferred_type: Option<DataType>,
6544}
6545
6546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6548#[cfg_attr(feature = "bindings", derive(TS))]
6549pub struct ApproxPercentileFunc {
6550 pub this: Expression,
6551 pub percentile: Expression,
6552 pub accuracy: Option<Expression>,
6553 pub filter: Option<Expression>,
6554}
6555
6556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6558#[cfg_attr(feature = "bindings", derive(TS))]
6559pub struct PercentileFunc {
6560 pub this: Expression,
6561 pub percentile: Expression,
6562 pub order_by: Option<Vec<Ordered>>,
6563 pub filter: Option<Expression>,
6564}
6565
6566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6572#[cfg_attr(feature = "bindings", derive(TS))]
6573pub struct RowNumber;
6574
6575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6577#[cfg_attr(feature = "bindings", derive(TS))]
6578pub struct Rank {
6579 #[serde(default, skip_serializing_if = "Option::is_none")]
6581 pub order_by: Option<Vec<Ordered>>,
6582 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6584 pub args: Vec<Expression>,
6585}
6586
6587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6589#[cfg_attr(feature = "bindings", derive(TS))]
6590pub struct DenseRank {
6591 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6593 pub args: Vec<Expression>,
6594}
6595
6596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6598#[cfg_attr(feature = "bindings", derive(TS))]
6599pub struct NTileFunc {
6600 #[serde(default, skip_serializing_if = "Option::is_none")]
6602 pub num_buckets: Option<Expression>,
6603 #[serde(default, skip_serializing_if = "Option::is_none")]
6605 pub order_by: Option<Vec<Ordered>>,
6606}
6607
6608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6610#[cfg_attr(feature = "bindings", derive(TS))]
6611pub struct LeadLagFunc {
6612 pub this: Expression,
6613 pub offset: Option<Expression>,
6614 pub default: Option<Expression>,
6615 #[serde(default, skip_serializing_if = "Option::is_none")]
6617 pub ignore_nulls: Option<bool>,
6618}
6619
6620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6622#[cfg_attr(feature = "bindings", derive(TS))]
6623pub struct ValueFunc {
6624 pub this: Expression,
6625 #[serde(default, skip_serializing_if = "Option::is_none")]
6627 pub ignore_nulls: Option<bool>,
6628 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6630 pub order_by: Vec<Ordered>,
6631}
6632
6633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6635#[cfg_attr(feature = "bindings", derive(TS))]
6636pub struct NthValueFunc {
6637 pub this: Expression,
6638 pub offset: Expression,
6639 #[serde(default, skip_serializing_if = "Option::is_none")]
6641 pub ignore_nulls: Option<bool>,
6642 #[serde(default, skip_serializing_if = "Option::is_none")]
6645 pub from_first: Option<bool>,
6646}
6647
6648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6650#[cfg_attr(feature = "bindings", derive(TS))]
6651pub struct PercentRank {
6652 #[serde(default, skip_serializing_if = "Option::is_none")]
6654 pub order_by: Option<Vec<Ordered>>,
6655 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6657 pub args: Vec<Expression>,
6658}
6659
6660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6662#[cfg_attr(feature = "bindings", derive(TS))]
6663pub struct CumeDist {
6664 #[serde(default, skip_serializing_if = "Option::is_none")]
6666 pub order_by: Option<Vec<Ordered>>,
6667 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6669 pub args: Vec<Expression>,
6670}
6671
6672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6678#[cfg_attr(feature = "bindings", derive(TS))]
6679pub struct PositionFunc {
6680 pub substring: Expression,
6681 pub string: Expression,
6682 pub start: Option<Expression>,
6683}
6684
6685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6691#[cfg_attr(feature = "bindings", derive(TS))]
6692pub struct Random;
6693
6694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6696#[cfg_attr(feature = "bindings", derive(TS))]
6697pub struct Rand {
6698 pub seed: Option<Box<Expression>>,
6699 #[serde(default)]
6701 pub lower: Option<Box<Expression>>,
6702 #[serde(default)]
6704 pub upper: Option<Box<Expression>>,
6705}
6706
6707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6709#[cfg_attr(feature = "bindings", derive(TS))]
6710pub struct TruncateFunc {
6711 pub this: Expression,
6712 pub decimals: Option<Expression>,
6713}
6714
6715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6717#[cfg_attr(feature = "bindings", derive(TS))]
6718pub struct Pi;
6719
6720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6726#[cfg_attr(feature = "bindings", derive(TS))]
6727pub struct DecodeFunc {
6728 pub this: Expression,
6729 pub search_results: Vec<(Expression, Expression)>,
6730 pub default: Option<Expression>,
6731}
6732
6733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6739#[cfg_attr(feature = "bindings", derive(TS))]
6740pub struct DateFormatFunc {
6741 pub this: Expression,
6742 pub format: Expression,
6743}
6744
6745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6747#[cfg_attr(feature = "bindings", derive(TS))]
6748pub struct FromUnixtimeFunc {
6749 pub this: Expression,
6750 pub format: Option<Expression>,
6751}
6752
6753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6755#[cfg_attr(feature = "bindings", derive(TS))]
6756pub struct UnixTimestampFunc {
6757 pub this: Option<Expression>,
6758 pub format: Option<Expression>,
6759}
6760
6761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6763#[cfg_attr(feature = "bindings", derive(TS))]
6764pub struct MakeDateFunc {
6765 pub year: Expression,
6766 pub month: Expression,
6767 pub day: Expression,
6768}
6769
6770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6772#[cfg_attr(feature = "bindings", derive(TS))]
6773pub struct MakeTimestampFunc {
6774 pub year: Expression,
6775 pub month: Expression,
6776 pub day: Expression,
6777 pub hour: Expression,
6778 pub minute: Expression,
6779 pub second: Expression,
6780 pub timezone: Option<Expression>,
6781}
6782
6783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6785#[cfg_attr(feature = "bindings", derive(TS))]
6786pub struct LastDayFunc {
6787 pub this: Expression,
6788 #[serde(skip_serializing_if = "Option::is_none", default)]
6790 pub unit: Option<DateTimeField>,
6791}
6792
6793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6799#[cfg_attr(feature = "bindings", derive(TS))]
6800pub struct ArrayConstructor {
6801 pub expressions: Vec<Expression>,
6802 pub bracket_notation: bool,
6803 pub use_list_keyword: bool,
6805}
6806
6807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6809#[cfg_attr(feature = "bindings", derive(TS))]
6810pub struct ArraySortFunc {
6811 pub this: Expression,
6812 pub comparator: Option<Expression>,
6813 pub desc: bool,
6814 pub nulls_first: Option<bool>,
6815}
6816
6817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6819#[cfg_attr(feature = "bindings", derive(TS))]
6820pub struct ArrayJoinFunc {
6821 pub this: Expression,
6822 pub separator: Expression,
6823 pub null_replacement: Option<Expression>,
6824}
6825
6826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6828#[cfg_attr(feature = "bindings", derive(TS))]
6829pub struct UnnestFunc {
6830 pub this: Expression,
6831 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6833 pub expressions: Vec<Expression>,
6834 pub with_ordinality: bool,
6835 pub alias: Option<Identifier>,
6836 #[serde(default, skip_serializing_if = "Option::is_none")]
6838 pub offset_alias: Option<Identifier>,
6839}
6840
6841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6843#[cfg_attr(feature = "bindings", derive(TS))]
6844pub struct ArrayFilterFunc {
6845 pub this: Expression,
6846 pub filter: Expression,
6847}
6848
6849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6851#[cfg_attr(feature = "bindings", derive(TS))]
6852pub struct ArrayTransformFunc {
6853 pub this: Expression,
6854 pub transform: Expression,
6855}
6856
6857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6859#[cfg_attr(feature = "bindings", derive(TS))]
6860pub struct SequenceFunc {
6861 pub start: Expression,
6862 pub stop: Expression,
6863 pub step: Option<Expression>,
6864}
6865
6866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6872#[cfg_attr(feature = "bindings", derive(TS))]
6873pub struct StructConstructor {
6874 pub fields: Vec<(Option<Identifier>, Expression)>,
6875}
6876
6877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6879#[cfg_attr(feature = "bindings", derive(TS))]
6880pub struct StructExtractFunc {
6881 pub this: Expression,
6882 pub field: Identifier,
6883}
6884
6885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6887#[cfg_attr(feature = "bindings", derive(TS))]
6888pub struct NamedStructFunc {
6889 pub pairs: Vec<(Expression, Expression)>,
6890}
6891
6892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6898#[cfg_attr(feature = "bindings", derive(TS))]
6899pub struct MapConstructor {
6900 pub keys: Vec<Expression>,
6901 pub values: Vec<Expression>,
6902 #[serde(default)]
6904 pub curly_brace_syntax: bool,
6905 #[serde(default)]
6907 pub with_map_keyword: bool,
6908}
6909
6910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6912#[cfg_attr(feature = "bindings", derive(TS))]
6913pub struct TransformFunc {
6914 pub this: Expression,
6915 pub transform: Expression,
6916}
6917
6918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6921#[cfg_attr(feature = "bindings", derive(TS))]
6922pub struct FunctionEmits {
6923 pub this: Expression,
6925 pub emits: Expression,
6927}
6928
6929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6935#[cfg_attr(feature = "bindings", derive(TS))]
6936pub struct JsonExtractFunc {
6937 pub this: Expression,
6938 pub path: Expression,
6939 pub returning: Option<DataType>,
6940 #[serde(default)]
6942 pub arrow_syntax: bool,
6943 #[serde(default)]
6945 pub hash_arrow_syntax: bool,
6946 #[serde(default)]
6948 pub wrapper_option: Option<String>,
6949 #[serde(default)]
6951 pub quotes_option: Option<String>,
6952 #[serde(default)]
6954 pub on_scalar_string: bool,
6955 #[serde(default)]
6957 pub on_error: Option<String>,
6958}
6959
6960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6962#[cfg_attr(feature = "bindings", derive(TS))]
6963pub struct JsonPathFunc {
6964 pub this: Expression,
6965 pub paths: Vec<Expression>,
6966}
6967
6968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6970#[cfg_attr(feature = "bindings", derive(TS))]
6971pub struct JsonObjectFunc {
6972 pub pairs: Vec<(Expression, Expression)>,
6973 pub null_handling: Option<JsonNullHandling>,
6974 #[serde(default)]
6975 pub with_unique_keys: bool,
6976 #[serde(default)]
6977 pub returning_type: Option<DataType>,
6978 #[serde(default)]
6979 pub format_json: bool,
6980 #[serde(default)]
6981 pub encoding: Option<String>,
6982 #[serde(default)]
6984 pub star: bool,
6985}
6986
6987#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6989#[cfg_attr(feature = "bindings", derive(TS))]
6990pub enum JsonNullHandling {
6991 NullOnNull,
6992 AbsentOnNull,
6993}
6994
6995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6997#[cfg_attr(feature = "bindings", derive(TS))]
6998pub struct JsonModifyFunc {
6999 pub this: Expression,
7000 pub path_values: Vec<(Expression, Expression)>,
7001}
7002
7003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7005#[cfg_attr(feature = "bindings", derive(TS))]
7006pub struct JsonArrayAggFunc {
7007 pub this: Expression,
7008 pub order_by: Option<Vec<Ordered>>,
7009 pub null_handling: Option<JsonNullHandling>,
7010 pub filter: Option<Expression>,
7011}
7012
7013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7015#[cfg_attr(feature = "bindings", derive(TS))]
7016pub struct JsonObjectAggFunc {
7017 pub key: Expression,
7018 pub value: Expression,
7019 pub null_handling: Option<JsonNullHandling>,
7020 pub filter: Option<Expression>,
7021}
7022
7023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7029#[cfg_attr(feature = "bindings", derive(TS))]
7030pub struct ConvertFunc {
7031 pub this: Expression,
7032 pub to: DataType,
7033 pub style: Option<Expression>,
7034}
7035
7036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7042#[cfg_attr(feature = "bindings", derive(TS))]
7043pub struct LambdaExpr {
7044 pub parameters: Vec<Identifier>,
7045 pub body: Expression,
7046 #[serde(default)]
7048 pub colon: bool,
7049 #[serde(default)]
7052 pub parameter_types: Vec<Option<DataType>>,
7053}
7054
7055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7057#[cfg_attr(feature = "bindings", derive(TS))]
7058pub struct Parameter {
7059 pub name: Option<String>,
7060 pub index: Option<u32>,
7061 pub style: ParameterStyle,
7062 #[serde(default)]
7064 pub quoted: bool,
7065 #[serde(default)]
7067 pub string_quoted: bool,
7068 #[serde(default)]
7070 pub expression: Option<String>,
7071}
7072
7073#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7075#[cfg_attr(feature = "bindings", derive(TS))]
7076pub enum ParameterStyle {
7077 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7087
7088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7090#[cfg_attr(feature = "bindings", derive(TS))]
7091pub struct Placeholder {
7092 pub index: Option<u32>,
7093}
7094
7095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7097#[cfg_attr(feature = "bindings", derive(TS))]
7098pub struct NamedArgument {
7099 pub name: Identifier,
7100 pub value: Expression,
7101 pub separator: NamedArgSeparator,
7103}
7104
7105#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7107#[cfg_attr(feature = "bindings", derive(TS))]
7108pub enum NamedArgSeparator {
7109 DArrow,
7111 ColonEq,
7113 Eq,
7115}
7116
7117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7120#[cfg_attr(feature = "bindings", derive(TS))]
7121pub struct TableArgument {
7122 pub prefix: String,
7124 pub this: Expression,
7126}
7127
7128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7130#[cfg_attr(feature = "bindings", derive(TS))]
7131pub struct SqlComment {
7132 pub text: String,
7133 pub is_block: bool,
7134}
7135
7136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7142#[cfg_attr(feature = "bindings", derive(TS))]
7143pub struct SimilarToExpr {
7144 pub this: Expression,
7145 pub pattern: Expression,
7146 pub escape: Option<Expression>,
7147 pub not: bool,
7148}
7149
7150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7152#[cfg_attr(feature = "bindings", derive(TS))]
7153pub struct QuantifiedExpr {
7154 pub this: Expression,
7155 pub subquery: Expression,
7156 pub op: Option<QuantifiedOp>,
7157}
7158
7159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7161#[cfg_attr(feature = "bindings", derive(TS))]
7162pub enum QuantifiedOp {
7163 Eq,
7164 Neq,
7165 Lt,
7166 Lte,
7167 Gt,
7168 Gte,
7169}
7170
7171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7176#[cfg_attr(feature = "bindings", derive(TS))]
7177pub struct OverlapsExpr {
7178 #[serde(skip_serializing_if = "Option::is_none")]
7180 pub this: Option<Expression>,
7181 #[serde(skip_serializing_if = "Option::is_none")]
7183 pub expression: Option<Expression>,
7184 #[serde(skip_serializing_if = "Option::is_none")]
7186 pub left_start: Option<Expression>,
7187 #[serde(skip_serializing_if = "Option::is_none")]
7189 pub left_end: Option<Expression>,
7190 #[serde(skip_serializing_if = "Option::is_none")]
7192 pub right_start: Option<Expression>,
7193 #[serde(skip_serializing_if = "Option::is_none")]
7195 pub right_end: Option<Expression>,
7196}
7197
7198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7204#[cfg_attr(feature = "bindings", derive(TS))]
7205pub struct Subscript {
7206 pub this: Expression,
7207 pub index: Expression,
7208}
7209
7210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7212#[cfg_attr(feature = "bindings", derive(TS))]
7213pub struct DotAccess {
7214 pub this: Expression,
7215 pub field: Identifier,
7216}
7217
7218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7220#[cfg_attr(feature = "bindings", derive(TS))]
7221pub struct MethodCall {
7222 pub this: Expression,
7223 pub method: Identifier,
7224 pub args: Vec<Expression>,
7225}
7226
7227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7229#[cfg_attr(feature = "bindings", derive(TS))]
7230pub struct ArraySlice {
7231 pub this: Expression,
7232 pub start: Option<Expression>,
7233 pub end: Option<Expression>,
7234}
7235
7236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7242#[cfg_attr(feature = "bindings", derive(TS))]
7243pub enum OnCommit {
7244 PreserveRows,
7246 DeleteRows,
7248}
7249
7250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7252#[cfg_attr(feature = "bindings", derive(TS))]
7253pub struct CreateTable {
7254 pub name: TableRef,
7255 #[serde(default, skip_serializing_if = "Option::is_none")]
7257 pub on_cluster: Option<OnCluster>,
7258 pub columns: Vec<ColumnDef>,
7259 pub constraints: Vec<TableConstraint>,
7260 pub if_not_exists: bool,
7261 pub temporary: bool,
7262 pub or_replace: bool,
7263 #[serde(default, skip_serializing_if = "Option::is_none")]
7265 pub table_modifier: Option<String>,
7266 pub as_select: Option<Expression>,
7267 #[serde(default)]
7269 pub as_select_parenthesized: bool,
7270 #[serde(default)]
7272 pub on_commit: Option<OnCommit>,
7273 #[serde(default)]
7275 pub clone_source: Option<TableRef>,
7276 #[serde(default, skip_serializing_if = "Option::is_none")]
7278 pub clone_at_clause: Option<Expression>,
7279 #[serde(default)]
7281 pub is_copy: bool,
7282 #[serde(default)]
7284 pub shallow_clone: bool,
7285 #[serde(default)]
7287 pub leading_comments: Vec<String>,
7288 #[serde(default)]
7290 pub with_properties: Vec<(String, String)>,
7291 #[serde(default)]
7293 pub teradata_post_name_options: Vec<String>,
7294 #[serde(default)]
7296 pub with_data: Option<bool>,
7297 #[serde(default)]
7299 pub with_statistics: Option<bool>,
7300 #[serde(default)]
7302 pub teradata_indexes: Vec<TeradataIndex>,
7303 #[serde(default)]
7305 pub with_cte: Option<With>,
7306 #[serde(default)]
7308 pub properties: Vec<Expression>,
7309 #[serde(default, skip_serializing_if = "Option::is_none")]
7311 pub partition_of: Option<Expression>,
7312 #[serde(default)]
7314 pub post_table_properties: Vec<Expression>,
7315 #[serde(default)]
7317 pub mysql_table_options: Vec<(String, String)>,
7318 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7320 pub inherits: Vec<TableRef>,
7321 #[serde(default, skip_serializing_if = "Option::is_none")]
7323 pub on_property: Option<OnProperty>,
7324 #[serde(default)]
7326 pub copy_grants: bool,
7327 #[serde(default, skip_serializing_if = "Option::is_none")]
7329 pub using_template: Option<Box<Expression>>,
7330 #[serde(default, skip_serializing_if = "Option::is_none")]
7332 pub rollup: Option<RollupProperty>,
7333 #[serde(default, skip_serializing_if = "Option::is_none")]
7335 pub uuid: Option<String>,
7336}
7337
7338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7340#[cfg_attr(feature = "bindings", derive(TS))]
7341pub struct TeradataIndex {
7342 pub kind: TeradataIndexKind,
7344 pub name: Option<String>,
7346 pub columns: Vec<String>,
7348}
7349
7350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7352#[cfg_attr(feature = "bindings", derive(TS))]
7353pub enum TeradataIndexKind {
7354 NoPrimary,
7356 Primary,
7358 PrimaryAmp,
7360 Unique,
7362 UniquePrimary,
7364 Secondary,
7366}
7367
7368impl CreateTable {
7369 pub fn new(name: impl Into<String>) -> Self {
7370 Self {
7371 name: TableRef::new(name),
7372 on_cluster: None,
7373 columns: Vec::new(),
7374 constraints: Vec::new(),
7375 if_not_exists: false,
7376 temporary: false,
7377 or_replace: false,
7378 table_modifier: None,
7379 as_select: None,
7380 as_select_parenthesized: false,
7381 on_commit: None,
7382 clone_source: None,
7383 clone_at_clause: None,
7384 shallow_clone: false,
7385 is_copy: false,
7386 leading_comments: Vec::new(),
7387 with_properties: Vec::new(),
7388 teradata_post_name_options: Vec::new(),
7389 with_data: None,
7390 with_statistics: None,
7391 teradata_indexes: Vec::new(),
7392 with_cte: None,
7393 properties: Vec::new(),
7394 partition_of: None,
7395 post_table_properties: Vec::new(),
7396 mysql_table_options: Vec::new(),
7397 inherits: Vec::new(),
7398 on_property: None,
7399 copy_grants: false,
7400 using_template: None,
7401 rollup: None,
7402 uuid: None,
7403 }
7404 }
7405}
7406
7407#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7409#[cfg_attr(feature = "bindings", derive(TS))]
7410pub enum SortOrder {
7411 Asc,
7412 Desc,
7413}
7414
7415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7417#[cfg_attr(feature = "bindings", derive(TS))]
7418pub enum ConstraintType {
7419 NotNull,
7420 Null,
7421 PrimaryKey,
7422 Unique,
7423 Default,
7424 AutoIncrement,
7425 Collate,
7426 Comment,
7427 References,
7428 Check,
7429 GeneratedAsIdentity,
7430 Tags,
7432 ComputedColumn,
7434 GeneratedAsRow,
7436 OnUpdate,
7438 Path,
7440 Encode,
7442}
7443
7444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7446#[cfg_attr(feature = "bindings", derive(TS))]
7447pub struct ColumnDef {
7448 pub name: Identifier,
7449 pub data_type: DataType,
7450 pub nullable: Option<bool>,
7451 pub default: Option<Expression>,
7452 pub primary_key: bool,
7453 #[serde(default)]
7455 pub primary_key_order: Option<SortOrder>,
7456 pub unique: bool,
7457 #[serde(default)]
7459 pub unique_nulls_not_distinct: bool,
7460 pub auto_increment: bool,
7461 pub comment: Option<String>,
7462 pub constraints: Vec<ColumnConstraint>,
7463 #[serde(default)]
7465 pub constraint_order: Vec<ConstraintType>,
7466 #[serde(default)]
7468 pub format: Option<String>,
7469 #[serde(default)]
7471 pub title: Option<String>,
7472 #[serde(default)]
7474 pub inline_length: Option<u64>,
7475 #[serde(default)]
7477 pub compress: Option<Vec<Expression>>,
7478 #[serde(default)]
7480 pub character_set: Option<String>,
7481 #[serde(default)]
7483 pub uppercase: bool,
7484 #[serde(default)]
7486 pub casespecific: Option<bool>,
7487 #[serde(default)]
7489 pub auto_increment_start: Option<Box<Expression>>,
7490 #[serde(default)]
7492 pub auto_increment_increment: Option<Box<Expression>>,
7493 #[serde(default)]
7495 pub auto_increment_order: Option<bool>,
7496 #[serde(default)]
7498 pub unsigned: bool,
7499 #[serde(default)]
7501 pub zerofill: bool,
7502 #[serde(default, skip_serializing_if = "Option::is_none")]
7504 pub on_update: Option<Expression>,
7505 #[serde(default, skip_serializing_if = "Option::is_none")]
7507 pub unique_constraint_name: Option<String>,
7508 #[serde(default, skip_serializing_if = "Option::is_none")]
7510 pub not_null_constraint_name: Option<String>,
7511 #[serde(default, skip_serializing_if = "Option::is_none")]
7513 pub primary_key_constraint_name: Option<String>,
7514 #[serde(default, skip_serializing_if = "Option::is_none")]
7516 pub check_constraint_name: Option<String>,
7517 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7519 pub options: Vec<Expression>,
7520 #[serde(default)]
7522 pub no_type: bool,
7523 #[serde(default, skip_serializing_if = "Option::is_none")]
7525 pub encoding: Option<String>,
7526 #[serde(default, skip_serializing_if = "Option::is_none")]
7528 pub codec: Option<String>,
7529 #[serde(default, skip_serializing_if = "Option::is_none")]
7531 pub ephemeral: Option<Option<Box<Expression>>>,
7532 #[serde(default, skip_serializing_if = "Option::is_none")]
7534 pub materialized_expr: Option<Box<Expression>>,
7535 #[serde(default, skip_serializing_if = "Option::is_none")]
7537 pub alias_expr: Option<Box<Expression>>,
7538 #[serde(default, skip_serializing_if = "Option::is_none")]
7540 pub ttl_expr: Option<Box<Expression>>,
7541 #[serde(default)]
7543 pub not_for_replication: bool,
7544}
7545
7546impl ColumnDef {
7547 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7548 Self {
7549 name: Identifier::new(name),
7550 data_type,
7551 nullable: None,
7552 default: None,
7553 primary_key: false,
7554 primary_key_order: None,
7555 unique: false,
7556 unique_nulls_not_distinct: false,
7557 auto_increment: false,
7558 comment: None,
7559 constraints: Vec::new(),
7560 constraint_order: Vec::new(),
7561 format: None,
7562 title: None,
7563 inline_length: None,
7564 compress: None,
7565 character_set: None,
7566 uppercase: false,
7567 casespecific: None,
7568 auto_increment_start: None,
7569 auto_increment_increment: None,
7570 auto_increment_order: None,
7571 unsigned: false,
7572 zerofill: false,
7573 on_update: None,
7574 unique_constraint_name: None,
7575 not_null_constraint_name: None,
7576 primary_key_constraint_name: None,
7577 check_constraint_name: None,
7578 options: Vec::new(),
7579 no_type: false,
7580 encoding: None,
7581 codec: None,
7582 ephemeral: None,
7583 materialized_expr: None,
7584 alias_expr: None,
7585 ttl_expr: None,
7586 not_for_replication: false,
7587 }
7588 }
7589}
7590
7591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7593#[cfg_attr(feature = "bindings", derive(TS))]
7594pub enum ColumnConstraint {
7595 NotNull,
7596 Null,
7597 Unique,
7598 PrimaryKey,
7599 Default(Expression),
7600 Check(Expression),
7601 References(ForeignKeyRef),
7602 GeneratedAsIdentity(GeneratedAsIdentity),
7603 Collate(Identifier),
7604 Comment(String),
7605 Tags(Tags),
7607 ComputedColumn(ComputedColumn),
7610 GeneratedAsRow(GeneratedAsRow),
7612 Path(Expression),
7614}
7615
7616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7618#[cfg_attr(feature = "bindings", derive(TS))]
7619pub struct ComputedColumn {
7620 pub expression: Box<Expression>,
7622 #[serde(default)]
7624 pub persisted: bool,
7625 #[serde(default)]
7627 pub not_null: bool,
7628 #[serde(default)]
7631 pub persistence_kind: Option<String>,
7632 #[serde(default, skip_serializing_if = "Option::is_none")]
7634 pub data_type: Option<DataType>,
7635}
7636
7637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7639#[cfg_attr(feature = "bindings", derive(TS))]
7640pub struct GeneratedAsRow {
7641 pub start: bool,
7643 #[serde(default)]
7645 pub hidden: bool,
7646}
7647
7648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7650#[cfg_attr(feature = "bindings", derive(TS))]
7651pub struct GeneratedAsIdentity {
7652 pub always: bool,
7654 pub on_null: bool,
7656 pub start: Option<Box<Expression>>,
7658 pub increment: Option<Box<Expression>>,
7660 pub minvalue: Option<Box<Expression>>,
7662 pub maxvalue: Option<Box<Expression>>,
7664 pub cycle: Option<bool>,
7666}
7667
7668#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7670#[cfg_attr(feature = "bindings", derive(TS))]
7671pub struct ConstraintModifiers {
7672 pub enforced: Option<bool>,
7674 pub deferrable: Option<bool>,
7676 pub initially_deferred: Option<bool>,
7678 pub norely: bool,
7680 pub rely: bool,
7682 #[serde(default)]
7684 pub using: Option<String>,
7685 #[serde(default)]
7687 pub using_before_columns: bool,
7688 #[serde(default, skip_serializing_if = "Option::is_none")]
7690 pub comment: Option<String>,
7691 #[serde(default, skip_serializing_if = "Option::is_none")]
7693 pub visible: Option<bool>,
7694 #[serde(default, skip_serializing_if = "Option::is_none")]
7696 pub engine_attribute: Option<String>,
7697 #[serde(default, skip_serializing_if = "Option::is_none")]
7699 pub with_parser: Option<String>,
7700 #[serde(default)]
7702 pub not_valid: bool,
7703 #[serde(default, skip_serializing_if = "Option::is_none")]
7705 pub clustered: Option<String>,
7706 #[serde(default, skip_serializing_if = "Option::is_none")]
7708 pub on_conflict: Option<String>,
7709 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7711 pub with_options: Vec<(String, String)>,
7712 #[serde(default, skip_serializing_if = "Option::is_none")]
7714 pub on_filegroup: Option<Identifier>,
7715}
7716
7717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7719#[cfg_attr(feature = "bindings", derive(TS))]
7720pub enum TableConstraint {
7721 PrimaryKey {
7722 name: Option<Identifier>,
7723 columns: Vec<Identifier>,
7724 #[serde(default)]
7726 include_columns: Vec<Identifier>,
7727 #[serde(default)]
7728 modifiers: ConstraintModifiers,
7729 #[serde(default)]
7731 has_constraint_keyword: bool,
7732 },
7733 Unique {
7734 name: Option<Identifier>,
7735 columns: Vec<Identifier>,
7736 #[serde(default)]
7738 columns_parenthesized: bool,
7739 #[serde(default)]
7740 modifiers: ConstraintModifiers,
7741 #[serde(default)]
7743 has_constraint_keyword: bool,
7744 #[serde(default)]
7746 nulls_not_distinct: bool,
7747 },
7748 ForeignKey {
7749 name: Option<Identifier>,
7750 columns: Vec<Identifier>,
7751 #[serde(default)]
7752 references: Option<ForeignKeyRef>,
7753 #[serde(default)]
7755 on_delete: Option<ReferentialAction>,
7756 #[serde(default)]
7758 on_update: Option<ReferentialAction>,
7759 #[serde(default)]
7760 modifiers: ConstraintModifiers,
7761 },
7762 Check {
7763 name: Option<Identifier>,
7764 expression: Expression,
7765 #[serde(default)]
7766 modifiers: ConstraintModifiers,
7767 },
7768 Assume {
7770 name: Option<Identifier>,
7771 expression: Expression,
7772 },
7773 Index {
7775 name: Option<Identifier>,
7776 columns: Vec<Identifier>,
7777 #[serde(default)]
7779 kind: Option<String>,
7780 #[serde(default)]
7781 modifiers: ConstraintModifiers,
7782 #[serde(default)]
7784 use_key_keyword: bool,
7785 #[serde(default, skip_serializing_if = "Option::is_none")]
7787 expression: Option<Box<Expression>>,
7788 #[serde(default, skip_serializing_if = "Option::is_none")]
7790 index_type: Option<Box<Expression>>,
7791 #[serde(default, skip_serializing_if = "Option::is_none")]
7793 granularity: Option<Box<Expression>>,
7794 },
7795 Projection {
7797 name: Identifier,
7798 expression: Expression,
7799 },
7800 Like {
7802 source: TableRef,
7803 options: Vec<(LikeOptionAction, String)>,
7805 },
7806 PeriodForSystemTime {
7808 start_col: Identifier,
7809 end_col: Identifier,
7810 },
7811 Exclude {
7814 name: Option<Identifier>,
7815 #[serde(default)]
7817 using: Option<String>,
7818 elements: Vec<ExcludeElement>,
7820 #[serde(default)]
7822 include_columns: Vec<Identifier>,
7823 #[serde(default)]
7825 where_clause: Option<Box<Expression>>,
7826 #[serde(default)]
7828 with_params: Vec<(String, String)>,
7829 #[serde(default)]
7831 using_index_tablespace: Option<String>,
7832 #[serde(default)]
7833 modifiers: ConstraintModifiers,
7834 },
7835 Tags(Tags),
7837 InitiallyDeferred {
7841 deferred: bool,
7843 },
7844}
7845
7846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7848#[cfg_attr(feature = "bindings", derive(TS))]
7849pub struct ExcludeElement {
7850 pub expression: String,
7852 pub operator: String,
7854}
7855
7856#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7858#[cfg_attr(feature = "bindings", derive(TS))]
7859pub enum LikeOptionAction {
7860 Including,
7861 Excluding,
7862}
7863
7864#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7866#[cfg_attr(feature = "bindings", derive(TS))]
7867pub enum MatchType {
7868 Full,
7869 Partial,
7870 Simple,
7871}
7872
7873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7875#[cfg_attr(feature = "bindings", derive(TS))]
7876pub struct ForeignKeyRef {
7877 pub table: TableRef,
7878 pub columns: Vec<Identifier>,
7879 pub on_delete: Option<ReferentialAction>,
7880 pub on_update: Option<ReferentialAction>,
7881 #[serde(default)]
7883 pub on_update_first: bool,
7884 #[serde(default)]
7886 pub match_type: Option<MatchType>,
7887 #[serde(default)]
7889 pub match_after_actions: bool,
7890 #[serde(default)]
7892 pub constraint_name: Option<String>,
7893 #[serde(default)]
7895 pub deferrable: Option<bool>,
7896 #[serde(default)]
7898 pub has_foreign_key_keywords: bool,
7899}
7900
7901#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7903#[cfg_attr(feature = "bindings", derive(TS))]
7904pub enum ReferentialAction {
7905 Cascade,
7906 SetNull,
7907 SetDefault,
7908 Restrict,
7909 NoAction,
7910}
7911
7912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7914#[cfg_attr(feature = "bindings", derive(TS))]
7915pub struct DropTable {
7916 pub names: Vec<TableRef>,
7917 pub if_exists: bool,
7918 pub cascade: bool,
7919 #[serde(default)]
7921 pub cascade_constraints: bool,
7922 #[serde(default)]
7924 pub purge: bool,
7925 #[serde(default)]
7927 pub leading_comments: Vec<String>,
7928 #[serde(default, skip_serializing_if = "Option::is_none")]
7931 pub object_id_args: Option<String>,
7932 #[serde(default)]
7934 pub sync: bool,
7935 #[serde(default)]
7937 pub iceberg: bool,
7938 #[serde(default)]
7940 pub restrict: bool,
7941}
7942
7943impl DropTable {
7944 pub fn new(name: impl Into<String>) -> Self {
7945 Self {
7946 names: vec![TableRef::new(name)],
7947 if_exists: false,
7948 cascade: false,
7949 cascade_constraints: false,
7950 purge: false,
7951 leading_comments: Vec::new(),
7952 object_id_args: None,
7953 sync: false,
7954 iceberg: false,
7955 restrict: false,
7956 }
7957 }
7958}
7959
7960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7962#[cfg_attr(feature = "bindings", derive(TS))]
7963pub struct AlterTable {
7964 pub name: TableRef,
7965 pub actions: Vec<AlterTableAction>,
7966 #[serde(default)]
7968 pub if_exists: bool,
7969 #[serde(default, skip_serializing_if = "Option::is_none")]
7971 pub algorithm: Option<String>,
7972 #[serde(default, skip_serializing_if = "Option::is_none")]
7974 pub lock: Option<String>,
7975 #[serde(default, skip_serializing_if = "Option::is_none")]
7977 pub with_check: Option<String>,
7978 #[serde(default, skip_serializing_if = "Option::is_none")]
7980 pub partition: Option<Vec<(Identifier, Expression)>>,
7981 #[serde(default, skip_serializing_if = "Option::is_none")]
7983 pub on_cluster: Option<OnCluster>,
7984 #[serde(default, skip_serializing_if = "Option::is_none")]
7986 pub table_modifier: Option<String>,
7987}
7988
7989impl AlterTable {
7990 pub fn new(name: impl Into<String>) -> Self {
7991 Self {
7992 name: TableRef::new(name),
7993 actions: Vec::new(),
7994 if_exists: false,
7995 algorithm: None,
7996 lock: None,
7997 with_check: None,
7998 partition: None,
7999 on_cluster: None,
8000 table_modifier: None,
8001 }
8002 }
8003}
8004
8005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8007#[cfg_attr(feature = "bindings", derive(TS))]
8008pub enum ColumnPosition {
8009 First,
8010 After(Identifier),
8011}
8012
8013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8015#[cfg_attr(feature = "bindings", derive(TS))]
8016pub enum AlterTableAction {
8017 AddColumn {
8018 column: ColumnDef,
8019 if_not_exists: bool,
8020 position: Option<ColumnPosition>,
8021 },
8022 DropColumn {
8023 name: Identifier,
8024 if_exists: bool,
8025 cascade: bool,
8026 },
8027 RenameColumn {
8028 old_name: Identifier,
8029 new_name: Identifier,
8030 if_exists: bool,
8031 },
8032 AlterColumn {
8033 name: Identifier,
8034 action: AlterColumnAction,
8035 #[serde(default)]
8037 use_modify_keyword: bool,
8038 },
8039 RenameTable(TableRef),
8040 AddConstraint(TableConstraint),
8041 DropConstraint {
8042 name: Identifier,
8043 if_exists: bool,
8044 },
8045 DropForeignKey {
8047 name: Identifier,
8048 },
8049 DropPartition {
8051 partitions: Vec<Vec<(Identifier, Expression)>>,
8053 if_exists: bool,
8054 },
8055 AddPartition {
8057 partition: Expression,
8059 if_not_exists: bool,
8060 location: Option<Expression>,
8061 },
8062 Delete {
8064 where_clause: Expression,
8065 },
8066 SwapWith(TableRef),
8068 SetProperty {
8070 properties: Vec<(String, Expression)>,
8071 },
8072 UnsetProperty {
8074 properties: Vec<String>,
8075 },
8076 ClusterBy {
8078 expressions: Vec<Expression>,
8079 },
8080 SetTag {
8082 expressions: Vec<(String, Expression)>,
8083 },
8084 UnsetTag {
8086 names: Vec<String>,
8087 },
8088 SetOptions {
8090 expressions: Vec<Expression>,
8091 },
8092 AlterIndex {
8094 name: Identifier,
8095 visible: bool,
8096 },
8097 SetAttribute {
8099 attribute: String,
8100 },
8101 SetStageFileFormat {
8103 options: Option<Expression>,
8104 },
8105 SetStageCopyOptions {
8107 options: Option<Expression>,
8108 },
8109 AddColumns {
8111 columns: Vec<ColumnDef>,
8112 cascade: bool,
8113 },
8114 DropColumns {
8116 names: Vec<Identifier>,
8117 },
8118 ChangeColumn {
8121 old_name: Identifier,
8122 new_name: Identifier,
8123 #[serde(default, skip_serializing_if = "Option::is_none")]
8124 data_type: Option<DataType>,
8125 comment: Option<String>,
8126 #[serde(default)]
8127 cascade: bool,
8128 },
8129 AlterSortKey {
8132 this: Option<String>,
8134 expressions: Vec<Expression>,
8136 compound: bool,
8138 },
8139 AlterDistStyle {
8143 style: String,
8145 distkey: Option<Identifier>,
8147 },
8148 SetTableProperties {
8150 properties: Vec<(Expression, Expression)>,
8151 },
8152 SetLocation {
8154 location: String,
8155 },
8156 SetFileFormat {
8158 format: String,
8159 },
8160 ReplacePartition {
8162 partition: Expression,
8163 source: Option<Box<Expression>>,
8164 },
8165 Raw {
8167 sql: String,
8168 },
8169}
8170
8171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8173#[cfg_attr(feature = "bindings", derive(TS))]
8174pub enum AlterColumnAction {
8175 SetDataType {
8176 data_type: DataType,
8177 using: Option<Expression>,
8179 #[serde(default, skip_serializing_if = "Option::is_none")]
8181 collate: Option<String>,
8182 },
8183 SetDefault(Expression),
8184 DropDefault,
8185 SetNotNull,
8186 DropNotNull,
8187 Comment(String),
8189 SetVisible,
8191 SetInvisible,
8193}
8194
8195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8197#[cfg_attr(feature = "bindings", derive(TS))]
8198pub struct CreateIndex {
8199 pub name: Identifier,
8200 pub table: TableRef,
8201 pub columns: Vec<IndexColumn>,
8202 pub unique: bool,
8203 pub if_not_exists: bool,
8204 pub using: Option<String>,
8205 #[serde(default)]
8207 pub clustered: Option<String>,
8208 #[serde(default)]
8210 pub concurrently: bool,
8211 #[serde(default)]
8213 pub where_clause: Option<Box<Expression>>,
8214 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8216 pub include_columns: Vec<Identifier>,
8217 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8219 pub with_options: Vec<(String, String)>,
8220 #[serde(default)]
8222 pub on_filegroup: Option<String>,
8223}
8224
8225impl CreateIndex {
8226 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8227 Self {
8228 name: Identifier::new(name),
8229 table: TableRef::new(table),
8230 columns: Vec::new(),
8231 unique: false,
8232 if_not_exists: false,
8233 using: None,
8234 clustered: None,
8235 concurrently: false,
8236 where_clause: None,
8237 include_columns: Vec::new(),
8238 with_options: Vec::new(),
8239 on_filegroup: None,
8240 }
8241 }
8242}
8243
8244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8246#[cfg_attr(feature = "bindings", derive(TS))]
8247pub struct IndexColumn {
8248 pub column: Identifier,
8249 pub desc: bool,
8250 #[serde(default)]
8252 pub asc: bool,
8253 pub nulls_first: Option<bool>,
8254 #[serde(default, skip_serializing_if = "Option::is_none")]
8256 pub opclass: Option<String>,
8257}
8258
8259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8261#[cfg_attr(feature = "bindings", derive(TS))]
8262pub struct DropIndex {
8263 pub name: Identifier,
8264 pub table: Option<TableRef>,
8265 pub if_exists: bool,
8266 #[serde(default)]
8268 pub concurrently: bool,
8269}
8270
8271impl DropIndex {
8272 pub fn new(name: impl Into<String>) -> Self {
8273 Self {
8274 name: Identifier::new(name),
8275 table: None,
8276 if_exists: false,
8277 concurrently: false,
8278 }
8279 }
8280}
8281
8282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8284#[cfg_attr(feature = "bindings", derive(TS))]
8285pub struct ViewColumn {
8286 pub name: Identifier,
8287 pub comment: Option<String>,
8288 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8290 pub options: Vec<Expression>,
8291}
8292
8293impl ViewColumn {
8294 pub fn new(name: impl Into<String>) -> Self {
8295 Self {
8296 name: Identifier::new(name),
8297 comment: None,
8298 options: Vec::new(),
8299 }
8300 }
8301
8302 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8303 Self {
8304 name: Identifier::new(name),
8305 comment: Some(comment.into()),
8306 options: Vec::new(),
8307 }
8308 }
8309}
8310
8311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8313#[cfg_attr(feature = "bindings", derive(TS))]
8314pub struct CreateView {
8315 pub name: TableRef,
8316 pub columns: Vec<ViewColumn>,
8317 pub query: Expression,
8318 pub or_replace: bool,
8319 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8321 pub or_alter: bool,
8322 pub if_not_exists: bool,
8323 pub materialized: bool,
8324 pub temporary: bool,
8325 #[serde(default)]
8327 pub secure: bool,
8328 #[serde(skip_serializing_if = "Option::is_none")]
8330 pub algorithm: Option<String>,
8331 #[serde(skip_serializing_if = "Option::is_none")]
8333 pub definer: Option<String>,
8334 #[serde(skip_serializing_if = "Option::is_none")]
8336 pub security: Option<FunctionSecurity>,
8337 #[serde(default = "default_true")]
8339 pub security_sql_style: bool,
8340 #[serde(default)]
8342 pub security_after_name: bool,
8343 #[serde(default)]
8345 pub query_parenthesized: bool,
8346 #[serde(skip_serializing_if = "Option::is_none")]
8348 pub locking_mode: Option<String>,
8349 #[serde(skip_serializing_if = "Option::is_none")]
8351 pub locking_access: Option<String>,
8352 #[serde(default)]
8354 pub copy_grants: bool,
8355 #[serde(skip_serializing_if = "Option::is_none", default)]
8357 pub comment: Option<String>,
8358 #[serde(default)]
8360 pub tags: Vec<(String, String)>,
8361 #[serde(default)]
8363 pub options: Vec<Expression>,
8364 #[serde(skip_serializing_if = "Option::is_none", default)]
8366 pub build: Option<String>,
8367 #[serde(skip_serializing_if = "Option::is_none", default)]
8369 pub refresh: Option<Box<RefreshTriggerProperty>>,
8370 #[serde(skip_serializing_if = "Option::is_none", default)]
8373 pub schema: Option<Box<Schema>>,
8374 #[serde(skip_serializing_if = "Option::is_none", default)]
8376 pub unique_key: Option<Box<UniqueKeyProperty>>,
8377 #[serde(default)]
8379 pub no_schema_binding: bool,
8380 #[serde(skip_serializing_if = "Option::is_none", default)]
8382 pub auto_refresh: Option<bool>,
8383 #[serde(default, skip_serializing_if = "Option::is_none")]
8385 pub on_cluster: Option<OnCluster>,
8386 #[serde(default, skip_serializing_if = "Option::is_none")]
8388 pub to_table: Option<TableRef>,
8389 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8391 pub table_properties: Vec<Expression>,
8392}
8393
8394impl CreateView {
8395 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8396 Self {
8397 name: TableRef::new(name),
8398 columns: Vec::new(),
8399 query,
8400 or_replace: false,
8401 or_alter: false,
8402 if_not_exists: false,
8403 materialized: false,
8404 temporary: false,
8405 secure: false,
8406 algorithm: None,
8407 definer: None,
8408 security: None,
8409 security_sql_style: true,
8410 security_after_name: false,
8411 query_parenthesized: false,
8412 locking_mode: None,
8413 locking_access: None,
8414 copy_grants: false,
8415 comment: None,
8416 tags: Vec::new(),
8417 options: Vec::new(),
8418 build: None,
8419 refresh: None,
8420 schema: None,
8421 unique_key: None,
8422 no_schema_binding: false,
8423 auto_refresh: None,
8424 on_cluster: None,
8425 to_table: None,
8426 table_properties: Vec::new(),
8427 }
8428 }
8429}
8430
8431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8433#[cfg_attr(feature = "bindings", derive(TS))]
8434pub struct DropView {
8435 pub name: TableRef,
8436 pub if_exists: bool,
8437 pub materialized: bool,
8438}
8439
8440impl DropView {
8441 pub fn new(name: impl Into<String>) -> Self {
8442 Self {
8443 name: TableRef::new(name),
8444 if_exists: false,
8445 materialized: false,
8446 }
8447 }
8448}
8449
8450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8452#[cfg_attr(feature = "bindings", derive(TS))]
8453pub struct Truncate {
8454 #[serde(default)]
8456 pub target: TruncateTarget,
8457 #[serde(default)]
8459 pub if_exists: bool,
8460 pub table: TableRef,
8461 #[serde(default, skip_serializing_if = "Option::is_none")]
8463 pub on_cluster: Option<OnCluster>,
8464 pub cascade: bool,
8465 #[serde(default)]
8467 pub extra_tables: Vec<TruncateTableEntry>,
8468 #[serde(default)]
8470 pub identity: Option<TruncateIdentity>,
8471 #[serde(default)]
8473 pub restrict: bool,
8474 #[serde(default, skip_serializing_if = "Option::is_none")]
8476 pub partition: Option<Box<Expression>>,
8477}
8478
8479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8481#[cfg_attr(feature = "bindings", derive(TS))]
8482pub struct TruncateTableEntry {
8483 pub table: TableRef,
8484 #[serde(default)]
8486 pub star: bool,
8487}
8488
8489#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8491#[cfg_attr(feature = "bindings", derive(TS))]
8492pub enum TruncateTarget {
8493 Table,
8494 Database,
8495}
8496
8497impl Default for TruncateTarget {
8498 fn default() -> Self {
8499 TruncateTarget::Table
8500 }
8501}
8502
8503#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8505#[cfg_attr(feature = "bindings", derive(TS))]
8506pub enum TruncateIdentity {
8507 Restart,
8508 Continue,
8509}
8510
8511impl Truncate {
8512 pub fn new(table: impl Into<String>) -> Self {
8513 Self {
8514 target: TruncateTarget::Table,
8515 if_exists: false,
8516 table: TableRef::new(table),
8517 on_cluster: None,
8518 cascade: false,
8519 extra_tables: Vec::new(),
8520 identity: None,
8521 restrict: false,
8522 partition: None,
8523 }
8524 }
8525}
8526
8527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8529#[cfg_attr(feature = "bindings", derive(TS))]
8530pub struct Use {
8531 pub kind: Option<UseKind>,
8533 pub this: Identifier,
8535}
8536
8537#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8539#[cfg_attr(feature = "bindings", derive(TS))]
8540pub enum UseKind {
8541 Database,
8542 Schema,
8543 Role,
8544 Warehouse,
8545 Catalog,
8546 SecondaryRoles,
8548}
8549
8550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8552#[cfg_attr(feature = "bindings", derive(TS))]
8553pub struct SetStatement {
8554 pub items: Vec<SetItem>,
8556}
8557
8558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8560#[cfg_attr(feature = "bindings", derive(TS))]
8561pub struct SetItem {
8562 pub name: Expression,
8564 pub value: Expression,
8566 pub kind: Option<String>,
8568 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8570 pub no_equals: bool,
8571}
8572
8573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8575#[cfg_attr(feature = "bindings", derive(TS))]
8576pub struct Cache {
8577 pub table: Identifier,
8579 pub lazy: bool,
8581 pub options: Vec<(Expression, Expression)>,
8583 pub query: Option<Expression>,
8585}
8586
8587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8589#[cfg_attr(feature = "bindings", derive(TS))]
8590pub struct Uncache {
8591 pub table: Identifier,
8593 pub if_exists: bool,
8595}
8596
8597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8599#[cfg_attr(feature = "bindings", derive(TS))]
8600pub struct LoadData {
8601 pub local: bool,
8603 pub inpath: String,
8605 pub overwrite: bool,
8607 pub table: Expression,
8609 pub partition: Vec<(Identifier, Expression)>,
8611 pub input_format: Option<String>,
8613 pub serde: Option<String>,
8615}
8616
8617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8619#[cfg_attr(feature = "bindings", derive(TS))]
8620pub struct Pragma {
8621 pub schema: Option<Identifier>,
8623 pub name: Identifier,
8625 pub value: Option<Expression>,
8627 pub args: Vec<Expression>,
8629}
8630
8631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8634#[cfg_attr(feature = "bindings", derive(TS))]
8635pub struct Privilege {
8636 pub name: String,
8638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8640 pub columns: Vec<String>,
8641}
8642
8643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8645#[cfg_attr(feature = "bindings", derive(TS))]
8646pub struct GrantPrincipal {
8647 pub name: Identifier,
8649 pub is_role: bool,
8651 #[serde(default)]
8653 pub is_group: bool,
8654 #[serde(default)]
8656 pub is_share: bool,
8657}
8658
8659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8661#[cfg_attr(feature = "bindings", derive(TS))]
8662pub struct Grant {
8663 pub privileges: Vec<Privilege>,
8665 pub kind: Option<String>,
8667 pub securable: Identifier,
8669 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8671 pub function_params: Vec<String>,
8672 pub principals: Vec<GrantPrincipal>,
8674 pub grant_option: bool,
8676 #[serde(default, skip_serializing_if = "Option::is_none")]
8678 pub as_principal: Option<Identifier>,
8679}
8680
8681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8683#[cfg_attr(feature = "bindings", derive(TS))]
8684pub struct Revoke {
8685 pub privileges: Vec<Privilege>,
8687 pub kind: Option<String>,
8689 pub securable: Identifier,
8691 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8693 pub function_params: Vec<String>,
8694 pub principals: Vec<GrantPrincipal>,
8696 pub grant_option: bool,
8698 pub cascade: bool,
8700 #[serde(default)]
8702 pub restrict: bool,
8703}
8704
8705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8707#[cfg_attr(feature = "bindings", derive(TS))]
8708pub struct Comment {
8709 pub this: Expression,
8711 pub kind: String,
8713 pub expression: Expression,
8715 pub exists: bool,
8717 pub materialized: bool,
8719}
8720
8721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8727#[cfg_attr(feature = "bindings", derive(TS))]
8728pub struct AlterView {
8729 pub name: TableRef,
8730 pub actions: Vec<AlterViewAction>,
8731 #[serde(default, skip_serializing_if = "Option::is_none")]
8733 pub algorithm: Option<String>,
8734 #[serde(default, skip_serializing_if = "Option::is_none")]
8736 pub definer: Option<String>,
8737 #[serde(default, skip_serializing_if = "Option::is_none")]
8739 pub sql_security: Option<String>,
8740 #[serde(default, skip_serializing_if = "Option::is_none")]
8742 pub with_option: Option<String>,
8743 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8745 pub columns: Vec<ViewColumn>,
8746}
8747
8748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8750#[cfg_attr(feature = "bindings", derive(TS))]
8751pub enum AlterViewAction {
8752 Rename(TableRef),
8754 OwnerTo(Identifier),
8756 SetSchema(Identifier),
8758 SetAuthorization(String),
8760 AlterColumn {
8762 name: Identifier,
8763 action: AlterColumnAction,
8764 },
8765 AsSelect(Box<Expression>),
8767 SetTblproperties(Vec<(String, String)>),
8769 UnsetTblproperties(Vec<String>),
8771}
8772
8773impl AlterView {
8774 pub fn new(name: impl Into<String>) -> Self {
8775 Self {
8776 name: TableRef::new(name),
8777 actions: Vec::new(),
8778 algorithm: None,
8779 definer: None,
8780 sql_security: None,
8781 with_option: None,
8782 columns: Vec::new(),
8783 }
8784 }
8785}
8786
8787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8789#[cfg_attr(feature = "bindings", derive(TS))]
8790pub struct AlterIndex {
8791 pub name: Identifier,
8792 pub table: Option<TableRef>,
8793 pub actions: Vec<AlterIndexAction>,
8794}
8795
8796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8798#[cfg_attr(feature = "bindings", derive(TS))]
8799pub enum AlterIndexAction {
8800 Rename(Identifier),
8802 SetTablespace(Identifier),
8804 Visible(bool),
8806}
8807
8808impl AlterIndex {
8809 pub fn new(name: impl Into<String>) -> Self {
8810 Self {
8811 name: Identifier::new(name),
8812 table: None,
8813 actions: Vec::new(),
8814 }
8815 }
8816}
8817
8818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8820#[cfg_attr(feature = "bindings", derive(TS))]
8821pub struct CreateSchema {
8822 pub name: Vec<Identifier>,
8824 pub if_not_exists: bool,
8825 pub authorization: Option<Identifier>,
8826 #[serde(default)]
8828 pub clone_from: Option<Vec<Identifier>>,
8829 #[serde(default)]
8831 pub at_clause: Option<Expression>,
8832 #[serde(default)]
8834 pub properties: Vec<Expression>,
8835 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8837 pub leading_comments: Vec<String>,
8838}
8839
8840impl CreateSchema {
8841 pub fn new(name: impl Into<String>) -> Self {
8842 Self {
8843 name: vec![Identifier::new(name)],
8844 if_not_exists: false,
8845 authorization: None,
8846 clone_from: None,
8847 at_clause: None,
8848 properties: Vec::new(),
8849 leading_comments: Vec::new(),
8850 }
8851 }
8852}
8853
8854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8856#[cfg_attr(feature = "bindings", derive(TS))]
8857pub struct DropSchema {
8858 pub name: Identifier,
8859 pub if_exists: bool,
8860 pub cascade: bool,
8861}
8862
8863impl DropSchema {
8864 pub fn new(name: impl Into<String>) -> Self {
8865 Self {
8866 name: Identifier::new(name),
8867 if_exists: false,
8868 cascade: false,
8869 }
8870 }
8871}
8872
8873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8875#[cfg_attr(feature = "bindings", derive(TS))]
8876pub struct DropNamespace {
8877 pub name: Identifier,
8878 pub if_exists: bool,
8879 pub cascade: bool,
8880}
8881
8882impl DropNamespace {
8883 pub fn new(name: impl Into<String>) -> Self {
8884 Self {
8885 name: Identifier::new(name),
8886 if_exists: false,
8887 cascade: false,
8888 }
8889 }
8890}
8891
8892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8894#[cfg_attr(feature = "bindings", derive(TS))]
8895pub struct CreateDatabase {
8896 pub name: Identifier,
8897 pub if_not_exists: bool,
8898 pub options: Vec<DatabaseOption>,
8899 #[serde(default)]
8901 pub clone_from: Option<Identifier>,
8902 #[serde(default)]
8904 pub at_clause: Option<Expression>,
8905}
8906
8907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8909#[cfg_attr(feature = "bindings", derive(TS))]
8910pub enum DatabaseOption {
8911 CharacterSet(String),
8912 Collate(String),
8913 Owner(Identifier),
8914 Template(Identifier),
8915 Encoding(String),
8916 Location(String),
8917}
8918
8919impl CreateDatabase {
8920 pub fn new(name: impl Into<String>) -> Self {
8921 Self {
8922 name: Identifier::new(name),
8923 if_not_exists: false,
8924 options: Vec::new(),
8925 clone_from: None,
8926 at_clause: None,
8927 }
8928 }
8929}
8930
8931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8933#[cfg_attr(feature = "bindings", derive(TS))]
8934pub struct DropDatabase {
8935 pub name: Identifier,
8936 pub if_exists: bool,
8937 #[serde(default)]
8939 pub sync: bool,
8940}
8941
8942impl DropDatabase {
8943 pub fn new(name: impl Into<String>) -> Self {
8944 Self {
8945 name: Identifier::new(name),
8946 if_exists: false,
8947 sync: false,
8948 }
8949 }
8950}
8951
8952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8954#[cfg_attr(feature = "bindings", derive(TS))]
8955pub struct CreateFunction {
8956 pub name: TableRef,
8957 pub parameters: Vec<FunctionParameter>,
8958 pub return_type: Option<DataType>,
8959 pub body: Option<FunctionBody>,
8960 pub or_replace: bool,
8961 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8963 pub or_alter: bool,
8964 pub if_not_exists: bool,
8965 pub temporary: bool,
8966 pub language: Option<String>,
8967 pub deterministic: Option<bool>,
8968 pub returns_null_on_null_input: Option<bool>,
8969 pub security: Option<FunctionSecurity>,
8970 #[serde(default = "default_true")]
8972 pub has_parens: bool,
8973 #[serde(default)]
8975 pub sql_data_access: Option<SqlDataAccess>,
8976 #[serde(default, skip_serializing_if = "Option::is_none")]
8978 pub returns_table_body: Option<String>,
8979 #[serde(default)]
8981 pub language_first: bool,
8982 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8984 pub set_options: Vec<FunctionSetOption>,
8985 #[serde(default)]
8987 pub strict: bool,
8988 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8990 pub options: Vec<Expression>,
8991 #[serde(default)]
8993 pub is_table_function: bool,
8994 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8996 pub property_order: Vec<FunctionPropertyKind>,
8997 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8999 pub environment: Vec<Expression>,
9000 #[serde(default, skip_serializing_if = "Option::is_none")]
9002 pub handler: Option<String>,
9003 #[serde(default, skip_serializing_if = "Option::is_none")]
9005 pub parameter_style: Option<String>,
9006}
9007
9008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9010#[cfg_attr(feature = "bindings", derive(TS))]
9011pub struct FunctionSetOption {
9012 pub name: String,
9013 pub value: FunctionSetValue,
9014}
9015
9016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9018#[cfg_attr(feature = "bindings", derive(TS))]
9019pub enum FunctionSetValue {
9020 Value { value: String, use_to: bool },
9022 FromCurrent,
9024}
9025
9026#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9028#[cfg_attr(feature = "bindings", derive(TS))]
9029pub enum SqlDataAccess {
9030 NoSql,
9032 ContainsSql,
9034 ReadsSqlData,
9036 ModifiesSqlData,
9038}
9039
9040#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9042#[cfg_attr(feature = "bindings", derive(TS))]
9043pub enum FunctionPropertyKind {
9044 Set,
9046 As,
9048 Language,
9050 Determinism,
9052 NullInput,
9054 Security,
9056 SqlDataAccess,
9058 Options,
9060 Environment,
9062 Handler,
9064 ParameterStyle,
9066}
9067
9068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9070#[cfg_attr(feature = "bindings", derive(TS))]
9071pub struct FunctionParameter {
9072 pub name: Option<Identifier>,
9073 pub data_type: DataType,
9074 pub mode: Option<ParameterMode>,
9075 pub default: Option<Expression>,
9076 #[serde(default, skip_serializing_if = "Option::is_none")]
9078 pub mode_text: Option<String>,
9079}
9080
9081#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9083#[cfg_attr(feature = "bindings", derive(TS))]
9084pub enum ParameterMode {
9085 In,
9086 Out,
9087 InOut,
9088 Variadic,
9089}
9090
9091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9093#[cfg_attr(feature = "bindings", derive(TS))]
9094pub enum FunctionBody {
9095 Block(String),
9097 StringLiteral(String),
9099 Expression(Expression),
9101 External(String),
9103 Return(Expression),
9105 Statements(Vec<Expression>),
9107 DollarQuoted {
9110 content: String,
9111 tag: Option<String>,
9112 },
9113}
9114
9115#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9117#[cfg_attr(feature = "bindings", derive(TS))]
9118pub enum FunctionSecurity {
9119 Definer,
9120 Invoker,
9121 None,
9123}
9124
9125impl CreateFunction {
9126 pub fn new(name: impl Into<String>) -> Self {
9127 Self {
9128 name: TableRef::new(name),
9129 parameters: Vec::new(),
9130 return_type: None,
9131 body: None,
9132 or_replace: false,
9133 or_alter: false,
9134 if_not_exists: false,
9135 temporary: false,
9136 language: None,
9137 deterministic: None,
9138 returns_null_on_null_input: None,
9139 security: None,
9140 has_parens: true,
9141 sql_data_access: None,
9142 returns_table_body: None,
9143 language_first: false,
9144 set_options: Vec::new(),
9145 strict: false,
9146 options: Vec::new(),
9147 is_table_function: false,
9148 property_order: Vec::new(),
9149 environment: Vec::new(),
9150 handler: None,
9151 parameter_style: None,
9152 }
9153 }
9154}
9155
9156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9158#[cfg_attr(feature = "bindings", derive(TS))]
9159pub struct DropFunction {
9160 pub name: TableRef,
9161 pub parameters: Option<Vec<DataType>>,
9162 pub if_exists: bool,
9163 pub cascade: bool,
9164}
9165
9166impl DropFunction {
9167 pub fn new(name: impl Into<String>) -> Self {
9168 Self {
9169 name: TableRef::new(name),
9170 parameters: None,
9171 if_exists: false,
9172 cascade: false,
9173 }
9174 }
9175}
9176
9177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9179#[cfg_attr(feature = "bindings", derive(TS))]
9180pub struct CreateProcedure {
9181 pub name: TableRef,
9182 pub parameters: Vec<FunctionParameter>,
9183 pub body: Option<FunctionBody>,
9184 pub or_replace: bool,
9185 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9187 pub or_alter: bool,
9188 pub if_not_exists: bool,
9189 pub language: Option<String>,
9190 pub security: Option<FunctionSecurity>,
9191 #[serde(default)]
9193 pub return_type: Option<DataType>,
9194 #[serde(default)]
9196 pub execute_as: Option<String>,
9197 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9199 pub with_options: Vec<String>,
9200 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9202 pub has_parens: bool,
9203 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9205 pub use_proc_keyword: bool,
9206}
9207
9208impl CreateProcedure {
9209 pub fn new(name: impl Into<String>) -> Self {
9210 Self {
9211 name: TableRef::new(name),
9212 parameters: Vec::new(),
9213 body: None,
9214 or_replace: false,
9215 or_alter: false,
9216 if_not_exists: false,
9217 language: None,
9218 security: None,
9219 return_type: None,
9220 execute_as: None,
9221 with_options: Vec::new(),
9222 has_parens: true,
9223 use_proc_keyword: false,
9224 }
9225 }
9226}
9227
9228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9230#[cfg_attr(feature = "bindings", derive(TS))]
9231pub struct DropProcedure {
9232 pub name: TableRef,
9233 pub parameters: Option<Vec<DataType>>,
9234 pub if_exists: bool,
9235 pub cascade: bool,
9236}
9237
9238impl DropProcedure {
9239 pub fn new(name: impl Into<String>) -> Self {
9240 Self {
9241 name: TableRef::new(name),
9242 parameters: None,
9243 if_exists: false,
9244 cascade: false,
9245 }
9246 }
9247}
9248
9249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9251#[cfg_attr(feature = "bindings", derive(TS))]
9252pub enum SeqPropKind {
9253 Start,
9254 Increment,
9255 Minvalue,
9256 Maxvalue,
9257 Cache,
9258 NoCache,
9259 Cycle,
9260 NoCycle,
9261 OwnedBy,
9262 Order,
9263 NoOrder,
9264 Comment,
9265 Sharing,
9267 Keep,
9269 NoKeep,
9271 Scale,
9273 NoScale,
9275 Shard,
9277 NoShard,
9279 Session,
9281 Global,
9283 NoCacheWord,
9285 NoCycleWord,
9287 NoMinvalueWord,
9289 NoMaxvalueWord,
9291}
9292
9293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9295#[cfg_attr(feature = "bindings", derive(TS))]
9296pub struct CreateSynonym {
9297 pub name: TableRef,
9299 pub target: TableRef,
9301}
9302
9303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9305#[cfg_attr(feature = "bindings", derive(TS))]
9306pub struct CreateSequence {
9307 pub name: TableRef,
9308 pub if_not_exists: bool,
9309 pub temporary: bool,
9310 #[serde(default)]
9311 pub or_replace: bool,
9312 #[serde(default, skip_serializing_if = "Option::is_none")]
9314 pub as_type: Option<DataType>,
9315 pub increment: Option<i64>,
9316 pub minvalue: Option<SequenceBound>,
9317 pub maxvalue: Option<SequenceBound>,
9318 pub start: Option<i64>,
9319 pub cache: Option<i64>,
9320 pub cycle: bool,
9321 pub owned_by: Option<TableRef>,
9322 #[serde(default)]
9324 pub owned_by_none: bool,
9325 #[serde(default)]
9327 pub order: Option<bool>,
9328 #[serde(default)]
9330 pub comment: Option<String>,
9331 #[serde(default, skip_serializing_if = "Option::is_none")]
9333 pub sharing: Option<String>,
9334 #[serde(default, skip_serializing_if = "Option::is_none")]
9336 pub scale_modifier: Option<String>,
9337 #[serde(default, skip_serializing_if = "Option::is_none")]
9339 pub shard_modifier: Option<String>,
9340 #[serde(default)]
9342 pub property_order: Vec<SeqPropKind>,
9343}
9344
9345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9347#[cfg_attr(feature = "bindings", derive(TS))]
9348pub enum SequenceBound {
9349 Value(i64),
9350 None,
9351}
9352
9353impl CreateSequence {
9354 pub fn new(name: impl Into<String>) -> Self {
9355 Self {
9356 name: TableRef::new(name),
9357 if_not_exists: false,
9358 temporary: false,
9359 or_replace: false,
9360 as_type: None,
9361 increment: None,
9362 minvalue: None,
9363 maxvalue: None,
9364 start: None,
9365 cache: None,
9366 cycle: false,
9367 owned_by: None,
9368 owned_by_none: false,
9369 order: None,
9370 comment: None,
9371 sharing: None,
9372 scale_modifier: None,
9373 shard_modifier: None,
9374 property_order: Vec::new(),
9375 }
9376 }
9377}
9378
9379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9381#[cfg_attr(feature = "bindings", derive(TS))]
9382pub struct DropSequence {
9383 pub name: TableRef,
9384 pub if_exists: bool,
9385 pub cascade: bool,
9386}
9387
9388impl DropSequence {
9389 pub fn new(name: impl Into<String>) -> Self {
9390 Self {
9391 name: TableRef::new(name),
9392 if_exists: false,
9393 cascade: false,
9394 }
9395 }
9396}
9397
9398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9400#[cfg_attr(feature = "bindings", derive(TS))]
9401pub struct AlterSequence {
9402 pub name: TableRef,
9403 pub if_exists: bool,
9404 pub increment: Option<i64>,
9405 pub minvalue: Option<SequenceBound>,
9406 pub maxvalue: Option<SequenceBound>,
9407 pub start: Option<i64>,
9408 pub restart: Option<Option<i64>>,
9409 pub cache: Option<i64>,
9410 pub cycle: Option<bool>,
9411 pub owned_by: Option<Option<TableRef>>,
9412}
9413
9414impl AlterSequence {
9415 pub fn new(name: impl Into<String>) -> Self {
9416 Self {
9417 name: TableRef::new(name),
9418 if_exists: false,
9419 increment: None,
9420 minvalue: None,
9421 maxvalue: None,
9422 start: None,
9423 restart: None,
9424 cache: None,
9425 cycle: None,
9426 owned_by: None,
9427 }
9428 }
9429}
9430
9431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9433#[cfg_attr(feature = "bindings", derive(TS))]
9434pub struct CreateTrigger {
9435 pub name: Identifier,
9436 pub table: TableRef,
9437 pub timing: TriggerTiming,
9438 pub events: Vec<TriggerEvent>,
9439 #[serde(default, skip_serializing_if = "Option::is_none")]
9440 pub for_each: Option<TriggerForEach>,
9441 pub when: Option<Expression>,
9442 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9444 pub when_paren: bool,
9445 pub body: TriggerBody,
9446 pub or_replace: bool,
9447 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9449 pub or_alter: bool,
9450 pub constraint: bool,
9451 pub deferrable: Option<bool>,
9452 pub initially_deferred: Option<bool>,
9453 pub referencing: Option<TriggerReferencing>,
9454}
9455
9456#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9458#[cfg_attr(feature = "bindings", derive(TS))]
9459pub enum TriggerTiming {
9460 Before,
9461 After,
9462 InsteadOf,
9463}
9464
9465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9467#[cfg_attr(feature = "bindings", derive(TS))]
9468pub enum TriggerEvent {
9469 Insert,
9470 Update(Option<Vec<Identifier>>),
9471 Delete,
9472 Truncate,
9473}
9474
9475#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9477#[cfg_attr(feature = "bindings", derive(TS))]
9478pub enum TriggerForEach {
9479 Row,
9480 Statement,
9481}
9482
9483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9485#[cfg_attr(feature = "bindings", derive(TS))]
9486pub enum TriggerBody {
9487 Execute {
9489 function: TableRef,
9490 args: Vec<Expression>,
9491 },
9492 Block(String),
9494}
9495
9496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9498#[cfg_attr(feature = "bindings", derive(TS))]
9499pub struct TriggerReferencing {
9500 pub old_table: Option<Identifier>,
9501 pub new_table: Option<Identifier>,
9502 pub old_row: Option<Identifier>,
9503 pub new_row: Option<Identifier>,
9504}
9505
9506impl CreateTrigger {
9507 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9508 Self {
9509 name: Identifier::new(name),
9510 table: TableRef::new(table),
9511 timing: TriggerTiming::Before,
9512 events: Vec::new(),
9513 for_each: Some(TriggerForEach::Row),
9514 when: None,
9515 when_paren: false,
9516 body: TriggerBody::Execute {
9517 function: TableRef::new(""),
9518 args: Vec::new(),
9519 },
9520 or_replace: false,
9521 or_alter: false,
9522 constraint: false,
9523 deferrable: None,
9524 initially_deferred: None,
9525 referencing: None,
9526 }
9527 }
9528}
9529
9530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9532#[cfg_attr(feature = "bindings", derive(TS))]
9533pub struct DropTrigger {
9534 pub name: Identifier,
9535 pub table: Option<TableRef>,
9536 pub if_exists: bool,
9537 pub cascade: bool,
9538}
9539
9540impl DropTrigger {
9541 pub fn new(name: impl Into<String>) -> Self {
9542 Self {
9543 name: Identifier::new(name),
9544 table: None,
9545 if_exists: false,
9546 cascade: false,
9547 }
9548 }
9549}
9550
9551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9553#[cfg_attr(feature = "bindings", derive(TS))]
9554pub struct CreateType {
9555 pub name: TableRef,
9556 pub definition: TypeDefinition,
9557 pub if_not_exists: bool,
9558}
9559
9560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9562#[cfg_attr(feature = "bindings", derive(TS))]
9563pub enum TypeDefinition {
9564 Enum(Vec<String>),
9566 Composite(Vec<TypeAttribute>),
9568 Range {
9570 subtype: DataType,
9571 subtype_diff: Option<String>,
9572 canonical: Option<String>,
9573 },
9574 Base {
9576 input: String,
9577 output: String,
9578 internallength: Option<i32>,
9579 },
9580 Domain {
9582 base_type: DataType,
9583 default: Option<Expression>,
9584 constraints: Vec<DomainConstraint>,
9585 },
9586}
9587
9588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9590#[cfg_attr(feature = "bindings", derive(TS))]
9591pub struct TypeAttribute {
9592 pub name: Identifier,
9593 pub data_type: DataType,
9594 pub collate: Option<Identifier>,
9595}
9596
9597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9599#[cfg_attr(feature = "bindings", derive(TS))]
9600pub struct DomainConstraint {
9601 pub name: Option<Identifier>,
9602 pub check: Expression,
9603}
9604
9605impl CreateType {
9606 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9607 Self {
9608 name: TableRef::new(name),
9609 definition: TypeDefinition::Enum(values),
9610 if_not_exists: false,
9611 }
9612 }
9613
9614 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9615 Self {
9616 name: TableRef::new(name),
9617 definition: TypeDefinition::Composite(attributes),
9618 if_not_exists: false,
9619 }
9620 }
9621}
9622
9623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9625#[cfg_attr(feature = "bindings", derive(TS))]
9626pub struct DropType {
9627 pub name: TableRef,
9628 pub if_exists: bool,
9629 pub cascade: bool,
9630}
9631
9632impl DropType {
9633 pub fn new(name: impl Into<String>) -> Self {
9634 Self {
9635 name: TableRef::new(name),
9636 if_exists: false,
9637 cascade: false,
9638 }
9639 }
9640}
9641
9642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9644#[cfg_attr(feature = "bindings", derive(TS))]
9645pub struct Describe {
9646 pub target: Expression,
9648 pub extended: bool,
9650 pub formatted: bool,
9652 #[serde(default)]
9654 pub kind: Option<String>,
9655 #[serde(default)]
9657 pub properties: Vec<(String, String)>,
9658 #[serde(default, skip_serializing_if = "Option::is_none")]
9660 pub style: Option<String>,
9661 #[serde(default)]
9663 pub partition: Option<Box<Expression>>,
9664 #[serde(default)]
9666 pub leading_comments: Vec<String>,
9667 #[serde(default)]
9669 pub as_json: bool,
9670 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9672 pub params: Vec<String>,
9673}
9674
9675impl Describe {
9676 pub fn new(target: Expression) -> Self {
9677 Self {
9678 target,
9679 extended: false,
9680 formatted: false,
9681 kind: None,
9682 properties: Vec::new(),
9683 style: None,
9684 partition: None,
9685 leading_comments: Vec::new(),
9686 as_json: false,
9687 params: Vec::new(),
9688 }
9689 }
9690}
9691
9692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9694#[cfg_attr(feature = "bindings", derive(TS))]
9695pub struct Show {
9696 pub this: String,
9698 #[serde(default)]
9700 pub terse: bool,
9701 #[serde(default)]
9703 pub history: bool,
9704 pub like: Option<Expression>,
9706 pub scope_kind: Option<String>,
9708 pub scope: Option<Expression>,
9710 pub starts_with: Option<Expression>,
9712 pub limit: Option<Box<Limit>>,
9714 pub from: Option<Expression>,
9716 #[serde(default, skip_serializing_if = "Option::is_none")]
9718 pub where_clause: Option<Expression>,
9719 #[serde(default, skip_serializing_if = "Option::is_none")]
9721 pub for_target: Option<Expression>,
9722 #[serde(default, skip_serializing_if = "Option::is_none")]
9724 pub db: Option<Expression>,
9725 #[serde(default, skip_serializing_if = "Option::is_none")]
9727 pub target: Option<Expression>,
9728 #[serde(default, skip_serializing_if = "Option::is_none")]
9730 pub mutex: Option<bool>,
9731 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9733 pub privileges: Vec<String>,
9734}
9735
9736impl Show {
9737 pub fn new(this: impl Into<String>) -> Self {
9738 Self {
9739 this: this.into(),
9740 terse: false,
9741 history: false,
9742 like: None,
9743 scope_kind: None,
9744 scope: None,
9745 starts_with: None,
9746 limit: None,
9747 from: None,
9748 where_clause: None,
9749 for_target: None,
9750 db: None,
9751 target: None,
9752 mutex: None,
9753 privileges: Vec::new(),
9754 }
9755 }
9756}
9757
9758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9763#[cfg_attr(feature = "bindings", derive(TS))]
9764pub struct Paren {
9765 pub this: Expression,
9767 #[serde(default)]
9768 pub trailing_comments: Vec<String>,
9769}
9770
9771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9773#[cfg_attr(feature = "bindings", derive(TS))]
9774pub struct Annotated {
9775 pub this: Expression,
9776 pub trailing_comments: Vec<String>,
9777}
9778
9779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9784#[cfg_attr(feature = "bindings", derive(TS))]
9785pub struct Refresh {
9786 pub this: Box<Expression>,
9787 pub kind: String,
9788}
9789
9790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9792#[cfg_attr(feature = "bindings", derive(TS))]
9793pub struct LockingStatement {
9794 pub this: Box<Expression>,
9795 pub expression: Box<Expression>,
9796}
9797
9798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9800#[cfg_attr(feature = "bindings", derive(TS))]
9801pub struct SequenceProperties {
9802 #[serde(default)]
9803 pub increment: Option<Box<Expression>>,
9804 #[serde(default)]
9805 pub minvalue: Option<Box<Expression>>,
9806 #[serde(default)]
9807 pub maxvalue: Option<Box<Expression>>,
9808 #[serde(default)]
9809 pub cache: Option<Box<Expression>>,
9810 #[serde(default)]
9811 pub start: Option<Box<Expression>>,
9812 #[serde(default)]
9813 pub owned: Option<Box<Expression>>,
9814 #[serde(default)]
9815 pub options: Vec<Expression>,
9816}
9817
9818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9820#[cfg_attr(feature = "bindings", derive(TS))]
9821pub struct TruncateTable {
9822 #[serde(default)]
9823 pub expressions: Vec<Expression>,
9824 #[serde(default)]
9825 pub is_database: Option<Box<Expression>>,
9826 #[serde(default)]
9827 pub exists: bool,
9828 #[serde(default)]
9829 pub only: Option<Box<Expression>>,
9830 #[serde(default)]
9831 pub cluster: Option<Box<Expression>>,
9832 #[serde(default)]
9833 pub identity: Option<Box<Expression>>,
9834 #[serde(default)]
9835 pub option: Option<Box<Expression>>,
9836 #[serde(default)]
9837 pub partition: Option<Box<Expression>>,
9838}
9839
9840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9842#[cfg_attr(feature = "bindings", derive(TS))]
9843pub struct Clone {
9844 pub this: Box<Expression>,
9845 #[serde(default)]
9846 pub shallow: Option<Box<Expression>>,
9847 #[serde(default)]
9848 pub copy: Option<Box<Expression>>,
9849}
9850
9851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9853#[cfg_attr(feature = "bindings", derive(TS))]
9854pub struct Attach {
9855 pub this: Box<Expression>,
9856 #[serde(default)]
9857 pub exists: bool,
9858 #[serde(default)]
9859 pub expressions: Vec<Expression>,
9860}
9861
9862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9864#[cfg_attr(feature = "bindings", derive(TS))]
9865pub struct Detach {
9866 pub this: Box<Expression>,
9867 #[serde(default)]
9868 pub exists: bool,
9869}
9870
9871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9873#[cfg_attr(feature = "bindings", derive(TS))]
9874pub struct Install {
9875 pub this: Box<Expression>,
9876 #[serde(default)]
9877 pub from_: Option<Box<Expression>>,
9878 #[serde(default)]
9879 pub force: Option<Box<Expression>>,
9880}
9881
9882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9884#[cfg_attr(feature = "bindings", derive(TS))]
9885pub struct Summarize {
9886 pub this: Box<Expression>,
9887 #[serde(default)]
9888 pub table: Option<Box<Expression>>,
9889}
9890
9891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9893#[cfg_attr(feature = "bindings", derive(TS))]
9894pub struct Declare {
9895 #[serde(default)]
9896 pub expressions: Vec<Expression>,
9897 #[serde(default)]
9898 pub replace: bool,
9899}
9900
9901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9903#[cfg_attr(feature = "bindings", derive(TS))]
9904pub struct DeclareItem {
9905 pub this: Box<Expression>,
9906 #[serde(default)]
9907 pub kind: Option<String>,
9908 #[serde(default)]
9909 pub default: Option<Box<Expression>>,
9910 #[serde(default)]
9911 pub has_as: bool,
9912 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9914 pub additional_names: Vec<Expression>,
9915}
9916
9917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9919#[cfg_attr(feature = "bindings", derive(TS))]
9920pub struct Set {
9921 #[serde(default)]
9922 pub expressions: Vec<Expression>,
9923 #[serde(default)]
9924 pub unset: Option<Box<Expression>>,
9925 #[serde(default)]
9926 pub tag: Option<Box<Expression>>,
9927}
9928
9929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9931#[cfg_attr(feature = "bindings", derive(TS))]
9932pub struct Heredoc {
9933 pub this: Box<Expression>,
9934 #[serde(default)]
9935 pub tag: Option<Box<Expression>>,
9936}
9937
9938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9940#[cfg_attr(feature = "bindings", derive(TS))]
9941pub struct QueryBand {
9942 pub this: Box<Expression>,
9943 #[serde(default)]
9944 pub scope: Option<Box<Expression>>,
9945 #[serde(default)]
9946 pub update: Option<Box<Expression>>,
9947}
9948
9949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9951#[cfg_attr(feature = "bindings", derive(TS))]
9952pub struct UserDefinedFunction {
9953 pub this: Box<Expression>,
9954 #[serde(default)]
9955 pub expressions: Vec<Expression>,
9956 #[serde(default)]
9957 pub wrapped: Option<Box<Expression>>,
9958}
9959
9960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9962#[cfg_attr(feature = "bindings", derive(TS))]
9963pub struct RecursiveWithSearch {
9964 pub kind: String,
9965 pub this: Box<Expression>,
9966 pub expression: Box<Expression>,
9967 #[serde(default)]
9968 pub using: Option<Box<Expression>>,
9969}
9970
9971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9973#[cfg_attr(feature = "bindings", derive(TS))]
9974pub struct ProjectionDef {
9975 pub this: Box<Expression>,
9976 pub expression: Box<Expression>,
9977}
9978
9979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9981#[cfg_attr(feature = "bindings", derive(TS))]
9982pub struct TableAlias {
9983 #[serde(default)]
9984 pub this: Option<Box<Expression>>,
9985 #[serde(default)]
9986 pub columns: Vec<Expression>,
9987}
9988
9989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9991#[cfg_attr(feature = "bindings", derive(TS))]
9992pub struct ByteString {
9993 pub this: Box<Expression>,
9994 #[serde(default)]
9995 pub is_bytes: Option<Box<Expression>>,
9996}
9997
9998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10001#[cfg_attr(feature = "bindings", derive(TS))]
10002pub struct HexStringExpr {
10003 pub this: Box<Expression>,
10004 #[serde(default)]
10005 pub is_integer: Option<bool>,
10006}
10007
10008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10010#[cfg_attr(feature = "bindings", derive(TS))]
10011pub struct UnicodeString {
10012 pub this: Box<Expression>,
10013 #[serde(default)]
10014 pub escape: Option<Box<Expression>>,
10015}
10016
10017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10019#[cfg_attr(feature = "bindings", derive(TS))]
10020pub struct AlterColumn {
10021 pub this: Box<Expression>,
10022 #[serde(default)]
10023 pub dtype: Option<Box<Expression>>,
10024 #[serde(default)]
10025 pub collate: Option<Box<Expression>>,
10026 #[serde(default)]
10027 pub using: Option<Box<Expression>>,
10028 #[serde(default)]
10029 pub default: Option<Box<Expression>>,
10030 #[serde(default)]
10031 pub drop: Option<Box<Expression>>,
10032 #[serde(default)]
10033 pub comment: Option<Box<Expression>>,
10034 #[serde(default)]
10035 pub allow_null: Option<Box<Expression>>,
10036 #[serde(default)]
10037 pub visible: Option<Box<Expression>>,
10038 #[serde(default)]
10039 pub rename_to: Option<Box<Expression>>,
10040}
10041
10042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10044#[cfg_attr(feature = "bindings", derive(TS))]
10045pub struct AlterSortKey {
10046 #[serde(default)]
10047 pub this: Option<Box<Expression>>,
10048 #[serde(default)]
10049 pub expressions: Vec<Expression>,
10050 #[serde(default)]
10051 pub compound: Option<Box<Expression>>,
10052}
10053
10054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10056#[cfg_attr(feature = "bindings", derive(TS))]
10057pub struct AlterSet {
10058 #[serde(default)]
10059 pub expressions: Vec<Expression>,
10060 #[serde(default)]
10061 pub option: Option<Box<Expression>>,
10062 #[serde(default)]
10063 pub tablespace: Option<Box<Expression>>,
10064 #[serde(default)]
10065 pub access_method: Option<Box<Expression>>,
10066 #[serde(default)]
10067 pub file_format: Option<Box<Expression>>,
10068 #[serde(default)]
10069 pub copy_options: Option<Box<Expression>>,
10070 #[serde(default)]
10071 pub tag: Option<Box<Expression>>,
10072 #[serde(default)]
10073 pub location: Option<Box<Expression>>,
10074 #[serde(default)]
10075 pub serde: Option<Box<Expression>>,
10076}
10077
10078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10080#[cfg_attr(feature = "bindings", derive(TS))]
10081pub struct RenameColumn {
10082 pub this: Box<Expression>,
10083 #[serde(default)]
10084 pub to: Option<Box<Expression>>,
10085 #[serde(default)]
10086 pub exists: bool,
10087}
10088
10089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10091#[cfg_attr(feature = "bindings", derive(TS))]
10092pub struct Comprehension {
10093 pub this: Box<Expression>,
10094 pub expression: Box<Expression>,
10095 #[serde(default)]
10096 pub position: Option<Box<Expression>>,
10097 #[serde(default)]
10098 pub iterator: Option<Box<Expression>>,
10099 #[serde(default)]
10100 pub condition: Option<Box<Expression>>,
10101}
10102
10103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10105#[cfg_attr(feature = "bindings", derive(TS))]
10106pub struct MergeTreeTTLAction {
10107 pub this: Box<Expression>,
10108 #[serde(default)]
10109 pub delete: Option<Box<Expression>>,
10110 #[serde(default)]
10111 pub recompress: Option<Box<Expression>>,
10112 #[serde(default)]
10113 pub to_disk: Option<Box<Expression>>,
10114 #[serde(default)]
10115 pub to_volume: Option<Box<Expression>>,
10116}
10117
10118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10120#[cfg_attr(feature = "bindings", derive(TS))]
10121pub struct MergeTreeTTL {
10122 #[serde(default)]
10123 pub expressions: Vec<Expression>,
10124 #[serde(default)]
10125 pub where_: Option<Box<Expression>>,
10126 #[serde(default)]
10127 pub group: Option<Box<Expression>>,
10128 #[serde(default)]
10129 pub aggregates: Option<Box<Expression>>,
10130}
10131
10132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10134#[cfg_attr(feature = "bindings", derive(TS))]
10135pub struct IndexConstraintOption {
10136 #[serde(default)]
10137 pub key_block_size: Option<Box<Expression>>,
10138 #[serde(default)]
10139 pub using: Option<Box<Expression>>,
10140 #[serde(default)]
10141 pub parser: Option<Box<Expression>>,
10142 #[serde(default)]
10143 pub comment: Option<Box<Expression>>,
10144 #[serde(default)]
10145 pub visible: Option<Box<Expression>>,
10146 #[serde(default)]
10147 pub engine_attr: Option<Box<Expression>>,
10148 #[serde(default)]
10149 pub secondary_engine_attr: Option<Box<Expression>>,
10150}
10151
10152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10154#[cfg_attr(feature = "bindings", derive(TS))]
10155pub struct PeriodForSystemTimeConstraint {
10156 pub this: Box<Expression>,
10157 pub expression: Box<Expression>,
10158}
10159
10160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10162#[cfg_attr(feature = "bindings", derive(TS))]
10163pub struct CaseSpecificColumnConstraint {
10164 #[serde(default)]
10165 pub not_: Option<Box<Expression>>,
10166}
10167
10168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10170#[cfg_attr(feature = "bindings", derive(TS))]
10171pub struct CharacterSetColumnConstraint {
10172 pub this: Box<Expression>,
10173}
10174
10175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10177#[cfg_attr(feature = "bindings", derive(TS))]
10178pub struct CheckColumnConstraint {
10179 pub this: Box<Expression>,
10180 #[serde(default)]
10181 pub enforced: Option<Box<Expression>>,
10182}
10183
10184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10186#[cfg_attr(feature = "bindings", derive(TS))]
10187pub struct AssumeColumnConstraint {
10188 pub this: Box<Expression>,
10189}
10190
10191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10193#[cfg_attr(feature = "bindings", derive(TS))]
10194pub struct CompressColumnConstraint {
10195 #[serde(default)]
10196 pub this: Option<Box<Expression>>,
10197}
10198
10199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10201#[cfg_attr(feature = "bindings", derive(TS))]
10202pub struct DateFormatColumnConstraint {
10203 pub this: Box<Expression>,
10204}
10205
10206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10208#[cfg_attr(feature = "bindings", derive(TS))]
10209pub struct EphemeralColumnConstraint {
10210 #[serde(default)]
10211 pub this: Option<Box<Expression>>,
10212}
10213
10214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10216#[cfg_attr(feature = "bindings", derive(TS))]
10217pub struct WithOperator {
10218 pub this: Box<Expression>,
10219 pub op: String,
10220}
10221
10222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10224#[cfg_attr(feature = "bindings", derive(TS))]
10225pub struct GeneratedAsIdentityColumnConstraint {
10226 #[serde(default)]
10227 pub this: Option<Box<Expression>>,
10228 #[serde(default)]
10229 pub expression: Option<Box<Expression>>,
10230 #[serde(default)]
10231 pub on_null: Option<Box<Expression>>,
10232 #[serde(default)]
10233 pub start: Option<Box<Expression>>,
10234 #[serde(default)]
10235 pub increment: Option<Box<Expression>>,
10236 #[serde(default)]
10237 pub minvalue: Option<Box<Expression>>,
10238 #[serde(default)]
10239 pub maxvalue: Option<Box<Expression>>,
10240 #[serde(default)]
10241 pub cycle: Option<Box<Expression>>,
10242 #[serde(default)]
10243 pub order: Option<Box<Expression>>,
10244}
10245
10246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10249#[cfg_attr(feature = "bindings", derive(TS))]
10250pub struct AutoIncrementColumnConstraint;
10251
10252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10254#[cfg_attr(feature = "bindings", derive(TS))]
10255pub struct CommentColumnConstraint;
10256
10257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10259#[cfg_attr(feature = "bindings", derive(TS))]
10260pub struct GeneratedAsRowColumnConstraint {
10261 #[serde(default)]
10262 pub start: Option<Box<Expression>>,
10263 #[serde(default)]
10264 pub hidden: Option<Box<Expression>>,
10265}
10266
10267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10269#[cfg_attr(feature = "bindings", derive(TS))]
10270pub struct IndexColumnConstraint {
10271 #[serde(default)]
10272 pub this: Option<Box<Expression>>,
10273 #[serde(default)]
10274 pub expressions: Vec<Expression>,
10275 #[serde(default)]
10276 pub kind: Option<String>,
10277 #[serde(default)]
10278 pub index_type: Option<Box<Expression>>,
10279 #[serde(default)]
10280 pub options: Vec<Expression>,
10281 #[serde(default)]
10282 pub expression: Option<Box<Expression>>,
10283 #[serde(default)]
10284 pub granularity: Option<Box<Expression>>,
10285}
10286
10287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10289#[cfg_attr(feature = "bindings", derive(TS))]
10290pub struct MaskingPolicyColumnConstraint {
10291 pub this: Box<Expression>,
10292 #[serde(default)]
10293 pub expressions: Vec<Expression>,
10294}
10295
10296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10298#[cfg_attr(feature = "bindings", derive(TS))]
10299pub struct NotNullColumnConstraint {
10300 #[serde(default)]
10301 pub allow_null: Option<Box<Expression>>,
10302}
10303
10304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10306#[cfg_attr(feature = "bindings", derive(TS))]
10307pub struct DefaultColumnConstraint {
10308 pub this: Box<Expression>,
10309 #[serde(default, skip_serializing_if = "Option::is_none")]
10311 pub for_column: Option<Identifier>,
10312}
10313
10314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10316#[cfg_attr(feature = "bindings", derive(TS))]
10317pub struct PrimaryKeyColumnConstraint {
10318 #[serde(default)]
10319 pub desc: Option<Box<Expression>>,
10320 #[serde(default)]
10321 pub options: Vec<Expression>,
10322}
10323
10324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10326#[cfg_attr(feature = "bindings", derive(TS))]
10327pub struct UniqueColumnConstraint {
10328 #[serde(default)]
10329 pub this: Option<Box<Expression>>,
10330 #[serde(default)]
10331 pub index_type: Option<Box<Expression>>,
10332 #[serde(default)]
10333 pub on_conflict: Option<Box<Expression>>,
10334 #[serde(default)]
10335 pub nulls: Option<Box<Expression>>,
10336 #[serde(default)]
10337 pub options: Vec<Expression>,
10338}
10339
10340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10342#[cfg_attr(feature = "bindings", derive(TS))]
10343pub struct WatermarkColumnConstraint {
10344 pub this: Box<Expression>,
10345 pub expression: Box<Expression>,
10346}
10347
10348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10350#[cfg_attr(feature = "bindings", derive(TS))]
10351pub struct ComputedColumnConstraint {
10352 pub this: Box<Expression>,
10353 #[serde(default)]
10354 pub persisted: Option<Box<Expression>>,
10355 #[serde(default)]
10356 pub not_null: Option<Box<Expression>>,
10357 #[serde(default)]
10358 pub data_type: Option<Box<Expression>>,
10359}
10360
10361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10363#[cfg_attr(feature = "bindings", derive(TS))]
10364pub struct InOutColumnConstraint {
10365 #[serde(default)]
10366 pub input_: Option<Box<Expression>>,
10367 #[serde(default)]
10368 pub output: Option<Box<Expression>>,
10369}
10370
10371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10373#[cfg_attr(feature = "bindings", derive(TS))]
10374pub struct PathColumnConstraint {
10375 pub this: Box<Expression>,
10376}
10377
10378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10380#[cfg_attr(feature = "bindings", derive(TS))]
10381pub struct Constraint {
10382 pub this: Box<Expression>,
10383 #[serde(default)]
10384 pub expressions: Vec<Expression>,
10385}
10386
10387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10389#[cfg_attr(feature = "bindings", derive(TS))]
10390pub struct Export {
10391 pub this: Box<Expression>,
10392 #[serde(default)]
10393 pub connection: Option<Box<Expression>>,
10394 #[serde(default)]
10395 pub options: Vec<Expression>,
10396}
10397
10398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10400#[cfg_attr(feature = "bindings", derive(TS))]
10401pub struct Filter {
10402 pub this: Box<Expression>,
10403 pub expression: Box<Expression>,
10404}
10405
10406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10408#[cfg_attr(feature = "bindings", derive(TS))]
10409pub struct Changes {
10410 #[serde(default)]
10411 pub information: Option<Box<Expression>>,
10412 #[serde(default)]
10413 pub at_before: Option<Box<Expression>>,
10414 #[serde(default)]
10415 pub end: Option<Box<Expression>>,
10416}
10417
10418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10420#[cfg_attr(feature = "bindings", derive(TS))]
10421pub struct Directory {
10422 pub this: Box<Expression>,
10423 #[serde(default)]
10424 pub local: Option<Box<Expression>>,
10425 #[serde(default)]
10426 pub row_format: Option<Box<Expression>>,
10427}
10428
10429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10431#[cfg_attr(feature = "bindings", derive(TS))]
10432pub struct ForeignKey {
10433 #[serde(default)]
10434 pub expressions: Vec<Expression>,
10435 #[serde(default)]
10436 pub reference: Option<Box<Expression>>,
10437 #[serde(default)]
10438 pub delete: Option<Box<Expression>>,
10439 #[serde(default)]
10440 pub update: Option<Box<Expression>>,
10441 #[serde(default)]
10442 pub options: Vec<Expression>,
10443}
10444
10445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10447#[cfg_attr(feature = "bindings", derive(TS))]
10448pub struct ColumnPrefix {
10449 pub this: Box<Expression>,
10450 pub expression: Box<Expression>,
10451}
10452
10453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10455#[cfg_attr(feature = "bindings", derive(TS))]
10456pub struct PrimaryKey {
10457 #[serde(default)]
10458 pub this: Option<Box<Expression>>,
10459 #[serde(default)]
10460 pub expressions: Vec<Expression>,
10461 #[serde(default)]
10462 pub options: Vec<Expression>,
10463 #[serde(default)]
10464 pub include: Option<Box<Expression>>,
10465}
10466
10467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10469#[cfg_attr(feature = "bindings", derive(TS))]
10470pub struct IntoClause {
10471 #[serde(default)]
10472 pub this: Option<Box<Expression>>,
10473 #[serde(default)]
10474 pub temporary: bool,
10475 #[serde(default)]
10476 pub unlogged: Option<Box<Expression>>,
10477 #[serde(default)]
10478 pub bulk_collect: Option<Box<Expression>>,
10479 #[serde(default)]
10480 pub expressions: Vec<Expression>,
10481}
10482
10483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10485#[cfg_attr(feature = "bindings", derive(TS))]
10486pub struct JoinHint {
10487 pub this: Box<Expression>,
10488 #[serde(default)]
10489 pub expressions: Vec<Expression>,
10490}
10491
10492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10494#[cfg_attr(feature = "bindings", derive(TS))]
10495pub struct Opclass {
10496 pub this: Box<Expression>,
10497 pub expression: Box<Expression>,
10498}
10499
10500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10502#[cfg_attr(feature = "bindings", derive(TS))]
10503pub struct Index {
10504 #[serde(default)]
10505 pub this: Option<Box<Expression>>,
10506 #[serde(default)]
10507 pub table: Option<Box<Expression>>,
10508 #[serde(default)]
10509 pub unique: bool,
10510 #[serde(default)]
10511 pub primary: Option<Box<Expression>>,
10512 #[serde(default)]
10513 pub amp: Option<Box<Expression>>,
10514 #[serde(default)]
10515 pub params: Vec<Expression>,
10516}
10517
10518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10520#[cfg_attr(feature = "bindings", derive(TS))]
10521pub struct IndexParameters {
10522 #[serde(default)]
10523 pub using: Option<Box<Expression>>,
10524 #[serde(default)]
10525 pub include: Option<Box<Expression>>,
10526 #[serde(default)]
10527 pub columns: Vec<Expression>,
10528 #[serde(default)]
10529 pub with_storage: Option<Box<Expression>>,
10530 #[serde(default)]
10531 pub partition_by: Option<Box<Expression>>,
10532 #[serde(default)]
10533 pub tablespace: Option<Box<Expression>>,
10534 #[serde(default)]
10535 pub where_: Option<Box<Expression>>,
10536 #[serde(default)]
10537 pub on: Option<Box<Expression>>,
10538}
10539
10540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10542#[cfg_attr(feature = "bindings", derive(TS))]
10543pub struct ConditionalInsert {
10544 pub this: Box<Expression>,
10545 #[serde(default)]
10546 pub expression: Option<Box<Expression>>,
10547 #[serde(default)]
10548 pub else_: Option<Box<Expression>>,
10549}
10550
10551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10553#[cfg_attr(feature = "bindings", derive(TS))]
10554pub struct MultitableInserts {
10555 #[serde(default)]
10556 pub expressions: Vec<Expression>,
10557 pub kind: String,
10558 #[serde(default)]
10559 pub source: Option<Box<Expression>>,
10560 #[serde(default)]
10562 pub leading_comments: Vec<String>,
10563}
10564
10565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10567#[cfg_attr(feature = "bindings", derive(TS))]
10568pub struct OnConflict {
10569 #[serde(default)]
10570 pub duplicate: Option<Box<Expression>>,
10571 #[serde(default)]
10572 pub expressions: Vec<Expression>,
10573 #[serde(default)]
10574 pub action: Option<Box<Expression>>,
10575 #[serde(default)]
10576 pub conflict_keys: Option<Box<Expression>>,
10577 #[serde(default)]
10578 pub index_predicate: Option<Box<Expression>>,
10579 #[serde(default)]
10580 pub constraint: Option<Box<Expression>>,
10581 #[serde(default)]
10582 pub where_: Option<Box<Expression>>,
10583}
10584
10585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10587#[cfg_attr(feature = "bindings", derive(TS))]
10588pub struct OnCondition {
10589 #[serde(default)]
10590 pub error: Option<Box<Expression>>,
10591 #[serde(default)]
10592 pub empty: Option<Box<Expression>>,
10593 #[serde(default)]
10594 pub null: Option<Box<Expression>>,
10595}
10596
10597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10599#[cfg_attr(feature = "bindings", derive(TS))]
10600pub struct Returning {
10601 #[serde(default)]
10602 pub expressions: Vec<Expression>,
10603 #[serde(default)]
10604 pub into: Option<Box<Expression>>,
10605}
10606
10607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10609#[cfg_attr(feature = "bindings", derive(TS))]
10610pub struct Introducer {
10611 pub this: Box<Expression>,
10612 pub expression: Box<Expression>,
10613}
10614
10615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10617#[cfg_attr(feature = "bindings", derive(TS))]
10618pub struct PartitionRange {
10619 pub this: Box<Expression>,
10620 #[serde(default)]
10621 pub expression: Option<Box<Expression>>,
10622 #[serde(default)]
10623 pub expressions: Vec<Expression>,
10624}
10625
10626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10628#[cfg_attr(feature = "bindings", derive(TS))]
10629pub struct Group {
10630 #[serde(default)]
10631 pub expressions: Vec<Expression>,
10632 #[serde(default)]
10633 pub grouping_sets: Option<Box<Expression>>,
10634 #[serde(default)]
10635 pub cube: Option<Box<Expression>>,
10636 #[serde(default)]
10637 pub rollup: Option<Box<Expression>>,
10638 #[serde(default)]
10639 pub totals: Option<Box<Expression>>,
10640 #[serde(default)]
10642 pub all: Option<bool>,
10643}
10644
10645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10647#[cfg_attr(feature = "bindings", derive(TS))]
10648pub struct Cube {
10649 #[serde(default)]
10650 pub expressions: Vec<Expression>,
10651}
10652
10653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10655#[cfg_attr(feature = "bindings", derive(TS))]
10656pub struct Rollup {
10657 #[serde(default)]
10658 pub expressions: Vec<Expression>,
10659}
10660
10661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10663#[cfg_attr(feature = "bindings", derive(TS))]
10664pub struct GroupingSets {
10665 #[serde(default)]
10666 pub expressions: Vec<Expression>,
10667}
10668
10669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10671#[cfg_attr(feature = "bindings", derive(TS))]
10672pub struct LimitOptions {
10673 #[serde(default)]
10674 pub percent: Option<Box<Expression>>,
10675 #[serde(default)]
10676 pub rows: Option<Box<Expression>>,
10677 #[serde(default)]
10678 pub with_ties: Option<Box<Expression>>,
10679}
10680
10681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10683#[cfg_attr(feature = "bindings", derive(TS))]
10684pub struct Lateral {
10685 pub this: Box<Expression>,
10686 #[serde(default)]
10687 pub view: Option<Box<Expression>>,
10688 #[serde(default)]
10689 pub outer: Option<Box<Expression>>,
10690 #[serde(default)]
10691 pub alias: Option<String>,
10692 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10694 pub alias_quoted: bool,
10695 #[serde(default)]
10696 pub cross_apply: Option<Box<Expression>>,
10697 #[serde(default)]
10698 pub ordinality: Option<Box<Expression>>,
10699 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10701 pub column_aliases: Vec<String>,
10702}
10703
10704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10706#[cfg_attr(feature = "bindings", derive(TS))]
10707pub struct TableFromRows {
10708 pub this: Box<Expression>,
10709 #[serde(default)]
10710 pub alias: Option<String>,
10711 #[serde(default)]
10712 pub joins: Vec<Expression>,
10713 #[serde(default)]
10714 pub pivots: Option<Box<Expression>>,
10715 #[serde(default)]
10716 pub sample: Option<Box<Expression>>,
10717}
10718
10719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10722#[cfg_attr(feature = "bindings", derive(TS))]
10723pub struct RowsFrom {
10724 pub expressions: Vec<Expression>,
10726 #[serde(default)]
10728 pub ordinality: bool,
10729 #[serde(default)]
10731 pub alias: Option<Box<Expression>>,
10732}
10733
10734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10736#[cfg_attr(feature = "bindings", derive(TS))]
10737pub struct WithFill {
10738 #[serde(default)]
10739 pub from_: Option<Box<Expression>>,
10740 #[serde(default)]
10741 pub to: Option<Box<Expression>>,
10742 #[serde(default)]
10743 pub step: Option<Box<Expression>>,
10744 #[serde(default)]
10745 pub staleness: Option<Box<Expression>>,
10746 #[serde(default)]
10747 pub interpolate: Option<Box<Expression>>,
10748}
10749
10750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10752#[cfg_attr(feature = "bindings", derive(TS))]
10753pub struct Property {
10754 pub this: Box<Expression>,
10755 #[serde(default)]
10756 pub value: Option<Box<Expression>>,
10757}
10758
10759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10761#[cfg_attr(feature = "bindings", derive(TS))]
10762pub struct GrantPrivilege {
10763 pub this: Box<Expression>,
10764 #[serde(default)]
10765 pub expressions: Vec<Expression>,
10766}
10767
10768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10770#[cfg_attr(feature = "bindings", derive(TS))]
10771pub struct AllowedValuesProperty {
10772 #[serde(default)]
10773 pub expressions: Vec<Expression>,
10774}
10775
10776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10778#[cfg_attr(feature = "bindings", derive(TS))]
10779pub struct AlgorithmProperty {
10780 pub this: Box<Expression>,
10781}
10782
10783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10785#[cfg_attr(feature = "bindings", derive(TS))]
10786pub struct AutoIncrementProperty {
10787 pub this: Box<Expression>,
10788}
10789
10790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10792#[cfg_attr(feature = "bindings", derive(TS))]
10793pub struct AutoRefreshProperty {
10794 pub this: Box<Expression>,
10795}
10796
10797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10799#[cfg_attr(feature = "bindings", derive(TS))]
10800pub struct BackupProperty {
10801 pub this: Box<Expression>,
10802}
10803
10804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10806#[cfg_attr(feature = "bindings", derive(TS))]
10807pub struct BuildProperty {
10808 pub this: Box<Expression>,
10809}
10810
10811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10813#[cfg_attr(feature = "bindings", derive(TS))]
10814pub struct BlockCompressionProperty {
10815 #[serde(default)]
10816 pub autotemp: Option<Box<Expression>>,
10817 #[serde(default)]
10818 pub always: Option<Box<Expression>>,
10819 #[serde(default)]
10820 pub default: Option<Box<Expression>>,
10821 #[serde(default)]
10822 pub manual: Option<Box<Expression>>,
10823 #[serde(default)]
10824 pub never: Option<Box<Expression>>,
10825}
10826
10827#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10829#[cfg_attr(feature = "bindings", derive(TS))]
10830pub struct CharacterSetProperty {
10831 pub this: Box<Expression>,
10832 #[serde(default)]
10833 pub default: Option<Box<Expression>>,
10834}
10835
10836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10838#[cfg_attr(feature = "bindings", derive(TS))]
10839pub struct ChecksumProperty {
10840 #[serde(default)]
10841 pub on: Option<Box<Expression>>,
10842 #[serde(default)]
10843 pub default: Option<Box<Expression>>,
10844}
10845
10846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10848#[cfg_attr(feature = "bindings", derive(TS))]
10849pub struct CollateProperty {
10850 pub this: Box<Expression>,
10851 #[serde(default)]
10852 pub default: Option<Box<Expression>>,
10853}
10854
10855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10857#[cfg_attr(feature = "bindings", derive(TS))]
10858pub struct DataBlocksizeProperty {
10859 #[serde(default)]
10860 pub size: Option<i64>,
10861 #[serde(default)]
10862 pub units: Option<Box<Expression>>,
10863 #[serde(default)]
10864 pub minimum: Option<Box<Expression>>,
10865 #[serde(default)]
10866 pub maximum: Option<Box<Expression>>,
10867 #[serde(default)]
10868 pub default: Option<Box<Expression>>,
10869}
10870
10871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10873#[cfg_attr(feature = "bindings", derive(TS))]
10874pub struct DataDeletionProperty {
10875 pub on: Box<Expression>,
10876 #[serde(default)]
10877 pub filter_column: Option<Box<Expression>>,
10878 #[serde(default)]
10879 pub retention_period: Option<Box<Expression>>,
10880}
10881
10882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10884#[cfg_attr(feature = "bindings", derive(TS))]
10885pub struct DefinerProperty {
10886 pub this: Box<Expression>,
10887}
10888
10889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10891#[cfg_attr(feature = "bindings", derive(TS))]
10892pub struct DistKeyProperty {
10893 pub this: Box<Expression>,
10894}
10895
10896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10898#[cfg_attr(feature = "bindings", derive(TS))]
10899pub struct DistributedByProperty {
10900 #[serde(default)]
10901 pub expressions: Vec<Expression>,
10902 pub kind: String,
10903 #[serde(default)]
10904 pub buckets: Option<Box<Expression>>,
10905 #[serde(default)]
10906 pub order: Option<Box<Expression>>,
10907}
10908
10909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10911#[cfg_attr(feature = "bindings", derive(TS))]
10912pub struct DistStyleProperty {
10913 pub this: Box<Expression>,
10914}
10915
10916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10918#[cfg_attr(feature = "bindings", derive(TS))]
10919pub struct DuplicateKeyProperty {
10920 #[serde(default)]
10921 pub expressions: Vec<Expression>,
10922}
10923
10924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10926#[cfg_attr(feature = "bindings", derive(TS))]
10927pub struct EngineProperty {
10928 pub this: Box<Expression>,
10929}
10930
10931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10933#[cfg_attr(feature = "bindings", derive(TS))]
10934pub struct ToTableProperty {
10935 pub this: Box<Expression>,
10936}
10937
10938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10940#[cfg_attr(feature = "bindings", derive(TS))]
10941pub struct ExecuteAsProperty {
10942 pub this: Box<Expression>,
10943}
10944
10945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10947#[cfg_attr(feature = "bindings", derive(TS))]
10948pub struct ExternalProperty {
10949 #[serde(default)]
10950 pub this: Option<Box<Expression>>,
10951}
10952
10953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10955#[cfg_attr(feature = "bindings", derive(TS))]
10956pub struct FallbackProperty {
10957 #[serde(default)]
10958 pub no: Option<Box<Expression>>,
10959 #[serde(default)]
10960 pub protection: Option<Box<Expression>>,
10961}
10962
10963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10965#[cfg_attr(feature = "bindings", derive(TS))]
10966pub struct FileFormatProperty {
10967 #[serde(default)]
10968 pub this: Option<Box<Expression>>,
10969 #[serde(default)]
10970 pub expressions: Vec<Expression>,
10971 #[serde(default)]
10972 pub hive_format: Option<Box<Expression>>,
10973}
10974
10975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10977#[cfg_attr(feature = "bindings", derive(TS))]
10978pub struct CredentialsProperty {
10979 #[serde(default)]
10980 pub expressions: Vec<Expression>,
10981}
10982
10983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10985#[cfg_attr(feature = "bindings", derive(TS))]
10986pub struct FreespaceProperty {
10987 pub this: Box<Expression>,
10988 #[serde(default)]
10989 pub percent: Option<Box<Expression>>,
10990}
10991
10992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10994#[cfg_attr(feature = "bindings", derive(TS))]
10995pub struct InheritsProperty {
10996 #[serde(default)]
10997 pub expressions: Vec<Expression>,
10998}
10999
11000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11002#[cfg_attr(feature = "bindings", derive(TS))]
11003pub struct InputModelProperty {
11004 pub this: Box<Expression>,
11005}
11006
11007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11009#[cfg_attr(feature = "bindings", derive(TS))]
11010pub struct OutputModelProperty {
11011 pub this: Box<Expression>,
11012}
11013
11014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11016#[cfg_attr(feature = "bindings", derive(TS))]
11017pub struct IsolatedLoadingProperty {
11018 #[serde(default)]
11019 pub no: Option<Box<Expression>>,
11020 #[serde(default)]
11021 pub concurrent: Option<Box<Expression>>,
11022 #[serde(default)]
11023 pub target: Option<Box<Expression>>,
11024}
11025
11026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11028#[cfg_attr(feature = "bindings", derive(TS))]
11029pub struct JournalProperty {
11030 #[serde(default)]
11031 pub no: Option<Box<Expression>>,
11032 #[serde(default)]
11033 pub dual: Option<Box<Expression>>,
11034 #[serde(default)]
11035 pub before: Option<Box<Expression>>,
11036 #[serde(default)]
11037 pub local: Option<Box<Expression>>,
11038 #[serde(default)]
11039 pub after: Option<Box<Expression>>,
11040}
11041
11042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11044#[cfg_attr(feature = "bindings", derive(TS))]
11045pub struct LanguageProperty {
11046 pub this: Box<Expression>,
11047}
11048
11049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11051#[cfg_attr(feature = "bindings", derive(TS))]
11052pub struct EnviromentProperty {
11053 #[serde(default)]
11054 pub expressions: Vec<Expression>,
11055}
11056
11057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11059#[cfg_attr(feature = "bindings", derive(TS))]
11060pub struct ClusteredByProperty {
11061 #[serde(default)]
11062 pub expressions: Vec<Expression>,
11063 #[serde(default)]
11064 pub sorted_by: Option<Box<Expression>>,
11065 #[serde(default)]
11066 pub buckets: Option<Box<Expression>>,
11067}
11068
11069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11071#[cfg_attr(feature = "bindings", derive(TS))]
11072pub struct DictProperty {
11073 pub this: Box<Expression>,
11074 pub kind: String,
11075 #[serde(default)]
11076 pub settings: Option<Box<Expression>>,
11077}
11078
11079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11081#[cfg_attr(feature = "bindings", derive(TS))]
11082pub struct DictRange {
11083 pub this: Box<Expression>,
11084 #[serde(default)]
11085 pub min: Option<Box<Expression>>,
11086 #[serde(default)]
11087 pub max: Option<Box<Expression>>,
11088}
11089
11090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11092#[cfg_attr(feature = "bindings", derive(TS))]
11093pub struct OnCluster {
11094 pub this: Box<Expression>,
11095}
11096
11097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11099#[cfg_attr(feature = "bindings", derive(TS))]
11100pub struct LikeProperty {
11101 pub this: Box<Expression>,
11102 #[serde(default)]
11103 pub expressions: Vec<Expression>,
11104}
11105
11106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11108#[cfg_attr(feature = "bindings", derive(TS))]
11109pub struct LocationProperty {
11110 pub this: Box<Expression>,
11111}
11112
11113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11115#[cfg_attr(feature = "bindings", derive(TS))]
11116pub struct LockProperty {
11117 pub this: Box<Expression>,
11118}
11119
11120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11122#[cfg_attr(feature = "bindings", derive(TS))]
11123pub struct LockingProperty {
11124 #[serde(default)]
11125 pub this: Option<Box<Expression>>,
11126 pub kind: String,
11127 #[serde(default)]
11128 pub for_or_in: Option<Box<Expression>>,
11129 #[serde(default)]
11130 pub lock_type: Option<Box<Expression>>,
11131 #[serde(default)]
11132 pub override_: Option<Box<Expression>>,
11133}
11134
11135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11137#[cfg_attr(feature = "bindings", derive(TS))]
11138pub struct LogProperty {
11139 #[serde(default)]
11140 pub no: Option<Box<Expression>>,
11141}
11142
11143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11145#[cfg_attr(feature = "bindings", derive(TS))]
11146pub struct MaterializedProperty {
11147 #[serde(default)]
11148 pub this: Option<Box<Expression>>,
11149}
11150
11151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11153#[cfg_attr(feature = "bindings", derive(TS))]
11154pub struct MergeBlockRatioProperty {
11155 #[serde(default)]
11156 pub this: Option<Box<Expression>>,
11157 #[serde(default)]
11158 pub no: Option<Box<Expression>>,
11159 #[serde(default)]
11160 pub default: Option<Box<Expression>>,
11161 #[serde(default)]
11162 pub percent: Option<Box<Expression>>,
11163}
11164
11165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11167#[cfg_attr(feature = "bindings", derive(TS))]
11168pub struct OnProperty {
11169 pub this: Box<Expression>,
11170}
11171
11172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11174#[cfg_attr(feature = "bindings", derive(TS))]
11175pub struct OnCommitProperty {
11176 #[serde(default)]
11177 pub delete: Option<Box<Expression>>,
11178}
11179
11180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11182#[cfg_attr(feature = "bindings", derive(TS))]
11183pub struct PartitionedByProperty {
11184 pub this: Box<Expression>,
11185}
11186
11187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11189#[cfg_attr(feature = "bindings", derive(TS))]
11190pub struct PartitionByProperty {
11191 #[serde(default)]
11192 pub expressions: Vec<Expression>,
11193}
11194
11195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11197#[cfg_attr(feature = "bindings", derive(TS))]
11198pub struct PartitionedByBucket {
11199 pub this: Box<Expression>,
11200 pub expression: Box<Expression>,
11201}
11202
11203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11205#[cfg_attr(feature = "bindings", derive(TS))]
11206pub struct ClusterByColumnsProperty {
11207 #[serde(default)]
11208 pub columns: Vec<Identifier>,
11209}
11210
11211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11213#[cfg_attr(feature = "bindings", derive(TS))]
11214pub struct PartitionByTruncate {
11215 pub this: Box<Expression>,
11216 pub expression: Box<Expression>,
11217}
11218
11219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11221#[cfg_attr(feature = "bindings", derive(TS))]
11222pub struct PartitionByRangeProperty {
11223 #[serde(default)]
11224 pub partition_expressions: Option<Box<Expression>>,
11225 #[serde(default)]
11226 pub create_expressions: Option<Box<Expression>>,
11227}
11228
11229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11231#[cfg_attr(feature = "bindings", derive(TS))]
11232pub struct PartitionByRangePropertyDynamic {
11233 #[serde(default)]
11234 pub this: Option<Box<Expression>>,
11235 #[serde(default)]
11236 pub start: Option<Box<Expression>>,
11237 #[serde(default)]
11239 pub use_start_end: bool,
11240 #[serde(default)]
11241 pub end: Option<Box<Expression>>,
11242 #[serde(default)]
11243 pub every: Option<Box<Expression>>,
11244}
11245
11246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11248#[cfg_attr(feature = "bindings", derive(TS))]
11249pub struct PartitionByListProperty {
11250 #[serde(default)]
11251 pub partition_expressions: Option<Box<Expression>>,
11252 #[serde(default)]
11253 pub create_expressions: Option<Box<Expression>>,
11254}
11255
11256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11258#[cfg_attr(feature = "bindings", derive(TS))]
11259pub struct PartitionList {
11260 pub this: Box<Expression>,
11261 #[serde(default)]
11262 pub expressions: Vec<Expression>,
11263}
11264
11265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11267#[cfg_attr(feature = "bindings", derive(TS))]
11268pub struct Partition {
11269 pub expressions: Vec<Expression>,
11270 #[serde(default)]
11271 pub subpartition: bool,
11272}
11273
11274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11277#[cfg_attr(feature = "bindings", derive(TS))]
11278pub struct RefreshTriggerProperty {
11279 pub method: String,
11281 #[serde(default)]
11283 pub kind: Option<String>,
11284 #[serde(default)]
11286 pub every: Option<Box<Expression>>,
11287 #[serde(default)]
11289 pub unit: Option<String>,
11290 #[serde(default)]
11292 pub starts: Option<Box<Expression>>,
11293}
11294
11295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11297#[cfg_attr(feature = "bindings", derive(TS))]
11298pub struct UniqueKeyProperty {
11299 #[serde(default)]
11300 pub expressions: Vec<Expression>,
11301}
11302
11303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11305#[cfg_attr(feature = "bindings", derive(TS))]
11306pub struct RollupProperty {
11307 pub expressions: Vec<RollupIndex>,
11308}
11309
11310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11312#[cfg_attr(feature = "bindings", derive(TS))]
11313pub struct RollupIndex {
11314 pub name: Identifier,
11315 pub expressions: Vec<Identifier>,
11316}
11317
11318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11320#[cfg_attr(feature = "bindings", derive(TS))]
11321pub struct PartitionBoundSpec {
11322 #[serde(default)]
11323 pub this: Option<Box<Expression>>,
11324 #[serde(default)]
11325 pub expression: Option<Box<Expression>>,
11326 #[serde(default)]
11327 pub from_expressions: Option<Box<Expression>>,
11328 #[serde(default)]
11329 pub to_expressions: Option<Box<Expression>>,
11330}
11331
11332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11334#[cfg_attr(feature = "bindings", derive(TS))]
11335pub struct PartitionedOfProperty {
11336 pub this: Box<Expression>,
11337 pub expression: Box<Expression>,
11338}
11339
11340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11342#[cfg_attr(feature = "bindings", derive(TS))]
11343pub struct RemoteWithConnectionModelProperty {
11344 pub this: Box<Expression>,
11345}
11346
11347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11349#[cfg_attr(feature = "bindings", derive(TS))]
11350pub struct ReturnsProperty {
11351 #[serde(default)]
11352 pub this: Option<Box<Expression>>,
11353 #[serde(default)]
11354 pub is_table: Option<Box<Expression>>,
11355 #[serde(default)]
11356 pub table: Option<Box<Expression>>,
11357 #[serde(default)]
11358 pub null: Option<Box<Expression>>,
11359}
11360
11361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11363#[cfg_attr(feature = "bindings", derive(TS))]
11364pub struct RowFormatProperty {
11365 pub this: Box<Expression>,
11366}
11367
11368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11370#[cfg_attr(feature = "bindings", derive(TS))]
11371pub struct RowFormatDelimitedProperty {
11372 #[serde(default)]
11373 pub fields: Option<Box<Expression>>,
11374 #[serde(default)]
11375 pub escaped: Option<Box<Expression>>,
11376 #[serde(default)]
11377 pub collection_items: Option<Box<Expression>>,
11378 #[serde(default)]
11379 pub map_keys: Option<Box<Expression>>,
11380 #[serde(default)]
11381 pub lines: Option<Box<Expression>>,
11382 #[serde(default)]
11383 pub null: Option<Box<Expression>>,
11384 #[serde(default)]
11385 pub serde: Option<Box<Expression>>,
11386}
11387
11388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11390#[cfg_attr(feature = "bindings", derive(TS))]
11391pub struct RowFormatSerdeProperty {
11392 pub this: Box<Expression>,
11393 #[serde(default)]
11394 pub serde_properties: Option<Box<Expression>>,
11395}
11396
11397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11399#[cfg_attr(feature = "bindings", derive(TS))]
11400pub struct QueryTransform {
11401 #[serde(default)]
11402 pub expressions: Vec<Expression>,
11403 #[serde(default)]
11404 pub command_script: Option<Box<Expression>>,
11405 #[serde(default)]
11406 pub schema: Option<Box<Expression>>,
11407 #[serde(default)]
11408 pub row_format_before: Option<Box<Expression>>,
11409 #[serde(default)]
11410 pub record_writer: Option<Box<Expression>>,
11411 #[serde(default)]
11412 pub row_format_after: Option<Box<Expression>>,
11413 #[serde(default)]
11414 pub record_reader: Option<Box<Expression>>,
11415}
11416
11417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11419#[cfg_attr(feature = "bindings", derive(TS))]
11420pub struct SampleProperty {
11421 pub this: Box<Expression>,
11422}
11423
11424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11426#[cfg_attr(feature = "bindings", derive(TS))]
11427pub struct SecurityProperty {
11428 pub this: Box<Expression>,
11429}
11430
11431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11433#[cfg_attr(feature = "bindings", derive(TS))]
11434pub struct SchemaCommentProperty {
11435 pub this: Box<Expression>,
11436}
11437
11438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11440#[cfg_attr(feature = "bindings", derive(TS))]
11441pub struct SemanticView {
11442 pub this: Box<Expression>,
11443 #[serde(default)]
11444 pub metrics: Option<Box<Expression>>,
11445 #[serde(default)]
11446 pub dimensions: Option<Box<Expression>>,
11447 #[serde(default)]
11448 pub facts: Option<Box<Expression>>,
11449 #[serde(default)]
11450 pub where_: Option<Box<Expression>>,
11451}
11452
11453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11455#[cfg_attr(feature = "bindings", derive(TS))]
11456pub struct SerdeProperties {
11457 #[serde(default)]
11458 pub expressions: Vec<Expression>,
11459 #[serde(default)]
11460 pub with_: Option<Box<Expression>>,
11461}
11462
11463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11465#[cfg_attr(feature = "bindings", derive(TS))]
11466pub struct SetProperty {
11467 #[serde(default)]
11468 pub multi: Option<Box<Expression>>,
11469}
11470
11471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11473#[cfg_attr(feature = "bindings", derive(TS))]
11474pub struct SharingProperty {
11475 #[serde(default)]
11476 pub this: Option<Box<Expression>>,
11477}
11478
11479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11481#[cfg_attr(feature = "bindings", derive(TS))]
11482pub struct SetConfigProperty {
11483 pub this: Box<Expression>,
11484}
11485
11486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11488#[cfg_attr(feature = "bindings", derive(TS))]
11489pub struct SettingsProperty {
11490 #[serde(default)]
11491 pub expressions: Vec<Expression>,
11492}
11493
11494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11496#[cfg_attr(feature = "bindings", derive(TS))]
11497pub struct SortKeyProperty {
11498 pub this: Box<Expression>,
11499 #[serde(default)]
11500 pub compound: Option<Box<Expression>>,
11501}
11502
11503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11505#[cfg_attr(feature = "bindings", derive(TS))]
11506pub struct SqlReadWriteProperty {
11507 pub this: Box<Expression>,
11508}
11509
11510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11512#[cfg_attr(feature = "bindings", derive(TS))]
11513pub struct SqlSecurityProperty {
11514 pub this: Box<Expression>,
11515}
11516
11517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11519#[cfg_attr(feature = "bindings", derive(TS))]
11520pub struct StabilityProperty {
11521 pub this: Box<Expression>,
11522}
11523
11524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11526#[cfg_attr(feature = "bindings", derive(TS))]
11527pub struct StorageHandlerProperty {
11528 pub this: Box<Expression>,
11529}
11530
11531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11533#[cfg_attr(feature = "bindings", derive(TS))]
11534pub struct TemporaryProperty {
11535 #[serde(default)]
11536 pub this: Option<Box<Expression>>,
11537}
11538
11539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11541#[cfg_attr(feature = "bindings", derive(TS))]
11542pub struct Tags {
11543 #[serde(default)]
11544 pub expressions: Vec<Expression>,
11545}
11546
11547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11549#[cfg_attr(feature = "bindings", derive(TS))]
11550pub struct TransformModelProperty {
11551 #[serde(default)]
11552 pub expressions: Vec<Expression>,
11553}
11554
11555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11557#[cfg_attr(feature = "bindings", derive(TS))]
11558pub struct TransientProperty {
11559 #[serde(default)]
11560 pub this: Option<Box<Expression>>,
11561}
11562
11563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11565#[cfg_attr(feature = "bindings", derive(TS))]
11566pub struct UsingTemplateProperty {
11567 pub this: Box<Expression>,
11568}
11569
11570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11572#[cfg_attr(feature = "bindings", derive(TS))]
11573pub struct ViewAttributeProperty {
11574 pub this: Box<Expression>,
11575}
11576
11577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11579#[cfg_attr(feature = "bindings", derive(TS))]
11580pub struct VolatileProperty {
11581 #[serde(default)]
11582 pub this: Option<Box<Expression>>,
11583}
11584
11585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11587#[cfg_attr(feature = "bindings", derive(TS))]
11588pub struct WithDataProperty {
11589 #[serde(default)]
11590 pub no: Option<Box<Expression>>,
11591 #[serde(default)]
11592 pub statistics: Option<Box<Expression>>,
11593}
11594
11595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11597#[cfg_attr(feature = "bindings", derive(TS))]
11598pub struct WithJournalTableProperty {
11599 pub this: Box<Expression>,
11600}
11601
11602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11604#[cfg_attr(feature = "bindings", derive(TS))]
11605pub struct WithSchemaBindingProperty {
11606 pub this: Box<Expression>,
11607}
11608
11609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11611#[cfg_attr(feature = "bindings", derive(TS))]
11612pub struct WithSystemVersioningProperty {
11613 #[serde(default)]
11614 pub on: Option<Box<Expression>>,
11615 #[serde(default)]
11616 pub this: Option<Box<Expression>>,
11617 #[serde(default)]
11618 pub data_consistency: Option<Box<Expression>>,
11619 #[serde(default)]
11620 pub retention_period: Option<Box<Expression>>,
11621 #[serde(default)]
11622 pub with_: Option<Box<Expression>>,
11623}
11624
11625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11627#[cfg_attr(feature = "bindings", derive(TS))]
11628pub struct WithProcedureOptions {
11629 #[serde(default)]
11630 pub expressions: Vec<Expression>,
11631}
11632
11633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11635#[cfg_attr(feature = "bindings", derive(TS))]
11636pub struct EncodeProperty {
11637 pub this: Box<Expression>,
11638 #[serde(default)]
11639 pub properties: Vec<Expression>,
11640 #[serde(default)]
11641 pub key: Option<Box<Expression>>,
11642}
11643
11644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11646#[cfg_attr(feature = "bindings", derive(TS))]
11647pub struct IncludeProperty {
11648 pub this: Box<Expression>,
11649 #[serde(default)]
11650 pub alias: Option<String>,
11651 #[serde(default)]
11652 pub column_def: Option<Box<Expression>>,
11653}
11654
11655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11657#[cfg_attr(feature = "bindings", derive(TS))]
11658pub struct Properties {
11659 #[serde(default)]
11660 pub expressions: Vec<Expression>,
11661}
11662
11663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11665#[cfg_attr(feature = "bindings", derive(TS))]
11666pub struct OptionEntry {
11667 pub key: Identifier,
11668 pub value: Expression,
11669}
11670
11671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11673#[cfg_attr(feature = "bindings", derive(TS))]
11674pub struct OptionsProperty {
11675 #[serde(default)]
11676 pub entries: Vec<OptionEntry>,
11677}
11678
11679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11681#[cfg_attr(feature = "bindings", derive(TS))]
11682pub struct InputOutputFormat {
11683 #[serde(default)]
11684 pub input_format: Option<Box<Expression>>,
11685 #[serde(default)]
11686 pub output_format: Option<Box<Expression>>,
11687}
11688
11689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11691#[cfg_attr(feature = "bindings", derive(TS))]
11692pub struct Reference {
11693 pub this: Box<Expression>,
11694 #[serde(default)]
11695 pub expressions: Vec<Expression>,
11696 #[serde(default)]
11697 pub options: Vec<Expression>,
11698}
11699
11700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11702#[cfg_attr(feature = "bindings", derive(TS))]
11703pub struct QueryOption {
11704 pub this: Box<Expression>,
11705 #[serde(default)]
11706 pub expression: Option<Box<Expression>>,
11707}
11708
11709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11711#[cfg_attr(feature = "bindings", derive(TS))]
11712pub struct WithTableHint {
11713 #[serde(default)]
11714 pub expressions: Vec<Expression>,
11715}
11716
11717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11719#[cfg_attr(feature = "bindings", derive(TS))]
11720pub struct IndexTableHint {
11721 pub this: Box<Expression>,
11722 #[serde(default)]
11723 pub expressions: Vec<Expression>,
11724 #[serde(default)]
11725 pub target: Option<Box<Expression>>,
11726}
11727
11728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11730#[cfg_attr(feature = "bindings", derive(TS))]
11731pub struct Get {
11732 pub this: Box<Expression>,
11733 #[serde(default)]
11734 pub target: Option<Box<Expression>>,
11735 #[serde(default)]
11736 pub properties: Vec<Expression>,
11737}
11738
11739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11741#[cfg_attr(feature = "bindings", derive(TS))]
11742pub struct SetOperation {
11743 #[serde(default)]
11744 pub with_: Option<Box<Expression>>,
11745 pub this: Box<Expression>,
11746 pub expression: Box<Expression>,
11747 #[serde(default)]
11748 pub distinct: bool,
11749 #[serde(default)]
11750 pub by_name: Option<Box<Expression>>,
11751 #[serde(default)]
11752 pub side: Option<Box<Expression>>,
11753 #[serde(default)]
11754 pub kind: Option<String>,
11755 #[serde(default)]
11756 pub on: Option<Box<Expression>>,
11757}
11758
11759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11761#[cfg_attr(feature = "bindings", derive(TS))]
11762pub struct Var {
11763 pub this: String,
11764}
11765
11766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11768#[cfg_attr(feature = "bindings", derive(TS))]
11769pub struct Variadic {
11770 pub this: Box<Expression>,
11771}
11772
11773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11775#[cfg_attr(feature = "bindings", derive(TS))]
11776pub struct Version {
11777 pub this: Box<Expression>,
11778 pub kind: String,
11779 #[serde(default)]
11780 pub expression: Option<Box<Expression>>,
11781}
11782
11783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11785#[cfg_attr(feature = "bindings", derive(TS))]
11786pub struct Schema {
11787 #[serde(default)]
11788 pub this: Option<Box<Expression>>,
11789 #[serde(default)]
11790 pub expressions: Vec<Expression>,
11791}
11792
11793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11795#[cfg_attr(feature = "bindings", derive(TS))]
11796pub struct Lock {
11797 #[serde(default)]
11798 pub update: Option<Box<Expression>>,
11799 #[serde(default)]
11800 pub expressions: Vec<Expression>,
11801 #[serde(default)]
11802 pub wait: Option<Box<Expression>>,
11803 #[serde(default)]
11804 pub key: Option<Box<Expression>>,
11805}
11806
11807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11810#[cfg_attr(feature = "bindings", derive(TS))]
11811pub struct TableSample {
11812 #[serde(default, skip_serializing_if = "Option::is_none")]
11814 pub this: Option<Box<Expression>>,
11815 #[serde(default, skip_serializing_if = "Option::is_none")]
11817 pub sample: Option<Box<Sample>>,
11818 #[serde(default)]
11819 pub expressions: Vec<Expression>,
11820 #[serde(default)]
11821 pub method: Option<String>,
11822 #[serde(default)]
11823 pub bucket_numerator: Option<Box<Expression>>,
11824 #[serde(default)]
11825 pub bucket_denominator: Option<Box<Expression>>,
11826 #[serde(default)]
11827 pub bucket_field: Option<Box<Expression>>,
11828 #[serde(default)]
11829 pub percent: Option<Box<Expression>>,
11830 #[serde(default)]
11831 pub rows: Option<Box<Expression>>,
11832 #[serde(default)]
11833 pub size: Option<i64>,
11834 #[serde(default)]
11835 pub seed: Option<Box<Expression>>,
11836}
11837
11838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11840#[cfg_attr(feature = "bindings", derive(TS))]
11841pub struct Tag {
11842 #[serde(default)]
11843 pub this: Option<Box<Expression>>,
11844 #[serde(default)]
11845 pub prefix: Option<Box<Expression>>,
11846 #[serde(default)]
11847 pub postfix: Option<Box<Expression>>,
11848}
11849
11850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11852#[cfg_attr(feature = "bindings", derive(TS))]
11853pub struct UnpivotColumns {
11854 pub this: Box<Expression>,
11855 #[serde(default)]
11856 pub expressions: Vec<Expression>,
11857}
11858
11859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11861#[cfg_attr(feature = "bindings", derive(TS))]
11862pub struct SessionParameter {
11863 pub this: Box<Expression>,
11864 #[serde(default)]
11865 pub kind: Option<String>,
11866}
11867
11868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11870#[cfg_attr(feature = "bindings", derive(TS))]
11871pub struct PseudoType {
11872 pub this: Box<Expression>,
11873}
11874
11875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11877#[cfg_attr(feature = "bindings", derive(TS))]
11878pub struct ObjectIdentifier {
11879 pub this: Box<Expression>,
11880}
11881
11882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11884#[cfg_attr(feature = "bindings", derive(TS))]
11885pub struct Transaction {
11886 #[serde(default)]
11887 pub this: Option<Box<Expression>>,
11888 #[serde(default)]
11889 pub modes: Option<Box<Expression>>,
11890 #[serde(default)]
11891 pub mark: Option<Box<Expression>>,
11892}
11893
11894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11896#[cfg_attr(feature = "bindings", derive(TS))]
11897pub struct Commit {
11898 #[serde(default)]
11899 pub chain: Option<Box<Expression>>,
11900 #[serde(default)]
11901 pub this: Option<Box<Expression>>,
11902 #[serde(default)]
11903 pub durability: Option<Box<Expression>>,
11904}
11905
11906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11908#[cfg_attr(feature = "bindings", derive(TS))]
11909pub struct Rollback {
11910 #[serde(default)]
11911 pub savepoint: Option<Box<Expression>>,
11912 #[serde(default)]
11913 pub this: Option<Box<Expression>>,
11914}
11915
11916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11918#[cfg_attr(feature = "bindings", derive(TS))]
11919pub struct AlterSession {
11920 #[serde(default)]
11921 pub expressions: Vec<Expression>,
11922 #[serde(default)]
11923 pub unset: Option<Box<Expression>>,
11924}
11925
11926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11928#[cfg_attr(feature = "bindings", derive(TS))]
11929pub struct Analyze {
11930 #[serde(default)]
11931 pub kind: Option<String>,
11932 #[serde(default)]
11933 pub this: Option<Box<Expression>>,
11934 #[serde(default)]
11935 pub options: Vec<Expression>,
11936 #[serde(default)]
11937 pub mode: Option<Box<Expression>>,
11938 #[serde(default)]
11939 pub partition: Option<Box<Expression>>,
11940 #[serde(default)]
11941 pub expression: Option<Box<Expression>>,
11942 #[serde(default)]
11943 pub properties: Vec<Expression>,
11944 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11946 pub columns: Vec<String>,
11947}
11948
11949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11951#[cfg_attr(feature = "bindings", derive(TS))]
11952pub struct AnalyzeStatistics {
11953 pub kind: String,
11954 #[serde(default)]
11955 pub option: Option<Box<Expression>>,
11956 #[serde(default)]
11957 pub this: Option<Box<Expression>>,
11958 #[serde(default)]
11959 pub expressions: Vec<Expression>,
11960}
11961
11962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11964#[cfg_attr(feature = "bindings", derive(TS))]
11965pub struct AnalyzeHistogram {
11966 pub this: Box<Expression>,
11967 #[serde(default)]
11968 pub expressions: Vec<Expression>,
11969 #[serde(default)]
11970 pub expression: Option<Box<Expression>>,
11971 #[serde(default)]
11972 pub update_options: Option<Box<Expression>>,
11973}
11974
11975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11977#[cfg_attr(feature = "bindings", derive(TS))]
11978pub struct AnalyzeSample {
11979 pub kind: String,
11980 #[serde(default)]
11981 pub sample: Option<Box<Expression>>,
11982}
11983
11984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11986#[cfg_attr(feature = "bindings", derive(TS))]
11987pub struct AnalyzeListChainedRows {
11988 #[serde(default)]
11989 pub expression: Option<Box<Expression>>,
11990}
11991
11992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11994#[cfg_attr(feature = "bindings", derive(TS))]
11995pub struct AnalyzeDelete {
11996 #[serde(default)]
11997 pub kind: Option<String>,
11998}
11999
12000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12002#[cfg_attr(feature = "bindings", derive(TS))]
12003pub struct AnalyzeWith {
12004 #[serde(default)]
12005 pub expressions: Vec<Expression>,
12006}
12007
12008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12010#[cfg_attr(feature = "bindings", derive(TS))]
12011pub struct AnalyzeValidate {
12012 pub kind: String,
12013 #[serde(default)]
12014 pub this: Option<Box<Expression>>,
12015 #[serde(default)]
12016 pub expression: Option<Box<Expression>>,
12017}
12018
12019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12021#[cfg_attr(feature = "bindings", derive(TS))]
12022pub struct AddPartition {
12023 pub this: Box<Expression>,
12024 #[serde(default)]
12025 pub exists: bool,
12026 #[serde(default)]
12027 pub location: Option<Box<Expression>>,
12028}
12029
12030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12032#[cfg_attr(feature = "bindings", derive(TS))]
12033pub struct AttachOption {
12034 pub this: Box<Expression>,
12035 #[serde(default)]
12036 pub expression: Option<Box<Expression>>,
12037}
12038
12039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12041#[cfg_attr(feature = "bindings", derive(TS))]
12042pub struct DropPartition {
12043 #[serde(default)]
12044 pub expressions: Vec<Expression>,
12045 #[serde(default)]
12046 pub exists: bool,
12047}
12048
12049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12051#[cfg_attr(feature = "bindings", derive(TS))]
12052pub struct ReplacePartition {
12053 pub expression: Box<Expression>,
12054 #[serde(default)]
12055 pub source: Option<Box<Expression>>,
12056}
12057
12058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12060#[cfg_attr(feature = "bindings", derive(TS))]
12061pub struct DPipe {
12062 pub this: Box<Expression>,
12063 pub expression: Box<Expression>,
12064 #[serde(default)]
12065 pub safe: Option<Box<Expression>>,
12066}
12067
12068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12070#[cfg_attr(feature = "bindings", derive(TS))]
12071pub struct Operator {
12072 pub this: Box<Expression>,
12073 #[serde(default)]
12074 pub operator: Option<Box<Expression>>,
12075 pub expression: Box<Expression>,
12076 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12078 pub comments: Vec<String>,
12079}
12080
12081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12083#[cfg_attr(feature = "bindings", derive(TS))]
12084pub struct PivotAny {
12085 #[serde(default)]
12086 pub this: Option<Box<Expression>>,
12087}
12088
12089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12091#[cfg_attr(feature = "bindings", derive(TS))]
12092pub struct Aliases {
12093 pub this: Box<Expression>,
12094 #[serde(default)]
12095 pub expressions: Vec<Expression>,
12096}
12097
12098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12100#[cfg_attr(feature = "bindings", derive(TS))]
12101pub struct AtIndex {
12102 pub this: Box<Expression>,
12103 pub expression: Box<Expression>,
12104}
12105
12106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12108#[cfg_attr(feature = "bindings", derive(TS))]
12109pub struct FromTimeZone {
12110 pub this: Box<Expression>,
12111 #[serde(default)]
12112 pub zone: Option<Box<Expression>>,
12113}
12114
12115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12117#[cfg_attr(feature = "bindings", derive(TS))]
12118pub struct FormatPhrase {
12119 pub this: Box<Expression>,
12120 pub format: String,
12121}
12122
12123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12125#[cfg_attr(feature = "bindings", derive(TS))]
12126pub struct ForIn {
12127 pub this: Box<Expression>,
12128 pub expression: Box<Expression>,
12129}
12130
12131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12133#[cfg_attr(feature = "bindings", derive(TS))]
12134pub struct TimeUnit {
12135 #[serde(default)]
12136 pub unit: Option<String>,
12137}
12138
12139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12141#[cfg_attr(feature = "bindings", derive(TS))]
12142pub struct IntervalOp {
12143 #[serde(default)]
12144 pub unit: Option<String>,
12145 pub expression: Box<Expression>,
12146}
12147
12148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12150#[cfg_attr(feature = "bindings", derive(TS))]
12151pub struct HavingMax {
12152 pub this: Box<Expression>,
12153 pub expression: Box<Expression>,
12154 #[serde(default)]
12155 pub max: Option<Box<Expression>>,
12156}
12157
12158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12160#[cfg_attr(feature = "bindings", derive(TS))]
12161pub struct CosineDistance {
12162 pub this: Box<Expression>,
12163 pub expression: Box<Expression>,
12164}
12165
12166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12168#[cfg_attr(feature = "bindings", derive(TS))]
12169pub struct DotProduct {
12170 pub this: Box<Expression>,
12171 pub expression: Box<Expression>,
12172}
12173
12174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12176#[cfg_attr(feature = "bindings", derive(TS))]
12177pub struct EuclideanDistance {
12178 pub this: Box<Expression>,
12179 pub expression: Box<Expression>,
12180}
12181
12182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12184#[cfg_attr(feature = "bindings", derive(TS))]
12185pub struct ManhattanDistance {
12186 pub this: Box<Expression>,
12187 pub expression: Box<Expression>,
12188}
12189
12190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12192#[cfg_attr(feature = "bindings", derive(TS))]
12193pub struct JarowinklerSimilarity {
12194 pub this: Box<Expression>,
12195 pub expression: Box<Expression>,
12196}
12197
12198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12200#[cfg_attr(feature = "bindings", derive(TS))]
12201pub struct Booland {
12202 pub this: Box<Expression>,
12203 pub expression: Box<Expression>,
12204}
12205
12206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12208#[cfg_attr(feature = "bindings", derive(TS))]
12209pub struct Boolor {
12210 pub this: Box<Expression>,
12211 pub expression: Box<Expression>,
12212}
12213
12214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12216#[cfg_attr(feature = "bindings", derive(TS))]
12217pub struct ParameterizedAgg {
12218 pub this: Box<Expression>,
12219 #[serde(default)]
12220 pub expressions: Vec<Expression>,
12221 #[serde(default)]
12222 pub params: Vec<Expression>,
12223}
12224
12225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12227#[cfg_attr(feature = "bindings", derive(TS))]
12228pub struct ArgMax {
12229 pub this: Box<Expression>,
12230 pub expression: Box<Expression>,
12231 #[serde(default)]
12232 pub count: Option<Box<Expression>>,
12233}
12234
12235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12237#[cfg_attr(feature = "bindings", derive(TS))]
12238pub struct ArgMin {
12239 pub this: Box<Expression>,
12240 pub expression: Box<Expression>,
12241 #[serde(default)]
12242 pub count: Option<Box<Expression>>,
12243}
12244
12245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12247#[cfg_attr(feature = "bindings", derive(TS))]
12248pub struct ApproxTopK {
12249 pub this: Box<Expression>,
12250 #[serde(default)]
12251 pub expression: Option<Box<Expression>>,
12252 #[serde(default)]
12253 pub counters: Option<Box<Expression>>,
12254}
12255
12256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12258#[cfg_attr(feature = "bindings", derive(TS))]
12259pub struct ApproxTopKAccumulate {
12260 pub this: Box<Expression>,
12261 #[serde(default)]
12262 pub expression: Option<Box<Expression>>,
12263}
12264
12265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12267#[cfg_attr(feature = "bindings", derive(TS))]
12268pub struct ApproxTopKCombine {
12269 pub this: Box<Expression>,
12270 #[serde(default)]
12271 pub expression: Option<Box<Expression>>,
12272}
12273
12274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12276#[cfg_attr(feature = "bindings", derive(TS))]
12277pub struct ApproxTopKEstimate {
12278 pub this: Box<Expression>,
12279 #[serde(default)]
12280 pub expression: Option<Box<Expression>>,
12281}
12282
12283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12285#[cfg_attr(feature = "bindings", derive(TS))]
12286pub struct ApproxTopSum {
12287 pub this: Box<Expression>,
12288 pub expression: Box<Expression>,
12289 #[serde(default)]
12290 pub count: Option<Box<Expression>>,
12291}
12292
12293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12295#[cfg_attr(feature = "bindings", derive(TS))]
12296pub struct ApproxQuantiles {
12297 pub this: Box<Expression>,
12298 #[serde(default)]
12299 pub expression: Option<Box<Expression>>,
12300}
12301
12302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12304#[cfg_attr(feature = "bindings", derive(TS))]
12305pub struct Minhash {
12306 pub this: Box<Expression>,
12307 #[serde(default)]
12308 pub expressions: Vec<Expression>,
12309}
12310
12311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12313#[cfg_attr(feature = "bindings", derive(TS))]
12314pub struct FarmFingerprint {
12315 #[serde(default)]
12316 pub expressions: Vec<Expression>,
12317}
12318
12319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12321#[cfg_attr(feature = "bindings", derive(TS))]
12322pub struct Float64 {
12323 pub this: Box<Expression>,
12324 #[serde(default)]
12325 pub expression: Option<Box<Expression>>,
12326}
12327
12328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12330#[cfg_attr(feature = "bindings", derive(TS))]
12331pub struct Transform {
12332 pub this: Box<Expression>,
12333 pub expression: Box<Expression>,
12334}
12335
12336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12338#[cfg_attr(feature = "bindings", derive(TS))]
12339pub struct Translate {
12340 pub this: Box<Expression>,
12341 #[serde(default)]
12342 pub from_: Option<Box<Expression>>,
12343 #[serde(default)]
12344 pub to: Option<Box<Expression>>,
12345}
12346
12347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12349#[cfg_attr(feature = "bindings", derive(TS))]
12350pub struct Grouping {
12351 #[serde(default)]
12352 pub expressions: Vec<Expression>,
12353}
12354
12355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12357#[cfg_attr(feature = "bindings", derive(TS))]
12358pub struct GroupingId {
12359 #[serde(default)]
12360 pub expressions: Vec<Expression>,
12361}
12362
12363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12365#[cfg_attr(feature = "bindings", derive(TS))]
12366pub struct Anonymous {
12367 pub this: Box<Expression>,
12368 #[serde(default)]
12369 pub expressions: Vec<Expression>,
12370}
12371
12372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12374#[cfg_attr(feature = "bindings", derive(TS))]
12375pub struct AnonymousAggFunc {
12376 pub this: Box<Expression>,
12377 #[serde(default)]
12378 pub expressions: Vec<Expression>,
12379}
12380
12381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12383#[cfg_attr(feature = "bindings", derive(TS))]
12384pub struct CombinedAggFunc {
12385 pub this: Box<Expression>,
12386 #[serde(default)]
12387 pub expressions: Vec<Expression>,
12388}
12389
12390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12392#[cfg_attr(feature = "bindings", derive(TS))]
12393pub struct CombinedParameterizedAgg {
12394 pub this: Box<Expression>,
12395 #[serde(default)]
12396 pub expressions: Vec<Expression>,
12397 #[serde(default)]
12398 pub params: Vec<Expression>,
12399}
12400
12401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12403#[cfg_attr(feature = "bindings", derive(TS))]
12404pub struct HashAgg {
12405 pub this: Box<Expression>,
12406 #[serde(default)]
12407 pub expressions: Vec<Expression>,
12408}
12409
12410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12412#[cfg_attr(feature = "bindings", derive(TS))]
12413pub struct Hll {
12414 pub this: Box<Expression>,
12415 #[serde(default)]
12416 pub expressions: Vec<Expression>,
12417}
12418
12419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12421#[cfg_attr(feature = "bindings", derive(TS))]
12422pub struct Apply {
12423 pub this: Box<Expression>,
12424 pub expression: Box<Expression>,
12425}
12426
12427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12429#[cfg_attr(feature = "bindings", derive(TS))]
12430pub struct ToBoolean {
12431 pub this: Box<Expression>,
12432 #[serde(default)]
12433 pub safe: Option<Box<Expression>>,
12434}
12435
12436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12438#[cfg_attr(feature = "bindings", derive(TS))]
12439pub struct List {
12440 #[serde(default)]
12441 pub expressions: Vec<Expression>,
12442}
12443
12444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12449#[cfg_attr(feature = "bindings", derive(TS))]
12450pub struct ToMap {
12451 pub this: Box<Expression>,
12453}
12454
12455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12457#[cfg_attr(feature = "bindings", derive(TS))]
12458pub struct Pad {
12459 pub this: Box<Expression>,
12460 pub expression: Box<Expression>,
12461 #[serde(default)]
12462 pub fill_pattern: Option<Box<Expression>>,
12463 #[serde(default)]
12464 pub is_left: Option<Box<Expression>>,
12465}
12466
12467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12469#[cfg_attr(feature = "bindings", derive(TS))]
12470pub struct ToChar {
12471 pub this: Box<Expression>,
12472 #[serde(default)]
12473 pub format: Option<String>,
12474 #[serde(default)]
12475 pub nlsparam: Option<Box<Expression>>,
12476 #[serde(default)]
12477 pub is_numeric: Option<Box<Expression>>,
12478}
12479
12480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12482#[cfg_attr(feature = "bindings", derive(TS))]
12483pub struct StringFunc {
12484 pub this: Box<Expression>,
12485 #[serde(default)]
12486 pub zone: Option<Box<Expression>>,
12487}
12488
12489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12491#[cfg_attr(feature = "bindings", derive(TS))]
12492pub struct ToNumber {
12493 pub this: Box<Expression>,
12494 #[serde(default)]
12495 pub format: Option<Box<Expression>>,
12496 #[serde(default)]
12497 pub nlsparam: Option<Box<Expression>>,
12498 #[serde(default)]
12499 pub precision: Option<Box<Expression>>,
12500 #[serde(default)]
12501 pub scale: Option<Box<Expression>>,
12502 #[serde(default)]
12503 pub safe: Option<Box<Expression>>,
12504 #[serde(default)]
12505 pub safe_name: Option<Box<Expression>>,
12506}
12507
12508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12510#[cfg_attr(feature = "bindings", derive(TS))]
12511pub struct ToDouble {
12512 pub this: Box<Expression>,
12513 #[serde(default)]
12514 pub format: Option<String>,
12515 #[serde(default)]
12516 pub safe: Option<Box<Expression>>,
12517}
12518
12519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12521#[cfg_attr(feature = "bindings", derive(TS))]
12522pub struct ToDecfloat {
12523 pub this: Box<Expression>,
12524 #[serde(default)]
12525 pub format: Option<String>,
12526}
12527
12528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12530#[cfg_attr(feature = "bindings", derive(TS))]
12531pub struct TryToDecfloat {
12532 pub this: Box<Expression>,
12533 #[serde(default)]
12534 pub format: Option<String>,
12535}
12536
12537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12539#[cfg_attr(feature = "bindings", derive(TS))]
12540pub struct ToFile {
12541 pub this: Box<Expression>,
12542 #[serde(default)]
12543 pub path: Option<Box<Expression>>,
12544 #[serde(default)]
12545 pub safe: Option<Box<Expression>>,
12546}
12547
12548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12550#[cfg_attr(feature = "bindings", derive(TS))]
12551pub struct Columns {
12552 pub this: Box<Expression>,
12553 #[serde(default)]
12554 pub unpack: Option<Box<Expression>>,
12555}
12556
12557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12559#[cfg_attr(feature = "bindings", derive(TS))]
12560pub struct ConvertToCharset {
12561 pub this: Box<Expression>,
12562 #[serde(default)]
12563 pub dest: Option<Box<Expression>>,
12564 #[serde(default)]
12565 pub source: Option<Box<Expression>>,
12566}
12567
12568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12570#[cfg_attr(feature = "bindings", derive(TS))]
12571pub struct ConvertTimezone {
12572 #[serde(default)]
12573 pub source_tz: Option<Box<Expression>>,
12574 #[serde(default)]
12575 pub target_tz: Option<Box<Expression>>,
12576 #[serde(default)]
12577 pub timestamp: Option<Box<Expression>>,
12578 #[serde(default)]
12579 pub options: Vec<Expression>,
12580}
12581
12582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12584#[cfg_attr(feature = "bindings", derive(TS))]
12585pub struct GenerateSeries {
12586 #[serde(default)]
12587 pub start: Option<Box<Expression>>,
12588 #[serde(default)]
12589 pub end: Option<Box<Expression>>,
12590 #[serde(default)]
12591 pub step: Option<Box<Expression>>,
12592 #[serde(default)]
12593 pub is_end_exclusive: Option<Box<Expression>>,
12594}
12595
12596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12598#[cfg_attr(feature = "bindings", derive(TS))]
12599pub struct AIAgg {
12600 pub this: Box<Expression>,
12601 pub expression: Box<Expression>,
12602}
12603
12604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12606#[cfg_attr(feature = "bindings", derive(TS))]
12607pub struct AIClassify {
12608 pub this: Box<Expression>,
12609 #[serde(default)]
12610 pub categories: Option<Box<Expression>>,
12611 #[serde(default)]
12612 pub config: Option<Box<Expression>>,
12613}
12614
12615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12617#[cfg_attr(feature = "bindings", derive(TS))]
12618pub struct ArrayAll {
12619 pub this: Box<Expression>,
12620 pub expression: Box<Expression>,
12621}
12622
12623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12625#[cfg_attr(feature = "bindings", derive(TS))]
12626pub struct ArrayAny {
12627 pub this: Box<Expression>,
12628 pub expression: Box<Expression>,
12629}
12630
12631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12633#[cfg_attr(feature = "bindings", derive(TS))]
12634pub struct ArrayConstructCompact {
12635 #[serde(default)]
12636 pub expressions: Vec<Expression>,
12637}
12638
12639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12641#[cfg_attr(feature = "bindings", derive(TS))]
12642pub struct StPoint {
12643 pub this: Box<Expression>,
12644 pub expression: Box<Expression>,
12645 #[serde(default)]
12646 pub null: Option<Box<Expression>>,
12647}
12648
12649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12651#[cfg_attr(feature = "bindings", derive(TS))]
12652pub struct StDistance {
12653 pub this: Box<Expression>,
12654 pub expression: Box<Expression>,
12655 #[serde(default)]
12656 pub use_spheroid: Option<Box<Expression>>,
12657}
12658
12659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12661#[cfg_attr(feature = "bindings", derive(TS))]
12662pub struct StringToArray {
12663 pub this: Box<Expression>,
12664 #[serde(default)]
12665 pub expression: Option<Box<Expression>>,
12666 #[serde(default)]
12667 pub null: Option<Box<Expression>>,
12668}
12669
12670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12672#[cfg_attr(feature = "bindings", derive(TS))]
12673pub struct ArraySum {
12674 pub this: Box<Expression>,
12675 #[serde(default)]
12676 pub expression: Option<Box<Expression>>,
12677}
12678
12679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12681#[cfg_attr(feature = "bindings", derive(TS))]
12682pub struct ObjectAgg {
12683 pub this: Box<Expression>,
12684 pub expression: Box<Expression>,
12685}
12686
12687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12689#[cfg_attr(feature = "bindings", derive(TS))]
12690pub struct CastToStrType {
12691 pub this: Box<Expression>,
12692 #[serde(default)]
12693 pub to: Option<Box<Expression>>,
12694}
12695
12696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12698#[cfg_attr(feature = "bindings", derive(TS))]
12699pub struct CheckJson {
12700 pub this: Box<Expression>,
12701}
12702
12703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12705#[cfg_attr(feature = "bindings", derive(TS))]
12706pub struct CheckXml {
12707 pub this: Box<Expression>,
12708 #[serde(default)]
12709 pub disable_auto_convert: Option<Box<Expression>>,
12710}
12711
12712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12714#[cfg_attr(feature = "bindings", derive(TS))]
12715pub struct TranslateCharacters {
12716 pub this: Box<Expression>,
12717 pub expression: Box<Expression>,
12718 #[serde(default)]
12719 pub with_error: Option<Box<Expression>>,
12720}
12721
12722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12724#[cfg_attr(feature = "bindings", derive(TS))]
12725pub struct CurrentSchemas {
12726 #[serde(default)]
12727 pub this: Option<Box<Expression>>,
12728}
12729
12730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12732#[cfg_attr(feature = "bindings", derive(TS))]
12733pub struct CurrentDatetime {
12734 #[serde(default)]
12735 pub this: Option<Box<Expression>>,
12736}
12737
12738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12740#[cfg_attr(feature = "bindings", derive(TS))]
12741pub struct Localtime {
12742 #[serde(default)]
12743 pub this: Option<Box<Expression>>,
12744}
12745
12746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12748#[cfg_attr(feature = "bindings", derive(TS))]
12749pub struct Localtimestamp {
12750 #[serde(default)]
12751 pub this: Option<Box<Expression>>,
12752}
12753
12754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12756#[cfg_attr(feature = "bindings", derive(TS))]
12757pub struct Systimestamp {
12758 #[serde(default)]
12759 pub this: Option<Box<Expression>>,
12760}
12761
12762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12764#[cfg_attr(feature = "bindings", derive(TS))]
12765pub struct CurrentSchema {
12766 #[serde(default)]
12767 pub this: Option<Box<Expression>>,
12768}
12769
12770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12772#[cfg_attr(feature = "bindings", derive(TS))]
12773pub struct CurrentUser {
12774 #[serde(default)]
12775 pub this: Option<Box<Expression>>,
12776}
12777
12778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12780#[cfg_attr(feature = "bindings", derive(TS))]
12781pub struct SessionUser;
12782
12783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12785#[cfg_attr(feature = "bindings", derive(TS))]
12786pub struct JSONPathRoot;
12787
12788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12790#[cfg_attr(feature = "bindings", derive(TS))]
12791pub struct UtcTime {
12792 #[serde(default)]
12793 pub this: Option<Box<Expression>>,
12794}
12795
12796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12798#[cfg_attr(feature = "bindings", derive(TS))]
12799pub struct UtcTimestamp {
12800 #[serde(default)]
12801 pub this: Option<Box<Expression>>,
12802}
12803
12804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12806#[cfg_attr(feature = "bindings", derive(TS))]
12807pub struct TimestampFunc {
12808 #[serde(default)]
12809 pub this: Option<Box<Expression>>,
12810 #[serde(default)]
12811 pub zone: Option<Box<Expression>>,
12812 #[serde(default)]
12813 pub with_tz: Option<bool>,
12814 #[serde(default)]
12815 pub safe: Option<bool>,
12816}
12817
12818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12820#[cfg_attr(feature = "bindings", derive(TS))]
12821pub struct DateBin {
12822 pub this: Box<Expression>,
12823 pub expression: Box<Expression>,
12824 #[serde(default)]
12825 pub unit: Option<String>,
12826 #[serde(default)]
12827 pub zone: Option<Box<Expression>>,
12828 #[serde(default)]
12829 pub origin: Option<Box<Expression>>,
12830}
12831
12832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12834#[cfg_attr(feature = "bindings", derive(TS))]
12835pub struct Datetime {
12836 pub this: Box<Expression>,
12837 #[serde(default)]
12838 pub expression: Option<Box<Expression>>,
12839}
12840
12841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12843#[cfg_attr(feature = "bindings", derive(TS))]
12844pub struct DatetimeAdd {
12845 pub this: Box<Expression>,
12846 pub expression: Box<Expression>,
12847 #[serde(default)]
12848 pub unit: Option<String>,
12849}
12850
12851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12853#[cfg_attr(feature = "bindings", derive(TS))]
12854pub struct DatetimeSub {
12855 pub this: Box<Expression>,
12856 pub expression: Box<Expression>,
12857 #[serde(default)]
12858 pub unit: Option<String>,
12859}
12860
12861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12863#[cfg_attr(feature = "bindings", derive(TS))]
12864pub struct DatetimeDiff {
12865 pub this: Box<Expression>,
12866 pub expression: Box<Expression>,
12867 #[serde(default)]
12868 pub unit: Option<String>,
12869}
12870
12871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12873#[cfg_attr(feature = "bindings", derive(TS))]
12874pub struct DatetimeTrunc {
12875 pub this: Box<Expression>,
12876 pub unit: String,
12877 #[serde(default)]
12878 pub zone: Option<Box<Expression>>,
12879}
12880
12881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12883#[cfg_attr(feature = "bindings", derive(TS))]
12884pub struct Dayname {
12885 pub this: Box<Expression>,
12886 #[serde(default)]
12887 pub abbreviated: Option<Box<Expression>>,
12888}
12889
12890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12892#[cfg_attr(feature = "bindings", derive(TS))]
12893pub struct MakeInterval {
12894 #[serde(default)]
12895 pub year: Option<Box<Expression>>,
12896 #[serde(default)]
12897 pub month: Option<Box<Expression>>,
12898 #[serde(default)]
12899 pub week: Option<Box<Expression>>,
12900 #[serde(default)]
12901 pub day: Option<Box<Expression>>,
12902 #[serde(default)]
12903 pub hour: Option<Box<Expression>>,
12904 #[serde(default)]
12905 pub minute: Option<Box<Expression>>,
12906 #[serde(default)]
12907 pub second: Option<Box<Expression>>,
12908}
12909
12910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12912#[cfg_attr(feature = "bindings", derive(TS))]
12913pub struct PreviousDay {
12914 pub this: Box<Expression>,
12915 pub expression: Box<Expression>,
12916}
12917
12918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12920#[cfg_attr(feature = "bindings", derive(TS))]
12921pub struct Elt {
12922 pub this: Box<Expression>,
12923 #[serde(default)]
12924 pub expressions: Vec<Expression>,
12925}
12926
12927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12929#[cfg_attr(feature = "bindings", derive(TS))]
12930pub struct TimestampAdd {
12931 pub this: Box<Expression>,
12932 pub expression: Box<Expression>,
12933 #[serde(default)]
12934 pub unit: Option<String>,
12935}
12936
12937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12939#[cfg_attr(feature = "bindings", derive(TS))]
12940pub struct TimestampSub {
12941 pub this: Box<Expression>,
12942 pub expression: Box<Expression>,
12943 #[serde(default)]
12944 pub unit: Option<String>,
12945}
12946
12947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12949#[cfg_attr(feature = "bindings", derive(TS))]
12950pub struct TimestampDiff {
12951 pub this: Box<Expression>,
12952 pub expression: Box<Expression>,
12953 #[serde(default)]
12954 pub unit: Option<String>,
12955}
12956
12957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12959#[cfg_attr(feature = "bindings", derive(TS))]
12960pub struct TimeSlice {
12961 pub this: Box<Expression>,
12962 pub expression: Box<Expression>,
12963 pub unit: String,
12964 #[serde(default)]
12965 pub kind: Option<String>,
12966}
12967
12968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12970#[cfg_attr(feature = "bindings", derive(TS))]
12971pub struct TimeAdd {
12972 pub this: Box<Expression>,
12973 pub expression: Box<Expression>,
12974 #[serde(default)]
12975 pub unit: Option<String>,
12976}
12977
12978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12980#[cfg_attr(feature = "bindings", derive(TS))]
12981pub struct TimeSub {
12982 pub this: Box<Expression>,
12983 pub expression: Box<Expression>,
12984 #[serde(default)]
12985 pub unit: Option<String>,
12986}
12987
12988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12990#[cfg_attr(feature = "bindings", derive(TS))]
12991pub struct TimeDiff {
12992 pub this: Box<Expression>,
12993 pub expression: Box<Expression>,
12994 #[serde(default)]
12995 pub unit: Option<String>,
12996}
12997
12998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13000#[cfg_attr(feature = "bindings", derive(TS))]
13001pub struct TimeTrunc {
13002 pub this: Box<Expression>,
13003 pub unit: String,
13004 #[serde(default)]
13005 pub zone: Option<Box<Expression>>,
13006}
13007
13008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13010#[cfg_attr(feature = "bindings", derive(TS))]
13011pub struct DateFromParts {
13012 #[serde(default)]
13013 pub year: Option<Box<Expression>>,
13014 #[serde(default)]
13015 pub month: Option<Box<Expression>>,
13016 #[serde(default)]
13017 pub day: Option<Box<Expression>>,
13018 #[serde(default)]
13019 pub allow_overflow: Option<Box<Expression>>,
13020}
13021
13022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13024#[cfg_attr(feature = "bindings", derive(TS))]
13025pub struct TimeFromParts {
13026 #[serde(default)]
13027 pub hour: Option<Box<Expression>>,
13028 #[serde(default)]
13029 pub min: Option<Box<Expression>>,
13030 #[serde(default)]
13031 pub sec: Option<Box<Expression>>,
13032 #[serde(default)]
13033 pub nano: Option<Box<Expression>>,
13034 #[serde(default)]
13035 pub fractions: Option<Box<Expression>>,
13036 #[serde(default)]
13037 pub precision: Option<i64>,
13038}
13039
13040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13042#[cfg_attr(feature = "bindings", derive(TS))]
13043pub struct DecodeCase {
13044 #[serde(default)]
13045 pub expressions: Vec<Expression>,
13046}
13047
13048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13050#[cfg_attr(feature = "bindings", derive(TS))]
13051pub struct Decrypt {
13052 pub this: Box<Expression>,
13053 #[serde(default)]
13054 pub passphrase: Option<Box<Expression>>,
13055 #[serde(default)]
13056 pub aad: Option<Box<Expression>>,
13057 #[serde(default)]
13058 pub encryption_method: Option<Box<Expression>>,
13059 #[serde(default)]
13060 pub safe: Option<Box<Expression>>,
13061}
13062
13063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13065#[cfg_attr(feature = "bindings", derive(TS))]
13066pub struct DecryptRaw {
13067 pub this: Box<Expression>,
13068 #[serde(default)]
13069 pub key: Option<Box<Expression>>,
13070 #[serde(default)]
13071 pub iv: Option<Box<Expression>>,
13072 #[serde(default)]
13073 pub aad: Option<Box<Expression>>,
13074 #[serde(default)]
13075 pub encryption_method: Option<Box<Expression>>,
13076 #[serde(default)]
13077 pub aead: Option<Box<Expression>>,
13078 #[serde(default)]
13079 pub safe: Option<Box<Expression>>,
13080}
13081
13082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13084#[cfg_attr(feature = "bindings", derive(TS))]
13085pub struct Encode {
13086 pub this: Box<Expression>,
13087 #[serde(default)]
13088 pub charset: Option<Box<Expression>>,
13089}
13090
13091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13093#[cfg_attr(feature = "bindings", derive(TS))]
13094pub struct Encrypt {
13095 pub this: Box<Expression>,
13096 #[serde(default)]
13097 pub passphrase: Option<Box<Expression>>,
13098 #[serde(default)]
13099 pub aad: Option<Box<Expression>>,
13100 #[serde(default)]
13101 pub encryption_method: Option<Box<Expression>>,
13102}
13103
13104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13106#[cfg_attr(feature = "bindings", derive(TS))]
13107pub struct EncryptRaw {
13108 pub this: Box<Expression>,
13109 #[serde(default)]
13110 pub key: Option<Box<Expression>>,
13111 #[serde(default)]
13112 pub iv: Option<Box<Expression>>,
13113 #[serde(default)]
13114 pub aad: Option<Box<Expression>>,
13115 #[serde(default)]
13116 pub encryption_method: Option<Box<Expression>>,
13117}
13118
13119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13121#[cfg_attr(feature = "bindings", derive(TS))]
13122pub struct EqualNull {
13123 pub this: Box<Expression>,
13124 pub expression: Box<Expression>,
13125}
13126
13127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13129#[cfg_attr(feature = "bindings", derive(TS))]
13130pub struct ToBinary {
13131 pub this: Box<Expression>,
13132 #[serde(default)]
13133 pub format: Option<String>,
13134 #[serde(default)]
13135 pub safe: Option<Box<Expression>>,
13136}
13137
13138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13140#[cfg_attr(feature = "bindings", derive(TS))]
13141pub struct Base64DecodeBinary {
13142 pub this: Box<Expression>,
13143 #[serde(default)]
13144 pub alphabet: Option<Box<Expression>>,
13145}
13146
13147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13149#[cfg_attr(feature = "bindings", derive(TS))]
13150pub struct Base64DecodeString {
13151 pub this: Box<Expression>,
13152 #[serde(default)]
13153 pub alphabet: Option<Box<Expression>>,
13154}
13155
13156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13158#[cfg_attr(feature = "bindings", derive(TS))]
13159pub struct Base64Encode {
13160 pub this: Box<Expression>,
13161 #[serde(default)]
13162 pub max_line_length: Option<Box<Expression>>,
13163 #[serde(default)]
13164 pub alphabet: Option<Box<Expression>>,
13165}
13166
13167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13169#[cfg_attr(feature = "bindings", derive(TS))]
13170pub struct TryBase64DecodeBinary {
13171 pub this: Box<Expression>,
13172 #[serde(default)]
13173 pub alphabet: Option<Box<Expression>>,
13174}
13175
13176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13178#[cfg_attr(feature = "bindings", derive(TS))]
13179pub struct TryBase64DecodeString {
13180 pub this: Box<Expression>,
13181 #[serde(default)]
13182 pub alphabet: Option<Box<Expression>>,
13183}
13184
13185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13187#[cfg_attr(feature = "bindings", derive(TS))]
13188pub struct GapFill {
13189 pub this: Box<Expression>,
13190 #[serde(default)]
13191 pub ts_column: Option<Box<Expression>>,
13192 #[serde(default)]
13193 pub bucket_width: Option<Box<Expression>>,
13194 #[serde(default)]
13195 pub partitioning_columns: Option<Box<Expression>>,
13196 #[serde(default)]
13197 pub value_columns: Option<Box<Expression>>,
13198 #[serde(default)]
13199 pub origin: Option<Box<Expression>>,
13200 #[serde(default)]
13201 pub ignore_nulls: Option<Box<Expression>>,
13202}
13203
13204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13206#[cfg_attr(feature = "bindings", derive(TS))]
13207pub struct GenerateDateArray {
13208 #[serde(default)]
13209 pub start: Option<Box<Expression>>,
13210 #[serde(default)]
13211 pub end: Option<Box<Expression>>,
13212 #[serde(default)]
13213 pub step: Option<Box<Expression>>,
13214}
13215
13216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13218#[cfg_attr(feature = "bindings", derive(TS))]
13219pub struct GenerateTimestampArray {
13220 #[serde(default)]
13221 pub start: Option<Box<Expression>>,
13222 #[serde(default)]
13223 pub end: Option<Box<Expression>>,
13224 #[serde(default)]
13225 pub step: Option<Box<Expression>>,
13226}
13227
13228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13230#[cfg_attr(feature = "bindings", derive(TS))]
13231pub struct GetExtract {
13232 pub this: Box<Expression>,
13233 pub expression: Box<Expression>,
13234}
13235
13236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13238#[cfg_attr(feature = "bindings", derive(TS))]
13239pub struct Getbit {
13240 pub this: Box<Expression>,
13241 pub expression: Box<Expression>,
13242 #[serde(default)]
13243 pub zero_is_msb: Option<Box<Expression>>,
13244}
13245
13246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13248#[cfg_attr(feature = "bindings", derive(TS))]
13249pub struct OverflowTruncateBehavior {
13250 #[serde(default)]
13251 pub this: Option<Box<Expression>>,
13252 #[serde(default)]
13253 pub with_count: Option<Box<Expression>>,
13254}
13255
13256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13258#[cfg_attr(feature = "bindings", derive(TS))]
13259pub struct HexEncode {
13260 pub this: Box<Expression>,
13261 #[serde(default)]
13262 pub case: Option<Box<Expression>>,
13263}
13264
13265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13267#[cfg_attr(feature = "bindings", derive(TS))]
13268pub struct Compress {
13269 pub this: Box<Expression>,
13270 #[serde(default)]
13271 pub method: Option<String>,
13272}
13273
13274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13276#[cfg_attr(feature = "bindings", derive(TS))]
13277pub struct DecompressBinary {
13278 pub this: Box<Expression>,
13279 pub method: String,
13280}
13281
13282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13284#[cfg_attr(feature = "bindings", derive(TS))]
13285pub struct DecompressString {
13286 pub this: Box<Expression>,
13287 pub method: String,
13288}
13289
13290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13292#[cfg_attr(feature = "bindings", derive(TS))]
13293pub struct Xor {
13294 #[serde(default)]
13295 pub this: Option<Box<Expression>>,
13296 #[serde(default)]
13297 pub expression: Option<Box<Expression>>,
13298 #[serde(default)]
13299 pub expressions: Vec<Expression>,
13300}
13301
13302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13304#[cfg_attr(feature = "bindings", derive(TS))]
13305pub struct Nullif {
13306 pub this: Box<Expression>,
13307 pub expression: Box<Expression>,
13308}
13309
13310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13312#[cfg_attr(feature = "bindings", derive(TS))]
13313pub struct JSON {
13314 #[serde(default)]
13315 pub this: Option<Box<Expression>>,
13316 #[serde(default)]
13317 pub with_: Option<Box<Expression>>,
13318 #[serde(default)]
13319 pub unique: bool,
13320}
13321
13322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13324#[cfg_attr(feature = "bindings", derive(TS))]
13325pub struct JSONPath {
13326 #[serde(default)]
13327 pub expressions: Vec<Expression>,
13328 #[serde(default)]
13329 pub escape: Option<Box<Expression>>,
13330}
13331
13332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13334#[cfg_attr(feature = "bindings", derive(TS))]
13335pub struct JSONPathFilter {
13336 pub this: Box<Expression>,
13337}
13338
13339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13341#[cfg_attr(feature = "bindings", derive(TS))]
13342pub struct JSONPathKey {
13343 pub this: Box<Expression>,
13344}
13345
13346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13348#[cfg_attr(feature = "bindings", derive(TS))]
13349pub struct JSONPathRecursive {
13350 #[serde(default)]
13351 pub this: Option<Box<Expression>>,
13352}
13353
13354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13356#[cfg_attr(feature = "bindings", derive(TS))]
13357pub struct JSONPathScript {
13358 pub this: Box<Expression>,
13359}
13360
13361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13363#[cfg_attr(feature = "bindings", derive(TS))]
13364pub struct JSONPathSlice {
13365 #[serde(default)]
13366 pub start: Option<Box<Expression>>,
13367 #[serde(default)]
13368 pub end: Option<Box<Expression>>,
13369 #[serde(default)]
13370 pub step: Option<Box<Expression>>,
13371}
13372
13373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13375#[cfg_attr(feature = "bindings", derive(TS))]
13376pub struct JSONPathSelector {
13377 pub this: Box<Expression>,
13378}
13379
13380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13382#[cfg_attr(feature = "bindings", derive(TS))]
13383pub struct JSONPathSubscript {
13384 pub this: Box<Expression>,
13385}
13386
13387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13389#[cfg_attr(feature = "bindings", derive(TS))]
13390pub struct JSONPathUnion {
13391 #[serde(default)]
13392 pub expressions: Vec<Expression>,
13393}
13394
13395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13397#[cfg_attr(feature = "bindings", derive(TS))]
13398pub struct Format {
13399 pub this: Box<Expression>,
13400 #[serde(default)]
13401 pub expressions: Vec<Expression>,
13402}
13403
13404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13406#[cfg_attr(feature = "bindings", derive(TS))]
13407pub struct JSONKeys {
13408 pub this: Box<Expression>,
13409 #[serde(default)]
13410 pub expression: Option<Box<Expression>>,
13411 #[serde(default)]
13412 pub expressions: Vec<Expression>,
13413}
13414
13415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13417#[cfg_attr(feature = "bindings", derive(TS))]
13418pub struct JSONKeyValue {
13419 pub this: Box<Expression>,
13420 pub expression: Box<Expression>,
13421}
13422
13423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13425#[cfg_attr(feature = "bindings", derive(TS))]
13426pub struct JSONKeysAtDepth {
13427 pub this: Box<Expression>,
13428 #[serde(default)]
13429 pub expression: Option<Box<Expression>>,
13430 #[serde(default)]
13431 pub mode: Option<Box<Expression>>,
13432}
13433
13434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13436#[cfg_attr(feature = "bindings", derive(TS))]
13437pub struct JSONObject {
13438 #[serde(default)]
13439 pub expressions: Vec<Expression>,
13440 #[serde(default)]
13441 pub null_handling: Option<Box<Expression>>,
13442 #[serde(default)]
13443 pub unique_keys: Option<Box<Expression>>,
13444 #[serde(default)]
13445 pub return_type: Option<Box<Expression>>,
13446 #[serde(default)]
13447 pub encoding: Option<Box<Expression>>,
13448}
13449
13450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13452#[cfg_attr(feature = "bindings", derive(TS))]
13453pub struct JSONObjectAgg {
13454 #[serde(default)]
13455 pub expressions: Vec<Expression>,
13456 #[serde(default)]
13457 pub null_handling: Option<Box<Expression>>,
13458 #[serde(default)]
13459 pub unique_keys: Option<Box<Expression>>,
13460 #[serde(default)]
13461 pub return_type: Option<Box<Expression>>,
13462 #[serde(default)]
13463 pub encoding: Option<Box<Expression>>,
13464}
13465
13466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13468#[cfg_attr(feature = "bindings", derive(TS))]
13469pub struct JSONBObjectAgg {
13470 pub this: Box<Expression>,
13471 pub expression: Box<Expression>,
13472}
13473
13474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13476#[cfg_attr(feature = "bindings", derive(TS))]
13477pub struct JSONArray {
13478 #[serde(default)]
13479 pub expressions: Vec<Expression>,
13480 #[serde(default)]
13481 pub null_handling: Option<Box<Expression>>,
13482 #[serde(default)]
13483 pub return_type: Option<Box<Expression>>,
13484 #[serde(default)]
13485 pub strict: Option<Box<Expression>>,
13486}
13487
13488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13490#[cfg_attr(feature = "bindings", derive(TS))]
13491pub struct JSONArrayAgg {
13492 pub this: Box<Expression>,
13493 #[serde(default)]
13494 pub order: Option<Box<Expression>>,
13495 #[serde(default)]
13496 pub null_handling: Option<Box<Expression>>,
13497 #[serde(default)]
13498 pub return_type: Option<Box<Expression>>,
13499 #[serde(default)]
13500 pub strict: Option<Box<Expression>>,
13501}
13502
13503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13505#[cfg_attr(feature = "bindings", derive(TS))]
13506pub struct JSONExists {
13507 pub this: Box<Expression>,
13508 #[serde(default)]
13509 pub path: Option<Box<Expression>>,
13510 #[serde(default)]
13511 pub passing: Option<Box<Expression>>,
13512 #[serde(default)]
13513 pub on_condition: Option<Box<Expression>>,
13514 #[serde(default)]
13515 pub from_dcolonqmark: Option<Box<Expression>>,
13516}
13517
13518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13520#[cfg_attr(feature = "bindings", derive(TS))]
13521pub struct JSONColumnDef {
13522 #[serde(default)]
13523 pub this: Option<Box<Expression>>,
13524 #[serde(default)]
13525 pub kind: Option<String>,
13526 #[serde(default)]
13527 pub path: Option<Box<Expression>>,
13528 #[serde(default)]
13529 pub nested_schema: Option<Box<Expression>>,
13530 #[serde(default)]
13531 pub ordinality: Option<Box<Expression>>,
13532}
13533
13534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13536#[cfg_attr(feature = "bindings", derive(TS))]
13537pub struct JSONSchema {
13538 #[serde(default)]
13539 pub expressions: Vec<Expression>,
13540}
13541
13542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13544#[cfg_attr(feature = "bindings", derive(TS))]
13545pub struct JSONSet {
13546 pub this: Box<Expression>,
13547 #[serde(default)]
13548 pub expressions: Vec<Expression>,
13549}
13550
13551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13553#[cfg_attr(feature = "bindings", derive(TS))]
13554pub struct JSONStripNulls {
13555 pub this: Box<Expression>,
13556 #[serde(default)]
13557 pub expression: Option<Box<Expression>>,
13558 #[serde(default)]
13559 pub include_arrays: Option<Box<Expression>>,
13560 #[serde(default)]
13561 pub remove_empty: Option<Box<Expression>>,
13562}
13563
13564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13566#[cfg_attr(feature = "bindings", derive(TS))]
13567pub struct JSONValue {
13568 pub this: Box<Expression>,
13569 #[serde(default)]
13570 pub path: Option<Box<Expression>>,
13571 #[serde(default)]
13572 pub returning: Option<Box<Expression>>,
13573 #[serde(default)]
13574 pub on_condition: Option<Box<Expression>>,
13575}
13576
13577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13579#[cfg_attr(feature = "bindings", derive(TS))]
13580pub struct JSONValueArray {
13581 pub this: Box<Expression>,
13582 #[serde(default)]
13583 pub expression: Option<Box<Expression>>,
13584}
13585
13586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13588#[cfg_attr(feature = "bindings", derive(TS))]
13589pub struct JSONRemove {
13590 pub this: Box<Expression>,
13591 #[serde(default)]
13592 pub expressions: Vec<Expression>,
13593}
13594
13595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13597#[cfg_attr(feature = "bindings", derive(TS))]
13598pub struct JSONTable {
13599 pub this: Box<Expression>,
13600 #[serde(default)]
13601 pub schema: Option<Box<Expression>>,
13602 #[serde(default)]
13603 pub path: Option<Box<Expression>>,
13604 #[serde(default)]
13605 pub error_handling: Option<Box<Expression>>,
13606 #[serde(default)]
13607 pub empty_handling: Option<Box<Expression>>,
13608}
13609
13610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13612#[cfg_attr(feature = "bindings", derive(TS))]
13613pub struct JSONType {
13614 pub this: Box<Expression>,
13615 #[serde(default)]
13616 pub expression: Option<Box<Expression>>,
13617}
13618
13619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13621#[cfg_attr(feature = "bindings", derive(TS))]
13622pub struct ObjectInsert {
13623 pub this: Box<Expression>,
13624 #[serde(default)]
13625 pub key: Option<Box<Expression>>,
13626 #[serde(default)]
13627 pub value: Option<Box<Expression>>,
13628 #[serde(default)]
13629 pub update_flag: Option<Box<Expression>>,
13630}
13631
13632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13634#[cfg_attr(feature = "bindings", derive(TS))]
13635pub struct OpenJSONColumnDef {
13636 pub this: Box<Expression>,
13637 pub kind: String,
13638 #[serde(default)]
13639 pub path: Option<Box<Expression>>,
13640 #[serde(default)]
13641 pub as_json: Option<Box<Expression>>,
13642 #[serde(default, skip_serializing_if = "Option::is_none")]
13644 pub data_type: Option<DataType>,
13645}
13646
13647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13649#[cfg_attr(feature = "bindings", derive(TS))]
13650pub struct OpenJSON {
13651 pub this: Box<Expression>,
13652 #[serde(default)]
13653 pub path: Option<Box<Expression>>,
13654 #[serde(default)]
13655 pub expressions: Vec<Expression>,
13656}
13657
13658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13660#[cfg_attr(feature = "bindings", derive(TS))]
13661pub struct JSONBExists {
13662 pub this: Box<Expression>,
13663 #[serde(default)]
13664 pub path: Option<Box<Expression>>,
13665}
13666
13667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13669#[cfg_attr(feature = "bindings", derive(TS))]
13670pub struct JSONCast {
13671 pub this: Box<Expression>,
13672 pub to: DataType,
13673}
13674
13675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13677#[cfg_attr(feature = "bindings", derive(TS))]
13678pub struct JSONExtract {
13679 pub this: Box<Expression>,
13680 pub expression: Box<Expression>,
13681 #[serde(default)]
13682 pub only_json_types: Option<Box<Expression>>,
13683 #[serde(default)]
13684 pub expressions: Vec<Expression>,
13685 #[serde(default)]
13686 pub variant_extract: Option<Box<Expression>>,
13687 #[serde(default)]
13688 pub json_query: Option<Box<Expression>>,
13689 #[serde(default)]
13690 pub option: Option<Box<Expression>>,
13691 #[serde(default)]
13692 pub quote: Option<Box<Expression>>,
13693 #[serde(default)]
13694 pub on_condition: Option<Box<Expression>>,
13695 #[serde(default)]
13696 pub requires_json: Option<Box<Expression>>,
13697}
13698
13699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13701#[cfg_attr(feature = "bindings", derive(TS))]
13702pub struct JSONExtractQuote {
13703 #[serde(default)]
13704 pub option: Option<Box<Expression>>,
13705 #[serde(default)]
13706 pub scalar: Option<Box<Expression>>,
13707}
13708
13709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13711#[cfg_attr(feature = "bindings", derive(TS))]
13712pub struct JSONExtractArray {
13713 pub this: Box<Expression>,
13714 #[serde(default)]
13715 pub expression: Option<Box<Expression>>,
13716}
13717
13718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13720#[cfg_attr(feature = "bindings", derive(TS))]
13721pub struct JSONExtractScalar {
13722 pub this: Box<Expression>,
13723 pub expression: Box<Expression>,
13724 #[serde(default)]
13725 pub only_json_types: Option<Box<Expression>>,
13726 #[serde(default)]
13727 pub expressions: Vec<Expression>,
13728 #[serde(default)]
13729 pub json_type: Option<Box<Expression>>,
13730 #[serde(default)]
13731 pub scalar_only: Option<Box<Expression>>,
13732}
13733
13734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13736#[cfg_attr(feature = "bindings", derive(TS))]
13737pub struct JSONBExtractScalar {
13738 pub this: Box<Expression>,
13739 pub expression: Box<Expression>,
13740 #[serde(default)]
13741 pub json_type: Option<Box<Expression>>,
13742}
13743
13744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13746#[cfg_attr(feature = "bindings", derive(TS))]
13747pub struct JSONFormat {
13748 #[serde(default)]
13749 pub this: Option<Box<Expression>>,
13750 #[serde(default)]
13751 pub options: Vec<Expression>,
13752 #[serde(default)]
13753 pub is_json: Option<Box<Expression>>,
13754 #[serde(default)]
13755 pub to_json: Option<Box<Expression>>,
13756}
13757
13758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13760#[cfg_attr(feature = "bindings", derive(TS))]
13761pub struct JSONArrayAppend {
13762 pub this: Box<Expression>,
13763 #[serde(default)]
13764 pub expressions: Vec<Expression>,
13765}
13766
13767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13769#[cfg_attr(feature = "bindings", derive(TS))]
13770pub struct JSONArrayContains {
13771 pub this: Box<Expression>,
13772 pub expression: Box<Expression>,
13773 #[serde(default)]
13774 pub json_type: Option<Box<Expression>>,
13775}
13776
13777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13779#[cfg_attr(feature = "bindings", derive(TS))]
13780pub struct JSONArrayInsert {
13781 pub this: Box<Expression>,
13782 #[serde(default)]
13783 pub expressions: Vec<Expression>,
13784}
13785
13786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13788#[cfg_attr(feature = "bindings", derive(TS))]
13789pub struct ParseJSON {
13790 pub this: Box<Expression>,
13791 #[serde(default)]
13792 pub expression: Option<Box<Expression>>,
13793 #[serde(default)]
13794 pub safe: Option<Box<Expression>>,
13795}
13796
13797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13799#[cfg_attr(feature = "bindings", derive(TS))]
13800pub struct ParseUrl {
13801 pub this: Box<Expression>,
13802 #[serde(default)]
13803 pub part_to_extract: Option<Box<Expression>>,
13804 #[serde(default)]
13805 pub key: Option<Box<Expression>>,
13806 #[serde(default)]
13807 pub permissive: Option<Box<Expression>>,
13808}
13809
13810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13812#[cfg_attr(feature = "bindings", derive(TS))]
13813pub struct ParseIp {
13814 pub this: Box<Expression>,
13815 #[serde(default)]
13816 pub type_: Option<Box<Expression>>,
13817 #[serde(default)]
13818 pub permissive: Option<Box<Expression>>,
13819}
13820
13821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13823#[cfg_attr(feature = "bindings", derive(TS))]
13824pub struct ParseTime {
13825 pub this: Box<Expression>,
13826 pub format: String,
13827}
13828
13829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13831#[cfg_attr(feature = "bindings", derive(TS))]
13832pub struct ParseDatetime {
13833 pub this: Box<Expression>,
13834 #[serde(default)]
13835 pub format: Option<String>,
13836 #[serde(default)]
13837 pub zone: Option<Box<Expression>>,
13838}
13839
13840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13842#[cfg_attr(feature = "bindings", derive(TS))]
13843pub struct Map {
13844 #[serde(default)]
13845 pub keys: Vec<Expression>,
13846 #[serde(default)]
13847 pub values: Vec<Expression>,
13848}
13849
13850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13852#[cfg_attr(feature = "bindings", derive(TS))]
13853pub struct MapCat {
13854 pub this: Box<Expression>,
13855 pub expression: Box<Expression>,
13856}
13857
13858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13860#[cfg_attr(feature = "bindings", derive(TS))]
13861pub struct MapDelete {
13862 pub this: Box<Expression>,
13863 #[serde(default)]
13864 pub expressions: Vec<Expression>,
13865}
13866
13867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13869#[cfg_attr(feature = "bindings", derive(TS))]
13870pub struct MapInsert {
13871 pub this: Box<Expression>,
13872 #[serde(default)]
13873 pub key: Option<Box<Expression>>,
13874 #[serde(default)]
13875 pub value: Option<Box<Expression>>,
13876 #[serde(default)]
13877 pub update_flag: Option<Box<Expression>>,
13878}
13879
13880#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13882#[cfg_attr(feature = "bindings", derive(TS))]
13883pub struct MapPick {
13884 pub this: Box<Expression>,
13885 #[serde(default)]
13886 pub expressions: Vec<Expression>,
13887}
13888
13889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13891#[cfg_attr(feature = "bindings", derive(TS))]
13892pub struct ScopeResolution {
13893 #[serde(default)]
13894 pub this: Option<Box<Expression>>,
13895 pub expression: Box<Expression>,
13896}
13897
13898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13900#[cfg_attr(feature = "bindings", derive(TS))]
13901pub struct Slice {
13902 #[serde(default)]
13903 pub this: Option<Box<Expression>>,
13904 #[serde(default)]
13905 pub expression: Option<Box<Expression>>,
13906 #[serde(default)]
13907 pub step: Option<Box<Expression>>,
13908}
13909
13910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13912#[cfg_attr(feature = "bindings", derive(TS))]
13913pub struct VarMap {
13914 #[serde(default)]
13915 pub keys: Vec<Expression>,
13916 #[serde(default)]
13917 pub values: Vec<Expression>,
13918}
13919
13920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13922#[cfg_attr(feature = "bindings", derive(TS))]
13923pub struct MatchAgainst {
13924 pub this: Box<Expression>,
13925 #[serde(default)]
13926 pub expressions: Vec<Expression>,
13927 #[serde(default)]
13928 pub modifier: Option<Box<Expression>>,
13929}
13930
13931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13933#[cfg_attr(feature = "bindings", derive(TS))]
13934pub struct MD5Digest {
13935 pub this: Box<Expression>,
13936 #[serde(default)]
13937 pub expressions: Vec<Expression>,
13938}
13939
13940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13942#[cfg_attr(feature = "bindings", derive(TS))]
13943pub struct Monthname {
13944 pub this: Box<Expression>,
13945 #[serde(default)]
13946 pub abbreviated: Option<Box<Expression>>,
13947}
13948
13949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13951#[cfg_attr(feature = "bindings", derive(TS))]
13952pub struct Ntile {
13953 #[serde(default)]
13954 pub this: Option<Box<Expression>>,
13955}
13956
13957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13959#[cfg_attr(feature = "bindings", derive(TS))]
13960pub struct Normalize {
13961 pub this: Box<Expression>,
13962 #[serde(default)]
13963 pub form: Option<Box<Expression>>,
13964 #[serde(default)]
13965 pub is_casefold: Option<Box<Expression>>,
13966}
13967
13968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13970#[cfg_attr(feature = "bindings", derive(TS))]
13971pub struct Normal {
13972 pub this: Box<Expression>,
13973 #[serde(default)]
13974 pub stddev: Option<Box<Expression>>,
13975 #[serde(default)]
13976 pub gen: Option<Box<Expression>>,
13977}
13978
13979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13981#[cfg_attr(feature = "bindings", derive(TS))]
13982pub struct Predict {
13983 pub this: Box<Expression>,
13984 pub expression: Box<Expression>,
13985 #[serde(default)]
13986 pub params_struct: Option<Box<Expression>>,
13987}
13988
13989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13991#[cfg_attr(feature = "bindings", derive(TS))]
13992pub struct MLTranslate {
13993 pub this: Box<Expression>,
13994 pub expression: Box<Expression>,
13995 #[serde(default)]
13996 pub params_struct: Option<Box<Expression>>,
13997}
13998
13999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14001#[cfg_attr(feature = "bindings", derive(TS))]
14002pub struct FeaturesAtTime {
14003 pub this: Box<Expression>,
14004 #[serde(default)]
14005 pub time: Option<Box<Expression>>,
14006 #[serde(default)]
14007 pub num_rows: Option<Box<Expression>>,
14008 #[serde(default)]
14009 pub ignore_feature_nulls: Option<Box<Expression>>,
14010}
14011
14012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14014#[cfg_attr(feature = "bindings", derive(TS))]
14015pub struct GenerateEmbedding {
14016 pub this: Box<Expression>,
14017 pub expression: Box<Expression>,
14018 #[serde(default)]
14019 pub params_struct: Option<Box<Expression>>,
14020 #[serde(default)]
14021 pub is_text: Option<Box<Expression>>,
14022}
14023
14024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14026#[cfg_attr(feature = "bindings", derive(TS))]
14027pub struct MLForecast {
14028 pub this: Box<Expression>,
14029 #[serde(default)]
14030 pub expression: Option<Box<Expression>>,
14031 #[serde(default)]
14032 pub params_struct: Option<Box<Expression>>,
14033}
14034
14035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14037#[cfg_attr(feature = "bindings", derive(TS))]
14038pub struct ModelAttribute {
14039 pub this: Box<Expression>,
14040 pub expression: Box<Expression>,
14041}
14042
14043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14045#[cfg_attr(feature = "bindings", derive(TS))]
14046pub struct VectorSearch {
14047 pub this: Box<Expression>,
14048 #[serde(default)]
14049 pub column_to_search: Option<Box<Expression>>,
14050 #[serde(default)]
14051 pub query_table: Option<Box<Expression>>,
14052 #[serde(default)]
14053 pub query_column_to_search: Option<Box<Expression>>,
14054 #[serde(default)]
14055 pub top_k: Option<Box<Expression>>,
14056 #[serde(default)]
14057 pub distance_type: Option<Box<Expression>>,
14058 #[serde(default)]
14059 pub options: Vec<Expression>,
14060}
14061
14062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14064#[cfg_attr(feature = "bindings", derive(TS))]
14065pub struct Quantile {
14066 pub this: Box<Expression>,
14067 #[serde(default)]
14068 pub quantile: Option<Box<Expression>>,
14069}
14070
14071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14073#[cfg_attr(feature = "bindings", derive(TS))]
14074pub struct ApproxQuantile {
14075 pub this: Box<Expression>,
14076 #[serde(default)]
14077 pub quantile: Option<Box<Expression>>,
14078 #[serde(default)]
14079 pub accuracy: Option<Box<Expression>>,
14080 #[serde(default)]
14081 pub weight: Option<Box<Expression>>,
14082 #[serde(default)]
14083 pub error_tolerance: Option<Box<Expression>>,
14084}
14085
14086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14088#[cfg_attr(feature = "bindings", derive(TS))]
14089pub struct ApproxPercentileEstimate {
14090 pub this: Box<Expression>,
14091 #[serde(default)]
14092 pub percentile: Option<Box<Expression>>,
14093}
14094
14095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14097#[cfg_attr(feature = "bindings", derive(TS))]
14098pub struct Randn {
14099 #[serde(default)]
14100 pub this: Option<Box<Expression>>,
14101}
14102
14103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14105#[cfg_attr(feature = "bindings", derive(TS))]
14106pub struct Randstr {
14107 pub this: Box<Expression>,
14108 #[serde(default)]
14109 pub generator: Option<Box<Expression>>,
14110}
14111
14112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14114#[cfg_attr(feature = "bindings", derive(TS))]
14115pub struct RangeN {
14116 pub this: Box<Expression>,
14117 #[serde(default)]
14118 pub expressions: Vec<Expression>,
14119 #[serde(default)]
14120 pub each: Option<Box<Expression>>,
14121}
14122
14123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14125#[cfg_attr(feature = "bindings", derive(TS))]
14126pub struct RangeBucket {
14127 pub this: Box<Expression>,
14128 pub expression: Box<Expression>,
14129}
14130
14131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14133#[cfg_attr(feature = "bindings", derive(TS))]
14134pub struct ReadCSV {
14135 pub this: Box<Expression>,
14136 #[serde(default)]
14137 pub expressions: Vec<Expression>,
14138}
14139
14140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14142#[cfg_attr(feature = "bindings", derive(TS))]
14143pub struct ReadParquet {
14144 #[serde(default)]
14145 pub expressions: Vec<Expression>,
14146}
14147
14148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14150#[cfg_attr(feature = "bindings", derive(TS))]
14151pub struct Reduce {
14152 pub this: Box<Expression>,
14153 #[serde(default)]
14154 pub initial: Option<Box<Expression>>,
14155 #[serde(default)]
14156 pub merge: Option<Box<Expression>>,
14157 #[serde(default)]
14158 pub finish: Option<Box<Expression>>,
14159}
14160
14161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14163#[cfg_attr(feature = "bindings", derive(TS))]
14164pub struct RegexpExtractAll {
14165 pub this: Box<Expression>,
14166 pub expression: Box<Expression>,
14167 #[serde(default)]
14168 pub group: Option<Box<Expression>>,
14169 #[serde(default)]
14170 pub parameters: Option<Box<Expression>>,
14171 #[serde(default)]
14172 pub position: Option<Box<Expression>>,
14173 #[serde(default)]
14174 pub occurrence: Option<Box<Expression>>,
14175}
14176
14177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14179#[cfg_attr(feature = "bindings", derive(TS))]
14180pub struct RegexpILike {
14181 pub this: Box<Expression>,
14182 pub expression: Box<Expression>,
14183 #[serde(default)]
14184 pub flag: Option<Box<Expression>>,
14185}
14186
14187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14189#[cfg_attr(feature = "bindings", derive(TS))]
14190pub struct RegexpFullMatch {
14191 pub this: Box<Expression>,
14192 pub expression: Box<Expression>,
14193 #[serde(default)]
14194 pub options: Vec<Expression>,
14195}
14196
14197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14199#[cfg_attr(feature = "bindings", derive(TS))]
14200pub struct RegexpInstr {
14201 pub this: Box<Expression>,
14202 pub expression: Box<Expression>,
14203 #[serde(default)]
14204 pub position: Option<Box<Expression>>,
14205 #[serde(default)]
14206 pub occurrence: Option<Box<Expression>>,
14207 #[serde(default)]
14208 pub option: Option<Box<Expression>>,
14209 #[serde(default)]
14210 pub parameters: Option<Box<Expression>>,
14211 #[serde(default)]
14212 pub group: Option<Box<Expression>>,
14213}
14214
14215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14217#[cfg_attr(feature = "bindings", derive(TS))]
14218pub struct RegexpSplit {
14219 pub this: Box<Expression>,
14220 pub expression: Box<Expression>,
14221 #[serde(default)]
14222 pub limit: Option<Box<Expression>>,
14223}
14224
14225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14227#[cfg_attr(feature = "bindings", derive(TS))]
14228pub struct RegexpCount {
14229 pub this: Box<Expression>,
14230 pub expression: Box<Expression>,
14231 #[serde(default)]
14232 pub position: Option<Box<Expression>>,
14233 #[serde(default)]
14234 pub parameters: Option<Box<Expression>>,
14235}
14236
14237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14239#[cfg_attr(feature = "bindings", derive(TS))]
14240pub struct RegrValx {
14241 pub this: Box<Expression>,
14242 pub expression: Box<Expression>,
14243}
14244
14245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14247#[cfg_attr(feature = "bindings", derive(TS))]
14248pub struct RegrValy {
14249 pub this: Box<Expression>,
14250 pub expression: Box<Expression>,
14251}
14252
14253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14255#[cfg_attr(feature = "bindings", derive(TS))]
14256pub struct RegrAvgy {
14257 pub this: Box<Expression>,
14258 pub expression: Box<Expression>,
14259}
14260
14261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14263#[cfg_attr(feature = "bindings", derive(TS))]
14264pub struct RegrAvgx {
14265 pub this: Box<Expression>,
14266 pub expression: Box<Expression>,
14267}
14268
14269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14271#[cfg_attr(feature = "bindings", derive(TS))]
14272pub struct RegrCount {
14273 pub this: Box<Expression>,
14274 pub expression: Box<Expression>,
14275}
14276
14277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14279#[cfg_attr(feature = "bindings", derive(TS))]
14280pub struct RegrIntercept {
14281 pub this: Box<Expression>,
14282 pub expression: Box<Expression>,
14283}
14284
14285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14287#[cfg_attr(feature = "bindings", derive(TS))]
14288pub struct RegrR2 {
14289 pub this: Box<Expression>,
14290 pub expression: Box<Expression>,
14291}
14292
14293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14295#[cfg_attr(feature = "bindings", derive(TS))]
14296pub struct RegrSxx {
14297 pub this: Box<Expression>,
14298 pub expression: Box<Expression>,
14299}
14300
14301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14303#[cfg_attr(feature = "bindings", derive(TS))]
14304pub struct RegrSxy {
14305 pub this: Box<Expression>,
14306 pub expression: Box<Expression>,
14307}
14308
14309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14311#[cfg_attr(feature = "bindings", derive(TS))]
14312pub struct RegrSyy {
14313 pub this: Box<Expression>,
14314 pub expression: Box<Expression>,
14315}
14316
14317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14319#[cfg_attr(feature = "bindings", derive(TS))]
14320pub struct RegrSlope {
14321 pub this: Box<Expression>,
14322 pub expression: Box<Expression>,
14323}
14324
14325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14327#[cfg_attr(feature = "bindings", derive(TS))]
14328pub struct SafeAdd {
14329 pub this: Box<Expression>,
14330 pub expression: Box<Expression>,
14331}
14332
14333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14335#[cfg_attr(feature = "bindings", derive(TS))]
14336pub struct SafeDivide {
14337 pub this: Box<Expression>,
14338 pub expression: Box<Expression>,
14339}
14340
14341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14343#[cfg_attr(feature = "bindings", derive(TS))]
14344pub struct SafeMultiply {
14345 pub this: Box<Expression>,
14346 pub expression: Box<Expression>,
14347}
14348
14349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14351#[cfg_attr(feature = "bindings", derive(TS))]
14352pub struct SafeSubtract {
14353 pub this: Box<Expression>,
14354 pub expression: Box<Expression>,
14355}
14356
14357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14359#[cfg_attr(feature = "bindings", derive(TS))]
14360pub struct SHA2 {
14361 pub this: Box<Expression>,
14362 #[serde(default)]
14363 pub length: Option<i64>,
14364}
14365
14366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14368#[cfg_attr(feature = "bindings", derive(TS))]
14369pub struct SHA2Digest {
14370 pub this: Box<Expression>,
14371 #[serde(default)]
14372 pub length: Option<i64>,
14373}
14374
14375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14377#[cfg_attr(feature = "bindings", derive(TS))]
14378pub struct SortArray {
14379 pub this: Box<Expression>,
14380 #[serde(default)]
14381 pub asc: Option<Box<Expression>>,
14382 #[serde(default)]
14383 pub nulls_first: Option<Box<Expression>>,
14384}
14385
14386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14388#[cfg_attr(feature = "bindings", derive(TS))]
14389pub struct SplitPart {
14390 pub this: Box<Expression>,
14391 #[serde(default)]
14392 pub delimiter: Option<Box<Expression>>,
14393 #[serde(default)]
14394 pub part_index: Option<Box<Expression>>,
14395}
14396
14397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14399#[cfg_attr(feature = "bindings", derive(TS))]
14400pub struct SubstringIndex {
14401 pub this: Box<Expression>,
14402 #[serde(default)]
14403 pub delimiter: Option<Box<Expression>>,
14404 #[serde(default)]
14405 pub count: Option<Box<Expression>>,
14406}
14407
14408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14410#[cfg_attr(feature = "bindings", derive(TS))]
14411pub struct StandardHash {
14412 pub this: Box<Expression>,
14413 #[serde(default)]
14414 pub expression: Option<Box<Expression>>,
14415}
14416
14417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14419#[cfg_attr(feature = "bindings", derive(TS))]
14420pub struct StrPosition {
14421 pub this: Box<Expression>,
14422 #[serde(default)]
14423 pub substr: Option<Box<Expression>>,
14424 #[serde(default)]
14425 pub position: Option<Box<Expression>>,
14426 #[serde(default)]
14427 pub occurrence: Option<Box<Expression>>,
14428}
14429
14430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14432#[cfg_attr(feature = "bindings", derive(TS))]
14433pub struct Search {
14434 pub this: Box<Expression>,
14435 pub expression: Box<Expression>,
14436 #[serde(default)]
14437 pub json_scope: Option<Box<Expression>>,
14438 #[serde(default)]
14439 pub analyzer: Option<Box<Expression>>,
14440 #[serde(default)]
14441 pub analyzer_options: Option<Box<Expression>>,
14442 #[serde(default)]
14443 pub search_mode: Option<Box<Expression>>,
14444}
14445
14446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14448#[cfg_attr(feature = "bindings", derive(TS))]
14449pub struct SearchIp {
14450 pub this: Box<Expression>,
14451 pub expression: Box<Expression>,
14452}
14453
14454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14456#[cfg_attr(feature = "bindings", derive(TS))]
14457pub struct StrToDate {
14458 pub this: Box<Expression>,
14459 #[serde(default)]
14460 pub format: Option<String>,
14461 #[serde(default)]
14462 pub safe: Option<Box<Expression>>,
14463}
14464
14465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14467#[cfg_attr(feature = "bindings", derive(TS))]
14468pub struct StrToTime {
14469 pub this: Box<Expression>,
14470 pub format: String,
14471 #[serde(default)]
14472 pub zone: Option<Box<Expression>>,
14473 #[serde(default)]
14474 pub safe: Option<Box<Expression>>,
14475 #[serde(default)]
14476 pub target_type: Option<Box<Expression>>,
14477}
14478
14479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14481#[cfg_attr(feature = "bindings", derive(TS))]
14482pub struct StrToUnix {
14483 #[serde(default)]
14484 pub this: Option<Box<Expression>>,
14485 #[serde(default)]
14486 pub format: Option<String>,
14487}
14488
14489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14491#[cfg_attr(feature = "bindings", derive(TS))]
14492pub struct StrToMap {
14493 pub this: Box<Expression>,
14494 #[serde(default)]
14495 pub pair_delim: Option<Box<Expression>>,
14496 #[serde(default)]
14497 pub key_value_delim: Option<Box<Expression>>,
14498 #[serde(default)]
14499 pub duplicate_resolution_callback: Option<Box<Expression>>,
14500}
14501
14502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14504#[cfg_attr(feature = "bindings", derive(TS))]
14505pub struct NumberToStr {
14506 pub this: Box<Expression>,
14507 pub format: String,
14508 #[serde(default)]
14509 pub culture: Option<Box<Expression>>,
14510}
14511
14512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14514#[cfg_attr(feature = "bindings", derive(TS))]
14515pub struct FromBase {
14516 pub this: Box<Expression>,
14517 pub expression: Box<Expression>,
14518}
14519
14520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14522#[cfg_attr(feature = "bindings", derive(TS))]
14523pub struct Stuff {
14524 pub this: Box<Expression>,
14525 #[serde(default)]
14526 pub start: Option<Box<Expression>>,
14527 #[serde(default)]
14528 pub length: Option<i64>,
14529 pub expression: Box<Expression>,
14530}
14531
14532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14534#[cfg_attr(feature = "bindings", derive(TS))]
14535pub struct TimeToStr {
14536 pub this: Box<Expression>,
14537 pub format: String,
14538 #[serde(default)]
14539 pub culture: Option<Box<Expression>>,
14540 #[serde(default)]
14541 pub zone: Option<Box<Expression>>,
14542}
14543
14544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14546#[cfg_attr(feature = "bindings", derive(TS))]
14547pub struct TimeStrToTime {
14548 pub this: Box<Expression>,
14549 #[serde(default)]
14550 pub zone: Option<Box<Expression>>,
14551}
14552
14553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14555#[cfg_attr(feature = "bindings", derive(TS))]
14556pub struct TsOrDsAdd {
14557 pub this: Box<Expression>,
14558 pub expression: Box<Expression>,
14559 #[serde(default)]
14560 pub unit: Option<String>,
14561 #[serde(default)]
14562 pub return_type: Option<Box<Expression>>,
14563}
14564
14565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14567#[cfg_attr(feature = "bindings", derive(TS))]
14568pub struct TsOrDsDiff {
14569 pub this: Box<Expression>,
14570 pub expression: Box<Expression>,
14571 #[serde(default)]
14572 pub unit: Option<String>,
14573}
14574
14575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14577#[cfg_attr(feature = "bindings", derive(TS))]
14578pub struct TsOrDsToDate {
14579 pub this: Box<Expression>,
14580 #[serde(default)]
14581 pub format: Option<String>,
14582 #[serde(default)]
14583 pub safe: Option<Box<Expression>>,
14584}
14585
14586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14588#[cfg_attr(feature = "bindings", derive(TS))]
14589pub struct TsOrDsToTime {
14590 pub this: Box<Expression>,
14591 #[serde(default)]
14592 pub format: Option<String>,
14593 #[serde(default)]
14594 pub safe: Option<Box<Expression>>,
14595}
14596
14597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14599#[cfg_attr(feature = "bindings", derive(TS))]
14600pub struct Unhex {
14601 pub this: Box<Expression>,
14602 #[serde(default)]
14603 pub expression: Option<Box<Expression>>,
14604}
14605
14606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14608#[cfg_attr(feature = "bindings", derive(TS))]
14609pub struct Uniform {
14610 pub this: Box<Expression>,
14611 pub expression: Box<Expression>,
14612 #[serde(default)]
14613 pub gen: Option<Box<Expression>>,
14614 #[serde(default)]
14615 pub seed: Option<Box<Expression>>,
14616}
14617
14618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14620#[cfg_attr(feature = "bindings", derive(TS))]
14621pub struct UnixToStr {
14622 pub this: Box<Expression>,
14623 #[serde(default)]
14624 pub format: Option<String>,
14625}
14626
14627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14629#[cfg_attr(feature = "bindings", derive(TS))]
14630pub struct UnixToTime {
14631 pub this: Box<Expression>,
14632 #[serde(default)]
14633 pub scale: Option<i64>,
14634 #[serde(default)]
14635 pub zone: Option<Box<Expression>>,
14636 #[serde(default)]
14637 pub hours: Option<Box<Expression>>,
14638 #[serde(default)]
14639 pub minutes: Option<Box<Expression>>,
14640 #[serde(default)]
14641 pub format: Option<String>,
14642 #[serde(default)]
14643 pub target_type: Option<Box<Expression>>,
14644}
14645
14646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14648#[cfg_attr(feature = "bindings", derive(TS))]
14649pub struct Uuid {
14650 #[serde(default)]
14651 pub this: Option<Box<Expression>>,
14652 #[serde(default)]
14653 pub name: Option<String>,
14654 #[serde(default)]
14655 pub is_string: Option<Box<Expression>>,
14656}
14657
14658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14660#[cfg_attr(feature = "bindings", derive(TS))]
14661pub struct TimestampFromParts {
14662 #[serde(default)]
14663 pub zone: Option<Box<Expression>>,
14664 #[serde(default)]
14665 pub milli: Option<Box<Expression>>,
14666 #[serde(default)]
14667 pub this: Option<Box<Expression>>,
14668 #[serde(default)]
14669 pub expression: Option<Box<Expression>>,
14670}
14671
14672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14674#[cfg_attr(feature = "bindings", derive(TS))]
14675pub struct TimestampTzFromParts {
14676 #[serde(default)]
14677 pub zone: Option<Box<Expression>>,
14678}
14679
14680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14682#[cfg_attr(feature = "bindings", derive(TS))]
14683pub struct Corr {
14684 pub this: Box<Expression>,
14685 pub expression: Box<Expression>,
14686 #[serde(default)]
14687 pub null_on_zero_variance: Option<Box<Expression>>,
14688}
14689
14690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14692#[cfg_attr(feature = "bindings", derive(TS))]
14693pub struct WidthBucket {
14694 pub this: Box<Expression>,
14695 #[serde(default)]
14696 pub min_value: Option<Box<Expression>>,
14697 #[serde(default)]
14698 pub max_value: Option<Box<Expression>>,
14699 #[serde(default)]
14700 pub num_buckets: Option<Box<Expression>>,
14701 #[serde(default)]
14702 pub threshold: Option<Box<Expression>>,
14703}
14704
14705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14707#[cfg_attr(feature = "bindings", derive(TS))]
14708pub struct CovarSamp {
14709 pub this: Box<Expression>,
14710 pub expression: Box<Expression>,
14711}
14712
14713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14715#[cfg_attr(feature = "bindings", derive(TS))]
14716pub struct CovarPop {
14717 pub this: Box<Expression>,
14718 pub expression: Box<Expression>,
14719}
14720
14721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14723#[cfg_attr(feature = "bindings", derive(TS))]
14724pub struct Week {
14725 pub this: Box<Expression>,
14726 #[serde(default)]
14727 pub mode: Option<Box<Expression>>,
14728}
14729
14730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14732#[cfg_attr(feature = "bindings", derive(TS))]
14733pub struct XMLElement {
14734 pub this: Box<Expression>,
14735 #[serde(default)]
14736 pub expressions: Vec<Expression>,
14737 #[serde(default)]
14738 pub evalname: Option<Box<Expression>>,
14739}
14740
14741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14743#[cfg_attr(feature = "bindings", derive(TS))]
14744pub struct XMLGet {
14745 pub this: Box<Expression>,
14746 pub expression: Box<Expression>,
14747 #[serde(default)]
14748 pub instance: Option<Box<Expression>>,
14749}
14750
14751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14753#[cfg_attr(feature = "bindings", derive(TS))]
14754pub struct XMLTable {
14755 pub this: Box<Expression>,
14756 #[serde(default)]
14757 pub namespaces: Option<Box<Expression>>,
14758 #[serde(default)]
14759 pub passing: Option<Box<Expression>>,
14760 #[serde(default)]
14761 pub columns: Vec<Expression>,
14762 #[serde(default)]
14763 pub by_ref: Option<Box<Expression>>,
14764}
14765
14766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14768#[cfg_attr(feature = "bindings", derive(TS))]
14769pub struct XMLKeyValueOption {
14770 pub this: Box<Expression>,
14771 #[serde(default)]
14772 pub expression: Option<Box<Expression>>,
14773}
14774
14775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14777#[cfg_attr(feature = "bindings", derive(TS))]
14778pub struct Zipf {
14779 pub this: Box<Expression>,
14780 #[serde(default)]
14781 pub elementcount: Option<Box<Expression>>,
14782 #[serde(default)]
14783 pub gen: Option<Box<Expression>>,
14784}
14785
14786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14788#[cfg_attr(feature = "bindings", derive(TS))]
14789pub struct Merge {
14790 pub this: Box<Expression>,
14791 pub using: Box<Expression>,
14792 #[serde(default)]
14793 pub on: Option<Box<Expression>>,
14794 #[serde(default)]
14795 pub using_cond: Option<Box<Expression>>,
14796 #[serde(default)]
14797 pub whens: Option<Box<Expression>>,
14798 #[serde(default)]
14799 pub with_: Option<Box<Expression>>,
14800 #[serde(default)]
14801 pub returning: Option<Box<Expression>>,
14802}
14803
14804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14806#[cfg_attr(feature = "bindings", derive(TS))]
14807pub struct When {
14808 #[serde(default)]
14809 pub matched: Option<Box<Expression>>,
14810 #[serde(default)]
14811 pub source: Option<Box<Expression>>,
14812 #[serde(default)]
14813 pub condition: Option<Box<Expression>>,
14814 pub then: Box<Expression>,
14815}
14816
14817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14819#[cfg_attr(feature = "bindings", derive(TS))]
14820pub struct Whens {
14821 #[serde(default)]
14822 pub expressions: Vec<Expression>,
14823}
14824
14825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14827#[cfg_attr(feature = "bindings", derive(TS))]
14828pub struct NextValueFor {
14829 pub this: Box<Expression>,
14830 #[serde(default)]
14831 pub order: Option<Box<Expression>>,
14832}
14833
14834#[cfg(test)]
14835mod tests {
14836 use super::*;
14837
14838 #[test]
14839 #[cfg(feature = "bindings")]
14840 fn export_typescript_types() {
14841 Expression::export_all(&ts_rs::Config::default())
14844 .expect("Failed to export Expression types");
14845 }
14846
14847 #[test]
14848 fn test_simple_select_builder() {
14849 let select = Select::new()
14850 .column(Expression::star())
14851 .from(Expression::Table(Box::new(TableRef::new("users"))));
14852
14853 assert_eq!(select.expressions.len(), 1);
14854 assert!(select.from.is_some());
14855 }
14856
14857 #[test]
14858 fn test_expression_alias() {
14859 let expr = Expression::column("id").alias("user_id");
14860
14861 match expr {
14862 Expression::Alias(a) => {
14863 assert_eq!(a.alias.name, "user_id");
14864 }
14865 _ => panic!("Expected Alias"),
14866 }
14867 }
14868
14869 #[test]
14870 fn test_literal_creation() {
14871 let num = Expression::number(42);
14872 let str = Expression::string("hello");
14873
14874 match num {
14875 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14876 let Literal::Number(n) = lit.as_ref() else {
14877 unreachable!()
14878 };
14879 assert_eq!(n, "42")
14880 }
14881 _ => panic!("Expected Number"),
14882 }
14883
14884 match str {
14885 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
14886 let Literal::String(s) = lit.as_ref() else {
14887 unreachable!()
14888 };
14889 assert_eq!(s, "hello")
14890 }
14891 _ => panic!("Expected String"),
14892 }
14893 }
14894
14895 #[test]
14896 fn test_expression_sql() {
14897 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14898 assert_eq!(expr.sql(), "SELECT 1 + 2");
14899 }
14900
14901 #[test]
14902 fn test_expression_sql_for() {
14903 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14904 let sql = expr.sql_for(crate::DialectType::Generic);
14905 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
14907 }
14908}