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
3818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3823#[cfg_attr(feature = "bindings", derive(TS))]
3824pub struct Intersect {
3825 pub left: Expression,
3827 pub right: Expression,
3829 pub all: bool,
3831 #[serde(default)]
3833 pub distinct: bool,
3834 pub with: Option<With>,
3836 pub order_by: Option<OrderBy>,
3838 pub limit: Option<Box<Expression>>,
3840 pub offset: Option<Box<Expression>>,
3842 #[serde(default, skip_serializing_if = "Option::is_none")]
3844 pub distribute_by: Option<DistributeBy>,
3845 #[serde(default, skip_serializing_if = "Option::is_none")]
3847 pub sort_by: Option<SortBy>,
3848 #[serde(default, skip_serializing_if = "Option::is_none")]
3850 pub cluster_by: Option<ClusterBy>,
3851 #[serde(default)]
3853 pub by_name: bool,
3854 #[serde(default, skip_serializing_if = "Option::is_none")]
3856 pub side: Option<String>,
3857 #[serde(default, skip_serializing_if = "Option::is_none")]
3859 pub kind: Option<String>,
3860 #[serde(default)]
3862 pub corresponding: bool,
3863 #[serde(default)]
3865 pub strict: bool,
3866 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3868 pub on_columns: Vec<Expression>,
3869}
3870
3871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3876#[cfg_attr(feature = "bindings", derive(TS))]
3877pub struct Except {
3878 pub left: Expression,
3880 pub right: Expression,
3882 pub all: bool,
3884 #[serde(default)]
3886 pub distinct: bool,
3887 pub with: Option<With>,
3889 pub order_by: Option<OrderBy>,
3891 pub limit: Option<Box<Expression>>,
3893 pub offset: Option<Box<Expression>>,
3895 #[serde(default, skip_serializing_if = "Option::is_none")]
3897 pub distribute_by: Option<DistributeBy>,
3898 #[serde(default, skip_serializing_if = "Option::is_none")]
3900 pub sort_by: Option<SortBy>,
3901 #[serde(default, skip_serializing_if = "Option::is_none")]
3903 pub cluster_by: Option<ClusterBy>,
3904 #[serde(default)]
3906 pub by_name: bool,
3907 #[serde(default, skip_serializing_if = "Option::is_none")]
3909 pub side: Option<String>,
3910 #[serde(default, skip_serializing_if = "Option::is_none")]
3912 pub kind: Option<String>,
3913 #[serde(default)]
3915 pub corresponding: bool,
3916 #[serde(default)]
3918 pub strict: bool,
3919 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3921 pub on_columns: Vec<Expression>,
3922}
3923
3924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3926#[cfg_attr(feature = "bindings", derive(TS))]
3927pub struct SelectInto {
3928 pub this: Expression,
3930 #[serde(default)]
3932 pub temporary: bool,
3933 #[serde(default)]
3935 pub unlogged: bool,
3936 #[serde(default)]
3938 pub bulk_collect: bool,
3939 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3941 pub expressions: Vec<Expression>,
3942}
3943
3944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3954#[cfg_attr(feature = "bindings", derive(TS))]
3955pub struct Subquery {
3956 pub this: Expression,
3958 pub alias: Option<Identifier>,
3960 pub column_aliases: Vec<Identifier>,
3962 pub order_by: Option<OrderBy>,
3964 pub limit: Option<Limit>,
3966 pub offset: Option<Offset>,
3968 #[serde(default, skip_serializing_if = "Option::is_none")]
3970 pub distribute_by: Option<DistributeBy>,
3971 #[serde(default, skip_serializing_if = "Option::is_none")]
3973 pub sort_by: Option<SortBy>,
3974 #[serde(default, skip_serializing_if = "Option::is_none")]
3976 pub cluster_by: Option<ClusterBy>,
3977 #[serde(default)]
3979 pub lateral: bool,
3980 #[serde(default)]
3984 pub modifiers_inside: bool,
3985 #[serde(default)]
3987 pub trailing_comments: Vec<String>,
3988 #[serde(default, skip_serializing_if = "Option::is_none")]
3990 pub inferred_type: Option<DataType>,
3991}
3992
3993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3998#[cfg_attr(feature = "bindings", derive(TS))]
3999pub struct PipeOperator {
4000 pub this: Expression,
4002 pub expression: Expression,
4004}
4005
4006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4008#[cfg_attr(feature = "bindings", derive(TS))]
4009pub struct Values {
4010 pub expressions: Vec<Tuple>,
4012 pub alias: Option<Identifier>,
4014 pub column_aliases: Vec<Identifier>,
4016}
4017
4018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4028#[cfg_attr(feature = "bindings", derive(TS))]
4029pub struct Pivot {
4030 pub this: Expression,
4032 #[serde(default)]
4035 pub expressions: Vec<Expression>,
4036 #[serde(default)]
4038 pub fields: Vec<Expression>,
4039 #[serde(default)]
4041 pub using: Vec<Expression>,
4042 #[serde(default)]
4044 pub group: Option<Box<Expression>>,
4045 #[serde(default)]
4047 pub unpivot: bool,
4048 #[serde(default)]
4050 pub into: Option<Box<Expression>>,
4051 #[serde(default)]
4053 pub alias: Option<Identifier>,
4054 #[serde(default)]
4056 pub include_nulls: Option<bool>,
4057 #[serde(default)]
4059 pub default_on_null: Option<Box<Expression>>,
4060 #[serde(default, skip_serializing_if = "Option::is_none")]
4062 pub with: Option<With>,
4063}
4064
4065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4067#[cfg_attr(feature = "bindings", derive(TS))]
4068pub struct Unpivot {
4069 pub this: Expression,
4070 pub value_column: Identifier,
4071 pub name_column: Identifier,
4072 pub columns: Vec<Expression>,
4073 pub alias: Option<Identifier>,
4074 #[serde(default)]
4076 pub value_column_parenthesized: bool,
4077 #[serde(default)]
4079 pub include_nulls: Option<bool>,
4080 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4082 pub extra_value_columns: Vec<Identifier>,
4083}
4084
4085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4088#[cfg_attr(feature = "bindings", derive(TS))]
4089pub struct PivotAlias {
4090 pub this: Expression,
4091 pub alias: Expression,
4092}
4093
4094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4096#[cfg_attr(feature = "bindings", derive(TS))]
4097pub struct PreWhere {
4098 pub this: Expression,
4099}
4100
4101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4103#[cfg_attr(feature = "bindings", derive(TS))]
4104pub struct Stream {
4105 pub this: Expression,
4106 #[serde(skip_serializing_if = "Option::is_none")]
4107 pub on: Option<Expression>,
4108 #[serde(skip_serializing_if = "Option::is_none")]
4109 pub show_initial_rows: Option<bool>,
4110}
4111
4112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4114#[cfg_attr(feature = "bindings", derive(TS))]
4115pub struct UsingData {
4116 pub this: Expression,
4117}
4118
4119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4121#[cfg_attr(feature = "bindings", derive(TS))]
4122pub struct XmlNamespace {
4123 pub this: Expression,
4124 #[serde(skip_serializing_if = "Option::is_none")]
4125 pub alias: Option<Identifier>,
4126}
4127
4128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4130#[cfg_attr(feature = "bindings", derive(TS))]
4131pub struct RowFormat {
4132 pub delimited: bool,
4133 pub fields_terminated_by: Option<String>,
4134 pub collection_items_terminated_by: Option<String>,
4135 pub map_keys_terminated_by: Option<String>,
4136 pub lines_terminated_by: Option<String>,
4137 pub null_defined_as: Option<String>,
4138}
4139
4140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4142#[cfg_attr(feature = "bindings", derive(TS))]
4143pub struct DirectoryInsert {
4144 pub local: bool,
4145 pub path: String,
4146 pub row_format: Option<RowFormat>,
4147 #[serde(default)]
4149 pub stored_as: Option<String>,
4150}
4151
4152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4154#[cfg_attr(feature = "bindings", derive(TS))]
4155pub struct Insert {
4156 pub table: TableRef,
4157 pub columns: Vec<Identifier>,
4158 pub values: Vec<Vec<Expression>>,
4159 pub query: Option<Expression>,
4160 pub overwrite: bool,
4162 pub partition: Vec<(Identifier, Option<Expression>)>,
4164 #[serde(default)]
4166 pub directory: Option<DirectoryInsert>,
4167 #[serde(default)]
4169 pub returning: Vec<Expression>,
4170 #[serde(default)]
4172 pub output: Option<OutputClause>,
4173 #[serde(default)]
4175 pub on_conflict: Option<Box<Expression>>,
4176 #[serde(default)]
4178 pub leading_comments: Vec<String>,
4179 #[serde(default)]
4181 pub if_exists: bool,
4182 #[serde(default)]
4184 pub with: Option<With>,
4185 #[serde(default)]
4187 pub ignore: bool,
4188 #[serde(default)]
4190 pub source_alias: Option<Identifier>,
4191 #[serde(default)]
4193 pub alias: Option<Identifier>,
4194 #[serde(default)]
4196 pub alias_explicit_as: bool,
4197 #[serde(default)]
4199 pub default_values: bool,
4200 #[serde(default)]
4202 pub by_name: bool,
4203 #[serde(default, skip_serializing_if = "Option::is_none")]
4205 pub conflict_action: Option<String>,
4206 #[serde(default)]
4208 pub is_replace: bool,
4209 #[serde(default, skip_serializing_if = "Option::is_none")]
4211 pub hint: Option<Hint>,
4212 #[serde(default)]
4214 pub replace_where: Option<Box<Expression>>,
4215 #[serde(default)]
4217 pub source: Option<Box<Expression>>,
4218 #[serde(default, skip_serializing_if = "Option::is_none")]
4220 pub function_target: Option<Box<Expression>>,
4221 #[serde(default, skip_serializing_if = "Option::is_none")]
4223 pub partition_by: Option<Box<Expression>>,
4224 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4226 pub settings: Vec<Expression>,
4227}
4228
4229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4231#[cfg_attr(feature = "bindings", derive(TS))]
4232pub struct OutputClause {
4233 pub columns: Vec<Expression>,
4235 #[serde(default)]
4237 pub into_table: Option<Expression>,
4238}
4239
4240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4242#[cfg_attr(feature = "bindings", derive(TS))]
4243pub struct Update {
4244 pub table: TableRef,
4245 #[serde(default)]
4247 pub extra_tables: Vec<TableRef>,
4248 #[serde(default)]
4250 pub table_joins: Vec<Join>,
4251 pub set: Vec<(Identifier, Expression)>,
4252 pub from_clause: Option<From>,
4253 #[serde(default)]
4255 pub from_joins: Vec<Join>,
4256 pub where_clause: Option<Where>,
4257 #[serde(default)]
4259 pub returning: Vec<Expression>,
4260 #[serde(default)]
4262 pub output: Option<OutputClause>,
4263 #[serde(default)]
4265 pub with: Option<With>,
4266 #[serde(default)]
4268 pub leading_comments: Vec<String>,
4269 #[serde(default)]
4271 pub limit: Option<Expression>,
4272 #[serde(default)]
4274 pub order_by: Option<OrderBy>,
4275 #[serde(default)]
4277 pub from_before_set: bool,
4278}
4279
4280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4282#[cfg_attr(feature = "bindings", derive(TS))]
4283pub struct Delete {
4284 pub table: TableRef,
4285 #[serde(default, skip_serializing_if = "Option::is_none")]
4287 pub on_cluster: Option<OnCluster>,
4288 pub alias: Option<Identifier>,
4290 #[serde(default)]
4292 pub alias_explicit_as: bool,
4293 pub using: Vec<TableRef>,
4295 pub where_clause: Option<Where>,
4296 #[serde(default)]
4298 pub output: Option<OutputClause>,
4299 #[serde(default)]
4301 pub leading_comments: Vec<String>,
4302 #[serde(default)]
4304 pub with: Option<With>,
4305 #[serde(default)]
4307 pub limit: Option<Expression>,
4308 #[serde(default)]
4310 pub order_by: Option<OrderBy>,
4311 #[serde(default)]
4313 pub returning: Vec<Expression>,
4314 #[serde(default)]
4317 pub tables: Vec<TableRef>,
4318 #[serde(default)]
4321 pub tables_from_using: bool,
4322 #[serde(default)]
4324 pub joins: Vec<Join>,
4325 #[serde(default)]
4327 pub force_index: Option<String>,
4328 #[serde(default)]
4330 pub no_from: bool,
4331}
4332
4333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4335#[cfg_attr(feature = "bindings", derive(TS))]
4336pub struct CopyStmt {
4337 pub this: Expression,
4339 pub kind: bool,
4341 pub files: Vec<Expression>,
4343 #[serde(default)]
4345 pub params: Vec<CopyParameter>,
4346 #[serde(default)]
4348 pub credentials: Option<Box<Credentials>>,
4349 #[serde(default)]
4351 pub is_into: bool,
4352 #[serde(default)]
4354 pub with_wrapped: bool,
4355}
4356
4357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4359#[cfg_attr(feature = "bindings", derive(TS))]
4360pub struct CopyParameter {
4361 pub name: String,
4362 pub value: Option<Expression>,
4363 pub values: Vec<Expression>,
4364 #[serde(default)]
4366 pub eq: bool,
4367}
4368
4369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4371#[cfg_attr(feature = "bindings", derive(TS))]
4372pub struct Credentials {
4373 pub credentials: Vec<(String, String)>,
4374 pub encryption: Option<String>,
4375 pub storage: Option<String>,
4376}
4377
4378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4380#[cfg_attr(feature = "bindings", derive(TS))]
4381pub struct PutStmt {
4382 pub source: String,
4384 #[serde(default)]
4386 pub source_quoted: bool,
4387 pub target: Expression,
4389 #[serde(default)]
4391 pub params: Vec<CopyParameter>,
4392}
4393
4394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4396#[cfg_attr(feature = "bindings", derive(TS))]
4397pub struct StageReference {
4398 pub name: String,
4400 #[serde(default)]
4402 pub path: Option<String>,
4403 #[serde(default)]
4405 pub file_format: Option<Expression>,
4406 #[serde(default)]
4408 pub pattern: Option<String>,
4409 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4411 pub quoted: bool,
4412}
4413
4414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4416#[cfg_attr(feature = "bindings", derive(TS))]
4417pub struct HistoricalData {
4418 pub this: Box<Expression>,
4420 pub kind: String,
4422 pub expression: Box<Expression>,
4424}
4425
4426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4431#[cfg_attr(feature = "bindings", derive(TS))]
4432pub struct Alias {
4433 pub this: Expression,
4435 pub alias: Identifier,
4437 #[serde(default)]
4439 pub column_aliases: Vec<Identifier>,
4440 #[serde(default)]
4442 pub pre_alias_comments: Vec<String>,
4443 #[serde(default)]
4445 pub trailing_comments: Vec<String>,
4446 #[serde(default, skip_serializing_if = "Option::is_none")]
4448 pub inferred_type: Option<DataType>,
4449}
4450
4451impl Alias {
4452 pub fn new(this: Expression, alias: Identifier) -> Self {
4454 Self {
4455 this,
4456 alias,
4457 column_aliases: Vec::new(),
4458 pre_alias_comments: Vec::new(),
4459 trailing_comments: Vec::new(),
4460 inferred_type: None,
4461 }
4462 }
4463
4464 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4466 Self {
4467 this,
4468 alias: Identifier::empty(),
4469 column_aliases,
4470 pre_alias_comments: Vec::new(),
4471 trailing_comments: Vec::new(),
4472 inferred_type: None,
4473 }
4474 }
4475}
4476
4477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4484#[cfg_attr(feature = "bindings", derive(TS))]
4485pub struct Cast {
4486 pub this: Expression,
4488 pub to: DataType,
4490 #[serde(default)]
4491 pub trailing_comments: Vec<String>,
4492 #[serde(default)]
4494 pub double_colon_syntax: bool,
4495 #[serde(skip_serializing_if = "Option::is_none", default)]
4497 pub format: Option<Box<Expression>>,
4498 #[serde(skip_serializing_if = "Option::is_none", default)]
4500 pub default: Option<Box<Expression>>,
4501 #[serde(default, skip_serializing_if = "Option::is_none")]
4503 pub inferred_type: Option<DataType>,
4504}
4505
4506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4508#[cfg_attr(feature = "bindings", derive(TS))]
4509pub struct CollationExpr {
4510 pub this: Expression,
4511 pub collation: String,
4512 #[serde(default)]
4514 pub quoted: bool,
4515 #[serde(default)]
4517 pub double_quoted: bool,
4518}
4519
4520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4526#[cfg_attr(feature = "bindings", derive(TS))]
4527pub struct Case {
4528 pub operand: Option<Expression>,
4530 pub whens: Vec<(Expression, Expression)>,
4532 pub else_: Option<Expression>,
4534 #[serde(default)]
4536 #[serde(skip_serializing_if = "Vec::is_empty")]
4537 pub comments: Vec<String>,
4538 #[serde(default, skip_serializing_if = "Option::is_none")]
4540 pub inferred_type: Option<DataType>,
4541}
4542
4543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4551#[cfg_attr(feature = "bindings", derive(TS))]
4552pub struct BinaryOp {
4553 pub left: Expression,
4554 pub right: Expression,
4555 #[serde(default)]
4557 pub left_comments: Vec<String>,
4558 #[serde(default)]
4560 pub operator_comments: Vec<String>,
4561 #[serde(default)]
4563 pub trailing_comments: Vec<String>,
4564 #[serde(default, skip_serializing_if = "Option::is_none")]
4566 pub inferred_type: Option<DataType>,
4567}
4568
4569impl BinaryOp {
4570 pub fn new(left: Expression, right: Expression) -> Self {
4571 Self {
4572 left,
4573 right,
4574 left_comments: Vec::new(),
4575 operator_comments: Vec::new(),
4576 trailing_comments: Vec::new(),
4577 inferred_type: None,
4578 }
4579 }
4580}
4581
4582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4584#[cfg_attr(feature = "bindings", derive(TS))]
4585pub struct LikeOp {
4586 pub left: Expression,
4587 pub right: Expression,
4588 #[serde(default)]
4590 pub escape: Option<Expression>,
4591 #[serde(default)]
4593 pub quantifier: Option<String>,
4594 #[serde(default, skip_serializing_if = "Option::is_none")]
4596 pub inferred_type: Option<DataType>,
4597}
4598
4599impl LikeOp {
4600 pub fn new(left: Expression, right: Expression) -> Self {
4601 Self {
4602 left,
4603 right,
4604 escape: None,
4605 quantifier: None,
4606 inferred_type: None,
4607 }
4608 }
4609
4610 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4611 Self {
4612 left,
4613 right,
4614 escape: Some(escape),
4615 quantifier: None,
4616 inferred_type: None,
4617 }
4618 }
4619}
4620
4621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4625#[cfg_attr(feature = "bindings", derive(TS))]
4626pub struct UnaryOp {
4627 pub this: Expression,
4629 #[serde(default, skip_serializing_if = "Option::is_none")]
4631 pub inferred_type: Option<DataType>,
4632}
4633
4634impl UnaryOp {
4635 pub fn new(this: Expression) -> Self {
4636 Self {
4637 this,
4638 inferred_type: None,
4639 }
4640 }
4641}
4642
4643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4648#[cfg_attr(feature = "bindings", derive(TS))]
4649pub struct In {
4650 pub this: Expression,
4652 pub expressions: Vec<Expression>,
4654 pub query: Option<Expression>,
4656 pub not: bool,
4658 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4659 pub global: bool,
4660 #[serde(default, skip_serializing_if = "Option::is_none")]
4662 pub unnest: Option<Box<Expression>>,
4663 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4667 pub is_field: bool,
4668}
4669
4670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4672#[cfg_attr(feature = "bindings", derive(TS))]
4673pub struct Between {
4674 pub this: Expression,
4676 pub low: Expression,
4678 pub high: Expression,
4680 pub not: bool,
4682 #[serde(default)]
4684 pub symmetric: Option<bool>,
4685}
4686
4687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4689#[cfg_attr(feature = "bindings", derive(TS))]
4690pub struct IsNull {
4691 pub this: Expression,
4692 pub not: bool,
4693 #[serde(default)]
4695 pub postfix_form: bool,
4696}
4697
4698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4700#[cfg_attr(feature = "bindings", derive(TS))]
4701pub struct IsTrueFalse {
4702 pub this: Expression,
4703 pub not: bool,
4704}
4705
4706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4709#[cfg_attr(feature = "bindings", derive(TS))]
4710pub struct IsJson {
4711 pub this: Expression,
4712 pub json_type: Option<String>,
4714 pub unique_keys: Option<JsonUniqueKeys>,
4716 pub negated: bool,
4718}
4719
4720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4722#[cfg_attr(feature = "bindings", derive(TS))]
4723pub enum JsonUniqueKeys {
4724 With,
4726 Without,
4728 Shorthand,
4730}
4731
4732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4734#[cfg_attr(feature = "bindings", derive(TS))]
4735pub struct Exists {
4736 pub this: Expression,
4738 pub not: bool,
4740}
4741
4742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4749#[cfg_attr(feature = "bindings", derive(TS))]
4750pub struct Function {
4751 pub name: String,
4753 pub args: Vec<Expression>,
4755 pub distinct: bool,
4757 #[serde(default)]
4758 pub trailing_comments: Vec<String>,
4759 #[serde(default)]
4761 pub use_bracket_syntax: bool,
4762 #[serde(default)]
4764 pub no_parens: bool,
4765 #[serde(default)]
4767 pub quoted: bool,
4768 #[serde(default, skip_serializing_if = "Option::is_none")]
4770 pub span: Option<Span>,
4771 #[serde(default, skip_serializing_if = "Option::is_none")]
4773 pub inferred_type: Option<DataType>,
4774}
4775
4776impl Default for Function {
4777 fn default() -> Self {
4778 Self {
4779 name: String::new(),
4780 args: Vec::new(),
4781 distinct: false,
4782 trailing_comments: Vec::new(),
4783 use_bracket_syntax: false,
4784 no_parens: false,
4785 quoted: false,
4786 span: None,
4787 inferred_type: None,
4788 }
4789 }
4790}
4791
4792impl Function {
4793 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4794 Self {
4795 name: name.into(),
4796 args,
4797 distinct: false,
4798 trailing_comments: Vec::new(),
4799 use_bracket_syntax: false,
4800 no_parens: false,
4801 quoted: false,
4802 span: None,
4803 inferred_type: None,
4804 }
4805 }
4806}
4807
4808#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4815#[cfg_attr(feature = "bindings", derive(TS))]
4816pub struct AggregateFunction {
4817 pub name: String,
4819 pub args: Vec<Expression>,
4821 pub distinct: bool,
4823 pub filter: Option<Expression>,
4825 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4827 pub order_by: Vec<Ordered>,
4828 #[serde(default, skip_serializing_if = "Option::is_none")]
4830 pub limit: Option<Box<Expression>>,
4831 #[serde(default, skip_serializing_if = "Option::is_none")]
4833 pub ignore_nulls: Option<bool>,
4834 #[serde(default, skip_serializing_if = "Option::is_none")]
4836 pub inferred_type: Option<DataType>,
4837}
4838
4839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4846#[cfg_attr(feature = "bindings", derive(TS))]
4847pub struct WindowFunction {
4848 pub this: Expression,
4850 pub over: Over,
4852 #[serde(default, skip_serializing_if = "Option::is_none")]
4854 pub keep: Option<Keep>,
4855 #[serde(default, skip_serializing_if = "Option::is_none")]
4857 pub inferred_type: Option<DataType>,
4858}
4859
4860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4863#[cfg_attr(feature = "bindings", derive(TS))]
4864pub struct Keep {
4865 pub first: bool,
4867 pub order_by: Vec<Ordered>,
4869}
4870
4871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4873#[cfg_attr(feature = "bindings", derive(TS))]
4874pub struct WithinGroup {
4875 pub this: Expression,
4877 pub order_by: Vec<Ordered>,
4879}
4880
4881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4886#[cfg_attr(feature = "bindings", derive(TS))]
4887pub struct From {
4888 pub expressions: Vec<Expression>,
4890}
4891
4892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4898#[cfg_attr(feature = "bindings", derive(TS))]
4899pub struct Join {
4900 pub this: Expression,
4902 pub on: Option<Expression>,
4904 pub using: Vec<Identifier>,
4906 pub kind: JoinKind,
4908 pub use_inner_keyword: bool,
4910 pub use_outer_keyword: bool,
4912 pub deferred_condition: bool,
4914 #[serde(default, skip_serializing_if = "Option::is_none")]
4916 pub join_hint: Option<String>,
4917 #[serde(default, skip_serializing_if = "Option::is_none")]
4919 pub match_condition: Option<Expression>,
4920 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4922 pub pivots: Vec<Expression>,
4923 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4925 pub comments: Vec<String>,
4926 #[serde(default)]
4930 pub nesting_group: usize,
4931 #[serde(default)]
4933 pub directed: bool,
4934}
4935
4936#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4943#[cfg_attr(feature = "bindings", derive(TS))]
4944pub enum JoinKind {
4945 Inner,
4946 Left,
4947 Right,
4948 Full,
4949 Outer, Cross,
4951 Natural,
4952 NaturalLeft,
4953 NaturalRight,
4954 NaturalFull,
4955 Semi,
4956 Anti,
4957 LeftSemi,
4959 LeftAnti,
4960 RightSemi,
4961 RightAnti,
4962 CrossApply,
4964 OuterApply,
4965 AsOf,
4967 AsOfLeft,
4968 AsOfRight,
4969 Lateral,
4971 LeftLateral,
4972 Straight,
4974 Implicit,
4976 Array,
4978 LeftArray,
4979 Paste,
4981 Positional,
4983}
4984
4985impl Default for JoinKind {
4986 fn default() -> Self {
4987 JoinKind::Inner
4988 }
4989}
4990
4991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4994#[cfg_attr(feature = "bindings", derive(TS))]
4995pub struct JoinedTable {
4996 pub left: Expression,
4998 pub joins: Vec<Join>,
5000 pub lateral_views: Vec<LateralView>,
5002 pub alias: Option<Identifier>,
5004}
5005
5006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5008#[cfg_attr(feature = "bindings", derive(TS))]
5009pub struct Where {
5010 pub this: Expression,
5012}
5013
5014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5019#[cfg_attr(feature = "bindings", derive(TS))]
5020pub struct GroupBy {
5021 pub expressions: Vec<Expression>,
5023 #[serde(default)]
5025 pub all: Option<bool>,
5026 #[serde(default)]
5028 pub totals: bool,
5029 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5031 pub comments: Vec<String>,
5032}
5033
5034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5036#[cfg_attr(feature = "bindings", derive(TS))]
5037pub struct Having {
5038 pub this: Expression,
5040 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5042 pub comments: Vec<String>,
5043}
5044
5045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5047#[cfg_attr(feature = "bindings", derive(TS))]
5048pub struct OrderBy {
5049 pub expressions: Vec<Ordered>,
5051 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5053 pub siblings: bool,
5054 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5056 pub comments: Vec<String>,
5057}
5058
5059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5066#[cfg_attr(feature = "bindings", derive(TS))]
5067pub struct Ordered {
5068 pub this: Expression,
5070 pub desc: bool,
5072 pub nulls_first: Option<bool>,
5074 #[serde(default)]
5076 pub explicit_asc: bool,
5077 #[serde(default, skip_serializing_if = "Option::is_none")]
5079 pub with_fill: Option<Box<WithFill>>,
5080}
5081
5082impl Ordered {
5083 pub fn asc(expr: Expression) -> Self {
5084 Self {
5085 this: expr,
5086 desc: false,
5087 nulls_first: None,
5088 explicit_asc: false,
5089 with_fill: None,
5090 }
5091 }
5092
5093 pub fn desc(expr: Expression) -> Self {
5094 Self {
5095 this: expr,
5096 desc: true,
5097 nulls_first: None,
5098 explicit_asc: false,
5099 with_fill: None,
5100 }
5101 }
5102}
5103
5104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5107#[cfg_attr(feature = "bindings", derive(TS))]
5108#[cfg_attr(feature = "bindings", ts(export))]
5109pub struct DistributeBy {
5110 pub expressions: Vec<Expression>,
5111}
5112
5113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5116#[cfg_attr(feature = "bindings", derive(TS))]
5117#[cfg_attr(feature = "bindings", ts(export))]
5118pub struct ClusterBy {
5119 pub expressions: Vec<Ordered>,
5120}
5121
5122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5125#[cfg_attr(feature = "bindings", derive(TS))]
5126#[cfg_attr(feature = "bindings", ts(export))]
5127pub struct SortBy {
5128 pub expressions: Vec<Ordered>,
5129}
5130
5131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5134#[cfg_attr(feature = "bindings", derive(TS))]
5135#[cfg_attr(feature = "bindings", ts(export))]
5136pub struct LateralView {
5137 pub this: Expression,
5139 pub table_alias: Option<Identifier>,
5141 pub column_aliases: Vec<Identifier>,
5143 pub outer: bool,
5145}
5146
5147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5149#[cfg_attr(feature = "bindings", derive(TS))]
5150#[cfg_attr(feature = "bindings", ts(export))]
5151pub struct Hint {
5152 pub expressions: Vec<HintExpression>,
5153}
5154
5155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5157#[cfg_attr(feature = "bindings", derive(TS))]
5158#[cfg_attr(feature = "bindings", ts(export))]
5159pub enum HintExpression {
5160 Function { name: String, args: Vec<Expression> },
5162 Identifier(String),
5164 Raw(String),
5166}
5167
5168#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5170#[cfg_attr(feature = "bindings", derive(TS))]
5171#[cfg_attr(feature = "bindings", ts(export))]
5172pub enum PseudocolumnType {
5173 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5180
5181impl PseudocolumnType {
5182 pub fn as_str(&self) -> &'static str {
5183 match self {
5184 PseudocolumnType::Rownum => "ROWNUM",
5185 PseudocolumnType::Rowid => "ROWID",
5186 PseudocolumnType::Level => "LEVEL",
5187 PseudocolumnType::Sysdate => "SYSDATE",
5188 PseudocolumnType::ObjectId => "OBJECT_ID",
5189 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5190 }
5191 }
5192
5193 pub fn from_str(s: &str) -> Option<Self> {
5194 match s.to_uppercase().as_str() {
5195 "ROWNUM" => Some(PseudocolumnType::Rownum),
5196 "ROWID" => Some(PseudocolumnType::Rowid),
5197 "LEVEL" => Some(PseudocolumnType::Level),
5198 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5199 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5200 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5201 _ => None,
5202 }
5203 }
5204}
5205
5206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5209#[cfg_attr(feature = "bindings", derive(TS))]
5210#[cfg_attr(feature = "bindings", ts(export))]
5211pub struct Pseudocolumn {
5212 pub kind: PseudocolumnType,
5213}
5214
5215impl Pseudocolumn {
5216 pub fn rownum() -> Self {
5217 Self {
5218 kind: PseudocolumnType::Rownum,
5219 }
5220 }
5221
5222 pub fn rowid() -> Self {
5223 Self {
5224 kind: PseudocolumnType::Rowid,
5225 }
5226 }
5227
5228 pub fn level() -> Self {
5229 Self {
5230 kind: PseudocolumnType::Level,
5231 }
5232 }
5233}
5234
5235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5237#[cfg_attr(feature = "bindings", derive(TS))]
5238#[cfg_attr(feature = "bindings", ts(export))]
5239pub struct Connect {
5240 pub start: Option<Expression>,
5242 pub connect: Expression,
5244 pub nocycle: bool,
5246}
5247
5248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5250#[cfg_attr(feature = "bindings", derive(TS))]
5251#[cfg_attr(feature = "bindings", ts(export))]
5252pub struct Prior {
5253 pub this: Expression,
5254}
5255
5256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5258#[cfg_attr(feature = "bindings", derive(TS))]
5259#[cfg_attr(feature = "bindings", ts(export))]
5260pub struct ConnectByRoot {
5261 pub this: Expression,
5262}
5263
5264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5266#[cfg_attr(feature = "bindings", derive(TS))]
5267#[cfg_attr(feature = "bindings", ts(export))]
5268pub struct MatchRecognize {
5269 pub this: Option<Box<Expression>>,
5271 pub partition_by: Option<Vec<Expression>>,
5273 pub order_by: Option<Vec<Ordered>>,
5275 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5277 pub rows: Option<MatchRecognizeRows>,
5279 pub after: Option<MatchRecognizeAfter>,
5281 pub pattern: Option<String>,
5283 pub define: Option<Vec<(Identifier, Expression)>>,
5285 pub alias: Option<Identifier>,
5287 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5289 pub alias_explicit_as: 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 MatchRecognizeMeasure {
5297 pub this: Expression,
5299 pub window_frame: Option<MatchRecognizeSemantics>,
5301}
5302
5303#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5305#[cfg_attr(feature = "bindings", derive(TS))]
5306#[cfg_attr(feature = "bindings", ts(export))]
5307pub enum MatchRecognizeSemantics {
5308 Running,
5309 Final,
5310}
5311
5312#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5314#[cfg_attr(feature = "bindings", derive(TS))]
5315#[cfg_attr(feature = "bindings", ts(export))]
5316pub enum MatchRecognizeRows {
5317 OneRowPerMatch,
5318 AllRowsPerMatch,
5319 AllRowsPerMatchShowEmptyMatches,
5320 AllRowsPerMatchOmitEmptyMatches,
5321 AllRowsPerMatchWithUnmatchedRows,
5322}
5323
5324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5326#[cfg_attr(feature = "bindings", derive(TS))]
5327#[cfg_attr(feature = "bindings", ts(export))]
5328pub enum MatchRecognizeAfter {
5329 PastLastRow,
5330 ToNextRow,
5331 ToFirst(Identifier),
5332 ToLast(Identifier),
5333}
5334
5335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5337#[cfg_attr(feature = "bindings", derive(TS))]
5338pub struct Limit {
5339 pub this: Expression,
5341 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5343 pub percent: bool,
5344 #[serde(default)]
5346 #[serde(skip_serializing_if = "Vec::is_empty")]
5347 pub comments: Vec<String>,
5348}
5349
5350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5352#[cfg_attr(feature = "bindings", derive(TS))]
5353pub struct Offset {
5354 pub this: Expression,
5355 #[serde(skip_serializing_if = "Option::is_none", default)]
5357 pub rows: Option<bool>,
5358}
5359
5360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5362#[cfg_attr(feature = "bindings", derive(TS))]
5363pub struct Top {
5364 pub this: Expression,
5365 pub percent: bool,
5366 pub with_ties: bool,
5367 #[serde(default)]
5369 pub parenthesized: bool,
5370}
5371
5372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5374#[cfg_attr(feature = "bindings", derive(TS))]
5375pub struct Fetch {
5376 pub direction: String,
5378 pub count: Option<Expression>,
5380 pub percent: bool,
5382 pub rows: bool,
5384 pub with_ties: bool,
5386}
5387
5388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5394#[cfg_attr(feature = "bindings", derive(TS))]
5395pub struct Qualify {
5396 pub this: Expression,
5398}
5399
5400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5402#[cfg_attr(feature = "bindings", derive(TS))]
5403pub struct Sample {
5404 pub method: SampleMethod,
5405 pub size: Expression,
5406 pub seed: Option<Expression>,
5407 #[serde(default)]
5409 pub offset: Option<Expression>,
5410 pub unit_after_size: bool,
5412 #[serde(default)]
5414 pub use_sample_keyword: bool,
5415 #[serde(default)]
5417 pub explicit_method: bool,
5418 #[serde(default)]
5420 pub method_before_size: bool,
5421 #[serde(default)]
5423 pub use_seed_keyword: bool,
5424 pub bucket_numerator: Option<Box<Expression>>,
5426 pub bucket_denominator: Option<Box<Expression>>,
5428 pub bucket_field: Option<Box<Expression>>,
5430 #[serde(default)]
5432 pub is_using_sample: bool,
5433 #[serde(default)]
5435 pub is_percent: bool,
5436 #[serde(default)]
5438 pub suppress_method_output: bool,
5439}
5440
5441#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5443#[cfg_attr(feature = "bindings", derive(TS))]
5444pub enum SampleMethod {
5445 Bernoulli,
5446 System,
5447 Block,
5448 Row,
5449 Percent,
5450 Bucket,
5452 Reservoir,
5454}
5455
5456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5458#[cfg_attr(feature = "bindings", derive(TS))]
5459pub struct NamedWindow {
5460 pub name: Identifier,
5461 pub spec: Over,
5462}
5463
5464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5470#[cfg_attr(feature = "bindings", derive(TS))]
5471pub struct With {
5472 pub ctes: Vec<Cte>,
5474 pub recursive: bool,
5476 #[serde(default)]
5478 pub leading_comments: Vec<String>,
5479 #[serde(default, skip_serializing_if = "Option::is_none")]
5481 pub search: Option<Box<Expression>>,
5482}
5483
5484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5491#[cfg_attr(feature = "bindings", derive(TS))]
5492pub struct Cte {
5493 pub alias: Identifier,
5495 pub this: Expression,
5497 pub columns: Vec<Identifier>,
5499 pub materialized: Option<bool>,
5501 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5503 pub key_expressions: Vec<Identifier>,
5504 #[serde(default)]
5506 pub alias_first: bool,
5507 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5509 pub comments: Vec<String>,
5510}
5511
5512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5514#[cfg_attr(feature = "bindings", derive(TS))]
5515pub struct WindowSpec {
5516 pub partition_by: Vec<Expression>,
5517 pub order_by: Vec<Ordered>,
5518 pub frame: Option<WindowFrame>,
5519}
5520
5521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5523#[cfg_attr(feature = "bindings", derive(TS))]
5524pub struct Over {
5525 pub window_name: Option<Identifier>,
5527 pub partition_by: Vec<Expression>,
5528 pub order_by: Vec<Ordered>,
5529 pub frame: Option<WindowFrame>,
5530 pub alias: Option<Identifier>,
5531}
5532
5533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5535#[cfg_attr(feature = "bindings", derive(TS))]
5536pub struct WindowFrame {
5537 pub kind: WindowFrameKind,
5538 pub start: WindowFrameBound,
5539 pub end: Option<WindowFrameBound>,
5540 pub exclude: Option<WindowFrameExclude>,
5541 #[serde(default, skip_serializing_if = "Option::is_none")]
5543 pub kind_text: Option<String>,
5544 #[serde(default, skip_serializing_if = "Option::is_none")]
5546 pub start_side_text: Option<String>,
5547 #[serde(default, skip_serializing_if = "Option::is_none")]
5549 pub end_side_text: Option<String>,
5550}
5551
5552#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5553#[cfg_attr(feature = "bindings", derive(TS))]
5554pub enum WindowFrameKind {
5555 Rows,
5556 Range,
5557 Groups,
5558}
5559
5560#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5562#[cfg_attr(feature = "bindings", derive(TS))]
5563pub enum WindowFrameExclude {
5564 CurrentRow,
5565 Group,
5566 Ties,
5567 NoOthers,
5568}
5569
5570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5571#[cfg_attr(feature = "bindings", derive(TS))]
5572pub enum WindowFrameBound {
5573 CurrentRow,
5574 UnboundedPreceding,
5575 UnboundedFollowing,
5576 Preceding(Box<Expression>),
5577 Following(Box<Expression>),
5578 BarePreceding,
5580 BareFollowing,
5582 Value(Box<Expression>),
5584}
5585
5586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5588#[cfg_attr(feature = "bindings", derive(TS))]
5589pub struct StructField {
5590 pub name: String,
5591 pub data_type: DataType,
5592 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5593 pub options: Vec<Expression>,
5594 #[serde(default, skip_serializing_if = "Option::is_none")]
5595 pub comment: Option<String>,
5596}
5597
5598impl StructField {
5599 pub fn new(name: String, data_type: DataType) -> Self {
5601 Self {
5602 name,
5603 data_type,
5604 options: Vec::new(),
5605 comment: None,
5606 }
5607 }
5608
5609 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5611 Self {
5612 name,
5613 data_type,
5614 options,
5615 comment: None,
5616 }
5617 }
5618
5619 pub fn with_options_and_comment(
5621 name: String,
5622 data_type: DataType,
5623 options: Vec<Expression>,
5624 comment: Option<String>,
5625 ) -> Self {
5626 Self {
5627 name,
5628 data_type,
5629 options,
5630 comment,
5631 }
5632 }
5633}
5634
5635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5647#[cfg_attr(feature = "bindings", derive(TS))]
5648#[serde(tag = "data_type", rename_all = "snake_case")]
5649pub enum DataType {
5650 Boolean,
5652 TinyInt {
5653 length: Option<u32>,
5654 },
5655 SmallInt {
5656 length: Option<u32>,
5657 },
5658 Int {
5662 length: Option<u32>,
5663 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5664 integer_spelling: bool,
5665 },
5666 BigInt {
5667 length: Option<u32>,
5668 },
5669 Float {
5673 precision: Option<u32>,
5674 scale: Option<u32>,
5675 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5676 real_spelling: bool,
5677 },
5678 Double {
5679 precision: Option<u32>,
5680 scale: Option<u32>,
5681 },
5682 Decimal {
5683 precision: Option<u32>,
5684 scale: Option<u32>,
5685 },
5686
5687 Char {
5689 length: Option<u32>,
5690 },
5691 VarChar {
5694 length: Option<u32>,
5695 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5696 parenthesized_length: bool,
5697 },
5698 String {
5700 length: Option<u32>,
5701 },
5702 Text,
5703 TextWithLength {
5705 length: u32,
5706 },
5707
5708 Binary {
5710 length: Option<u32>,
5711 },
5712 VarBinary {
5713 length: Option<u32>,
5714 },
5715 Blob,
5716
5717 Bit {
5719 length: Option<u32>,
5720 },
5721 VarBit {
5722 length: Option<u32>,
5723 },
5724
5725 Date,
5727 Time {
5728 precision: Option<u32>,
5729 #[serde(default)]
5730 timezone: bool,
5731 },
5732 Timestamp {
5733 precision: Option<u32>,
5734 timezone: bool,
5735 },
5736 Interval {
5737 unit: Option<String>,
5738 #[serde(default, skip_serializing_if = "Option::is_none")]
5740 to: Option<String>,
5741 },
5742
5743 Json,
5745 JsonB,
5746
5747 Uuid,
5749
5750 Array {
5752 element_type: Box<DataType>,
5753 #[serde(default, skip_serializing_if = "Option::is_none")]
5755 dimension: Option<u32>,
5756 },
5757
5758 List {
5761 element_type: Box<DataType>,
5762 },
5763
5764 Struct {
5768 fields: Vec<StructField>,
5769 nested: bool,
5770 },
5771 Map {
5772 key_type: Box<DataType>,
5773 value_type: Box<DataType>,
5774 },
5775
5776 Enum {
5778 values: Vec<String>,
5779 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5780 assignments: Vec<Option<String>>,
5781 },
5782
5783 Set {
5785 values: Vec<String>,
5786 },
5787
5788 Union {
5790 fields: Vec<(String, DataType)>,
5791 },
5792
5793 Vector {
5795 #[serde(default)]
5796 element_type: Option<Box<DataType>>,
5797 dimension: Option<u32>,
5798 },
5799
5800 Object {
5803 fields: Vec<(String, DataType, bool)>,
5804 modifier: Option<String>,
5805 },
5806
5807 Nullable {
5809 inner: Box<DataType>,
5810 },
5811
5812 Custom {
5814 name: String,
5815 },
5816
5817 Geometry {
5819 subtype: Option<String>,
5820 srid: Option<u32>,
5821 },
5822 Geography {
5823 subtype: Option<String>,
5824 srid: Option<u32>,
5825 },
5826
5827 CharacterSet {
5830 name: String,
5831 },
5832
5833 Unknown,
5835}
5836
5837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5839#[cfg_attr(feature = "bindings", derive(TS))]
5840#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5841pub struct Array {
5842 pub expressions: Vec<Expression>,
5843}
5844
5845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5847#[cfg_attr(feature = "bindings", derive(TS))]
5848pub struct Struct {
5849 pub fields: Vec<(Option<String>, Expression)>,
5850}
5851
5852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5854#[cfg_attr(feature = "bindings", derive(TS))]
5855pub struct Tuple {
5856 pub expressions: Vec<Expression>,
5857}
5858
5859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5861#[cfg_attr(feature = "bindings", derive(TS))]
5862pub struct Interval {
5863 pub this: Option<Expression>,
5865 pub unit: Option<IntervalUnitSpec>,
5867}
5868
5869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5871#[cfg_attr(feature = "bindings", derive(TS))]
5872#[serde(tag = "type", rename_all = "snake_case")]
5873pub enum IntervalUnitSpec {
5874 Simple {
5876 unit: IntervalUnit,
5877 use_plural: bool,
5879 },
5880 Span(IntervalSpan),
5882 ExprSpan(IntervalSpanExpr),
5885 Expr(Box<Expression>),
5887}
5888
5889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5891#[cfg_attr(feature = "bindings", derive(TS))]
5892pub struct IntervalSpan {
5893 pub this: IntervalUnit,
5895 pub expression: IntervalUnit,
5897}
5898
5899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5902#[cfg_attr(feature = "bindings", derive(TS))]
5903pub struct IntervalSpanExpr {
5904 pub this: Box<Expression>,
5906 pub expression: Box<Expression>,
5908}
5909
5910#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5911#[cfg_attr(feature = "bindings", derive(TS))]
5912pub enum IntervalUnit {
5913 Year,
5914 Quarter,
5915 Month,
5916 Week,
5917 Day,
5918 Hour,
5919 Minute,
5920 Second,
5921 Millisecond,
5922 Microsecond,
5923 Nanosecond,
5924}
5925
5926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5928#[cfg_attr(feature = "bindings", derive(TS))]
5929pub struct Command {
5930 pub this: String,
5932}
5933
5934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5937#[cfg_attr(feature = "bindings", derive(TS))]
5938pub struct ExecuteStatement {
5939 pub this: Expression,
5941 #[serde(default)]
5943 pub parameters: Vec<ExecuteParameter>,
5944 #[serde(default, skip_serializing_if = "Option::is_none")]
5946 pub suffix: Option<String>,
5947}
5948
5949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5951#[cfg_attr(feature = "bindings", derive(TS))]
5952pub struct ExecuteParameter {
5953 pub name: String,
5955 pub value: Expression,
5957 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5959 pub positional: bool,
5960 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5962 pub output: bool,
5963}
5964
5965#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5968#[cfg_attr(feature = "bindings", derive(TS))]
5969pub struct Kill {
5970 pub this: Expression,
5972 pub kind: Option<String>,
5974}
5975
5976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5978#[cfg_attr(feature = "bindings", derive(TS))]
5979pub struct CreateTask {
5980 pub or_replace: bool,
5981 pub if_not_exists: bool,
5982 pub name: String,
5984 pub properties: String,
5986 pub body: Expression,
5988}
5989
5990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5992#[cfg_attr(feature = "bindings", derive(TS))]
5993pub struct Raw {
5994 pub sql: String,
5995}
5996
5997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6003#[cfg_attr(feature = "bindings", derive(TS))]
6004pub struct UnaryFunc {
6005 pub this: Expression,
6006 #[serde(skip_serializing_if = "Option::is_none", default)]
6008 pub original_name: Option<String>,
6009 #[serde(default, skip_serializing_if = "Option::is_none")]
6011 pub inferred_type: Option<DataType>,
6012}
6013
6014impl UnaryFunc {
6015 pub fn new(this: Expression) -> Self {
6017 Self {
6018 this,
6019 original_name: None,
6020 inferred_type: None,
6021 }
6022 }
6023
6024 pub fn with_name(this: Expression, name: String) -> Self {
6026 Self {
6027 this,
6028 original_name: Some(name),
6029 inferred_type: None,
6030 }
6031 }
6032}
6033
6034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6038#[cfg_attr(feature = "bindings", derive(TS))]
6039pub struct CharFunc {
6040 pub args: Vec<Expression>,
6041 #[serde(skip_serializing_if = "Option::is_none", default)]
6042 pub charset: Option<String>,
6043 #[serde(skip_serializing_if = "Option::is_none", default)]
6045 pub name: Option<String>,
6046}
6047
6048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6050#[cfg_attr(feature = "bindings", derive(TS))]
6051pub struct BinaryFunc {
6052 pub this: Expression,
6053 pub expression: Expression,
6054 #[serde(skip_serializing_if = "Option::is_none", default)]
6056 pub original_name: Option<String>,
6057 #[serde(default, skip_serializing_if = "Option::is_none")]
6059 pub inferred_type: Option<DataType>,
6060}
6061
6062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6064#[cfg_attr(feature = "bindings", derive(TS))]
6065pub struct VarArgFunc {
6066 pub expressions: Vec<Expression>,
6067 #[serde(skip_serializing_if = "Option::is_none", default)]
6069 pub original_name: Option<String>,
6070 #[serde(default, skip_serializing_if = "Option::is_none")]
6072 pub inferred_type: Option<DataType>,
6073}
6074
6075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6077#[cfg_attr(feature = "bindings", derive(TS))]
6078pub struct ConcatWs {
6079 pub separator: Expression,
6080 pub expressions: Vec<Expression>,
6081}
6082
6083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6085#[cfg_attr(feature = "bindings", derive(TS))]
6086pub struct SubstringFunc {
6087 pub this: Expression,
6088 pub start: Expression,
6089 pub length: Option<Expression>,
6090 #[serde(default)]
6092 pub from_for_syntax: bool,
6093}
6094
6095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6097#[cfg_attr(feature = "bindings", derive(TS))]
6098pub struct OverlayFunc {
6099 pub this: Expression,
6100 pub replacement: Expression,
6101 pub from: Expression,
6102 pub length: Option<Expression>,
6103}
6104
6105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6107#[cfg_attr(feature = "bindings", derive(TS))]
6108pub struct TrimFunc {
6109 pub this: Expression,
6110 pub characters: Option<Expression>,
6111 pub position: TrimPosition,
6112 #[serde(default)]
6114 pub sql_standard_syntax: bool,
6115 #[serde(default)]
6117 pub position_explicit: bool,
6118}
6119
6120#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6121#[cfg_attr(feature = "bindings", derive(TS))]
6122pub enum TrimPosition {
6123 Both,
6124 Leading,
6125 Trailing,
6126}
6127
6128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6130#[cfg_attr(feature = "bindings", derive(TS))]
6131pub struct ReplaceFunc {
6132 pub this: Expression,
6133 pub old: Expression,
6134 pub new: Expression,
6135}
6136
6137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6139#[cfg_attr(feature = "bindings", derive(TS))]
6140pub struct LeftRightFunc {
6141 pub this: Expression,
6142 pub length: Expression,
6143}
6144
6145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6147#[cfg_attr(feature = "bindings", derive(TS))]
6148pub struct RepeatFunc {
6149 pub this: Expression,
6150 pub times: Expression,
6151}
6152
6153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6155#[cfg_attr(feature = "bindings", derive(TS))]
6156pub struct PadFunc {
6157 pub this: Expression,
6158 pub length: Expression,
6159 pub fill: Option<Expression>,
6160}
6161
6162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6164#[cfg_attr(feature = "bindings", derive(TS))]
6165pub struct SplitFunc {
6166 pub this: Expression,
6167 pub delimiter: Expression,
6168}
6169
6170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6172#[cfg_attr(feature = "bindings", derive(TS))]
6173pub struct RegexpFunc {
6174 pub this: Expression,
6175 pub pattern: Expression,
6176 pub flags: Option<Expression>,
6177}
6178
6179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6181#[cfg_attr(feature = "bindings", derive(TS))]
6182pub struct RegexpReplaceFunc {
6183 pub this: Expression,
6184 pub pattern: Expression,
6185 pub replacement: Expression,
6186 pub flags: Option<Expression>,
6187}
6188
6189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6191#[cfg_attr(feature = "bindings", derive(TS))]
6192pub struct RegexpExtractFunc {
6193 pub this: Expression,
6194 pub pattern: Expression,
6195 pub group: Option<Expression>,
6196}
6197
6198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6200#[cfg_attr(feature = "bindings", derive(TS))]
6201pub struct RoundFunc {
6202 pub this: Expression,
6203 pub decimals: Option<Expression>,
6204}
6205
6206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6208#[cfg_attr(feature = "bindings", derive(TS))]
6209pub struct FloorFunc {
6210 pub this: Expression,
6211 pub scale: Option<Expression>,
6212 #[serde(skip_serializing_if = "Option::is_none", default)]
6214 pub to: Option<Expression>,
6215}
6216
6217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6219#[cfg_attr(feature = "bindings", derive(TS))]
6220pub struct CeilFunc {
6221 pub this: Expression,
6222 #[serde(skip_serializing_if = "Option::is_none", default)]
6223 pub decimals: Option<Expression>,
6224 #[serde(skip_serializing_if = "Option::is_none", default)]
6226 pub to: Option<Expression>,
6227}
6228
6229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6231#[cfg_attr(feature = "bindings", derive(TS))]
6232pub struct LogFunc {
6233 pub this: Expression,
6234 pub base: Option<Expression>,
6235}
6236
6237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6239#[cfg_attr(feature = "bindings", derive(TS))]
6240pub struct CurrentDate;
6241
6242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6244#[cfg_attr(feature = "bindings", derive(TS))]
6245pub struct CurrentTime {
6246 pub precision: Option<u32>,
6247}
6248
6249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6251#[cfg_attr(feature = "bindings", derive(TS))]
6252pub struct CurrentTimestamp {
6253 pub precision: Option<u32>,
6254 #[serde(default)]
6256 pub sysdate: bool,
6257}
6258
6259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6261#[cfg_attr(feature = "bindings", derive(TS))]
6262pub struct CurrentTimestampLTZ {
6263 pub precision: Option<u32>,
6264}
6265
6266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6268#[cfg_attr(feature = "bindings", derive(TS))]
6269pub struct AtTimeZone {
6270 pub this: Expression,
6272 pub zone: Expression,
6274}
6275
6276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6278#[cfg_attr(feature = "bindings", derive(TS))]
6279pub struct DateAddFunc {
6280 pub this: Expression,
6281 pub interval: Expression,
6282 pub unit: IntervalUnit,
6283}
6284
6285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6287#[cfg_attr(feature = "bindings", derive(TS))]
6288pub struct DateDiffFunc {
6289 pub this: Expression,
6290 pub expression: Expression,
6291 pub unit: Option<IntervalUnit>,
6292}
6293
6294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6296#[cfg_attr(feature = "bindings", derive(TS))]
6297pub struct DateTruncFunc {
6298 pub this: Expression,
6299 pub unit: DateTimeField,
6300}
6301
6302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6304#[cfg_attr(feature = "bindings", derive(TS))]
6305pub struct ExtractFunc {
6306 pub this: Expression,
6307 pub field: DateTimeField,
6308}
6309
6310#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6311#[cfg_attr(feature = "bindings", derive(TS))]
6312pub enum DateTimeField {
6313 Year,
6314 Month,
6315 Day,
6316 Hour,
6317 Minute,
6318 Second,
6319 Millisecond,
6320 Microsecond,
6321 DayOfWeek,
6322 DayOfYear,
6323 Week,
6324 WeekWithModifier(String),
6326 Quarter,
6327 Epoch,
6328 Timezone,
6329 TimezoneHour,
6330 TimezoneMinute,
6331 Date,
6332 Time,
6333 Custom(String),
6335}
6336
6337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6339#[cfg_attr(feature = "bindings", derive(TS))]
6340pub struct ToDateFunc {
6341 pub this: Expression,
6342 pub format: Option<Expression>,
6343}
6344
6345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6347#[cfg_attr(feature = "bindings", derive(TS))]
6348pub struct ToTimestampFunc {
6349 pub this: Expression,
6350 pub format: Option<Expression>,
6351}
6352
6353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6355#[cfg_attr(feature = "bindings", derive(TS))]
6356pub struct IfFunc {
6357 pub condition: Expression,
6358 pub true_value: Expression,
6359 pub false_value: Option<Expression>,
6360 #[serde(skip_serializing_if = "Option::is_none", default)]
6362 pub original_name: Option<String>,
6363 #[serde(default, skip_serializing_if = "Option::is_none")]
6365 pub inferred_type: Option<DataType>,
6366}
6367
6368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6370#[cfg_attr(feature = "bindings", derive(TS))]
6371pub struct Nvl2Func {
6372 pub this: Expression,
6373 pub true_value: Expression,
6374 pub false_value: Expression,
6375 #[serde(default, skip_serializing_if = "Option::is_none")]
6377 pub inferred_type: Option<DataType>,
6378}
6379
6380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6386#[cfg_attr(feature = "bindings", derive(TS))]
6387pub struct AggFunc {
6388 pub this: Expression,
6389 pub distinct: bool,
6390 pub filter: Option<Expression>,
6391 pub order_by: Vec<Ordered>,
6392 #[serde(skip_serializing_if = "Option::is_none", default)]
6394 pub name: Option<String>,
6395 #[serde(skip_serializing_if = "Option::is_none", default)]
6397 pub ignore_nulls: Option<bool>,
6398 #[serde(skip_serializing_if = "Option::is_none", default)]
6401 pub having_max: Option<(Box<Expression>, bool)>,
6402 #[serde(skip_serializing_if = "Option::is_none", default)]
6404 pub limit: Option<Box<Expression>>,
6405 #[serde(default, skip_serializing_if = "Option::is_none")]
6407 pub inferred_type: Option<DataType>,
6408}
6409
6410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6412#[cfg_attr(feature = "bindings", derive(TS))]
6413pub struct CountFunc {
6414 pub this: Option<Expression>,
6415 pub star: bool,
6416 pub distinct: bool,
6417 pub filter: Option<Expression>,
6418 #[serde(default, skip_serializing_if = "Option::is_none")]
6420 pub ignore_nulls: Option<bool>,
6421 #[serde(default, skip_serializing_if = "Option::is_none")]
6423 pub original_name: Option<String>,
6424 #[serde(default, skip_serializing_if = "Option::is_none")]
6426 pub inferred_type: Option<DataType>,
6427}
6428
6429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6431#[cfg_attr(feature = "bindings", derive(TS))]
6432pub struct GroupConcatFunc {
6433 pub this: Expression,
6434 pub separator: Option<Expression>,
6435 pub order_by: Option<Vec<Ordered>>,
6436 pub distinct: bool,
6437 pub filter: Option<Expression>,
6438 #[serde(default, skip_serializing_if = "Option::is_none")]
6440 pub inferred_type: Option<DataType>,
6441}
6442
6443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6445#[cfg_attr(feature = "bindings", derive(TS))]
6446pub struct StringAggFunc {
6447 pub this: Expression,
6448 #[serde(default)]
6449 pub separator: Option<Expression>,
6450 #[serde(default)]
6451 pub order_by: Option<Vec<Ordered>>,
6452 #[serde(default)]
6453 pub distinct: bool,
6454 #[serde(default)]
6455 pub filter: Option<Expression>,
6456 #[serde(default, skip_serializing_if = "Option::is_none")]
6458 pub limit: Option<Box<Expression>>,
6459 #[serde(default, skip_serializing_if = "Option::is_none")]
6461 pub inferred_type: Option<DataType>,
6462}
6463
6464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6466#[cfg_attr(feature = "bindings", derive(TS))]
6467pub struct ListAggFunc {
6468 pub this: Expression,
6469 pub separator: Option<Expression>,
6470 pub on_overflow: Option<ListAggOverflow>,
6471 pub order_by: Option<Vec<Ordered>>,
6472 pub distinct: bool,
6473 pub filter: Option<Expression>,
6474 #[serde(default, skip_serializing_if = "Option::is_none")]
6476 pub inferred_type: Option<DataType>,
6477}
6478
6479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6481#[cfg_attr(feature = "bindings", derive(TS))]
6482pub enum ListAggOverflow {
6483 Error,
6484 Truncate {
6485 filler: Option<Expression>,
6486 with_count: bool,
6487 },
6488}
6489
6490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6492#[cfg_attr(feature = "bindings", derive(TS))]
6493pub struct SumIfFunc {
6494 pub this: Expression,
6495 pub condition: Expression,
6496 pub filter: Option<Expression>,
6497 #[serde(default, skip_serializing_if = "Option::is_none")]
6499 pub inferred_type: Option<DataType>,
6500}
6501
6502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6504#[cfg_attr(feature = "bindings", derive(TS))]
6505pub struct ApproxPercentileFunc {
6506 pub this: Expression,
6507 pub percentile: Expression,
6508 pub accuracy: Option<Expression>,
6509 pub filter: Option<Expression>,
6510}
6511
6512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6514#[cfg_attr(feature = "bindings", derive(TS))]
6515pub struct PercentileFunc {
6516 pub this: Expression,
6517 pub percentile: Expression,
6518 pub order_by: Option<Vec<Ordered>>,
6519 pub filter: Option<Expression>,
6520}
6521
6522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6528#[cfg_attr(feature = "bindings", derive(TS))]
6529pub struct RowNumber;
6530
6531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6533#[cfg_attr(feature = "bindings", derive(TS))]
6534pub struct Rank {
6535 #[serde(default, skip_serializing_if = "Option::is_none")]
6537 pub order_by: Option<Vec<Ordered>>,
6538 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6540 pub args: Vec<Expression>,
6541}
6542
6543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6545#[cfg_attr(feature = "bindings", derive(TS))]
6546pub struct DenseRank {
6547 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6549 pub args: Vec<Expression>,
6550}
6551
6552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6554#[cfg_attr(feature = "bindings", derive(TS))]
6555pub struct NTileFunc {
6556 #[serde(default, skip_serializing_if = "Option::is_none")]
6558 pub num_buckets: Option<Expression>,
6559 #[serde(default, skip_serializing_if = "Option::is_none")]
6561 pub order_by: Option<Vec<Ordered>>,
6562}
6563
6564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6566#[cfg_attr(feature = "bindings", derive(TS))]
6567pub struct LeadLagFunc {
6568 pub this: Expression,
6569 pub offset: Option<Expression>,
6570 pub default: Option<Expression>,
6571 #[serde(default, skip_serializing_if = "Option::is_none")]
6573 pub ignore_nulls: Option<bool>,
6574}
6575
6576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6578#[cfg_attr(feature = "bindings", derive(TS))]
6579pub struct ValueFunc {
6580 pub this: Expression,
6581 #[serde(default, skip_serializing_if = "Option::is_none")]
6583 pub ignore_nulls: Option<bool>,
6584 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6586 pub order_by: Vec<Ordered>,
6587}
6588
6589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6591#[cfg_attr(feature = "bindings", derive(TS))]
6592pub struct NthValueFunc {
6593 pub this: Expression,
6594 pub offset: Expression,
6595 #[serde(default, skip_serializing_if = "Option::is_none")]
6597 pub ignore_nulls: Option<bool>,
6598 #[serde(default, skip_serializing_if = "Option::is_none")]
6601 pub from_first: Option<bool>,
6602}
6603
6604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6606#[cfg_attr(feature = "bindings", derive(TS))]
6607pub struct PercentRank {
6608 #[serde(default, skip_serializing_if = "Option::is_none")]
6610 pub order_by: Option<Vec<Ordered>>,
6611 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6613 pub args: Vec<Expression>,
6614}
6615
6616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6618#[cfg_attr(feature = "bindings", derive(TS))]
6619pub struct CumeDist {
6620 #[serde(default, skip_serializing_if = "Option::is_none")]
6622 pub order_by: Option<Vec<Ordered>>,
6623 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6625 pub args: Vec<Expression>,
6626}
6627
6628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6634#[cfg_attr(feature = "bindings", derive(TS))]
6635pub struct PositionFunc {
6636 pub substring: Expression,
6637 pub string: Expression,
6638 pub start: Option<Expression>,
6639}
6640
6641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6647#[cfg_attr(feature = "bindings", derive(TS))]
6648pub struct Random;
6649
6650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6652#[cfg_attr(feature = "bindings", derive(TS))]
6653pub struct Rand {
6654 pub seed: Option<Box<Expression>>,
6655 #[serde(default)]
6657 pub lower: Option<Box<Expression>>,
6658 #[serde(default)]
6660 pub upper: Option<Box<Expression>>,
6661}
6662
6663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6665#[cfg_attr(feature = "bindings", derive(TS))]
6666pub struct TruncateFunc {
6667 pub this: Expression,
6668 pub decimals: Option<Expression>,
6669}
6670
6671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6673#[cfg_attr(feature = "bindings", derive(TS))]
6674pub struct Pi;
6675
6676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6682#[cfg_attr(feature = "bindings", derive(TS))]
6683pub struct DecodeFunc {
6684 pub this: Expression,
6685 pub search_results: Vec<(Expression, Expression)>,
6686 pub default: Option<Expression>,
6687}
6688
6689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6695#[cfg_attr(feature = "bindings", derive(TS))]
6696pub struct DateFormatFunc {
6697 pub this: Expression,
6698 pub format: Expression,
6699}
6700
6701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6703#[cfg_attr(feature = "bindings", derive(TS))]
6704pub struct FromUnixtimeFunc {
6705 pub this: Expression,
6706 pub format: Option<Expression>,
6707}
6708
6709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6711#[cfg_attr(feature = "bindings", derive(TS))]
6712pub struct UnixTimestampFunc {
6713 pub this: Option<Expression>,
6714 pub format: Option<Expression>,
6715}
6716
6717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6719#[cfg_attr(feature = "bindings", derive(TS))]
6720pub struct MakeDateFunc {
6721 pub year: Expression,
6722 pub month: Expression,
6723 pub day: Expression,
6724}
6725
6726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6728#[cfg_attr(feature = "bindings", derive(TS))]
6729pub struct MakeTimestampFunc {
6730 pub year: Expression,
6731 pub month: Expression,
6732 pub day: Expression,
6733 pub hour: Expression,
6734 pub minute: Expression,
6735 pub second: Expression,
6736 pub timezone: Option<Expression>,
6737}
6738
6739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6741#[cfg_attr(feature = "bindings", derive(TS))]
6742pub struct LastDayFunc {
6743 pub this: Expression,
6744 #[serde(skip_serializing_if = "Option::is_none", default)]
6746 pub unit: Option<DateTimeField>,
6747}
6748
6749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6755#[cfg_attr(feature = "bindings", derive(TS))]
6756pub struct ArrayConstructor {
6757 pub expressions: Vec<Expression>,
6758 pub bracket_notation: bool,
6759 pub use_list_keyword: bool,
6761}
6762
6763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6765#[cfg_attr(feature = "bindings", derive(TS))]
6766pub struct ArraySortFunc {
6767 pub this: Expression,
6768 pub comparator: Option<Expression>,
6769 pub desc: bool,
6770 pub nulls_first: Option<bool>,
6771}
6772
6773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6775#[cfg_attr(feature = "bindings", derive(TS))]
6776pub struct ArrayJoinFunc {
6777 pub this: Expression,
6778 pub separator: Expression,
6779 pub null_replacement: Option<Expression>,
6780}
6781
6782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6784#[cfg_attr(feature = "bindings", derive(TS))]
6785pub struct UnnestFunc {
6786 pub this: Expression,
6787 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6789 pub expressions: Vec<Expression>,
6790 pub with_ordinality: bool,
6791 pub alias: Option<Identifier>,
6792 #[serde(default, skip_serializing_if = "Option::is_none")]
6794 pub offset_alias: Option<Identifier>,
6795}
6796
6797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6799#[cfg_attr(feature = "bindings", derive(TS))]
6800pub struct ArrayFilterFunc {
6801 pub this: Expression,
6802 pub filter: Expression,
6803}
6804
6805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6807#[cfg_attr(feature = "bindings", derive(TS))]
6808pub struct ArrayTransformFunc {
6809 pub this: Expression,
6810 pub transform: Expression,
6811}
6812
6813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6815#[cfg_attr(feature = "bindings", derive(TS))]
6816pub struct SequenceFunc {
6817 pub start: Expression,
6818 pub stop: Expression,
6819 pub step: Option<Expression>,
6820}
6821
6822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6828#[cfg_attr(feature = "bindings", derive(TS))]
6829pub struct StructConstructor {
6830 pub fields: Vec<(Option<Identifier>, Expression)>,
6831}
6832
6833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6835#[cfg_attr(feature = "bindings", derive(TS))]
6836pub struct StructExtractFunc {
6837 pub this: Expression,
6838 pub field: Identifier,
6839}
6840
6841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6843#[cfg_attr(feature = "bindings", derive(TS))]
6844pub struct NamedStructFunc {
6845 pub pairs: Vec<(Expression, Expression)>,
6846}
6847
6848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6854#[cfg_attr(feature = "bindings", derive(TS))]
6855pub struct MapConstructor {
6856 pub keys: Vec<Expression>,
6857 pub values: Vec<Expression>,
6858 #[serde(default)]
6860 pub curly_brace_syntax: bool,
6861 #[serde(default)]
6863 pub with_map_keyword: bool,
6864}
6865
6866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6868#[cfg_attr(feature = "bindings", derive(TS))]
6869pub struct TransformFunc {
6870 pub this: Expression,
6871 pub transform: Expression,
6872}
6873
6874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6877#[cfg_attr(feature = "bindings", derive(TS))]
6878pub struct FunctionEmits {
6879 pub this: Expression,
6881 pub emits: Expression,
6883}
6884
6885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6891#[cfg_attr(feature = "bindings", derive(TS))]
6892pub struct JsonExtractFunc {
6893 pub this: Expression,
6894 pub path: Expression,
6895 pub returning: Option<DataType>,
6896 #[serde(default)]
6898 pub arrow_syntax: bool,
6899 #[serde(default)]
6901 pub hash_arrow_syntax: bool,
6902 #[serde(default)]
6904 pub wrapper_option: Option<String>,
6905 #[serde(default)]
6907 pub quotes_option: Option<String>,
6908 #[serde(default)]
6910 pub on_scalar_string: bool,
6911 #[serde(default)]
6913 pub on_error: Option<String>,
6914}
6915
6916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6918#[cfg_attr(feature = "bindings", derive(TS))]
6919pub struct JsonPathFunc {
6920 pub this: Expression,
6921 pub paths: Vec<Expression>,
6922}
6923
6924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6926#[cfg_attr(feature = "bindings", derive(TS))]
6927pub struct JsonObjectFunc {
6928 pub pairs: Vec<(Expression, Expression)>,
6929 pub null_handling: Option<JsonNullHandling>,
6930 #[serde(default)]
6931 pub with_unique_keys: bool,
6932 #[serde(default)]
6933 pub returning_type: Option<DataType>,
6934 #[serde(default)]
6935 pub format_json: bool,
6936 #[serde(default)]
6937 pub encoding: Option<String>,
6938 #[serde(default)]
6940 pub star: bool,
6941}
6942
6943#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6945#[cfg_attr(feature = "bindings", derive(TS))]
6946pub enum JsonNullHandling {
6947 NullOnNull,
6948 AbsentOnNull,
6949}
6950
6951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6953#[cfg_attr(feature = "bindings", derive(TS))]
6954pub struct JsonModifyFunc {
6955 pub this: Expression,
6956 pub path_values: Vec<(Expression, Expression)>,
6957}
6958
6959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6961#[cfg_attr(feature = "bindings", derive(TS))]
6962pub struct JsonArrayAggFunc {
6963 pub this: Expression,
6964 pub order_by: Option<Vec<Ordered>>,
6965 pub null_handling: Option<JsonNullHandling>,
6966 pub filter: Option<Expression>,
6967}
6968
6969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6971#[cfg_attr(feature = "bindings", derive(TS))]
6972pub struct JsonObjectAggFunc {
6973 pub key: Expression,
6974 pub value: Expression,
6975 pub null_handling: Option<JsonNullHandling>,
6976 pub filter: Option<Expression>,
6977}
6978
6979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6985#[cfg_attr(feature = "bindings", derive(TS))]
6986pub struct ConvertFunc {
6987 pub this: Expression,
6988 pub to: DataType,
6989 pub style: Option<Expression>,
6990}
6991
6992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6998#[cfg_attr(feature = "bindings", derive(TS))]
6999pub struct LambdaExpr {
7000 pub parameters: Vec<Identifier>,
7001 pub body: Expression,
7002 #[serde(default)]
7004 pub colon: bool,
7005 #[serde(default)]
7008 pub parameter_types: Vec<Option<DataType>>,
7009}
7010
7011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7013#[cfg_attr(feature = "bindings", derive(TS))]
7014pub struct Parameter {
7015 pub name: Option<String>,
7016 pub index: Option<u32>,
7017 pub style: ParameterStyle,
7018 #[serde(default)]
7020 pub quoted: bool,
7021 #[serde(default)]
7023 pub string_quoted: bool,
7024 #[serde(default)]
7026 pub expression: Option<String>,
7027}
7028
7029#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7031#[cfg_attr(feature = "bindings", derive(TS))]
7032pub enum ParameterStyle {
7033 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7043
7044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7046#[cfg_attr(feature = "bindings", derive(TS))]
7047pub struct Placeholder {
7048 pub index: Option<u32>,
7049}
7050
7051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7053#[cfg_attr(feature = "bindings", derive(TS))]
7054pub struct NamedArgument {
7055 pub name: Identifier,
7056 pub value: Expression,
7057 pub separator: NamedArgSeparator,
7059}
7060
7061#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7063#[cfg_attr(feature = "bindings", derive(TS))]
7064pub enum NamedArgSeparator {
7065 DArrow,
7067 ColonEq,
7069 Eq,
7071}
7072
7073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7076#[cfg_attr(feature = "bindings", derive(TS))]
7077pub struct TableArgument {
7078 pub prefix: String,
7080 pub this: Expression,
7082}
7083
7084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7086#[cfg_attr(feature = "bindings", derive(TS))]
7087pub struct SqlComment {
7088 pub text: String,
7089 pub is_block: bool,
7090}
7091
7092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7098#[cfg_attr(feature = "bindings", derive(TS))]
7099pub struct SimilarToExpr {
7100 pub this: Expression,
7101 pub pattern: Expression,
7102 pub escape: Option<Expression>,
7103 pub not: bool,
7104}
7105
7106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7108#[cfg_attr(feature = "bindings", derive(TS))]
7109pub struct QuantifiedExpr {
7110 pub this: Expression,
7111 pub subquery: Expression,
7112 pub op: Option<QuantifiedOp>,
7113}
7114
7115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7117#[cfg_attr(feature = "bindings", derive(TS))]
7118pub enum QuantifiedOp {
7119 Eq,
7120 Neq,
7121 Lt,
7122 Lte,
7123 Gt,
7124 Gte,
7125}
7126
7127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7132#[cfg_attr(feature = "bindings", derive(TS))]
7133pub struct OverlapsExpr {
7134 #[serde(skip_serializing_if = "Option::is_none")]
7136 pub this: Option<Expression>,
7137 #[serde(skip_serializing_if = "Option::is_none")]
7139 pub expression: Option<Expression>,
7140 #[serde(skip_serializing_if = "Option::is_none")]
7142 pub left_start: Option<Expression>,
7143 #[serde(skip_serializing_if = "Option::is_none")]
7145 pub left_end: Option<Expression>,
7146 #[serde(skip_serializing_if = "Option::is_none")]
7148 pub right_start: Option<Expression>,
7149 #[serde(skip_serializing_if = "Option::is_none")]
7151 pub right_end: Option<Expression>,
7152}
7153
7154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7160#[cfg_attr(feature = "bindings", derive(TS))]
7161pub struct Subscript {
7162 pub this: Expression,
7163 pub index: Expression,
7164}
7165
7166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7168#[cfg_attr(feature = "bindings", derive(TS))]
7169pub struct DotAccess {
7170 pub this: Expression,
7171 pub field: Identifier,
7172}
7173
7174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7176#[cfg_attr(feature = "bindings", derive(TS))]
7177pub struct MethodCall {
7178 pub this: Expression,
7179 pub method: Identifier,
7180 pub args: Vec<Expression>,
7181}
7182
7183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7185#[cfg_attr(feature = "bindings", derive(TS))]
7186pub struct ArraySlice {
7187 pub this: Expression,
7188 pub start: Option<Expression>,
7189 pub end: Option<Expression>,
7190}
7191
7192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7198#[cfg_attr(feature = "bindings", derive(TS))]
7199pub enum OnCommit {
7200 PreserveRows,
7202 DeleteRows,
7204}
7205
7206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7208#[cfg_attr(feature = "bindings", derive(TS))]
7209pub struct CreateTable {
7210 pub name: TableRef,
7211 #[serde(default, skip_serializing_if = "Option::is_none")]
7213 pub on_cluster: Option<OnCluster>,
7214 pub columns: Vec<ColumnDef>,
7215 pub constraints: Vec<TableConstraint>,
7216 pub if_not_exists: bool,
7217 pub temporary: bool,
7218 pub or_replace: bool,
7219 #[serde(default, skip_serializing_if = "Option::is_none")]
7221 pub table_modifier: Option<String>,
7222 pub as_select: Option<Expression>,
7223 #[serde(default)]
7225 pub as_select_parenthesized: bool,
7226 #[serde(default)]
7228 pub on_commit: Option<OnCommit>,
7229 #[serde(default)]
7231 pub clone_source: Option<TableRef>,
7232 #[serde(default, skip_serializing_if = "Option::is_none")]
7234 pub clone_at_clause: Option<Expression>,
7235 #[serde(default)]
7237 pub is_copy: bool,
7238 #[serde(default)]
7240 pub shallow_clone: bool,
7241 #[serde(default)]
7243 pub leading_comments: Vec<String>,
7244 #[serde(default)]
7246 pub with_properties: Vec<(String, String)>,
7247 #[serde(default)]
7249 pub teradata_post_name_options: Vec<String>,
7250 #[serde(default)]
7252 pub with_data: Option<bool>,
7253 #[serde(default)]
7255 pub with_statistics: Option<bool>,
7256 #[serde(default)]
7258 pub teradata_indexes: Vec<TeradataIndex>,
7259 #[serde(default)]
7261 pub with_cte: Option<With>,
7262 #[serde(default)]
7264 pub properties: Vec<Expression>,
7265 #[serde(default, skip_serializing_if = "Option::is_none")]
7267 pub partition_of: Option<Expression>,
7268 #[serde(default)]
7270 pub post_table_properties: Vec<Expression>,
7271 #[serde(default)]
7273 pub mysql_table_options: Vec<(String, String)>,
7274 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7276 pub inherits: Vec<TableRef>,
7277 #[serde(default, skip_serializing_if = "Option::is_none")]
7279 pub on_property: Option<OnProperty>,
7280 #[serde(default)]
7282 pub copy_grants: bool,
7283 #[serde(default, skip_serializing_if = "Option::is_none")]
7285 pub using_template: Option<Box<Expression>>,
7286 #[serde(default, skip_serializing_if = "Option::is_none")]
7288 pub rollup: Option<RollupProperty>,
7289 #[serde(default, skip_serializing_if = "Option::is_none")]
7291 pub uuid: Option<String>,
7292}
7293
7294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7296#[cfg_attr(feature = "bindings", derive(TS))]
7297pub struct TeradataIndex {
7298 pub kind: TeradataIndexKind,
7300 pub name: Option<String>,
7302 pub columns: Vec<String>,
7304}
7305
7306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7308#[cfg_attr(feature = "bindings", derive(TS))]
7309pub enum TeradataIndexKind {
7310 NoPrimary,
7312 Primary,
7314 PrimaryAmp,
7316 Unique,
7318 UniquePrimary,
7320 Secondary,
7322}
7323
7324impl CreateTable {
7325 pub fn new(name: impl Into<String>) -> Self {
7326 Self {
7327 name: TableRef::new(name),
7328 on_cluster: None,
7329 columns: Vec::new(),
7330 constraints: Vec::new(),
7331 if_not_exists: false,
7332 temporary: false,
7333 or_replace: false,
7334 table_modifier: None,
7335 as_select: None,
7336 as_select_parenthesized: false,
7337 on_commit: None,
7338 clone_source: None,
7339 clone_at_clause: None,
7340 shallow_clone: false,
7341 is_copy: false,
7342 leading_comments: Vec::new(),
7343 with_properties: Vec::new(),
7344 teradata_post_name_options: Vec::new(),
7345 with_data: None,
7346 with_statistics: None,
7347 teradata_indexes: Vec::new(),
7348 with_cte: None,
7349 properties: Vec::new(),
7350 partition_of: None,
7351 post_table_properties: Vec::new(),
7352 mysql_table_options: Vec::new(),
7353 inherits: Vec::new(),
7354 on_property: None,
7355 copy_grants: false,
7356 using_template: None,
7357 rollup: None,
7358 uuid: None,
7359 }
7360 }
7361}
7362
7363#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7365#[cfg_attr(feature = "bindings", derive(TS))]
7366pub enum SortOrder {
7367 Asc,
7368 Desc,
7369}
7370
7371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7373#[cfg_attr(feature = "bindings", derive(TS))]
7374pub enum ConstraintType {
7375 NotNull,
7376 Null,
7377 PrimaryKey,
7378 Unique,
7379 Default,
7380 AutoIncrement,
7381 Collate,
7382 Comment,
7383 References,
7384 Check,
7385 GeneratedAsIdentity,
7386 Tags,
7388 ComputedColumn,
7390 GeneratedAsRow,
7392 OnUpdate,
7394 Path,
7396 Encode,
7398}
7399
7400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7402#[cfg_attr(feature = "bindings", derive(TS))]
7403pub struct ColumnDef {
7404 pub name: Identifier,
7405 pub data_type: DataType,
7406 pub nullable: Option<bool>,
7407 pub default: Option<Expression>,
7408 pub primary_key: bool,
7409 #[serde(default)]
7411 pub primary_key_order: Option<SortOrder>,
7412 pub unique: bool,
7413 #[serde(default)]
7415 pub unique_nulls_not_distinct: bool,
7416 pub auto_increment: bool,
7417 pub comment: Option<String>,
7418 pub constraints: Vec<ColumnConstraint>,
7419 #[serde(default)]
7421 pub constraint_order: Vec<ConstraintType>,
7422 #[serde(default)]
7424 pub format: Option<String>,
7425 #[serde(default)]
7427 pub title: Option<String>,
7428 #[serde(default)]
7430 pub inline_length: Option<u64>,
7431 #[serde(default)]
7433 pub compress: Option<Vec<Expression>>,
7434 #[serde(default)]
7436 pub character_set: Option<String>,
7437 #[serde(default)]
7439 pub uppercase: bool,
7440 #[serde(default)]
7442 pub casespecific: Option<bool>,
7443 #[serde(default)]
7445 pub auto_increment_start: Option<Box<Expression>>,
7446 #[serde(default)]
7448 pub auto_increment_increment: Option<Box<Expression>>,
7449 #[serde(default)]
7451 pub auto_increment_order: Option<bool>,
7452 #[serde(default)]
7454 pub unsigned: bool,
7455 #[serde(default)]
7457 pub zerofill: bool,
7458 #[serde(default, skip_serializing_if = "Option::is_none")]
7460 pub on_update: Option<Expression>,
7461 #[serde(default, skip_serializing_if = "Option::is_none")]
7463 pub unique_constraint_name: Option<String>,
7464 #[serde(default, skip_serializing_if = "Option::is_none")]
7466 pub not_null_constraint_name: Option<String>,
7467 #[serde(default, skip_serializing_if = "Option::is_none")]
7469 pub primary_key_constraint_name: Option<String>,
7470 #[serde(default, skip_serializing_if = "Option::is_none")]
7472 pub check_constraint_name: Option<String>,
7473 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7475 pub options: Vec<Expression>,
7476 #[serde(default)]
7478 pub no_type: bool,
7479 #[serde(default, skip_serializing_if = "Option::is_none")]
7481 pub encoding: Option<String>,
7482 #[serde(default, skip_serializing_if = "Option::is_none")]
7484 pub codec: Option<String>,
7485 #[serde(default, skip_serializing_if = "Option::is_none")]
7487 pub ephemeral: Option<Option<Box<Expression>>>,
7488 #[serde(default, skip_serializing_if = "Option::is_none")]
7490 pub materialized_expr: Option<Box<Expression>>,
7491 #[serde(default, skip_serializing_if = "Option::is_none")]
7493 pub alias_expr: Option<Box<Expression>>,
7494 #[serde(default, skip_serializing_if = "Option::is_none")]
7496 pub ttl_expr: Option<Box<Expression>>,
7497 #[serde(default)]
7499 pub not_for_replication: bool,
7500}
7501
7502impl ColumnDef {
7503 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7504 Self {
7505 name: Identifier::new(name),
7506 data_type,
7507 nullable: None,
7508 default: None,
7509 primary_key: false,
7510 primary_key_order: None,
7511 unique: false,
7512 unique_nulls_not_distinct: false,
7513 auto_increment: false,
7514 comment: None,
7515 constraints: Vec::new(),
7516 constraint_order: Vec::new(),
7517 format: None,
7518 title: None,
7519 inline_length: None,
7520 compress: None,
7521 character_set: None,
7522 uppercase: false,
7523 casespecific: None,
7524 auto_increment_start: None,
7525 auto_increment_increment: None,
7526 auto_increment_order: None,
7527 unsigned: false,
7528 zerofill: false,
7529 on_update: None,
7530 unique_constraint_name: None,
7531 not_null_constraint_name: None,
7532 primary_key_constraint_name: None,
7533 check_constraint_name: None,
7534 options: Vec::new(),
7535 no_type: false,
7536 encoding: None,
7537 codec: None,
7538 ephemeral: None,
7539 materialized_expr: None,
7540 alias_expr: None,
7541 ttl_expr: None,
7542 not_for_replication: false,
7543 }
7544 }
7545}
7546
7547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7549#[cfg_attr(feature = "bindings", derive(TS))]
7550pub enum ColumnConstraint {
7551 NotNull,
7552 Null,
7553 Unique,
7554 PrimaryKey,
7555 Default(Expression),
7556 Check(Expression),
7557 References(ForeignKeyRef),
7558 GeneratedAsIdentity(GeneratedAsIdentity),
7559 Collate(Identifier),
7560 Comment(String),
7561 Tags(Tags),
7563 ComputedColumn(ComputedColumn),
7566 GeneratedAsRow(GeneratedAsRow),
7568 Path(Expression),
7570}
7571
7572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7574#[cfg_attr(feature = "bindings", derive(TS))]
7575pub struct ComputedColumn {
7576 pub expression: Box<Expression>,
7578 #[serde(default)]
7580 pub persisted: bool,
7581 #[serde(default)]
7583 pub not_null: bool,
7584 #[serde(default)]
7587 pub persistence_kind: Option<String>,
7588 #[serde(default, skip_serializing_if = "Option::is_none")]
7590 pub data_type: Option<DataType>,
7591}
7592
7593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7595#[cfg_attr(feature = "bindings", derive(TS))]
7596pub struct GeneratedAsRow {
7597 pub start: bool,
7599 #[serde(default)]
7601 pub hidden: bool,
7602}
7603
7604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7606#[cfg_attr(feature = "bindings", derive(TS))]
7607pub struct GeneratedAsIdentity {
7608 pub always: bool,
7610 pub on_null: bool,
7612 pub start: Option<Box<Expression>>,
7614 pub increment: Option<Box<Expression>>,
7616 pub minvalue: Option<Box<Expression>>,
7618 pub maxvalue: Option<Box<Expression>>,
7620 pub cycle: Option<bool>,
7622}
7623
7624#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7626#[cfg_attr(feature = "bindings", derive(TS))]
7627pub struct ConstraintModifiers {
7628 pub enforced: Option<bool>,
7630 pub deferrable: Option<bool>,
7632 pub initially_deferred: Option<bool>,
7634 pub norely: bool,
7636 pub rely: bool,
7638 #[serde(default)]
7640 pub using: Option<String>,
7641 #[serde(default)]
7643 pub using_before_columns: bool,
7644 #[serde(default, skip_serializing_if = "Option::is_none")]
7646 pub comment: Option<String>,
7647 #[serde(default, skip_serializing_if = "Option::is_none")]
7649 pub visible: Option<bool>,
7650 #[serde(default, skip_serializing_if = "Option::is_none")]
7652 pub engine_attribute: Option<String>,
7653 #[serde(default, skip_serializing_if = "Option::is_none")]
7655 pub with_parser: Option<String>,
7656 #[serde(default)]
7658 pub not_valid: bool,
7659 #[serde(default, skip_serializing_if = "Option::is_none")]
7661 pub clustered: Option<String>,
7662 #[serde(default, skip_serializing_if = "Option::is_none")]
7664 pub on_conflict: Option<String>,
7665 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7667 pub with_options: Vec<(String, String)>,
7668 #[serde(default, skip_serializing_if = "Option::is_none")]
7670 pub on_filegroup: Option<Identifier>,
7671}
7672
7673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7675#[cfg_attr(feature = "bindings", derive(TS))]
7676pub enum TableConstraint {
7677 PrimaryKey {
7678 name: Option<Identifier>,
7679 columns: Vec<Identifier>,
7680 #[serde(default)]
7682 include_columns: Vec<Identifier>,
7683 #[serde(default)]
7684 modifiers: ConstraintModifiers,
7685 #[serde(default)]
7687 has_constraint_keyword: bool,
7688 },
7689 Unique {
7690 name: Option<Identifier>,
7691 columns: Vec<Identifier>,
7692 #[serde(default)]
7694 columns_parenthesized: bool,
7695 #[serde(default)]
7696 modifiers: ConstraintModifiers,
7697 #[serde(default)]
7699 has_constraint_keyword: bool,
7700 #[serde(default)]
7702 nulls_not_distinct: bool,
7703 },
7704 ForeignKey {
7705 name: Option<Identifier>,
7706 columns: Vec<Identifier>,
7707 #[serde(default)]
7708 references: Option<ForeignKeyRef>,
7709 #[serde(default)]
7711 on_delete: Option<ReferentialAction>,
7712 #[serde(default)]
7714 on_update: Option<ReferentialAction>,
7715 #[serde(default)]
7716 modifiers: ConstraintModifiers,
7717 },
7718 Check {
7719 name: Option<Identifier>,
7720 expression: Expression,
7721 #[serde(default)]
7722 modifiers: ConstraintModifiers,
7723 },
7724 Assume {
7726 name: Option<Identifier>,
7727 expression: Expression,
7728 },
7729 Index {
7731 name: Option<Identifier>,
7732 columns: Vec<Identifier>,
7733 #[serde(default)]
7735 kind: Option<String>,
7736 #[serde(default)]
7737 modifiers: ConstraintModifiers,
7738 #[serde(default)]
7740 use_key_keyword: bool,
7741 #[serde(default, skip_serializing_if = "Option::is_none")]
7743 expression: Option<Box<Expression>>,
7744 #[serde(default, skip_serializing_if = "Option::is_none")]
7746 index_type: Option<Box<Expression>>,
7747 #[serde(default, skip_serializing_if = "Option::is_none")]
7749 granularity: Option<Box<Expression>>,
7750 },
7751 Projection {
7753 name: Identifier,
7754 expression: Expression,
7755 },
7756 Like {
7758 source: TableRef,
7759 options: Vec<(LikeOptionAction, String)>,
7761 },
7762 PeriodForSystemTime {
7764 start_col: Identifier,
7765 end_col: Identifier,
7766 },
7767 Exclude {
7770 name: Option<Identifier>,
7771 #[serde(default)]
7773 using: Option<String>,
7774 elements: Vec<ExcludeElement>,
7776 #[serde(default)]
7778 include_columns: Vec<Identifier>,
7779 #[serde(default)]
7781 where_clause: Option<Box<Expression>>,
7782 #[serde(default)]
7784 with_params: Vec<(String, String)>,
7785 #[serde(default)]
7787 using_index_tablespace: Option<String>,
7788 #[serde(default)]
7789 modifiers: ConstraintModifiers,
7790 },
7791 Tags(Tags),
7793 InitiallyDeferred {
7797 deferred: bool,
7799 },
7800}
7801
7802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7804#[cfg_attr(feature = "bindings", derive(TS))]
7805pub struct ExcludeElement {
7806 pub expression: String,
7808 pub operator: String,
7810}
7811
7812#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7814#[cfg_attr(feature = "bindings", derive(TS))]
7815pub enum LikeOptionAction {
7816 Including,
7817 Excluding,
7818}
7819
7820#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7822#[cfg_attr(feature = "bindings", derive(TS))]
7823pub enum MatchType {
7824 Full,
7825 Partial,
7826 Simple,
7827}
7828
7829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7831#[cfg_attr(feature = "bindings", derive(TS))]
7832pub struct ForeignKeyRef {
7833 pub table: TableRef,
7834 pub columns: Vec<Identifier>,
7835 pub on_delete: Option<ReferentialAction>,
7836 pub on_update: Option<ReferentialAction>,
7837 #[serde(default)]
7839 pub on_update_first: bool,
7840 #[serde(default)]
7842 pub match_type: Option<MatchType>,
7843 #[serde(default)]
7845 pub match_after_actions: bool,
7846 #[serde(default)]
7848 pub constraint_name: Option<String>,
7849 #[serde(default)]
7851 pub deferrable: Option<bool>,
7852 #[serde(default)]
7854 pub has_foreign_key_keywords: bool,
7855}
7856
7857#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7859#[cfg_attr(feature = "bindings", derive(TS))]
7860pub enum ReferentialAction {
7861 Cascade,
7862 SetNull,
7863 SetDefault,
7864 Restrict,
7865 NoAction,
7866}
7867
7868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7870#[cfg_attr(feature = "bindings", derive(TS))]
7871pub struct DropTable {
7872 pub names: Vec<TableRef>,
7873 pub if_exists: bool,
7874 pub cascade: bool,
7875 #[serde(default)]
7877 pub cascade_constraints: bool,
7878 #[serde(default)]
7880 pub purge: bool,
7881 #[serde(default)]
7883 pub leading_comments: Vec<String>,
7884 #[serde(default, skip_serializing_if = "Option::is_none")]
7887 pub object_id_args: Option<String>,
7888 #[serde(default)]
7890 pub sync: bool,
7891 #[serde(default)]
7893 pub iceberg: bool,
7894 #[serde(default)]
7896 pub restrict: bool,
7897}
7898
7899impl DropTable {
7900 pub fn new(name: impl Into<String>) -> Self {
7901 Self {
7902 names: vec![TableRef::new(name)],
7903 if_exists: false,
7904 cascade: false,
7905 cascade_constraints: false,
7906 purge: false,
7907 leading_comments: Vec::new(),
7908 object_id_args: None,
7909 sync: false,
7910 iceberg: false,
7911 restrict: false,
7912 }
7913 }
7914}
7915
7916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7918#[cfg_attr(feature = "bindings", derive(TS))]
7919pub struct AlterTable {
7920 pub name: TableRef,
7921 pub actions: Vec<AlterTableAction>,
7922 #[serde(default)]
7924 pub if_exists: bool,
7925 #[serde(default, skip_serializing_if = "Option::is_none")]
7927 pub algorithm: Option<String>,
7928 #[serde(default, skip_serializing_if = "Option::is_none")]
7930 pub lock: Option<String>,
7931 #[serde(default, skip_serializing_if = "Option::is_none")]
7933 pub with_check: Option<String>,
7934 #[serde(default, skip_serializing_if = "Option::is_none")]
7936 pub partition: Option<Vec<(Identifier, Expression)>>,
7937 #[serde(default, skip_serializing_if = "Option::is_none")]
7939 pub on_cluster: Option<OnCluster>,
7940 #[serde(default, skip_serializing_if = "Option::is_none")]
7942 pub table_modifier: Option<String>,
7943}
7944
7945impl AlterTable {
7946 pub fn new(name: impl Into<String>) -> Self {
7947 Self {
7948 name: TableRef::new(name),
7949 actions: Vec::new(),
7950 if_exists: false,
7951 algorithm: None,
7952 lock: None,
7953 with_check: None,
7954 partition: None,
7955 on_cluster: None,
7956 table_modifier: None,
7957 }
7958 }
7959}
7960
7961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7963#[cfg_attr(feature = "bindings", derive(TS))]
7964pub enum ColumnPosition {
7965 First,
7966 After(Identifier),
7967}
7968
7969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7971#[cfg_attr(feature = "bindings", derive(TS))]
7972pub enum AlterTableAction {
7973 AddColumn {
7974 column: ColumnDef,
7975 if_not_exists: bool,
7976 position: Option<ColumnPosition>,
7977 },
7978 DropColumn {
7979 name: Identifier,
7980 if_exists: bool,
7981 cascade: bool,
7982 },
7983 RenameColumn {
7984 old_name: Identifier,
7985 new_name: Identifier,
7986 if_exists: bool,
7987 },
7988 AlterColumn {
7989 name: Identifier,
7990 action: AlterColumnAction,
7991 #[serde(default)]
7993 use_modify_keyword: bool,
7994 },
7995 RenameTable(TableRef),
7996 AddConstraint(TableConstraint),
7997 DropConstraint {
7998 name: Identifier,
7999 if_exists: bool,
8000 },
8001 DropForeignKey {
8003 name: Identifier,
8004 },
8005 DropPartition {
8007 partitions: Vec<Vec<(Identifier, Expression)>>,
8009 if_exists: bool,
8010 },
8011 AddPartition {
8013 partition: Expression,
8015 if_not_exists: bool,
8016 location: Option<Expression>,
8017 },
8018 Delete {
8020 where_clause: Expression,
8021 },
8022 SwapWith(TableRef),
8024 SetProperty {
8026 properties: Vec<(String, Expression)>,
8027 },
8028 UnsetProperty {
8030 properties: Vec<String>,
8031 },
8032 ClusterBy {
8034 expressions: Vec<Expression>,
8035 },
8036 SetTag {
8038 expressions: Vec<(String, Expression)>,
8039 },
8040 UnsetTag {
8042 names: Vec<String>,
8043 },
8044 SetOptions {
8046 expressions: Vec<Expression>,
8047 },
8048 AlterIndex {
8050 name: Identifier,
8051 visible: bool,
8052 },
8053 SetAttribute {
8055 attribute: String,
8056 },
8057 SetStageFileFormat {
8059 options: Option<Expression>,
8060 },
8061 SetStageCopyOptions {
8063 options: Option<Expression>,
8064 },
8065 AddColumns {
8067 columns: Vec<ColumnDef>,
8068 cascade: bool,
8069 },
8070 DropColumns {
8072 names: Vec<Identifier>,
8073 },
8074 ChangeColumn {
8077 old_name: Identifier,
8078 new_name: Identifier,
8079 #[serde(default, skip_serializing_if = "Option::is_none")]
8080 data_type: Option<DataType>,
8081 comment: Option<String>,
8082 #[serde(default)]
8083 cascade: bool,
8084 },
8085 AlterSortKey {
8088 this: Option<String>,
8090 expressions: Vec<Expression>,
8092 compound: bool,
8094 },
8095 AlterDistStyle {
8099 style: String,
8101 distkey: Option<Identifier>,
8103 },
8104 SetTableProperties {
8106 properties: Vec<(Expression, Expression)>,
8107 },
8108 SetLocation {
8110 location: String,
8111 },
8112 SetFileFormat {
8114 format: String,
8115 },
8116 ReplacePartition {
8118 partition: Expression,
8119 source: Option<Box<Expression>>,
8120 },
8121 Raw {
8123 sql: String,
8124 },
8125}
8126
8127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8129#[cfg_attr(feature = "bindings", derive(TS))]
8130pub enum AlterColumnAction {
8131 SetDataType {
8132 data_type: DataType,
8133 using: Option<Expression>,
8135 #[serde(default, skip_serializing_if = "Option::is_none")]
8137 collate: Option<String>,
8138 },
8139 SetDefault(Expression),
8140 DropDefault,
8141 SetNotNull,
8142 DropNotNull,
8143 Comment(String),
8145 SetVisible,
8147 SetInvisible,
8149}
8150
8151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8153#[cfg_attr(feature = "bindings", derive(TS))]
8154pub struct CreateIndex {
8155 pub name: Identifier,
8156 pub table: TableRef,
8157 pub columns: Vec<IndexColumn>,
8158 pub unique: bool,
8159 pub if_not_exists: bool,
8160 pub using: Option<String>,
8161 #[serde(default)]
8163 pub clustered: Option<String>,
8164 #[serde(default)]
8166 pub concurrently: bool,
8167 #[serde(default)]
8169 pub where_clause: Option<Box<Expression>>,
8170 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8172 pub include_columns: Vec<Identifier>,
8173 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8175 pub with_options: Vec<(String, String)>,
8176 #[serde(default)]
8178 pub on_filegroup: Option<String>,
8179}
8180
8181impl CreateIndex {
8182 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8183 Self {
8184 name: Identifier::new(name),
8185 table: TableRef::new(table),
8186 columns: Vec::new(),
8187 unique: false,
8188 if_not_exists: false,
8189 using: None,
8190 clustered: None,
8191 concurrently: false,
8192 where_clause: None,
8193 include_columns: Vec::new(),
8194 with_options: Vec::new(),
8195 on_filegroup: None,
8196 }
8197 }
8198}
8199
8200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8202#[cfg_attr(feature = "bindings", derive(TS))]
8203pub struct IndexColumn {
8204 pub column: Identifier,
8205 pub desc: bool,
8206 #[serde(default)]
8208 pub asc: bool,
8209 pub nulls_first: Option<bool>,
8210 #[serde(default, skip_serializing_if = "Option::is_none")]
8212 pub opclass: Option<String>,
8213}
8214
8215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8217#[cfg_attr(feature = "bindings", derive(TS))]
8218pub struct DropIndex {
8219 pub name: Identifier,
8220 pub table: Option<TableRef>,
8221 pub if_exists: bool,
8222 #[serde(default)]
8224 pub concurrently: bool,
8225}
8226
8227impl DropIndex {
8228 pub fn new(name: impl Into<String>) -> Self {
8229 Self {
8230 name: Identifier::new(name),
8231 table: None,
8232 if_exists: false,
8233 concurrently: false,
8234 }
8235 }
8236}
8237
8238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8240#[cfg_attr(feature = "bindings", derive(TS))]
8241pub struct ViewColumn {
8242 pub name: Identifier,
8243 pub comment: Option<String>,
8244 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8246 pub options: Vec<Expression>,
8247}
8248
8249impl ViewColumn {
8250 pub fn new(name: impl Into<String>) -> Self {
8251 Self {
8252 name: Identifier::new(name),
8253 comment: None,
8254 options: Vec::new(),
8255 }
8256 }
8257
8258 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8259 Self {
8260 name: Identifier::new(name),
8261 comment: Some(comment.into()),
8262 options: Vec::new(),
8263 }
8264 }
8265}
8266
8267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8269#[cfg_attr(feature = "bindings", derive(TS))]
8270pub struct CreateView {
8271 pub name: TableRef,
8272 pub columns: Vec<ViewColumn>,
8273 pub query: Expression,
8274 pub or_replace: bool,
8275 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8277 pub or_alter: bool,
8278 pub if_not_exists: bool,
8279 pub materialized: bool,
8280 pub temporary: bool,
8281 #[serde(default)]
8283 pub secure: bool,
8284 #[serde(skip_serializing_if = "Option::is_none")]
8286 pub algorithm: Option<String>,
8287 #[serde(skip_serializing_if = "Option::is_none")]
8289 pub definer: Option<String>,
8290 #[serde(skip_serializing_if = "Option::is_none")]
8292 pub security: Option<FunctionSecurity>,
8293 #[serde(default = "default_true")]
8295 pub security_sql_style: bool,
8296 #[serde(default)]
8298 pub security_after_name: bool,
8299 #[serde(default)]
8301 pub query_parenthesized: bool,
8302 #[serde(skip_serializing_if = "Option::is_none")]
8304 pub locking_mode: Option<String>,
8305 #[serde(skip_serializing_if = "Option::is_none")]
8307 pub locking_access: Option<String>,
8308 #[serde(default)]
8310 pub copy_grants: bool,
8311 #[serde(skip_serializing_if = "Option::is_none", default)]
8313 pub comment: Option<String>,
8314 #[serde(default)]
8316 pub tags: Vec<(String, String)>,
8317 #[serde(default)]
8319 pub options: Vec<Expression>,
8320 #[serde(skip_serializing_if = "Option::is_none", default)]
8322 pub build: Option<String>,
8323 #[serde(skip_serializing_if = "Option::is_none", default)]
8325 pub refresh: Option<Box<RefreshTriggerProperty>>,
8326 #[serde(skip_serializing_if = "Option::is_none", default)]
8329 pub schema: Option<Box<Schema>>,
8330 #[serde(skip_serializing_if = "Option::is_none", default)]
8332 pub unique_key: Option<Box<UniqueKeyProperty>>,
8333 #[serde(default)]
8335 pub no_schema_binding: bool,
8336 #[serde(skip_serializing_if = "Option::is_none", default)]
8338 pub auto_refresh: Option<bool>,
8339 #[serde(default, skip_serializing_if = "Option::is_none")]
8341 pub on_cluster: Option<OnCluster>,
8342 #[serde(default, skip_serializing_if = "Option::is_none")]
8344 pub to_table: Option<TableRef>,
8345 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8347 pub table_properties: Vec<Expression>,
8348}
8349
8350impl CreateView {
8351 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8352 Self {
8353 name: TableRef::new(name),
8354 columns: Vec::new(),
8355 query,
8356 or_replace: false,
8357 or_alter: false,
8358 if_not_exists: false,
8359 materialized: false,
8360 temporary: false,
8361 secure: false,
8362 algorithm: None,
8363 definer: None,
8364 security: None,
8365 security_sql_style: true,
8366 security_after_name: false,
8367 query_parenthesized: false,
8368 locking_mode: None,
8369 locking_access: None,
8370 copy_grants: false,
8371 comment: None,
8372 tags: Vec::new(),
8373 options: Vec::new(),
8374 build: None,
8375 refresh: None,
8376 schema: None,
8377 unique_key: None,
8378 no_schema_binding: false,
8379 auto_refresh: None,
8380 on_cluster: None,
8381 to_table: None,
8382 table_properties: Vec::new(),
8383 }
8384 }
8385}
8386
8387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8389#[cfg_attr(feature = "bindings", derive(TS))]
8390pub struct DropView {
8391 pub name: TableRef,
8392 pub if_exists: bool,
8393 pub materialized: bool,
8394}
8395
8396impl DropView {
8397 pub fn new(name: impl Into<String>) -> Self {
8398 Self {
8399 name: TableRef::new(name),
8400 if_exists: false,
8401 materialized: false,
8402 }
8403 }
8404}
8405
8406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8408#[cfg_attr(feature = "bindings", derive(TS))]
8409pub struct Truncate {
8410 #[serde(default)]
8412 pub target: TruncateTarget,
8413 #[serde(default)]
8415 pub if_exists: bool,
8416 pub table: TableRef,
8417 #[serde(default, skip_serializing_if = "Option::is_none")]
8419 pub on_cluster: Option<OnCluster>,
8420 pub cascade: bool,
8421 #[serde(default)]
8423 pub extra_tables: Vec<TruncateTableEntry>,
8424 #[serde(default)]
8426 pub identity: Option<TruncateIdentity>,
8427 #[serde(default)]
8429 pub restrict: bool,
8430 #[serde(default, skip_serializing_if = "Option::is_none")]
8432 pub partition: Option<Box<Expression>>,
8433}
8434
8435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8437#[cfg_attr(feature = "bindings", derive(TS))]
8438pub struct TruncateTableEntry {
8439 pub table: TableRef,
8440 #[serde(default)]
8442 pub star: bool,
8443}
8444
8445#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8447#[cfg_attr(feature = "bindings", derive(TS))]
8448pub enum TruncateTarget {
8449 Table,
8450 Database,
8451}
8452
8453impl Default for TruncateTarget {
8454 fn default() -> Self {
8455 TruncateTarget::Table
8456 }
8457}
8458
8459#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8461#[cfg_attr(feature = "bindings", derive(TS))]
8462pub enum TruncateIdentity {
8463 Restart,
8464 Continue,
8465}
8466
8467impl Truncate {
8468 pub fn new(table: impl Into<String>) -> Self {
8469 Self {
8470 target: TruncateTarget::Table,
8471 if_exists: false,
8472 table: TableRef::new(table),
8473 on_cluster: None,
8474 cascade: false,
8475 extra_tables: Vec::new(),
8476 identity: None,
8477 restrict: false,
8478 partition: None,
8479 }
8480 }
8481}
8482
8483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8485#[cfg_attr(feature = "bindings", derive(TS))]
8486pub struct Use {
8487 pub kind: Option<UseKind>,
8489 pub this: Identifier,
8491}
8492
8493#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8495#[cfg_attr(feature = "bindings", derive(TS))]
8496pub enum UseKind {
8497 Database,
8498 Schema,
8499 Role,
8500 Warehouse,
8501 Catalog,
8502 SecondaryRoles,
8504}
8505
8506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8508#[cfg_attr(feature = "bindings", derive(TS))]
8509pub struct SetStatement {
8510 pub items: Vec<SetItem>,
8512}
8513
8514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8516#[cfg_attr(feature = "bindings", derive(TS))]
8517pub struct SetItem {
8518 pub name: Expression,
8520 pub value: Expression,
8522 pub kind: Option<String>,
8524 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8526 pub no_equals: bool,
8527}
8528
8529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8531#[cfg_attr(feature = "bindings", derive(TS))]
8532pub struct Cache {
8533 pub table: Identifier,
8535 pub lazy: bool,
8537 pub options: Vec<(Expression, Expression)>,
8539 pub query: Option<Expression>,
8541}
8542
8543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8545#[cfg_attr(feature = "bindings", derive(TS))]
8546pub struct Uncache {
8547 pub table: Identifier,
8549 pub if_exists: bool,
8551}
8552
8553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8555#[cfg_attr(feature = "bindings", derive(TS))]
8556pub struct LoadData {
8557 pub local: bool,
8559 pub inpath: String,
8561 pub overwrite: bool,
8563 pub table: Expression,
8565 pub partition: Vec<(Identifier, Expression)>,
8567 pub input_format: Option<String>,
8569 pub serde: Option<String>,
8571}
8572
8573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8575#[cfg_attr(feature = "bindings", derive(TS))]
8576pub struct Pragma {
8577 pub schema: Option<Identifier>,
8579 pub name: Identifier,
8581 pub value: Option<Expression>,
8583 pub args: Vec<Expression>,
8585}
8586
8587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8590#[cfg_attr(feature = "bindings", derive(TS))]
8591pub struct Privilege {
8592 pub name: String,
8594 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8596 pub columns: Vec<String>,
8597}
8598
8599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8601#[cfg_attr(feature = "bindings", derive(TS))]
8602pub struct GrantPrincipal {
8603 pub name: Identifier,
8605 pub is_role: bool,
8607 #[serde(default)]
8609 pub is_group: bool,
8610 #[serde(default)]
8612 pub is_share: bool,
8613}
8614
8615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8617#[cfg_attr(feature = "bindings", derive(TS))]
8618pub struct Grant {
8619 pub privileges: Vec<Privilege>,
8621 pub kind: Option<String>,
8623 pub securable: Identifier,
8625 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8627 pub function_params: Vec<String>,
8628 pub principals: Vec<GrantPrincipal>,
8630 pub grant_option: bool,
8632 #[serde(default, skip_serializing_if = "Option::is_none")]
8634 pub as_principal: Option<Identifier>,
8635}
8636
8637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8639#[cfg_attr(feature = "bindings", derive(TS))]
8640pub struct Revoke {
8641 pub privileges: Vec<Privilege>,
8643 pub kind: Option<String>,
8645 pub securable: Identifier,
8647 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8649 pub function_params: Vec<String>,
8650 pub principals: Vec<GrantPrincipal>,
8652 pub grant_option: bool,
8654 pub cascade: bool,
8656 #[serde(default)]
8658 pub restrict: bool,
8659}
8660
8661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8663#[cfg_attr(feature = "bindings", derive(TS))]
8664pub struct Comment {
8665 pub this: Expression,
8667 pub kind: String,
8669 pub expression: Expression,
8671 pub exists: bool,
8673 pub materialized: bool,
8675}
8676
8677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8683#[cfg_attr(feature = "bindings", derive(TS))]
8684pub struct AlterView {
8685 pub name: TableRef,
8686 pub actions: Vec<AlterViewAction>,
8687 #[serde(default, skip_serializing_if = "Option::is_none")]
8689 pub algorithm: Option<String>,
8690 #[serde(default, skip_serializing_if = "Option::is_none")]
8692 pub definer: Option<String>,
8693 #[serde(default, skip_serializing_if = "Option::is_none")]
8695 pub sql_security: Option<String>,
8696 #[serde(default, skip_serializing_if = "Option::is_none")]
8698 pub with_option: Option<String>,
8699 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8701 pub columns: Vec<ViewColumn>,
8702}
8703
8704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8706#[cfg_attr(feature = "bindings", derive(TS))]
8707pub enum AlterViewAction {
8708 Rename(TableRef),
8710 OwnerTo(Identifier),
8712 SetSchema(Identifier),
8714 SetAuthorization(String),
8716 AlterColumn {
8718 name: Identifier,
8719 action: AlterColumnAction,
8720 },
8721 AsSelect(Box<Expression>),
8723 SetTblproperties(Vec<(String, String)>),
8725 UnsetTblproperties(Vec<String>),
8727}
8728
8729impl AlterView {
8730 pub fn new(name: impl Into<String>) -> Self {
8731 Self {
8732 name: TableRef::new(name),
8733 actions: Vec::new(),
8734 algorithm: None,
8735 definer: None,
8736 sql_security: None,
8737 with_option: None,
8738 columns: Vec::new(),
8739 }
8740 }
8741}
8742
8743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8745#[cfg_attr(feature = "bindings", derive(TS))]
8746pub struct AlterIndex {
8747 pub name: Identifier,
8748 pub table: Option<TableRef>,
8749 pub actions: Vec<AlterIndexAction>,
8750}
8751
8752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8754#[cfg_attr(feature = "bindings", derive(TS))]
8755pub enum AlterIndexAction {
8756 Rename(Identifier),
8758 SetTablespace(Identifier),
8760 Visible(bool),
8762}
8763
8764impl AlterIndex {
8765 pub fn new(name: impl Into<String>) -> Self {
8766 Self {
8767 name: Identifier::new(name),
8768 table: None,
8769 actions: Vec::new(),
8770 }
8771 }
8772}
8773
8774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8776#[cfg_attr(feature = "bindings", derive(TS))]
8777pub struct CreateSchema {
8778 pub name: Vec<Identifier>,
8780 pub if_not_exists: bool,
8781 pub authorization: Option<Identifier>,
8782 #[serde(default)]
8784 pub clone_from: Option<Vec<Identifier>>,
8785 #[serde(default)]
8787 pub at_clause: Option<Expression>,
8788 #[serde(default)]
8790 pub properties: Vec<Expression>,
8791 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8793 pub leading_comments: Vec<String>,
8794}
8795
8796impl CreateSchema {
8797 pub fn new(name: impl Into<String>) -> Self {
8798 Self {
8799 name: vec![Identifier::new(name)],
8800 if_not_exists: false,
8801 authorization: None,
8802 clone_from: None,
8803 at_clause: None,
8804 properties: Vec::new(),
8805 leading_comments: Vec::new(),
8806 }
8807 }
8808}
8809
8810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8812#[cfg_attr(feature = "bindings", derive(TS))]
8813pub struct DropSchema {
8814 pub name: Identifier,
8815 pub if_exists: bool,
8816 pub cascade: bool,
8817}
8818
8819impl DropSchema {
8820 pub fn new(name: impl Into<String>) -> Self {
8821 Self {
8822 name: Identifier::new(name),
8823 if_exists: false,
8824 cascade: false,
8825 }
8826 }
8827}
8828
8829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8831#[cfg_attr(feature = "bindings", derive(TS))]
8832pub struct DropNamespace {
8833 pub name: Identifier,
8834 pub if_exists: bool,
8835 pub cascade: bool,
8836}
8837
8838impl DropNamespace {
8839 pub fn new(name: impl Into<String>) -> Self {
8840 Self {
8841 name: Identifier::new(name),
8842 if_exists: false,
8843 cascade: false,
8844 }
8845 }
8846}
8847
8848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8850#[cfg_attr(feature = "bindings", derive(TS))]
8851pub struct CreateDatabase {
8852 pub name: Identifier,
8853 pub if_not_exists: bool,
8854 pub options: Vec<DatabaseOption>,
8855 #[serde(default)]
8857 pub clone_from: Option<Identifier>,
8858 #[serde(default)]
8860 pub at_clause: Option<Expression>,
8861}
8862
8863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8865#[cfg_attr(feature = "bindings", derive(TS))]
8866pub enum DatabaseOption {
8867 CharacterSet(String),
8868 Collate(String),
8869 Owner(Identifier),
8870 Template(Identifier),
8871 Encoding(String),
8872 Location(String),
8873}
8874
8875impl CreateDatabase {
8876 pub fn new(name: impl Into<String>) -> Self {
8877 Self {
8878 name: Identifier::new(name),
8879 if_not_exists: false,
8880 options: Vec::new(),
8881 clone_from: None,
8882 at_clause: None,
8883 }
8884 }
8885}
8886
8887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8889#[cfg_attr(feature = "bindings", derive(TS))]
8890pub struct DropDatabase {
8891 pub name: Identifier,
8892 pub if_exists: bool,
8893 #[serde(default)]
8895 pub sync: bool,
8896}
8897
8898impl DropDatabase {
8899 pub fn new(name: impl Into<String>) -> Self {
8900 Self {
8901 name: Identifier::new(name),
8902 if_exists: false,
8903 sync: false,
8904 }
8905 }
8906}
8907
8908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8910#[cfg_attr(feature = "bindings", derive(TS))]
8911pub struct CreateFunction {
8912 pub name: TableRef,
8913 pub parameters: Vec<FunctionParameter>,
8914 pub return_type: Option<DataType>,
8915 pub body: Option<FunctionBody>,
8916 pub or_replace: bool,
8917 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8919 pub or_alter: bool,
8920 pub if_not_exists: bool,
8921 pub temporary: bool,
8922 pub language: Option<String>,
8923 pub deterministic: Option<bool>,
8924 pub returns_null_on_null_input: Option<bool>,
8925 pub security: Option<FunctionSecurity>,
8926 #[serde(default = "default_true")]
8928 pub has_parens: bool,
8929 #[serde(default)]
8931 pub sql_data_access: Option<SqlDataAccess>,
8932 #[serde(default, skip_serializing_if = "Option::is_none")]
8934 pub returns_table_body: Option<String>,
8935 #[serde(default)]
8937 pub language_first: bool,
8938 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8940 pub set_options: Vec<FunctionSetOption>,
8941 #[serde(default)]
8943 pub strict: bool,
8944 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8946 pub options: Vec<Expression>,
8947 #[serde(default)]
8949 pub is_table_function: bool,
8950 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8952 pub property_order: Vec<FunctionPropertyKind>,
8953 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8955 pub environment: Vec<Expression>,
8956 #[serde(default, skip_serializing_if = "Option::is_none")]
8958 pub handler: Option<String>,
8959 #[serde(default, skip_serializing_if = "Option::is_none")]
8961 pub parameter_style: Option<String>,
8962}
8963
8964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8966#[cfg_attr(feature = "bindings", derive(TS))]
8967pub struct FunctionSetOption {
8968 pub name: String,
8969 pub value: FunctionSetValue,
8970}
8971
8972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8974#[cfg_attr(feature = "bindings", derive(TS))]
8975pub enum FunctionSetValue {
8976 Value { value: String, use_to: bool },
8978 FromCurrent,
8980}
8981
8982#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8984#[cfg_attr(feature = "bindings", derive(TS))]
8985pub enum SqlDataAccess {
8986 NoSql,
8988 ContainsSql,
8990 ReadsSqlData,
8992 ModifiesSqlData,
8994}
8995
8996#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8998#[cfg_attr(feature = "bindings", derive(TS))]
8999pub enum FunctionPropertyKind {
9000 Set,
9002 As,
9004 Language,
9006 Determinism,
9008 NullInput,
9010 Security,
9012 SqlDataAccess,
9014 Options,
9016 Environment,
9018 Handler,
9020 ParameterStyle,
9022}
9023
9024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9026#[cfg_attr(feature = "bindings", derive(TS))]
9027pub struct FunctionParameter {
9028 pub name: Option<Identifier>,
9029 pub data_type: DataType,
9030 pub mode: Option<ParameterMode>,
9031 pub default: Option<Expression>,
9032 #[serde(default, skip_serializing_if = "Option::is_none")]
9034 pub mode_text: Option<String>,
9035}
9036
9037#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9039#[cfg_attr(feature = "bindings", derive(TS))]
9040pub enum ParameterMode {
9041 In,
9042 Out,
9043 InOut,
9044 Variadic,
9045}
9046
9047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9049#[cfg_attr(feature = "bindings", derive(TS))]
9050pub enum FunctionBody {
9051 Block(String),
9053 StringLiteral(String),
9055 Expression(Expression),
9057 External(String),
9059 Return(Expression),
9061 Statements(Vec<Expression>),
9063 DollarQuoted {
9066 content: String,
9067 tag: Option<String>,
9068 },
9069}
9070
9071#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9073#[cfg_attr(feature = "bindings", derive(TS))]
9074pub enum FunctionSecurity {
9075 Definer,
9076 Invoker,
9077 None,
9079}
9080
9081impl CreateFunction {
9082 pub fn new(name: impl Into<String>) -> Self {
9083 Self {
9084 name: TableRef::new(name),
9085 parameters: Vec::new(),
9086 return_type: None,
9087 body: None,
9088 or_replace: false,
9089 or_alter: false,
9090 if_not_exists: false,
9091 temporary: false,
9092 language: None,
9093 deterministic: None,
9094 returns_null_on_null_input: None,
9095 security: None,
9096 has_parens: true,
9097 sql_data_access: None,
9098 returns_table_body: None,
9099 language_first: false,
9100 set_options: Vec::new(),
9101 strict: false,
9102 options: Vec::new(),
9103 is_table_function: false,
9104 property_order: Vec::new(),
9105 environment: Vec::new(),
9106 handler: None,
9107 parameter_style: None,
9108 }
9109 }
9110}
9111
9112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9114#[cfg_attr(feature = "bindings", derive(TS))]
9115pub struct DropFunction {
9116 pub name: TableRef,
9117 pub parameters: Option<Vec<DataType>>,
9118 pub if_exists: bool,
9119 pub cascade: bool,
9120}
9121
9122impl DropFunction {
9123 pub fn new(name: impl Into<String>) -> Self {
9124 Self {
9125 name: TableRef::new(name),
9126 parameters: None,
9127 if_exists: false,
9128 cascade: false,
9129 }
9130 }
9131}
9132
9133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9135#[cfg_attr(feature = "bindings", derive(TS))]
9136pub struct CreateProcedure {
9137 pub name: TableRef,
9138 pub parameters: Vec<FunctionParameter>,
9139 pub body: Option<FunctionBody>,
9140 pub or_replace: bool,
9141 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9143 pub or_alter: bool,
9144 pub if_not_exists: bool,
9145 pub language: Option<String>,
9146 pub security: Option<FunctionSecurity>,
9147 #[serde(default)]
9149 pub return_type: Option<DataType>,
9150 #[serde(default)]
9152 pub execute_as: Option<String>,
9153 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9155 pub with_options: Vec<String>,
9156 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9158 pub has_parens: bool,
9159 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9161 pub use_proc_keyword: bool,
9162}
9163
9164impl CreateProcedure {
9165 pub fn new(name: impl Into<String>) -> Self {
9166 Self {
9167 name: TableRef::new(name),
9168 parameters: Vec::new(),
9169 body: None,
9170 or_replace: false,
9171 or_alter: false,
9172 if_not_exists: false,
9173 language: None,
9174 security: None,
9175 return_type: None,
9176 execute_as: None,
9177 with_options: Vec::new(),
9178 has_parens: true,
9179 use_proc_keyword: false,
9180 }
9181 }
9182}
9183
9184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9186#[cfg_attr(feature = "bindings", derive(TS))]
9187pub struct DropProcedure {
9188 pub name: TableRef,
9189 pub parameters: Option<Vec<DataType>>,
9190 pub if_exists: bool,
9191 pub cascade: bool,
9192}
9193
9194impl DropProcedure {
9195 pub fn new(name: impl Into<String>) -> Self {
9196 Self {
9197 name: TableRef::new(name),
9198 parameters: None,
9199 if_exists: false,
9200 cascade: false,
9201 }
9202 }
9203}
9204
9205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9207#[cfg_attr(feature = "bindings", derive(TS))]
9208pub enum SeqPropKind {
9209 Start,
9210 Increment,
9211 Minvalue,
9212 Maxvalue,
9213 Cache,
9214 NoCache,
9215 Cycle,
9216 NoCycle,
9217 OwnedBy,
9218 Order,
9219 NoOrder,
9220 Comment,
9221 Sharing,
9223 Keep,
9225 NoKeep,
9227 Scale,
9229 NoScale,
9231 Shard,
9233 NoShard,
9235 Session,
9237 Global,
9239 NoCacheWord,
9241 NoCycleWord,
9243 NoMinvalueWord,
9245 NoMaxvalueWord,
9247}
9248
9249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9251#[cfg_attr(feature = "bindings", derive(TS))]
9252pub struct CreateSynonym {
9253 pub name: TableRef,
9255 pub target: TableRef,
9257}
9258
9259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9261#[cfg_attr(feature = "bindings", derive(TS))]
9262pub struct CreateSequence {
9263 pub name: TableRef,
9264 pub if_not_exists: bool,
9265 pub temporary: bool,
9266 #[serde(default)]
9267 pub or_replace: bool,
9268 #[serde(default, skip_serializing_if = "Option::is_none")]
9270 pub as_type: Option<DataType>,
9271 pub increment: Option<i64>,
9272 pub minvalue: Option<SequenceBound>,
9273 pub maxvalue: Option<SequenceBound>,
9274 pub start: Option<i64>,
9275 pub cache: Option<i64>,
9276 pub cycle: bool,
9277 pub owned_by: Option<TableRef>,
9278 #[serde(default)]
9280 pub owned_by_none: bool,
9281 #[serde(default)]
9283 pub order: Option<bool>,
9284 #[serde(default)]
9286 pub comment: Option<String>,
9287 #[serde(default, skip_serializing_if = "Option::is_none")]
9289 pub sharing: Option<String>,
9290 #[serde(default, skip_serializing_if = "Option::is_none")]
9292 pub scale_modifier: Option<String>,
9293 #[serde(default, skip_serializing_if = "Option::is_none")]
9295 pub shard_modifier: Option<String>,
9296 #[serde(default)]
9298 pub property_order: Vec<SeqPropKind>,
9299}
9300
9301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9303#[cfg_attr(feature = "bindings", derive(TS))]
9304pub enum SequenceBound {
9305 Value(i64),
9306 None,
9307}
9308
9309impl CreateSequence {
9310 pub fn new(name: impl Into<String>) -> Self {
9311 Self {
9312 name: TableRef::new(name),
9313 if_not_exists: false,
9314 temporary: false,
9315 or_replace: false,
9316 as_type: None,
9317 increment: None,
9318 minvalue: None,
9319 maxvalue: None,
9320 start: None,
9321 cache: None,
9322 cycle: false,
9323 owned_by: None,
9324 owned_by_none: false,
9325 order: None,
9326 comment: None,
9327 sharing: None,
9328 scale_modifier: None,
9329 shard_modifier: None,
9330 property_order: Vec::new(),
9331 }
9332 }
9333}
9334
9335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9337#[cfg_attr(feature = "bindings", derive(TS))]
9338pub struct DropSequence {
9339 pub name: TableRef,
9340 pub if_exists: bool,
9341 pub cascade: bool,
9342}
9343
9344impl DropSequence {
9345 pub fn new(name: impl Into<String>) -> Self {
9346 Self {
9347 name: TableRef::new(name),
9348 if_exists: false,
9349 cascade: false,
9350 }
9351 }
9352}
9353
9354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9356#[cfg_attr(feature = "bindings", derive(TS))]
9357pub struct AlterSequence {
9358 pub name: TableRef,
9359 pub if_exists: bool,
9360 pub increment: Option<i64>,
9361 pub minvalue: Option<SequenceBound>,
9362 pub maxvalue: Option<SequenceBound>,
9363 pub start: Option<i64>,
9364 pub restart: Option<Option<i64>>,
9365 pub cache: Option<i64>,
9366 pub cycle: Option<bool>,
9367 pub owned_by: Option<Option<TableRef>>,
9368}
9369
9370impl AlterSequence {
9371 pub fn new(name: impl Into<String>) -> Self {
9372 Self {
9373 name: TableRef::new(name),
9374 if_exists: false,
9375 increment: None,
9376 minvalue: None,
9377 maxvalue: None,
9378 start: None,
9379 restart: None,
9380 cache: None,
9381 cycle: None,
9382 owned_by: None,
9383 }
9384 }
9385}
9386
9387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9389#[cfg_attr(feature = "bindings", derive(TS))]
9390pub struct CreateTrigger {
9391 pub name: Identifier,
9392 pub table: TableRef,
9393 pub timing: TriggerTiming,
9394 pub events: Vec<TriggerEvent>,
9395 #[serde(default, skip_serializing_if = "Option::is_none")]
9396 pub for_each: Option<TriggerForEach>,
9397 pub when: Option<Expression>,
9398 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9400 pub when_paren: bool,
9401 pub body: TriggerBody,
9402 pub or_replace: bool,
9403 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9405 pub or_alter: bool,
9406 pub constraint: bool,
9407 pub deferrable: Option<bool>,
9408 pub initially_deferred: Option<bool>,
9409 pub referencing: Option<TriggerReferencing>,
9410}
9411
9412#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9414#[cfg_attr(feature = "bindings", derive(TS))]
9415pub enum TriggerTiming {
9416 Before,
9417 After,
9418 InsteadOf,
9419}
9420
9421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9423#[cfg_attr(feature = "bindings", derive(TS))]
9424pub enum TriggerEvent {
9425 Insert,
9426 Update(Option<Vec<Identifier>>),
9427 Delete,
9428 Truncate,
9429}
9430
9431#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9433#[cfg_attr(feature = "bindings", derive(TS))]
9434pub enum TriggerForEach {
9435 Row,
9436 Statement,
9437}
9438
9439#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9441#[cfg_attr(feature = "bindings", derive(TS))]
9442pub enum TriggerBody {
9443 Execute {
9445 function: TableRef,
9446 args: Vec<Expression>,
9447 },
9448 Block(String),
9450}
9451
9452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9454#[cfg_attr(feature = "bindings", derive(TS))]
9455pub struct TriggerReferencing {
9456 pub old_table: Option<Identifier>,
9457 pub new_table: Option<Identifier>,
9458 pub old_row: Option<Identifier>,
9459 pub new_row: Option<Identifier>,
9460}
9461
9462impl CreateTrigger {
9463 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9464 Self {
9465 name: Identifier::new(name),
9466 table: TableRef::new(table),
9467 timing: TriggerTiming::Before,
9468 events: Vec::new(),
9469 for_each: Some(TriggerForEach::Row),
9470 when: None,
9471 when_paren: false,
9472 body: TriggerBody::Execute {
9473 function: TableRef::new(""),
9474 args: Vec::new(),
9475 },
9476 or_replace: false,
9477 or_alter: false,
9478 constraint: false,
9479 deferrable: None,
9480 initially_deferred: None,
9481 referencing: None,
9482 }
9483 }
9484}
9485
9486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9488#[cfg_attr(feature = "bindings", derive(TS))]
9489pub struct DropTrigger {
9490 pub name: Identifier,
9491 pub table: Option<TableRef>,
9492 pub if_exists: bool,
9493 pub cascade: bool,
9494}
9495
9496impl DropTrigger {
9497 pub fn new(name: impl Into<String>) -> Self {
9498 Self {
9499 name: Identifier::new(name),
9500 table: None,
9501 if_exists: false,
9502 cascade: false,
9503 }
9504 }
9505}
9506
9507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9509#[cfg_attr(feature = "bindings", derive(TS))]
9510pub struct CreateType {
9511 pub name: TableRef,
9512 pub definition: TypeDefinition,
9513 pub if_not_exists: bool,
9514}
9515
9516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9518#[cfg_attr(feature = "bindings", derive(TS))]
9519pub enum TypeDefinition {
9520 Enum(Vec<String>),
9522 Composite(Vec<TypeAttribute>),
9524 Range {
9526 subtype: DataType,
9527 subtype_diff: Option<String>,
9528 canonical: Option<String>,
9529 },
9530 Base {
9532 input: String,
9533 output: String,
9534 internallength: Option<i32>,
9535 },
9536 Domain {
9538 base_type: DataType,
9539 default: Option<Expression>,
9540 constraints: Vec<DomainConstraint>,
9541 },
9542}
9543
9544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9546#[cfg_attr(feature = "bindings", derive(TS))]
9547pub struct TypeAttribute {
9548 pub name: Identifier,
9549 pub data_type: DataType,
9550 pub collate: Option<Identifier>,
9551}
9552
9553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9555#[cfg_attr(feature = "bindings", derive(TS))]
9556pub struct DomainConstraint {
9557 pub name: Option<Identifier>,
9558 pub check: Expression,
9559}
9560
9561impl CreateType {
9562 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9563 Self {
9564 name: TableRef::new(name),
9565 definition: TypeDefinition::Enum(values),
9566 if_not_exists: false,
9567 }
9568 }
9569
9570 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9571 Self {
9572 name: TableRef::new(name),
9573 definition: TypeDefinition::Composite(attributes),
9574 if_not_exists: false,
9575 }
9576 }
9577}
9578
9579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9581#[cfg_attr(feature = "bindings", derive(TS))]
9582pub struct DropType {
9583 pub name: TableRef,
9584 pub if_exists: bool,
9585 pub cascade: bool,
9586}
9587
9588impl DropType {
9589 pub fn new(name: impl Into<String>) -> Self {
9590 Self {
9591 name: TableRef::new(name),
9592 if_exists: false,
9593 cascade: false,
9594 }
9595 }
9596}
9597
9598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9600#[cfg_attr(feature = "bindings", derive(TS))]
9601pub struct Describe {
9602 pub target: Expression,
9604 pub extended: bool,
9606 pub formatted: bool,
9608 #[serde(default)]
9610 pub kind: Option<String>,
9611 #[serde(default)]
9613 pub properties: Vec<(String, String)>,
9614 #[serde(default, skip_serializing_if = "Option::is_none")]
9616 pub style: Option<String>,
9617 #[serde(default)]
9619 pub partition: Option<Box<Expression>>,
9620 #[serde(default)]
9622 pub leading_comments: Vec<String>,
9623 #[serde(default)]
9625 pub as_json: bool,
9626}
9627
9628impl Describe {
9629 pub fn new(target: Expression) -> Self {
9630 Self {
9631 target,
9632 extended: false,
9633 formatted: false,
9634 kind: None,
9635 properties: Vec::new(),
9636 style: None,
9637 partition: None,
9638 leading_comments: Vec::new(),
9639 as_json: false,
9640 }
9641 }
9642}
9643
9644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9646#[cfg_attr(feature = "bindings", derive(TS))]
9647pub struct Show {
9648 pub this: String,
9650 #[serde(default)]
9652 pub terse: bool,
9653 #[serde(default)]
9655 pub history: bool,
9656 pub like: Option<Expression>,
9658 pub scope_kind: Option<String>,
9660 pub scope: Option<Expression>,
9662 pub starts_with: Option<Expression>,
9664 pub limit: Option<Box<Limit>>,
9666 pub from: Option<Expression>,
9668 #[serde(default, skip_serializing_if = "Option::is_none")]
9670 pub where_clause: Option<Expression>,
9671 #[serde(default, skip_serializing_if = "Option::is_none")]
9673 pub for_target: Option<Expression>,
9674 #[serde(default, skip_serializing_if = "Option::is_none")]
9676 pub db: Option<Expression>,
9677 #[serde(default, skip_serializing_if = "Option::is_none")]
9679 pub target: Option<Expression>,
9680 #[serde(default, skip_serializing_if = "Option::is_none")]
9682 pub mutex: Option<bool>,
9683 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9685 pub privileges: Vec<String>,
9686}
9687
9688impl Show {
9689 pub fn new(this: impl Into<String>) -> Self {
9690 Self {
9691 this: this.into(),
9692 terse: false,
9693 history: false,
9694 like: None,
9695 scope_kind: None,
9696 scope: None,
9697 starts_with: None,
9698 limit: None,
9699 from: None,
9700 where_clause: None,
9701 for_target: None,
9702 db: None,
9703 target: None,
9704 mutex: None,
9705 privileges: Vec::new(),
9706 }
9707 }
9708}
9709
9710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9715#[cfg_attr(feature = "bindings", derive(TS))]
9716pub struct Paren {
9717 pub this: Expression,
9719 #[serde(default)]
9720 pub trailing_comments: Vec<String>,
9721}
9722
9723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9725#[cfg_attr(feature = "bindings", derive(TS))]
9726pub struct Annotated {
9727 pub this: Expression,
9728 pub trailing_comments: Vec<String>,
9729}
9730
9731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9736#[cfg_attr(feature = "bindings", derive(TS))]
9737pub struct Refresh {
9738 pub this: Box<Expression>,
9739 pub kind: String,
9740}
9741
9742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9744#[cfg_attr(feature = "bindings", derive(TS))]
9745pub struct LockingStatement {
9746 pub this: Box<Expression>,
9747 pub expression: Box<Expression>,
9748}
9749
9750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9752#[cfg_attr(feature = "bindings", derive(TS))]
9753pub struct SequenceProperties {
9754 #[serde(default)]
9755 pub increment: Option<Box<Expression>>,
9756 #[serde(default)]
9757 pub minvalue: Option<Box<Expression>>,
9758 #[serde(default)]
9759 pub maxvalue: Option<Box<Expression>>,
9760 #[serde(default)]
9761 pub cache: Option<Box<Expression>>,
9762 #[serde(default)]
9763 pub start: Option<Box<Expression>>,
9764 #[serde(default)]
9765 pub owned: Option<Box<Expression>>,
9766 #[serde(default)]
9767 pub options: Vec<Expression>,
9768}
9769
9770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9772#[cfg_attr(feature = "bindings", derive(TS))]
9773pub struct TruncateTable {
9774 #[serde(default)]
9775 pub expressions: Vec<Expression>,
9776 #[serde(default)]
9777 pub is_database: Option<Box<Expression>>,
9778 #[serde(default)]
9779 pub exists: bool,
9780 #[serde(default)]
9781 pub only: Option<Box<Expression>>,
9782 #[serde(default)]
9783 pub cluster: Option<Box<Expression>>,
9784 #[serde(default)]
9785 pub identity: Option<Box<Expression>>,
9786 #[serde(default)]
9787 pub option: Option<Box<Expression>>,
9788 #[serde(default)]
9789 pub partition: Option<Box<Expression>>,
9790}
9791
9792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9794#[cfg_attr(feature = "bindings", derive(TS))]
9795pub struct Clone {
9796 pub this: Box<Expression>,
9797 #[serde(default)]
9798 pub shallow: Option<Box<Expression>>,
9799 #[serde(default)]
9800 pub copy: Option<Box<Expression>>,
9801}
9802
9803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9805#[cfg_attr(feature = "bindings", derive(TS))]
9806pub struct Attach {
9807 pub this: Box<Expression>,
9808 #[serde(default)]
9809 pub exists: bool,
9810 #[serde(default)]
9811 pub expressions: Vec<Expression>,
9812}
9813
9814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9816#[cfg_attr(feature = "bindings", derive(TS))]
9817pub struct Detach {
9818 pub this: Box<Expression>,
9819 #[serde(default)]
9820 pub exists: bool,
9821}
9822
9823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9825#[cfg_attr(feature = "bindings", derive(TS))]
9826pub struct Install {
9827 pub this: Box<Expression>,
9828 #[serde(default)]
9829 pub from_: Option<Box<Expression>>,
9830 #[serde(default)]
9831 pub force: Option<Box<Expression>>,
9832}
9833
9834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9836#[cfg_attr(feature = "bindings", derive(TS))]
9837pub struct Summarize {
9838 pub this: Box<Expression>,
9839 #[serde(default)]
9840 pub table: Option<Box<Expression>>,
9841}
9842
9843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9845#[cfg_attr(feature = "bindings", derive(TS))]
9846pub struct Declare {
9847 #[serde(default)]
9848 pub expressions: Vec<Expression>,
9849 #[serde(default)]
9850 pub replace: bool,
9851}
9852
9853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9855#[cfg_attr(feature = "bindings", derive(TS))]
9856pub struct DeclareItem {
9857 pub this: Box<Expression>,
9858 #[serde(default)]
9859 pub kind: Option<String>,
9860 #[serde(default)]
9861 pub default: Option<Box<Expression>>,
9862 #[serde(default)]
9863 pub has_as: bool,
9864 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9866 pub additional_names: Vec<Expression>,
9867}
9868
9869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9871#[cfg_attr(feature = "bindings", derive(TS))]
9872pub struct Set {
9873 #[serde(default)]
9874 pub expressions: Vec<Expression>,
9875 #[serde(default)]
9876 pub unset: Option<Box<Expression>>,
9877 #[serde(default)]
9878 pub tag: Option<Box<Expression>>,
9879}
9880
9881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9883#[cfg_attr(feature = "bindings", derive(TS))]
9884pub struct Heredoc {
9885 pub this: Box<Expression>,
9886 #[serde(default)]
9887 pub tag: Option<Box<Expression>>,
9888}
9889
9890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9892#[cfg_attr(feature = "bindings", derive(TS))]
9893pub struct QueryBand {
9894 pub this: Box<Expression>,
9895 #[serde(default)]
9896 pub scope: Option<Box<Expression>>,
9897 #[serde(default)]
9898 pub update: Option<Box<Expression>>,
9899}
9900
9901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9903#[cfg_attr(feature = "bindings", derive(TS))]
9904pub struct UserDefinedFunction {
9905 pub this: Box<Expression>,
9906 #[serde(default)]
9907 pub expressions: Vec<Expression>,
9908 #[serde(default)]
9909 pub wrapped: Option<Box<Expression>>,
9910}
9911
9912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9914#[cfg_attr(feature = "bindings", derive(TS))]
9915pub struct RecursiveWithSearch {
9916 pub kind: String,
9917 pub this: Box<Expression>,
9918 pub expression: Box<Expression>,
9919 #[serde(default)]
9920 pub using: Option<Box<Expression>>,
9921}
9922
9923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9925#[cfg_attr(feature = "bindings", derive(TS))]
9926pub struct ProjectionDef {
9927 pub this: Box<Expression>,
9928 pub expression: Box<Expression>,
9929}
9930
9931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9933#[cfg_attr(feature = "bindings", derive(TS))]
9934pub struct TableAlias {
9935 #[serde(default)]
9936 pub this: Option<Box<Expression>>,
9937 #[serde(default)]
9938 pub columns: Vec<Expression>,
9939}
9940
9941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9943#[cfg_attr(feature = "bindings", derive(TS))]
9944pub struct ByteString {
9945 pub this: Box<Expression>,
9946 #[serde(default)]
9947 pub is_bytes: Option<Box<Expression>>,
9948}
9949
9950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9953#[cfg_attr(feature = "bindings", derive(TS))]
9954pub struct HexStringExpr {
9955 pub this: Box<Expression>,
9956 #[serde(default)]
9957 pub is_integer: Option<bool>,
9958}
9959
9960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9962#[cfg_attr(feature = "bindings", derive(TS))]
9963pub struct UnicodeString {
9964 pub this: Box<Expression>,
9965 #[serde(default)]
9966 pub escape: Option<Box<Expression>>,
9967}
9968
9969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9971#[cfg_attr(feature = "bindings", derive(TS))]
9972pub struct AlterColumn {
9973 pub this: Box<Expression>,
9974 #[serde(default)]
9975 pub dtype: Option<Box<Expression>>,
9976 #[serde(default)]
9977 pub collate: Option<Box<Expression>>,
9978 #[serde(default)]
9979 pub using: Option<Box<Expression>>,
9980 #[serde(default)]
9981 pub default: Option<Box<Expression>>,
9982 #[serde(default)]
9983 pub drop: Option<Box<Expression>>,
9984 #[serde(default)]
9985 pub comment: Option<Box<Expression>>,
9986 #[serde(default)]
9987 pub allow_null: Option<Box<Expression>>,
9988 #[serde(default)]
9989 pub visible: Option<Box<Expression>>,
9990 #[serde(default)]
9991 pub rename_to: Option<Box<Expression>>,
9992}
9993
9994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9996#[cfg_attr(feature = "bindings", derive(TS))]
9997pub struct AlterSortKey {
9998 #[serde(default)]
9999 pub this: Option<Box<Expression>>,
10000 #[serde(default)]
10001 pub expressions: Vec<Expression>,
10002 #[serde(default)]
10003 pub compound: Option<Box<Expression>>,
10004}
10005
10006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10008#[cfg_attr(feature = "bindings", derive(TS))]
10009pub struct AlterSet {
10010 #[serde(default)]
10011 pub expressions: Vec<Expression>,
10012 #[serde(default)]
10013 pub option: Option<Box<Expression>>,
10014 #[serde(default)]
10015 pub tablespace: Option<Box<Expression>>,
10016 #[serde(default)]
10017 pub access_method: Option<Box<Expression>>,
10018 #[serde(default)]
10019 pub file_format: Option<Box<Expression>>,
10020 #[serde(default)]
10021 pub copy_options: Option<Box<Expression>>,
10022 #[serde(default)]
10023 pub tag: Option<Box<Expression>>,
10024 #[serde(default)]
10025 pub location: Option<Box<Expression>>,
10026 #[serde(default)]
10027 pub serde: Option<Box<Expression>>,
10028}
10029
10030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10032#[cfg_attr(feature = "bindings", derive(TS))]
10033pub struct RenameColumn {
10034 pub this: Box<Expression>,
10035 #[serde(default)]
10036 pub to: Option<Box<Expression>>,
10037 #[serde(default)]
10038 pub exists: bool,
10039}
10040
10041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10043#[cfg_attr(feature = "bindings", derive(TS))]
10044pub struct Comprehension {
10045 pub this: Box<Expression>,
10046 pub expression: Box<Expression>,
10047 #[serde(default)]
10048 pub position: Option<Box<Expression>>,
10049 #[serde(default)]
10050 pub iterator: Option<Box<Expression>>,
10051 #[serde(default)]
10052 pub condition: Option<Box<Expression>>,
10053}
10054
10055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10057#[cfg_attr(feature = "bindings", derive(TS))]
10058pub struct MergeTreeTTLAction {
10059 pub this: Box<Expression>,
10060 #[serde(default)]
10061 pub delete: Option<Box<Expression>>,
10062 #[serde(default)]
10063 pub recompress: Option<Box<Expression>>,
10064 #[serde(default)]
10065 pub to_disk: Option<Box<Expression>>,
10066 #[serde(default)]
10067 pub to_volume: Option<Box<Expression>>,
10068}
10069
10070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10072#[cfg_attr(feature = "bindings", derive(TS))]
10073pub struct MergeTreeTTL {
10074 #[serde(default)]
10075 pub expressions: Vec<Expression>,
10076 #[serde(default)]
10077 pub where_: Option<Box<Expression>>,
10078 #[serde(default)]
10079 pub group: Option<Box<Expression>>,
10080 #[serde(default)]
10081 pub aggregates: Option<Box<Expression>>,
10082}
10083
10084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10086#[cfg_attr(feature = "bindings", derive(TS))]
10087pub struct IndexConstraintOption {
10088 #[serde(default)]
10089 pub key_block_size: Option<Box<Expression>>,
10090 #[serde(default)]
10091 pub using: Option<Box<Expression>>,
10092 #[serde(default)]
10093 pub parser: Option<Box<Expression>>,
10094 #[serde(default)]
10095 pub comment: Option<Box<Expression>>,
10096 #[serde(default)]
10097 pub visible: Option<Box<Expression>>,
10098 #[serde(default)]
10099 pub engine_attr: Option<Box<Expression>>,
10100 #[serde(default)]
10101 pub secondary_engine_attr: Option<Box<Expression>>,
10102}
10103
10104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10106#[cfg_attr(feature = "bindings", derive(TS))]
10107pub struct PeriodForSystemTimeConstraint {
10108 pub this: Box<Expression>,
10109 pub expression: Box<Expression>,
10110}
10111
10112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10114#[cfg_attr(feature = "bindings", derive(TS))]
10115pub struct CaseSpecificColumnConstraint {
10116 #[serde(default)]
10117 pub not_: Option<Box<Expression>>,
10118}
10119
10120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10122#[cfg_attr(feature = "bindings", derive(TS))]
10123pub struct CharacterSetColumnConstraint {
10124 pub this: Box<Expression>,
10125}
10126
10127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10129#[cfg_attr(feature = "bindings", derive(TS))]
10130pub struct CheckColumnConstraint {
10131 pub this: Box<Expression>,
10132 #[serde(default)]
10133 pub enforced: Option<Box<Expression>>,
10134}
10135
10136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10138#[cfg_attr(feature = "bindings", derive(TS))]
10139pub struct AssumeColumnConstraint {
10140 pub this: Box<Expression>,
10141}
10142
10143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10145#[cfg_attr(feature = "bindings", derive(TS))]
10146pub struct CompressColumnConstraint {
10147 #[serde(default)]
10148 pub this: Option<Box<Expression>>,
10149}
10150
10151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10153#[cfg_attr(feature = "bindings", derive(TS))]
10154pub struct DateFormatColumnConstraint {
10155 pub this: Box<Expression>,
10156}
10157
10158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10160#[cfg_attr(feature = "bindings", derive(TS))]
10161pub struct EphemeralColumnConstraint {
10162 #[serde(default)]
10163 pub this: Option<Box<Expression>>,
10164}
10165
10166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10168#[cfg_attr(feature = "bindings", derive(TS))]
10169pub struct WithOperator {
10170 pub this: Box<Expression>,
10171 pub op: String,
10172}
10173
10174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10176#[cfg_attr(feature = "bindings", derive(TS))]
10177pub struct GeneratedAsIdentityColumnConstraint {
10178 #[serde(default)]
10179 pub this: Option<Box<Expression>>,
10180 #[serde(default)]
10181 pub expression: Option<Box<Expression>>,
10182 #[serde(default)]
10183 pub on_null: Option<Box<Expression>>,
10184 #[serde(default)]
10185 pub start: Option<Box<Expression>>,
10186 #[serde(default)]
10187 pub increment: Option<Box<Expression>>,
10188 #[serde(default)]
10189 pub minvalue: Option<Box<Expression>>,
10190 #[serde(default)]
10191 pub maxvalue: Option<Box<Expression>>,
10192 #[serde(default)]
10193 pub cycle: Option<Box<Expression>>,
10194 #[serde(default)]
10195 pub order: Option<Box<Expression>>,
10196}
10197
10198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10201#[cfg_attr(feature = "bindings", derive(TS))]
10202pub struct AutoIncrementColumnConstraint;
10203
10204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10206#[cfg_attr(feature = "bindings", derive(TS))]
10207pub struct CommentColumnConstraint;
10208
10209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10211#[cfg_attr(feature = "bindings", derive(TS))]
10212pub struct GeneratedAsRowColumnConstraint {
10213 #[serde(default)]
10214 pub start: Option<Box<Expression>>,
10215 #[serde(default)]
10216 pub hidden: Option<Box<Expression>>,
10217}
10218
10219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10221#[cfg_attr(feature = "bindings", derive(TS))]
10222pub struct IndexColumnConstraint {
10223 #[serde(default)]
10224 pub this: Option<Box<Expression>>,
10225 #[serde(default)]
10226 pub expressions: Vec<Expression>,
10227 #[serde(default)]
10228 pub kind: Option<String>,
10229 #[serde(default)]
10230 pub index_type: Option<Box<Expression>>,
10231 #[serde(default)]
10232 pub options: Vec<Expression>,
10233 #[serde(default)]
10234 pub expression: Option<Box<Expression>>,
10235 #[serde(default)]
10236 pub granularity: Option<Box<Expression>>,
10237}
10238
10239#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10241#[cfg_attr(feature = "bindings", derive(TS))]
10242pub struct MaskingPolicyColumnConstraint {
10243 pub this: Box<Expression>,
10244 #[serde(default)]
10245 pub expressions: Vec<Expression>,
10246}
10247
10248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10250#[cfg_attr(feature = "bindings", derive(TS))]
10251pub struct NotNullColumnConstraint {
10252 #[serde(default)]
10253 pub allow_null: Option<Box<Expression>>,
10254}
10255
10256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10258#[cfg_attr(feature = "bindings", derive(TS))]
10259pub struct DefaultColumnConstraint {
10260 pub this: Box<Expression>,
10261 #[serde(default, skip_serializing_if = "Option::is_none")]
10263 pub for_column: Option<Identifier>,
10264}
10265
10266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10268#[cfg_attr(feature = "bindings", derive(TS))]
10269pub struct PrimaryKeyColumnConstraint {
10270 #[serde(default)]
10271 pub desc: Option<Box<Expression>>,
10272 #[serde(default)]
10273 pub options: Vec<Expression>,
10274}
10275
10276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10278#[cfg_attr(feature = "bindings", derive(TS))]
10279pub struct UniqueColumnConstraint {
10280 #[serde(default)]
10281 pub this: Option<Box<Expression>>,
10282 #[serde(default)]
10283 pub index_type: Option<Box<Expression>>,
10284 #[serde(default)]
10285 pub on_conflict: Option<Box<Expression>>,
10286 #[serde(default)]
10287 pub nulls: Option<Box<Expression>>,
10288 #[serde(default)]
10289 pub options: Vec<Expression>,
10290}
10291
10292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10294#[cfg_attr(feature = "bindings", derive(TS))]
10295pub struct WatermarkColumnConstraint {
10296 pub this: Box<Expression>,
10297 pub expression: Box<Expression>,
10298}
10299
10300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10302#[cfg_attr(feature = "bindings", derive(TS))]
10303pub struct ComputedColumnConstraint {
10304 pub this: Box<Expression>,
10305 #[serde(default)]
10306 pub persisted: Option<Box<Expression>>,
10307 #[serde(default)]
10308 pub not_null: Option<Box<Expression>>,
10309 #[serde(default)]
10310 pub data_type: Option<Box<Expression>>,
10311}
10312
10313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10315#[cfg_attr(feature = "bindings", derive(TS))]
10316pub struct InOutColumnConstraint {
10317 #[serde(default)]
10318 pub input_: Option<Box<Expression>>,
10319 #[serde(default)]
10320 pub output: Option<Box<Expression>>,
10321}
10322
10323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10325#[cfg_attr(feature = "bindings", derive(TS))]
10326pub struct PathColumnConstraint {
10327 pub this: Box<Expression>,
10328}
10329
10330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10332#[cfg_attr(feature = "bindings", derive(TS))]
10333pub struct Constraint {
10334 pub this: Box<Expression>,
10335 #[serde(default)]
10336 pub expressions: Vec<Expression>,
10337}
10338
10339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10341#[cfg_attr(feature = "bindings", derive(TS))]
10342pub struct Export {
10343 pub this: Box<Expression>,
10344 #[serde(default)]
10345 pub connection: Option<Box<Expression>>,
10346 #[serde(default)]
10347 pub options: Vec<Expression>,
10348}
10349
10350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10352#[cfg_attr(feature = "bindings", derive(TS))]
10353pub struct Filter {
10354 pub this: Box<Expression>,
10355 pub expression: Box<Expression>,
10356}
10357
10358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10360#[cfg_attr(feature = "bindings", derive(TS))]
10361pub struct Changes {
10362 #[serde(default)]
10363 pub information: Option<Box<Expression>>,
10364 #[serde(default)]
10365 pub at_before: Option<Box<Expression>>,
10366 #[serde(default)]
10367 pub end: Option<Box<Expression>>,
10368}
10369
10370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10372#[cfg_attr(feature = "bindings", derive(TS))]
10373pub struct Directory {
10374 pub this: Box<Expression>,
10375 #[serde(default)]
10376 pub local: Option<Box<Expression>>,
10377 #[serde(default)]
10378 pub row_format: Option<Box<Expression>>,
10379}
10380
10381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10383#[cfg_attr(feature = "bindings", derive(TS))]
10384pub struct ForeignKey {
10385 #[serde(default)]
10386 pub expressions: Vec<Expression>,
10387 #[serde(default)]
10388 pub reference: Option<Box<Expression>>,
10389 #[serde(default)]
10390 pub delete: Option<Box<Expression>>,
10391 #[serde(default)]
10392 pub update: Option<Box<Expression>>,
10393 #[serde(default)]
10394 pub options: Vec<Expression>,
10395}
10396
10397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10399#[cfg_attr(feature = "bindings", derive(TS))]
10400pub struct ColumnPrefix {
10401 pub this: Box<Expression>,
10402 pub expression: Box<Expression>,
10403}
10404
10405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10407#[cfg_attr(feature = "bindings", derive(TS))]
10408pub struct PrimaryKey {
10409 #[serde(default)]
10410 pub this: Option<Box<Expression>>,
10411 #[serde(default)]
10412 pub expressions: Vec<Expression>,
10413 #[serde(default)]
10414 pub options: Vec<Expression>,
10415 #[serde(default)]
10416 pub include: Option<Box<Expression>>,
10417}
10418
10419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10421#[cfg_attr(feature = "bindings", derive(TS))]
10422pub struct IntoClause {
10423 #[serde(default)]
10424 pub this: Option<Box<Expression>>,
10425 #[serde(default)]
10426 pub temporary: bool,
10427 #[serde(default)]
10428 pub unlogged: Option<Box<Expression>>,
10429 #[serde(default)]
10430 pub bulk_collect: Option<Box<Expression>>,
10431 #[serde(default)]
10432 pub expressions: Vec<Expression>,
10433}
10434
10435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10437#[cfg_attr(feature = "bindings", derive(TS))]
10438pub struct JoinHint {
10439 pub this: Box<Expression>,
10440 #[serde(default)]
10441 pub expressions: Vec<Expression>,
10442}
10443
10444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10446#[cfg_attr(feature = "bindings", derive(TS))]
10447pub struct Opclass {
10448 pub this: Box<Expression>,
10449 pub expression: Box<Expression>,
10450}
10451
10452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10454#[cfg_attr(feature = "bindings", derive(TS))]
10455pub struct Index {
10456 #[serde(default)]
10457 pub this: Option<Box<Expression>>,
10458 #[serde(default)]
10459 pub table: Option<Box<Expression>>,
10460 #[serde(default)]
10461 pub unique: bool,
10462 #[serde(default)]
10463 pub primary: Option<Box<Expression>>,
10464 #[serde(default)]
10465 pub amp: Option<Box<Expression>>,
10466 #[serde(default)]
10467 pub params: Vec<Expression>,
10468}
10469
10470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10472#[cfg_attr(feature = "bindings", derive(TS))]
10473pub struct IndexParameters {
10474 #[serde(default)]
10475 pub using: Option<Box<Expression>>,
10476 #[serde(default)]
10477 pub include: Option<Box<Expression>>,
10478 #[serde(default)]
10479 pub columns: Vec<Expression>,
10480 #[serde(default)]
10481 pub with_storage: Option<Box<Expression>>,
10482 #[serde(default)]
10483 pub partition_by: Option<Box<Expression>>,
10484 #[serde(default)]
10485 pub tablespace: Option<Box<Expression>>,
10486 #[serde(default)]
10487 pub where_: Option<Box<Expression>>,
10488 #[serde(default)]
10489 pub on: Option<Box<Expression>>,
10490}
10491
10492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10494#[cfg_attr(feature = "bindings", derive(TS))]
10495pub struct ConditionalInsert {
10496 pub this: Box<Expression>,
10497 #[serde(default)]
10498 pub expression: Option<Box<Expression>>,
10499 #[serde(default)]
10500 pub else_: Option<Box<Expression>>,
10501}
10502
10503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10505#[cfg_attr(feature = "bindings", derive(TS))]
10506pub struct MultitableInserts {
10507 #[serde(default)]
10508 pub expressions: Vec<Expression>,
10509 pub kind: String,
10510 #[serde(default)]
10511 pub source: Option<Box<Expression>>,
10512 #[serde(default)]
10514 pub leading_comments: Vec<String>,
10515}
10516
10517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10519#[cfg_attr(feature = "bindings", derive(TS))]
10520pub struct OnConflict {
10521 #[serde(default)]
10522 pub duplicate: Option<Box<Expression>>,
10523 #[serde(default)]
10524 pub expressions: Vec<Expression>,
10525 #[serde(default)]
10526 pub action: Option<Box<Expression>>,
10527 #[serde(default)]
10528 pub conflict_keys: Option<Box<Expression>>,
10529 #[serde(default)]
10530 pub index_predicate: Option<Box<Expression>>,
10531 #[serde(default)]
10532 pub constraint: Option<Box<Expression>>,
10533 #[serde(default)]
10534 pub where_: Option<Box<Expression>>,
10535}
10536
10537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10539#[cfg_attr(feature = "bindings", derive(TS))]
10540pub struct OnCondition {
10541 #[serde(default)]
10542 pub error: Option<Box<Expression>>,
10543 #[serde(default)]
10544 pub empty: Option<Box<Expression>>,
10545 #[serde(default)]
10546 pub null: Option<Box<Expression>>,
10547}
10548
10549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10551#[cfg_attr(feature = "bindings", derive(TS))]
10552pub struct Returning {
10553 #[serde(default)]
10554 pub expressions: Vec<Expression>,
10555 #[serde(default)]
10556 pub into: Option<Box<Expression>>,
10557}
10558
10559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10561#[cfg_attr(feature = "bindings", derive(TS))]
10562pub struct Introducer {
10563 pub this: Box<Expression>,
10564 pub expression: Box<Expression>,
10565}
10566
10567#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10569#[cfg_attr(feature = "bindings", derive(TS))]
10570pub struct PartitionRange {
10571 pub this: Box<Expression>,
10572 #[serde(default)]
10573 pub expression: Option<Box<Expression>>,
10574 #[serde(default)]
10575 pub expressions: Vec<Expression>,
10576}
10577
10578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10580#[cfg_attr(feature = "bindings", derive(TS))]
10581pub struct Group {
10582 #[serde(default)]
10583 pub expressions: Vec<Expression>,
10584 #[serde(default)]
10585 pub grouping_sets: Option<Box<Expression>>,
10586 #[serde(default)]
10587 pub cube: Option<Box<Expression>>,
10588 #[serde(default)]
10589 pub rollup: Option<Box<Expression>>,
10590 #[serde(default)]
10591 pub totals: Option<Box<Expression>>,
10592 #[serde(default)]
10594 pub all: Option<bool>,
10595}
10596
10597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10599#[cfg_attr(feature = "bindings", derive(TS))]
10600pub struct Cube {
10601 #[serde(default)]
10602 pub expressions: Vec<Expression>,
10603}
10604
10605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10607#[cfg_attr(feature = "bindings", derive(TS))]
10608pub struct Rollup {
10609 #[serde(default)]
10610 pub expressions: Vec<Expression>,
10611}
10612
10613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10615#[cfg_attr(feature = "bindings", derive(TS))]
10616pub struct GroupingSets {
10617 #[serde(default)]
10618 pub expressions: Vec<Expression>,
10619}
10620
10621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10623#[cfg_attr(feature = "bindings", derive(TS))]
10624pub struct LimitOptions {
10625 #[serde(default)]
10626 pub percent: Option<Box<Expression>>,
10627 #[serde(default)]
10628 pub rows: Option<Box<Expression>>,
10629 #[serde(default)]
10630 pub with_ties: Option<Box<Expression>>,
10631}
10632
10633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10635#[cfg_attr(feature = "bindings", derive(TS))]
10636pub struct Lateral {
10637 pub this: Box<Expression>,
10638 #[serde(default)]
10639 pub view: Option<Box<Expression>>,
10640 #[serde(default)]
10641 pub outer: Option<Box<Expression>>,
10642 #[serde(default)]
10643 pub alias: Option<String>,
10644 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10646 pub alias_quoted: bool,
10647 #[serde(default)]
10648 pub cross_apply: Option<Box<Expression>>,
10649 #[serde(default)]
10650 pub ordinality: Option<Box<Expression>>,
10651 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10653 pub column_aliases: Vec<String>,
10654}
10655
10656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10658#[cfg_attr(feature = "bindings", derive(TS))]
10659pub struct TableFromRows {
10660 pub this: Box<Expression>,
10661 #[serde(default)]
10662 pub alias: Option<String>,
10663 #[serde(default)]
10664 pub joins: Vec<Expression>,
10665 #[serde(default)]
10666 pub pivots: Option<Box<Expression>>,
10667 #[serde(default)]
10668 pub sample: Option<Box<Expression>>,
10669}
10670
10671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10674#[cfg_attr(feature = "bindings", derive(TS))]
10675pub struct RowsFrom {
10676 pub expressions: Vec<Expression>,
10678 #[serde(default)]
10680 pub ordinality: bool,
10681 #[serde(default)]
10683 pub alias: Option<Box<Expression>>,
10684}
10685
10686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10688#[cfg_attr(feature = "bindings", derive(TS))]
10689pub struct WithFill {
10690 #[serde(default)]
10691 pub from_: Option<Box<Expression>>,
10692 #[serde(default)]
10693 pub to: Option<Box<Expression>>,
10694 #[serde(default)]
10695 pub step: Option<Box<Expression>>,
10696 #[serde(default)]
10697 pub staleness: Option<Box<Expression>>,
10698 #[serde(default)]
10699 pub interpolate: Option<Box<Expression>>,
10700}
10701
10702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10704#[cfg_attr(feature = "bindings", derive(TS))]
10705pub struct Property {
10706 pub this: Box<Expression>,
10707 #[serde(default)]
10708 pub value: Option<Box<Expression>>,
10709}
10710
10711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10713#[cfg_attr(feature = "bindings", derive(TS))]
10714pub struct GrantPrivilege {
10715 pub this: Box<Expression>,
10716 #[serde(default)]
10717 pub expressions: Vec<Expression>,
10718}
10719
10720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10722#[cfg_attr(feature = "bindings", derive(TS))]
10723pub struct AllowedValuesProperty {
10724 #[serde(default)]
10725 pub expressions: Vec<Expression>,
10726}
10727
10728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10730#[cfg_attr(feature = "bindings", derive(TS))]
10731pub struct AlgorithmProperty {
10732 pub this: Box<Expression>,
10733}
10734
10735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10737#[cfg_attr(feature = "bindings", derive(TS))]
10738pub struct AutoIncrementProperty {
10739 pub this: Box<Expression>,
10740}
10741
10742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10744#[cfg_attr(feature = "bindings", derive(TS))]
10745pub struct AutoRefreshProperty {
10746 pub this: Box<Expression>,
10747}
10748
10749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10751#[cfg_attr(feature = "bindings", derive(TS))]
10752pub struct BackupProperty {
10753 pub this: Box<Expression>,
10754}
10755
10756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10758#[cfg_attr(feature = "bindings", derive(TS))]
10759pub struct BuildProperty {
10760 pub this: Box<Expression>,
10761}
10762
10763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10765#[cfg_attr(feature = "bindings", derive(TS))]
10766pub struct BlockCompressionProperty {
10767 #[serde(default)]
10768 pub autotemp: Option<Box<Expression>>,
10769 #[serde(default)]
10770 pub always: Option<Box<Expression>>,
10771 #[serde(default)]
10772 pub default: Option<Box<Expression>>,
10773 #[serde(default)]
10774 pub manual: Option<Box<Expression>>,
10775 #[serde(default)]
10776 pub never: Option<Box<Expression>>,
10777}
10778
10779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10781#[cfg_attr(feature = "bindings", derive(TS))]
10782pub struct CharacterSetProperty {
10783 pub this: Box<Expression>,
10784 #[serde(default)]
10785 pub default: Option<Box<Expression>>,
10786}
10787
10788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10790#[cfg_attr(feature = "bindings", derive(TS))]
10791pub struct ChecksumProperty {
10792 #[serde(default)]
10793 pub on: Option<Box<Expression>>,
10794 #[serde(default)]
10795 pub default: Option<Box<Expression>>,
10796}
10797
10798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10800#[cfg_attr(feature = "bindings", derive(TS))]
10801pub struct CollateProperty {
10802 pub this: Box<Expression>,
10803 #[serde(default)]
10804 pub default: Option<Box<Expression>>,
10805}
10806
10807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10809#[cfg_attr(feature = "bindings", derive(TS))]
10810pub struct DataBlocksizeProperty {
10811 #[serde(default)]
10812 pub size: Option<i64>,
10813 #[serde(default)]
10814 pub units: Option<Box<Expression>>,
10815 #[serde(default)]
10816 pub minimum: Option<Box<Expression>>,
10817 #[serde(default)]
10818 pub maximum: Option<Box<Expression>>,
10819 #[serde(default)]
10820 pub default: Option<Box<Expression>>,
10821}
10822
10823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10825#[cfg_attr(feature = "bindings", derive(TS))]
10826pub struct DataDeletionProperty {
10827 pub on: Box<Expression>,
10828 #[serde(default)]
10829 pub filter_column: Option<Box<Expression>>,
10830 #[serde(default)]
10831 pub retention_period: Option<Box<Expression>>,
10832}
10833
10834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10836#[cfg_attr(feature = "bindings", derive(TS))]
10837pub struct DefinerProperty {
10838 pub this: Box<Expression>,
10839}
10840
10841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10843#[cfg_attr(feature = "bindings", derive(TS))]
10844pub struct DistKeyProperty {
10845 pub this: Box<Expression>,
10846}
10847
10848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10850#[cfg_attr(feature = "bindings", derive(TS))]
10851pub struct DistributedByProperty {
10852 #[serde(default)]
10853 pub expressions: Vec<Expression>,
10854 pub kind: String,
10855 #[serde(default)]
10856 pub buckets: Option<Box<Expression>>,
10857 #[serde(default)]
10858 pub order: Option<Box<Expression>>,
10859}
10860
10861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10863#[cfg_attr(feature = "bindings", derive(TS))]
10864pub struct DistStyleProperty {
10865 pub this: Box<Expression>,
10866}
10867
10868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10870#[cfg_attr(feature = "bindings", derive(TS))]
10871pub struct DuplicateKeyProperty {
10872 #[serde(default)]
10873 pub expressions: Vec<Expression>,
10874}
10875
10876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10878#[cfg_attr(feature = "bindings", derive(TS))]
10879pub struct EngineProperty {
10880 pub this: Box<Expression>,
10881}
10882
10883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10885#[cfg_attr(feature = "bindings", derive(TS))]
10886pub struct ToTableProperty {
10887 pub this: Box<Expression>,
10888}
10889
10890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10892#[cfg_attr(feature = "bindings", derive(TS))]
10893pub struct ExecuteAsProperty {
10894 pub this: Box<Expression>,
10895}
10896
10897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10899#[cfg_attr(feature = "bindings", derive(TS))]
10900pub struct ExternalProperty {
10901 #[serde(default)]
10902 pub this: Option<Box<Expression>>,
10903}
10904
10905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10907#[cfg_attr(feature = "bindings", derive(TS))]
10908pub struct FallbackProperty {
10909 #[serde(default)]
10910 pub no: Option<Box<Expression>>,
10911 #[serde(default)]
10912 pub protection: Option<Box<Expression>>,
10913}
10914
10915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10917#[cfg_attr(feature = "bindings", derive(TS))]
10918pub struct FileFormatProperty {
10919 #[serde(default)]
10920 pub this: Option<Box<Expression>>,
10921 #[serde(default)]
10922 pub expressions: Vec<Expression>,
10923 #[serde(default)]
10924 pub hive_format: Option<Box<Expression>>,
10925}
10926
10927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10929#[cfg_attr(feature = "bindings", derive(TS))]
10930pub struct CredentialsProperty {
10931 #[serde(default)]
10932 pub expressions: Vec<Expression>,
10933}
10934
10935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10937#[cfg_attr(feature = "bindings", derive(TS))]
10938pub struct FreespaceProperty {
10939 pub this: Box<Expression>,
10940 #[serde(default)]
10941 pub percent: Option<Box<Expression>>,
10942}
10943
10944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10946#[cfg_attr(feature = "bindings", derive(TS))]
10947pub struct InheritsProperty {
10948 #[serde(default)]
10949 pub expressions: Vec<Expression>,
10950}
10951
10952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10954#[cfg_attr(feature = "bindings", derive(TS))]
10955pub struct InputModelProperty {
10956 pub this: Box<Expression>,
10957}
10958
10959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10961#[cfg_attr(feature = "bindings", derive(TS))]
10962pub struct OutputModelProperty {
10963 pub this: Box<Expression>,
10964}
10965
10966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10968#[cfg_attr(feature = "bindings", derive(TS))]
10969pub struct IsolatedLoadingProperty {
10970 #[serde(default)]
10971 pub no: Option<Box<Expression>>,
10972 #[serde(default)]
10973 pub concurrent: Option<Box<Expression>>,
10974 #[serde(default)]
10975 pub target: Option<Box<Expression>>,
10976}
10977
10978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10980#[cfg_attr(feature = "bindings", derive(TS))]
10981pub struct JournalProperty {
10982 #[serde(default)]
10983 pub no: Option<Box<Expression>>,
10984 #[serde(default)]
10985 pub dual: Option<Box<Expression>>,
10986 #[serde(default)]
10987 pub before: Option<Box<Expression>>,
10988 #[serde(default)]
10989 pub local: Option<Box<Expression>>,
10990 #[serde(default)]
10991 pub after: Option<Box<Expression>>,
10992}
10993
10994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10996#[cfg_attr(feature = "bindings", derive(TS))]
10997pub struct LanguageProperty {
10998 pub this: Box<Expression>,
10999}
11000
11001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11003#[cfg_attr(feature = "bindings", derive(TS))]
11004pub struct EnviromentProperty {
11005 #[serde(default)]
11006 pub expressions: Vec<Expression>,
11007}
11008
11009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11011#[cfg_attr(feature = "bindings", derive(TS))]
11012pub struct ClusteredByProperty {
11013 #[serde(default)]
11014 pub expressions: Vec<Expression>,
11015 #[serde(default)]
11016 pub sorted_by: Option<Box<Expression>>,
11017 #[serde(default)]
11018 pub buckets: Option<Box<Expression>>,
11019}
11020
11021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11023#[cfg_attr(feature = "bindings", derive(TS))]
11024pub struct DictProperty {
11025 pub this: Box<Expression>,
11026 pub kind: String,
11027 #[serde(default)]
11028 pub settings: Option<Box<Expression>>,
11029}
11030
11031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11033#[cfg_attr(feature = "bindings", derive(TS))]
11034pub struct DictRange {
11035 pub this: Box<Expression>,
11036 #[serde(default)]
11037 pub min: Option<Box<Expression>>,
11038 #[serde(default)]
11039 pub max: Option<Box<Expression>>,
11040}
11041
11042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11044#[cfg_attr(feature = "bindings", derive(TS))]
11045pub struct OnCluster {
11046 pub this: Box<Expression>,
11047}
11048
11049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11051#[cfg_attr(feature = "bindings", derive(TS))]
11052pub struct LikeProperty {
11053 pub this: Box<Expression>,
11054 #[serde(default)]
11055 pub expressions: Vec<Expression>,
11056}
11057
11058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11060#[cfg_attr(feature = "bindings", derive(TS))]
11061pub struct LocationProperty {
11062 pub this: Box<Expression>,
11063}
11064
11065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11067#[cfg_attr(feature = "bindings", derive(TS))]
11068pub struct LockProperty {
11069 pub this: Box<Expression>,
11070}
11071
11072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11074#[cfg_attr(feature = "bindings", derive(TS))]
11075pub struct LockingProperty {
11076 #[serde(default)]
11077 pub this: Option<Box<Expression>>,
11078 pub kind: String,
11079 #[serde(default)]
11080 pub for_or_in: Option<Box<Expression>>,
11081 #[serde(default)]
11082 pub lock_type: Option<Box<Expression>>,
11083 #[serde(default)]
11084 pub override_: Option<Box<Expression>>,
11085}
11086
11087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11089#[cfg_attr(feature = "bindings", derive(TS))]
11090pub struct LogProperty {
11091 #[serde(default)]
11092 pub no: Option<Box<Expression>>,
11093}
11094
11095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11097#[cfg_attr(feature = "bindings", derive(TS))]
11098pub struct MaterializedProperty {
11099 #[serde(default)]
11100 pub this: Option<Box<Expression>>,
11101}
11102
11103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11105#[cfg_attr(feature = "bindings", derive(TS))]
11106pub struct MergeBlockRatioProperty {
11107 #[serde(default)]
11108 pub this: Option<Box<Expression>>,
11109 #[serde(default)]
11110 pub no: Option<Box<Expression>>,
11111 #[serde(default)]
11112 pub default: Option<Box<Expression>>,
11113 #[serde(default)]
11114 pub percent: Option<Box<Expression>>,
11115}
11116
11117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11119#[cfg_attr(feature = "bindings", derive(TS))]
11120pub struct OnProperty {
11121 pub this: Box<Expression>,
11122}
11123
11124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11126#[cfg_attr(feature = "bindings", derive(TS))]
11127pub struct OnCommitProperty {
11128 #[serde(default)]
11129 pub delete: Option<Box<Expression>>,
11130}
11131
11132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11134#[cfg_attr(feature = "bindings", derive(TS))]
11135pub struct PartitionedByProperty {
11136 pub this: Box<Expression>,
11137}
11138
11139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11141#[cfg_attr(feature = "bindings", derive(TS))]
11142pub struct PartitionByProperty {
11143 #[serde(default)]
11144 pub expressions: Vec<Expression>,
11145}
11146
11147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11149#[cfg_attr(feature = "bindings", derive(TS))]
11150pub struct PartitionedByBucket {
11151 pub this: Box<Expression>,
11152 pub expression: Box<Expression>,
11153}
11154
11155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11157#[cfg_attr(feature = "bindings", derive(TS))]
11158pub struct ClusterByColumnsProperty {
11159 #[serde(default)]
11160 pub columns: Vec<Identifier>,
11161}
11162
11163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11165#[cfg_attr(feature = "bindings", derive(TS))]
11166pub struct PartitionByTruncate {
11167 pub this: Box<Expression>,
11168 pub expression: Box<Expression>,
11169}
11170
11171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11173#[cfg_attr(feature = "bindings", derive(TS))]
11174pub struct PartitionByRangeProperty {
11175 #[serde(default)]
11176 pub partition_expressions: Option<Box<Expression>>,
11177 #[serde(default)]
11178 pub create_expressions: Option<Box<Expression>>,
11179}
11180
11181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11183#[cfg_attr(feature = "bindings", derive(TS))]
11184pub struct PartitionByRangePropertyDynamic {
11185 #[serde(default)]
11186 pub this: Option<Box<Expression>>,
11187 #[serde(default)]
11188 pub start: Option<Box<Expression>>,
11189 #[serde(default)]
11191 pub use_start_end: bool,
11192 #[serde(default)]
11193 pub end: Option<Box<Expression>>,
11194 #[serde(default)]
11195 pub every: Option<Box<Expression>>,
11196}
11197
11198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11200#[cfg_attr(feature = "bindings", derive(TS))]
11201pub struct PartitionByListProperty {
11202 #[serde(default)]
11203 pub partition_expressions: Option<Box<Expression>>,
11204 #[serde(default)]
11205 pub create_expressions: Option<Box<Expression>>,
11206}
11207
11208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11210#[cfg_attr(feature = "bindings", derive(TS))]
11211pub struct PartitionList {
11212 pub this: Box<Expression>,
11213 #[serde(default)]
11214 pub expressions: Vec<Expression>,
11215}
11216
11217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11219#[cfg_attr(feature = "bindings", derive(TS))]
11220pub struct Partition {
11221 pub expressions: Vec<Expression>,
11222 #[serde(default)]
11223 pub subpartition: bool,
11224}
11225
11226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11229#[cfg_attr(feature = "bindings", derive(TS))]
11230pub struct RefreshTriggerProperty {
11231 pub method: String,
11233 #[serde(default)]
11235 pub kind: Option<String>,
11236 #[serde(default)]
11238 pub every: Option<Box<Expression>>,
11239 #[serde(default)]
11241 pub unit: Option<String>,
11242 #[serde(default)]
11244 pub starts: Option<Box<Expression>>,
11245}
11246
11247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11249#[cfg_attr(feature = "bindings", derive(TS))]
11250pub struct UniqueKeyProperty {
11251 #[serde(default)]
11252 pub expressions: Vec<Expression>,
11253}
11254
11255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11257#[cfg_attr(feature = "bindings", derive(TS))]
11258pub struct RollupProperty {
11259 pub expressions: Vec<RollupIndex>,
11260}
11261
11262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11264#[cfg_attr(feature = "bindings", derive(TS))]
11265pub struct RollupIndex {
11266 pub name: Identifier,
11267 pub expressions: Vec<Identifier>,
11268}
11269
11270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11272#[cfg_attr(feature = "bindings", derive(TS))]
11273pub struct PartitionBoundSpec {
11274 #[serde(default)]
11275 pub this: Option<Box<Expression>>,
11276 #[serde(default)]
11277 pub expression: Option<Box<Expression>>,
11278 #[serde(default)]
11279 pub from_expressions: Option<Box<Expression>>,
11280 #[serde(default)]
11281 pub to_expressions: Option<Box<Expression>>,
11282}
11283
11284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11286#[cfg_attr(feature = "bindings", derive(TS))]
11287pub struct PartitionedOfProperty {
11288 pub this: Box<Expression>,
11289 pub expression: Box<Expression>,
11290}
11291
11292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11294#[cfg_attr(feature = "bindings", derive(TS))]
11295pub struct RemoteWithConnectionModelProperty {
11296 pub this: Box<Expression>,
11297}
11298
11299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11301#[cfg_attr(feature = "bindings", derive(TS))]
11302pub struct ReturnsProperty {
11303 #[serde(default)]
11304 pub this: Option<Box<Expression>>,
11305 #[serde(default)]
11306 pub is_table: Option<Box<Expression>>,
11307 #[serde(default)]
11308 pub table: Option<Box<Expression>>,
11309 #[serde(default)]
11310 pub null: Option<Box<Expression>>,
11311}
11312
11313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11315#[cfg_attr(feature = "bindings", derive(TS))]
11316pub struct RowFormatProperty {
11317 pub this: Box<Expression>,
11318}
11319
11320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11322#[cfg_attr(feature = "bindings", derive(TS))]
11323pub struct RowFormatDelimitedProperty {
11324 #[serde(default)]
11325 pub fields: Option<Box<Expression>>,
11326 #[serde(default)]
11327 pub escaped: Option<Box<Expression>>,
11328 #[serde(default)]
11329 pub collection_items: Option<Box<Expression>>,
11330 #[serde(default)]
11331 pub map_keys: Option<Box<Expression>>,
11332 #[serde(default)]
11333 pub lines: Option<Box<Expression>>,
11334 #[serde(default)]
11335 pub null: Option<Box<Expression>>,
11336 #[serde(default)]
11337 pub serde: Option<Box<Expression>>,
11338}
11339
11340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11342#[cfg_attr(feature = "bindings", derive(TS))]
11343pub struct RowFormatSerdeProperty {
11344 pub this: Box<Expression>,
11345 #[serde(default)]
11346 pub serde_properties: Option<Box<Expression>>,
11347}
11348
11349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11351#[cfg_attr(feature = "bindings", derive(TS))]
11352pub struct QueryTransform {
11353 #[serde(default)]
11354 pub expressions: Vec<Expression>,
11355 #[serde(default)]
11356 pub command_script: Option<Box<Expression>>,
11357 #[serde(default)]
11358 pub schema: Option<Box<Expression>>,
11359 #[serde(default)]
11360 pub row_format_before: Option<Box<Expression>>,
11361 #[serde(default)]
11362 pub record_writer: Option<Box<Expression>>,
11363 #[serde(default)]
11364 pub row_format_after: Option<Box<Expression>>,
11365 #[serde(default)]
11366 pub record_reader: Option<Box<Expression>>,
11367}
11368
11369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11371#[cfg_attr(feature = "bindings", derive(TS))]
11372pub struct SampleProperty {
11373 pub this: Box<Expression>,
11374}
11375
11376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11378#[cfg_attr(feature = "bindings", derive(TS))]
11379pub struct SecurityProperty {
11380 pub this: Box<Expression>,
11381}
11382
11383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11385#[cfg_attr(feature = "bindings", derive(TS))]
11386pub struct SchemaCommentProperty {
11387 pub this: Box<Expression>,
11388}
11389
11390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11392#[cfg_attr(feature = "bindings", derive(TS))]
11393pub struct SemanticView {
11394 pub this: Box<Expression>,
11395 #[serde(default)]
11396 pub metrics: Option<Box<Expression>>,
11397 #[serde(default)]
11398 pub dimensions: Option<Box<Expression>>,
11399 #[serde(default)]
11400 pub facts: Option<Box<Expression>>,
11401 #[serde(default)]
11402 pub where_: Option<Box<Expression>>,
11403}
11404
11405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11407#[cfg_attr(feature = "bindings", derive(TS))]
11408pub struct SerdeProperties {
11409 #[serde(default)]
11410 pub expressions: Vec<Expression>,
11411 #[serde(default)]
11412 pub with_: Option<Box<Expression>>,
11413}
11414
11415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11417#[cfg_attr(feature = "bindings", derive(TS))]
11418pub struct SetProperty {
11419 #[serde(default)]
11420 pub multi: Option<Box<Expression>>,
11421}
11422
11423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11425#[cfg_attr(feature = "bindings", derive(TS))]
11426pub struct SharingProperty {
11427 #[serde(default)]
11428 pub this: Option<Box<Expression>>,
11429}
11430
11431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11433#[cfg_attr(feature = "bindings", derive(TS))]
11434pub struct SetConfigProperty {
11435 pub this: Box<Expression>,
11436}
11437
11438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11440#[cfg_attr(feature = "bindings", derive(TS))]
11441pub struct SettingsProperty {
11442 #[serde(default)]
11443 pub expressions: Vec<Expression>,
11444}
11445
11446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11448#[cfg_attr(feature = "bindings", derive(TS))]
11449pub struct SortKeyProperty {
11450 pub this: Box<Expression>,
11451 #[serde(default)]
11452 pub compound: Option<Box<Expression>>,
11453}
11454
11455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11457#[cfg_attr(feature = "bindings", derive(TS))]
11458pub struct SqlReadWriteProperty {
11459 pub this: Box<Expression>,
11460}
11461
11462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11464#[cfg_attr(feature = "bindings", derive(TS))]
11465pub struct SqlSecurityProperty {
11466 pub this: Box<Expression>,
11467}
11468
11469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11471#[cfg_attr(feature = "bindings", derive(TS))]
11472pub struct StabilityProperty {
11473 pub this: Box<Expression>,
11474}
11475
11476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11478#[cfg_attr(feature = "bindings", derive(TS))]
11479pub struct StorageHandlerProperty {
11480 pub this: Box<Expression>,
11481}
11482
11483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11485#[cfg_attr(feature = "bindings", derive(TS))]
11486pub struct TemporaryProperty {
11487 #[serde(default)]
11488 pub this: Option<Box<Expression>>,
11489}
11490
11491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11493#[cfg_attr(feature = "bindings", derive(TS))]
11494pub struct Tags {
11495 #[serde(default)]
11496 pub expressions: Vec<Expression>,
11497}
11498
11499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11501#[cfg_attr(feature = "bindings", derive(TS))]
11502pub struct TransformModelProperty {
11503 #[serde(default)]
11504 pub expressions: Vec<Expression>,
11505}
11506
11507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11509#[cfg_attr(feature = "bindings", derive(TS))]
11510pub struct TransientProperty {
11511 #[serde(default)]
11512 pub this: Option<Box<Expression>>,
11513}
11514
11515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11517#[cfg_attr(feature = "bindings", derive(TS))]
11518pub struct UsingTemplateProperty {
11519 pub this: Box<Expression>,
11520}
11521
11522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11524#[cfg_attr(feature = "bindings", derive(TS))]
11525pub struct ViewAttributeProperty {
11526 pub this: Box<Expression>,
11527}
11528
11529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11531#[cfg_attr(feature = "bindings", derive(TS))]
11532pub struct VolatileProperty {
11533 #[serde(default)]
11534 pub this: Option<Box<Expression>>,
11535}
11536
11537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11539#[cfg_attr(feature = "bindings", derive(TS))]
11540pub struct WithDataProperty {
11541 #[serde(default)]
11542 pub no: Option<Box<Expression>>,
11543 #[serde(default)]
11544 pub statistics: Option<Box<Expression>>,
11545}
11546
11547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11549#[cfg_attr(feature = "bindings", derive(TS))]
11550pub struct WithJournalTableProperty {
11551 pub this: Box<Expression>,
11552}
11553
11554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11556#[cfg_attr(feature = "bindings", derive(TS))]
11557pub struct WithSchemaBindingProperty {
11558 pub this: Box<Expression>,
11559}
11560
11561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11563#[cfg_attr(feature = "bindings", derive(TS))]
11564pub struct WithSystemVersioningProperty {
11565 #[serde(default)]
11566 pub on: Option<Box<Expression>>,
11567 #[serde(default)]
11568 pub this: Option<Box<Expression>>,
11569 #[serde(default)]
11570 pub data_consistency: Option<Box<Expression>>,
11571 #[serde(default)]
11572 pub retention_period: Option<Box<Expression>>,
11573 #[serde(default)]
11574 pub with_: Option<Box<Expression>>,
11575}
11576
11577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11579#[cfg_attr(feature = "bindings", derive(TS))]
11580pub struct WithProcedureOptions {
11581 #[serde(default)]
11582 pub expressions: Vec<Expression>,
11583}
11584
11585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11587#[cfg_attr(feature = "bindings", derive(TS))]
11588pub struct EncodeProperty {
11589 pub this: Box<Expression>,
11590 #[serde(default)]
11591 pub properties: Vec<Expression>,
11592 #[serde(default)]
11593 pub key: Option<Box<Expression>>,
11594}
11595
11596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11598#[cfg_attr(feature = "bindings", derive(TS))]
11599pub struct IncludeProperty {
11600 pub this: Box<Expression>,
11601 #[serde(default)]
11602 pub alias: Option<String>,
11603 #[serde(default)]
11604 pub column_def: Option<Box<Expression>>,
11605}
11606
11607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11609#[cfg_attr(feature = "bindings", derive(TS))]
11610pub struct Properties {
11611 #[serde(default)]
11612 pub expressions: Vec<Expression>,
11613}
11614
11615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11617#[cfg_attr(feature = "bindings", derive(TS))]
11618pub struct OptionEntry {
11619 pub key: Identifier,
11620 pub value: Expression,
11621}
11622
11623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11625#[cfg_attr(feature = "bindings", derive(TS))]
11626pub struct OptionsProperty {
11627 #[serde(default)]
11628 pub entries: Vec<OptionEntry>,
11629}
11630
11631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11633#[cfg_attr(feature = "bindings", derive(TS))]
11634pub struct InputOutputFormat {
11635 #[serde(default)]
11636 pub input_format: Option<Box<Expression>>,
11637 #[serde(default)]
11638 pub output_format: Option<Box<Expression>>,
11639}
11640
11641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11643#[cfg_attr(feature = "bindings", derive(TS))]
11644pub struct Reference {
11645 pub this: Box<Expression>,
11646 #[serde(default)]
11647 pub expressions: Vec<Expression>,
11648 #[serde(default)]
11649 pub options: Vec<Expression>,
11650}
11651
11652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11654#[cfg_attr(feature = "bindings", derive(TS))]
11655pub struct QueryOption {
11656 pub this: Box<Expression>,
11657 #[serde(default)]
11658 pub expression: Option<Box<Expression>>,
11659}
11660
11661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11663#[cfg_attr(feature = "bindings", derive(TS))]
11664pub struct WithTableHint {
11665 #[serde(default)]
11666 pub expressions: Vec<Expression>,
11667}
11668
11669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11671#[cfg_attr(feature = "bindings", derive(TS))]
11672pub struct IndexTableHint {
11673 pub this: Box<Expression>,
11674 #[serde(default)]
11675 pub expressions: Vec<Expression>,
11676 #[serde(default)]
11677 pub target: Option<Box<Expression>>,
11678}
11679
11680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11682#[cfg_attr(feature = "bindings", derive(TS))]
11683pub struct Get {
11684 pub this: Box<Expression>,
11685 #[serde(default)]
11686 pub target: Option<Box<Expression>>,
11687 #[serde(default)]
11688 pub properties: Vec<Expression>,
11689}
11690
11691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11693#[cfg_attr(feature = "bindings", derive(TS))]
11694pub struct SetOperation {
11695 #[serde(default)]
11696 pub with_: Option<Box<Expression>>,
11697 pub this: Box<Expression>,
11698 pub expression: Box<Expression>,
11699 #[serde(default)]
11700 pub distinct: bool,
11701 #[serde(default)]
11702 pub by_name: Option<Box<Expression>>,
11703 #[serde(default)]
11704 pub side: Option<Box<Expression>>,
11705 #[serde(default)]
11706 pub kind: Option<String>,
11707 #[serde(default)]
11708 pub on: Option<Box<Expression>>,
11709}
11710
11711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11713#[cfg_attr(feature = "bindings", derive(TS))]
11714pub struct Var {
11715 pub this: String,
11716}
11717
11718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11720#[cfg_attr(feature = "bindings", derive(TS))]
11721pub struct Variadic {
11722 pub this: Box<Expression>,
11723}
11724
11725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11727#[cfg_attr(feature = "bindings", derive(TS))]
11728pub struct Version {
11729 pub this: Box<Expression>,
11730 pub kind: String,
11731 #[serde(default)]
11732 pub expression: Option<Box<Expression>>,
11733}
11734
11735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11737#[cfg_attr(feature = "bindings", derive(TS))]
11738pub struct Schema {
11739 #[serde(default)]
11740 pub this: Option<Box<Expression>>,
11741 #[serde(default)]
11742 pub expressions: Vec<Expression>,
11743}
11744
11745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11747#[cfg_attr(feature = "bindings", derive(TS))]
11748pub struct Lock {
11749 #[serde(default)]
11750 pub update: Option<Box<Expression>>,
11751 #[serde(default)]
11752 pub expressions: Vec<Expression>,
11753 #[serde(default)]
11754 pub wait: Option<Box<Expression>>,
11755 #[serde(default)]
11756 pub key: Option<Box<Expression>>,
11757}
11758
11759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11762#[cfg_attr(feature = "bindings", derive(TS))]
11763pub struct TableSample {
11764 #[serde(default, skip_serializing_if = "Option::is_none")]
11766 pub this: Option<Box<Expression>>,
11767 #[serde(default, skip_serializing_if = "Option::is_none")]
11769 pub sample: Option<Box<Sample>>,
11770 #[serde(default)]
11771 pub expressions: Vec<Expression>,
11772 #[serde(default)]
11773 pub method: Option<String>,
11774 #[serde(default)]
11775 pub bucket_numerator: Option<Box<Expression>>,
11776 #[serde(default)]
11777 pub bucket_denominator: Option<Box<Expression>>,
11778 #[serde(default)]
11779 pub bucket_field: Option<Box<Expression>>,
11780 #[serde(default)]
11781 pub percent: Option<Box<Expression>>,
11782 #[serde(default)]
11783 pub rows: Option<Box<Expression>>,
11784 #[serde(default)]
11785 pub size: Option<i64>,
11786 #[serde(default)]
11787 pub seed: Option<Box<Expression>>,
11788}
11789
11790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11792#[cfg_attr(feature = "bindings", derive(TS))]
11793pub struct Tag {
11794 #[serde(default)]
11795 pub this: Option<Box<Expression>>,
11796 #[serde(default)]
11797 pub prefix: Option<Box<Expression>>,
11798 #[serde(default)]
11799 pub postfix: Option<Box<Expression>>,
11800}
11801
11802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11804#[cfg_attr(feature = "bindings", derive(TS))]
11805pub struct UnpivotColumns {
11806 pub this: Box<Expression>,
11807 #[serde(default)]
11808 pub expressions: Vec<Expression>,
11809}
11810
11811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11813#[cfg_attr(feature = "bindings", derive(TS))]
11814pub struct SessionParameter {
11815 pub this: Box<Expression>,
11816 #[serde(default)]
11817 pub kind: Option<String>,
11818}
11819
11820#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11822#[cfg_attr(feature = "bindings", derive(TS))]
11823pub struct PseudoType {
11824 pub this: Box<Expression>,
11825}
11826
11827#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11829#[cfg_attr(feature = "bindings", derive(TS))]
11830pub struct ObjectIdentifier {
11831 pub this: Box<Expression>,
11832}
11833
11834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11836#[cfg_attr(feature = "bindings", derive(TS))]
11837pub struct Transaction {
11838 #[serde(default)]
11839 pub this: Option<Box<Expression>>,
11840 #[serde(default)]
11841 pub modes: Option<Box<Expression>>,
11842 #[serde(default)]
11843 pub mark: Option<Box<Expression>>,
11844}
11845
11846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11848#[cfg_attr(feature = "bindings", derive(TS))]
11849pub struct Commit {
11850 #[serde(default)]
11851 pub chain: Option<Box<Expression>>,
11852 #[serde(default)]
11853 pub this: Option<Box<Expression>>,
11854 #[serde(default)]
11855 pub durability: Option<Box<Expression>>,
11856}
11857
11858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11860#[cfg_attr(feature = "bindings", derive(TS))]
11861pub struct Rollback {
11862 #[serde(default)]
11863 pub savepoint: Option<Box<Expression>>,
11864 #[serde(default)]
11865 pub this: Option<Box<Expression>>,
11866}
11867
11868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11870#[cfg_attr(feature = "bindings", derive(TS))]
11871pub struct AlterSession {
11872 #[serde(default)]
11873 pub expressions: Vec<Expression>,
11874 #[serde(default)]
11875 pub unset: Option<Box<Expression>>,
11876}
11877
11878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11880#[cfg_attr(feature = "bindings", derive(TS))]
11881pub struct Analyze {
11882 #[serde(default)]
11883 pub kind: Option<String>,
11884 #[serde(default)]
11885 pub this: Option<Box<Expression>>,
11886 #[serde(default)]
11887 pub options: Vec<Expression>,
11888 #[serde(default)]
11889 pub mode: Option<Box<Expression>>,
11890 #[serde(default)]
11891 pub partition: Option<Box<Expression>>,
11892 #[serde(default)]
11893 pub expression: Option<Box<Expression>>,
11894 #[serde(default)]
11895 pub properties: Vec<Expression>,
11896 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11898 pub columns: Vec<String>,
11899}
11900
11901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11903#[cfg_attr(feature = "bindings", derive(TS))]
11904pub struct AnalyzeStatistics {
11905 pub kind: String,
11906 #[serde(default)]
11907 pub option: Option<Box<Expression>>,
11908 #[serde(default)]
11909 pub this: Option<Box<Expression>>,
11910 #[serde(default)]
11911 pub expressions: Vec<Expression>,
11912}
11913
11914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11916#[cfg_attr(feature = "bindings", derive(TS))]
11917pub struct AnalyzeHistogram {
11918 pub this: Box<Expression>,
11919 #[serde(default)]
11920 pub expressions: Vec<Expression>,
11921 #[serde(default)]
11922 pub expression: Option<Box<Expression>>,
11923 #[serde(default)]
11924 pub update_options: Option<Box<Expression>>,
11925}
11926
11927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11929#[cfg_attr(feature = "bindings", derive(TS))]
11930pub struct AnalyzeSample {
11931 pub kind: String,
11932 #[serde(default)]
11933 pub sample: Option<Box<Expression>>,
11934}
11935
11936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11938#[cfg_attr(feature = "bindings", derive(TS))]
11939pub struct AnalyzeListChainedRows {
11940 #[serde(default)]
11941 pub expression: Option<Box<Expression>>,
11942}
11943
11944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11946#[cfg_attr(feature = "bindings", derive(TS))]
11947pub struct AnalyzeDelete {
11948 #[serde(default)]
11949 pub kind: Option<String>,
11950}
11951
11952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11954#[cfg_attr(feature = "bindings", derive(TS))]
11955pub struct AnalyzeWith {
11956 #[serde(default)]
11957 pub expressions: Vec<Expression>,
11958}
11959
11960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11962#[cfg_attr(feature = "bindings", derive(TS))]
11963pub struct AnalyzeValidate {
11964 pub kind: String,
11965 #[serde(default)]
11966 pub this: Option<Box<Expression>>,
11967 #[serde(default)]
11968 pub expression: Option<Box<Expression>>,
11969}
11970
11971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11973#[cfg_attr(feature = "bindings", derive(TS))]
11974pub struct AddPartition {
11975 pub this: Box<Expression>,
11976 #[serde(default)]
11977 pub exists: bool,
11978 #[serde(default)]
11979 pub location: Option<Box<Expression>>,
11980}
11981
11982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11984#[cfg_attr(feature = "bindings", derive(TS))]
11985pub struct AttachOption {
11986 pub this: Box<Expression>,
11987 #[serde(default)]
11988 pub expression: Option<Box<Expression>>,
11989}
11990
11991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11993#[cfg_attr(feature = "bindings", derive(TS))]
11994pub struct DropPartition {
11995 #[serde(default)]
11996 pub expressions: Vec<Expression>,
11997 #[serde(default)]
11998 pub exists: bool,
11999}
12000
12001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12003#[cfg_attr(feature = "bindings", derive(TS))]
12004pub struct ReplacePartition {
12005 pub expression: Box<Expression>,
12006 #[serde(default)]
12007 pub source: Option<Box<Expression>>,
12008}
12009
12010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12012#[cfg_attr(feature = "bindings", derive(TS))]
12013pub struct DPipe {
12014 pub this: Box<Expression>,
12015 pub expression: Box<Expression>,
12016 #[serde(default)]
12017 pub safe: Option<Box<Expression>>,
12018}
12019
12020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12022#[cfg_attr(feature = "bindings", derive(TS))]
12023pub struct Operator {
12024 pub this: Box<Expression>,
12025 #[serde(default)]
12026 pub operator: Option<Box<Expression>>,
12027 pub expression: Box<Expression>,
12028 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12030 pub comments: Vec<String>,
12031}
12032
12033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12035#[cfg_attr(feature = "bindings", derive(TS))]
12036pub struct PivotAny {
12037 #[serde(default)]
12038 pub this: Option<Box<Expression>>,
12039}
12040
12041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12043#[cfg_attr(feature = "bindings", derive(TS))]
12044pub struct Aliases {
12045 pub this: Box<Expression>,
12046 #[serde(default)]
12047 pub expressions: Vec<Expression>,
12048}
12049
12050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12052#[cfg_attr(feature = "bindings", derive(TS))]
12053pub struct AtIndex {
12054 pub this: Box<Expression>,
12055 pub expression: Box<Expression>,
12056}
12057
12058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12060#[cfg_attr(feature = "bindings", derive(TS))]
12061pub struct FromTimeZone {
12062 pub this: Box<Expression>,
12063 #[serde(default)]
12064 pub zone: Option<Box<Expression>>,
12065}
12066
12067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12069#[cfg_attr(feature = "bindings", derive(TS))]
12070pub struct FormatPhrase {
12071 pub this: Box<Expression>,
12072 pub format: String,
12073}
12074
12075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12077#[cfg_attr(feature = "bindings", derive(TS))]
12078pub struct ForIn {
12079 pub this: Box<Expression>,
12080 pub expression: Box<Expression>,
12081}
12082
12083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12085#[cfg_attr(feature = "bindings", derive(TS))]
12086pub struct TimeUnit {
12087 #[serde(default)]
12088 pub unit: Option<String>,
12089}
12090
12091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12093#[cfg_attr(feature = "bindings", derive(TS))]
12094pub struct IntervalOp {
12095 #[serde(default)]
12096 pub unit: Option<String>,
12097 pub expression: Box<Expression>,
12098}
12099
12100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12102#[cfg_attr(feature = "bindings", derive(TS))]
12103pub struct HavingMax {
12104 pub this: Box<Expression>,
12105 pub expression: Box<Expression>,
12106 #[serde(default)]
12107 pub max: Option<Box<Expression>>,
12108}
12109
12110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12112#[cfg_attr(feature = "bindings", derive(TS))]
12113pub struct CosineDistance {
12114 pub this: Box<Expression>,
12115 pub expression: Box<Expression>,
12116}
12117
12118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12120#[cfg_attr(feature = "bindings", derive(TS))]
12121pub struct DotProduct {
12122 pub this: Box<Expression>,
12123 pub expression: Box<Expression>,
12124}
12125
12126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12128#[cfg_attr(feature = "bindings", derive(TS))]
12129pub struct EuclideanDistance {
12130 pub this: Box<Expression>,
12131 pub expression: Box<Expression>,
12132}
12133
12134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12136#[cfg_attr(feature = "bindings", derive(TS))]
12137pub struct ManhattanDistance {
12138 pub this: Box<Expression>,
12139 pub expression: Box<Expression>,
12140}
12141
12142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12144#[cfg_attr(feature = "bindings", derive(TS))]
12145pub struct JarowinklerSimilarity {
12146 pub this: Box<Expression>,
12147 pub expression: Box<Expression>,
12148}
12149
12150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12152#[cfg_attr(feature = "bindings", derive(TS))]
12153pub struct Booland {
12154 pub this: Box<Expression>,
12155 pub expression: Box<Expression>,
12156}
12157
12158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12160#[cfg_attr(feature = "bindings", derive(TS))]
12161pub struct Boolor {
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 ParameterizedAgg {
12170 pub this: Box<Expression>,
12171 #[serde(default)]
12172 pub expressions: Vec<Expression>,
12173 #[serde(default)]
12174 pub params: Vec<Expression>,
12175}
12176
12177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12179#[cfg_attr(feature = "bindings", derive(TS))]
12180pub struct ArgMax {
12181 pub this: Box<Expression>,
12182 pub expression: Box<Expression>,
12183 #[serde(default)]
12184 pub count: Option<Box<Expression>>,
12185}
12186
12187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12189#[cfg_attr(feature = "bindings", derive(TS))]
12190pub struct ArgMin {
12191 pub this: Box<Expression>,
12192 pub expression: Box<Expression>,
12193 #[serde(default)]
12194 pub count: Option<Box<Expression>>,
12195}
12196
12197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12199#[cfg_attr(feature = "bindings", derive(TS))]
12200pub struct ApproxTopK {
12201 pub this: Box<Expression>,
12202 #[serde(default)]
12203 pub expression: Option<Box<Expression>>,
12204 #[serde(default)]
12205 pub counters: Option<Box<Expression>>,
12206}
12207
12208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12210#[cfg_attr(feature = "bindings", derive(TS))]
12211pub struct ApproxTopKAccumulate {
12212 pub this: Box<Expression>,
12213 #[serde(default)]
12214 pub expression: Option<Box<Expression>>,
12215}
12216
12217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12219#[cfg_attr(feature = "bindings", derive(TS))]
12220pub struct ApproxTopKCombine {
12221 pub this: Box<Expression>,
12222 #[serde(default)]
12223 pub expression: Option<Box<Expression>>,
12224}
12225
12226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12228#[cfg_attr(feature = "bindings", derive(TS))]
12229pub struct ApproxTopKEstimate {
12230 pub this: Box<Expression>,
12231 #[serde(default)]
12232 pub expression: Option<Box<Expression>>,
12233}
12234
12235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12237#[cfg_attr(feature = "bindings", derive(TS))]
12238pub struct ApproxTopSum {
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 ApproxQuantiles {
12249 pub this: Box<Expression>,
12250 #[serde(default)]
12251 pub expression: Option<Box<Expression>>,
12252}
12253
12254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12256#[cfg_attr(feature = "bindings", derive(TS))]
12257pub struct Minhash {
12258 pub this: Box<Expression>,
12259 #[serde(default)]
12260 pub expressions: Vec<Expression>,
12261}
12262
12263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12265#[cfg_attr(feature = "bindings", derive(TS))]
12266pub struct FarmFingerprint {
12267 #[serde(default)]
12268 pub expressions: Vec<Expression>,
12269}
12270
12271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12273#[cfg_attr(feature = "bindings", derive(TS))]
12274pub struct Float64 {
12275 pub this: Box<Expression>,
12276 #[serde(default)]
12277 pub expression: Option<Box<Expression>>,
12278}
12279
12280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12282#[cfg_attr(feature = "bindings", derive(TS))]
12283pub struct Transform {
12284 pub this: Box<Expression>,
12285 pub expression: Box<Expression>,
12286}
12287
12288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12290#[cfg_attr(feature = "bindings", derive(TS))]
12291pub struct Translate {
12292 pub this: Box<Expression>,
12293 #[serde(default)]
12294 pub from_: Option<Box<Expression>>,
12295 #[serde(default)]
12296 pub to: Option<Box<Expression>>,
12297}
12298
12299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12301#[cfg_attr(feature = "bindings", derive(TS))]
12302pub struct Grouping {
12303 #[serde(default)]
12304 pub expressions: Vec<Expression>,
12305}
12306
12307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12309#[cfg_attr(feature = "bindings", derive(TS))]
12310pub struct GroupingId {
12311 #[serde(default)]
12312 pub expressions: Vec<Expression>,
12313}
12314
12315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12317#[cfg_attr(feature = "bindings", derive(TS))]
12318pub struct Anonymous {
12319 pub this: Box<Expression>,
12320 #[serde(default)]
12321 pub expressions: Vec<Expression>,
12322}
12323
12324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12326#[cfg_attr(feature = "bindings", derive(TS))]
12327pub struct AnonymousAggFunc {
12328 pub this: Box<Expression>,
12329 #[serde(default)]
12330 pub expressions: Vec<Expression>,
12331}
12332
12333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12335#[cfg_attr(feature = "bindings", derive(TS))]
12336pub struct CombinedAggFunc {
12337 pub this: Box<Expression>,
12338 #[serde(default)]
12339 pub expressions: Vec<Expression>,
12340}
12341
12342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12344#[cfg_attr(feature = "bindings", derive(TS))]
12345pub struct CombinedParameterizedAgg {
12346 pub this: Box<Expression>,
12347 #[serde(default)]
12348 pub expressions: Vec<Expression>,
12349 #[serde(default)]
12350 pub params: Vec<Expression>,
12351}
12352
12353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12355#[cfg_attr(feature = "bindings", derive(TS))]
12356pub struct HashAgg {
12357 pub this: Box<Expression>,
12358 #[serde(default)]
12359 pub expressions: Vec<Expression>,
12360}
12361
12362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12364#[cfg_attr(feature = "bindings", derive(TS))]
12365pub struct Hll {
12366 pub this: Box<Expression>,
12367 #[serde(default)]
12368 pub expressions: Vec<Expression>,
12369}
12370
12371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12373#[cfg_attr(feature = "bindings", derive(TS))]
12374pub struct Apply {
12375 pub this: Box<Expression>,
12376 pub expression: Box<Expression>,
12377}
12378
12379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12381#[cfg_attr(feature = "bindings", derive(TS))]
12382pub struct ToBoolean {
12383 pub this: Box<Expression>,
12384 #[serde(default)]
12385 pub safe: Option<Box<Expression>>,
12386}
12387
12388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12390#[cfg_attr(feature = "bindings", derive(TS))]
12391pub struct List {
12392 #[serde(default)]
12393 pub expressions: Vec<Expression>,
12394}
12395
12396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12401#[cfg_attr(feature = "bindings", derive(TS))]
12402pub struct ToMap {
12403 pub this: Box<Expression>,
12405}
12406
12407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12409#[cfg_attr(feature = "bindings", derive(TS))]
12410pub struct Pad {
12411 pub this: Box<Expression>,
12412 pub expression: Box<Expression>,
12413 #[serde(default)]
12414 pub fill_pattern: Option<Box<Expression>>,
12415 #[serde(default)]
12416 pub is_left: Option<Box<Expression>>,
12417}
12418
12419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12421#[cfg_attr(feature = "bindings", derive(TS))]
12422pub struct ToChar {
12423 pub this: Box<Expression>,
12424 #[serde(default)]
12425 pub format: Option<String>,
12426 #[serde(default)]
12427 pub nlsparam: Option<Box<Expression>>,
12428 #[serde(default)]
12429 pub is_numeric: Option<Box<Expression>>,
12430}
12431
12432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12434#[cfg_attr(feature = "bindings", derive(TS))]
12435pub struct StringFunc {
12436 pub this: Box<Expression>,
12437 #[serde(default)]
12438 pub zone: Option<Box<Expression>>,
12439}
12440
12441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12443#[cfg_attr(feature = "bindings", derive(TS))]
12444pub struct ToNumber {
12445 pub this: Box<Expression>,
12446 #[serde(default)]
12447 pub format: Option<Box<Expression>>,
12448 #[serde(default)]
12449 pub nlsparam: Option<Box<Expression>>,
12450 #[serde(default)]
12451 pub precision: Option<Box<Expression>>,
12452 #[serde(default)]
12453 pub scale: Option<Box<Expression>>,
12454 #[serde(default)]
12455 pub safe: Option<Box<Expression>>,
12456 #[serde(default)]
12457 pub safe_name: Option<Box<Expression>>,
12458}
12459
12460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12462#[cfg_attr(feature = "bindings", derive(TS))]
12463pub struct ToDouble {
12464 pub this: Box<Expression>,
12465 #[serde(default)]
12466 pub format: Option<String>,
12467 #[serde(default)]
12468 pub safe: Option<Box<Expression>>,
12469}
12470
12471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12473#[cfg_attr(feature = "bindings", derive(TS))]
12474pub struct ToDecfloat {
12475 pub this: Box<Expression>,
12476 #[serde(default)]
12477 pub format: Option<String>,
12478}
12479
12480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12482#[cfg_attr(feature = "bindings", derive(TS))]
12483pub struct TryToDecfloat {
12484 pub this: Box<Expression>,
12485 #[serde(default)]
12486 pub format: Option<String>,
12487}
12488
12489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12491#[cfg_attr(feature = "bindings", derive(TS))]
12492pub struct ToFile {
12493 pub this: Box<Expression>,
12494 #[serde(default)]
12495 pub path: Option<Box<Expression>>,
12496 #[serde(default)]
12497 pub safe: Option<Box<Expression>>,
12498}
12499
12500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12502#[cfg_attr(feature = "bindings", derive(TS))]
12503pub struct Columns {
12504 pub this: Box<Expression>,
12505 #[serde(default)]
12506 pub unpack: Option<Box<Expression>>,
12507}
12508
12509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12511#[cfg_attr(feature = "bindings", derive(TS))]
12512pub struct ConvertToCharset {
12513 pub this: Box<Expression>,
12514 #[serde(default)]
12515 pub dest: Option<Box<Expression>>,
12516 #[serde(default)]
12517 pub source: Option<Box<Expression>>,
12518}
12519
12520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12522#[cfg_attr(feature = "bindings", derive(TS))]
12523pub struct ConvertTimezone {
12524 #[serde(default)]
12525 pub source_tz: Option<Box<Expression>>,
12526 #[serde(default)]
12527 pub target_tz: Option<Box<Expression>>,
12528 #[serde(default)]
12529 pub timestamp: Option<Box<Expression>>,
12530 #[serde(default)]
12531 pub options: Vec<Expression>,
12532}
12533
12534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12536#[cfg_attr(feature = "bindings", derive(TS))]
12537pub struct GenerateSeries {
12538 #[serde(default)]
12539 pub start: Option<Box<Expression>>,
12540 #[serde(default)]
12541 pub end: Option<Box<Expression>>,
12542 #[serde(default)]
12543 pub step: Option<Box<Expression>>,
12544 #[serde(default)]
12545 pub is_end_exclusive: Option<Box<Expression>>,
12546}
12547
12548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12550#[cfg_attr(feature = "bindings", derive(TS))]
12551pub struct AIAgg {
12552 pub this: Box<Expression>,
12553 pub expression: Box<Expression>,
12554}
12555
12556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12558#[cfg_attr(feature = "bindings", derive(TS))]
12559pub struct AIClassify {
12560 pub this: Box<Expression>,
12561 #[serde(default)]
12562 pub categories: Option<Box<Expression>>,
12563 #[serde(default)]
12564 pub config: Option<Box<Expression>>,
12565}
12566
12567#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12569#[cfg_attr(feature = "bindings", derive(TS))]
12570pub struct ArrayAll {
12571 pub this: Box<Expression>,
12572 pub expression: Box<Expression>,
12573}
12574
12575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12577#[cfg_attr(feature = "bindings", derive(TS))]
12578pub struct ArrayAny {
12579 pub this: Box<Expression>,
12580 pub expression: Box<Expression>,
12581}
12582
12583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12585#[cfg_attr(feature = "bindings", derive(TS))]
12586pub struct ArrayConstructCompact {
12587 #[serde(default)]
12588 pub expressions: Vec<Expression>,
12589}
12590
12591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12593#[cfg_attr(feature = "bindings", derive(TS))]
12594pub struct StPoint {
12595 pub this: Box<Expression>,
12596 pub expression: Box<Expression>,
12597 #[serde(default)]
12598 pub null: Option<Box<Expression>>,
12599}
12600
12601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12603#[cfg_attr(feature = "bindings", derive(TS))]
12604pub struct StDistance {
12605 pub this: Box<Expression>,
12606 pub expression: Box<Expression>,
12607 #[serde(default)]
12608 pub use_spheroid: Option<Box<Expression>>,
12609}
12610
12611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12613#[cfg_attr(feature = "bindings", derive(TS))]
12614pub struct StringToArray {
12615 pub this: Box<Expression>,
12616 #[serde(default)]
12617 pub expression: Option<Box<Expression>>,
12618 #[serde(default)]
12619 pub null: Option<Box<Expression>>,
12620}
12621
12622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12624#[cfg_attr(feature = "bindings", derive(TS))]
12625pub struct ArraySum {
12626 pub this: Box<Expression>,
12627 #[serde(default)]
12628 pub expression: Option<Box<Expression>>,
12629}
12630
12631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12633#[cfg_attr(feature = "bindings", derive(TS))]
12634pub struct ObjectAgg {
12635 pub this: Box<Expression>,
12636 pub expression: Box<Expression>,
12637}
12638
12639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12641#[cfg_attr(feature = "bindings", derive(TS))]
12642pub struct CastToStrType {
12643 pub this: Box<Expression>,
12644 #[serde(default)]
12645 pub to: Option<Box<Expression>>,
12646}
12647
12648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12650#[cfg_attr(feature = "bindings", derive(TS))]
12651pub struct CheckJson {
12652 pub this: Box<Expression>,
12653}
12654
12655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12657#[cfg_attr(feature = "bindings", derive(TS))]
12658pub struct CheckXml {
12659 pub this: Box<Expression>,
12660 #[serde(default)]
12661 pub disable_auto_convert: Option<Box<Expression>>,
12662}
12663
12664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12666#[cfg_attr(feature = "bindings", derive(TS))]
12667pub struct TranslateCharacters {
12668 pub this: Box<Expression>,
12669 pub expression: Box<Expression>,
12670 #[serde(default)]
12671 pub with_error: Option<Box<Expression>>,
12672}
12673
12674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12676#[cfg_attr(feature = "bindings", derive(TS))]
12677pub struct CurrentSchemas {
12678 #[serde(default)]
12679 pub this: Option<Box<Expression>>,
12680}
12681
12682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12684#[cfg_attr(feature = "bindings", derive(TS))]
12685pub struct CurrentDatetime {
12686 #[serde(default)]
12687 pub this: Option<Box<Expression>>,
12688}
12689
12690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12692#[cfg_attr(feature = "bindings", derive(TS))]
12693pub struct Localtime {
12694 #[serde(default)]
12695 pub this: Option<Box<Expression>>,
12696}
12697
12698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12700#[cfg_attr(feature = "bindings", derive(TS))]
12701pub struct Localtimestamp {
12702 #[serde(default)]
12703 pub this: Option<Box<Expression>>,
12704}
12705
12706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12708#[cfg_attr(feature = "bindings", derive(TS))]
12709pub struct Systimestamp {
12710 #[serde(default)]
12711 pub this: Option<Box<Expression>>,
12712}
12713
12714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12716#[cfg_attr(feature = "bindings", derive(TS))]
12717pub struct CurrentSchema {
12718 #[serde(default)]
12719 pub this: Option<Box<Expression>>,
12720}
12721
12722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12724#[cfg_attr(feature = "bindings", derive(TS))]
12725pub struct CurrentUser {
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 SessionUser;
12734
12735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12737#[cfg_attr(feature = "bindings", derive(TS))]
12738pub struct JSONPathRoot;
12739
12740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12742#[cfg_attr(feature = "bindings", derive(TS))]
12743pub struct UtcTime {
12744 #[serde(default)]
12745 pub this: Option<Box<Expression>>,
12746}
12747
12748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12750#[cfg_attr(feature = "bindings", derive(TS))]
12751pub struct UtcTimestamp {
12752 #[serde(default)]
12753 pub this: Option<Box<Expression>>,
12754}
12755
12756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12758#[cfg_attr(feature = "bindings", derive(TS))]
12759pub struct TimestampFunc {
12760 #[serde(default)]
12761 pub this: Option<Box<Expression>>,
12762 #[serde(default)]
12763 pub zone: Option<Box<Expression>>,
12764 #[serde(default)]
12765 pub with_tz: Option<bool>,
12766 #[serde(default)]
12767 pub safe: Option<bool>,
12768}
12769
12770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12772#[cfg_attr(feature = "bindings", derive(TS))]
12773pub struct DateBin {
12774 pub this: Box<Expression>,
12775 pub expression: Box<Expression>,
12776 #[serde(default)]
12777 pub unit: Option<String>,
12778 #[serde(default)]
12779 pub zone: Option<Box<Expression>>,
12780 #[serde(default)]
12781 pub origin: Option<Box<Expression>>,
12782}
12783
12784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12786#[cfg_attr(feature = "bindings", derive(TS))]
12787pub struct Datetime {
12788 pub this: Box<Expression>,
12789 #[serde(default)]
12790 pub expression: Option<Box<Expression>>,
12791}
12792
12793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12795#[cfg_attr(feature = "bindings", derive(TS))]
12796pub struct DatetimeAdd {
12797 pub this: Box<Expression>,
12798 pub expression: Box<Expression>,
12799 #[serde(default)]
12800 pub unit: Option<String>,
12801}
12802
12803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12805#[cfg_attr(feature = "bindings", derive(TS))]
12806pub struct DatetimeSub {
12807 pub this: Box<Expression>,
12808 pub expression: Box<Expression>,
12809 #[serde(default)]
12810 pub unit: Option<String>,
12811}
12812
12813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12815#[cfg_attr(feature = "bindings", derive(TS))]
12816pub struct DatetimeDiff {
12817 pub this: Box<Expression>,
12818 pub expression: Box<Expression>,
12819 #[serde(default)]
12820 pub unit: Option<String>,
12821}
12822
12823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12825#[cfg_attr(feature = "bindings", derive(TS))]
12826pub struct DatetimeTrunc {
12827 pub this: Box<Expression>,
12828 pub unit: String,
12829 #[serde(default)]
12830 pub zone: Option<Box<Expression>>,
12831}
12832
12833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12835#[cfg_attr(feature = "bindings", derive(TS))]
12836pub struct Dayname {
12837 pub this: Box<Expression>,
12838 #[serde(default)]
12839 pub abbreviated: Option<Box<Expression>>,
12840}
12841
12842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12844#[cfg_attr(feature = "bindings", derive(TS))]
12845pub struct MakeInterval {
12846 #[serde(default)]
12847 pub year: Option<Box<Expression>>,
12848 #[serde(default)]
12849 pub month: Option<Box<Expression>>,
12850 #[serde(default)]
12851 pub week: Option<Box<Expression>>,
12852 #[serde(default)]
12853 pub day: Option<Box<Expression>>,
12854 #[serde(default)]
12855 pub hour: Option<Box<Expression>>,
12856 #[serde(default)]
12857 pub minute: Option<Box<Expression>>,
12858 #[serde(default)]
12859 pub second: Option<Box<Expression>>,
12860}
12861
12862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12864#[cfg_attr(feature = "bindings", derive(TS))]
12865pub struct PreviousDay {
12866 pub this: Box<Expression>,
12867 pub expression: Box<Expression>,
12868}
12869
12870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12872#[cfg_attr(feature = "bindings", derive(TS))]
12873pub struct Elt {
12874 pub this: Box<Expression>,
12875 #[serde(default)]
12876 pub expressions: Vec<Expression>,
12877}
12878
12879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12881#[cfg_attr(feature = "bindings", derive(TS))]
12882pub struct TimestampAdd {
12883 pub this: Box<Expression>,
12884 pub expression: Box<Expression>,
12885 #[serde(default)]
12886 pub unit: Option<String>,
12887}
12888
12889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12891#[cfg_attr(feature = "bindings", derive(TS))]
12892pub struct TimestampSub {
12893 pub this: Box<Expression>,
12894 pub expression: Box<Expression>,
12895 #[serde(default)]
12896 pub unit: Option<String>,
12897}
12898
12899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12901#[cfg_attr(feature = "bindings", derive(TS))]
12902pub struct TimestampDiff {
12903 pub this: Box<Expression>,
12904 pub expression: Box<Expression>,
12905 #[serde(default)]
12906 pub unit: Option<String>,
12907}
12908
12909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12911#[cfg_attr(feature = "bindings", derive(TS))]
12912pub struct TimeSlice {
12913 pub this: Box<Expression>,
12914 pub expression: Box<Expression>,
12915 pub unit: String,
12916 #[serde(default)]
12917 pub kind: Option<String>,
12918}
12919
12920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12922#[cfg_attr(feature = "bindings", derive(TS))]
12923pub struct TimeAdd {
12924 pub this: Box<Expression>,
12925 pub expression: Box<Expression>,
12926 #[serde(default)]
12927 pub unit: Option<String>,
12928}
12929
12930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12932#[cfg_attr(feature = "bindings", derive(TS))]
12933pub struct TimeSub {
12934 pub this: Box<Expression>,
12935 pub expression: Box<Expression>,
12936 #[serde(default)]
12937 pub unit: Option<String>,
12938}
12939
12940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12942#[cfg_attr(feature = "bindings", derive(TS))]
12943pub struct TimeDiff {
12944 pub this: Box<Expression>,
12945 pub expression: Box<Expression>,
12946 #[serde(default)]
12947 pub unit: Option<String>,
12948}
12949
12950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12952#[cfg_attr(feature = "bindings", derive(TS))]
12953pub struct TimeTrunc {
12954 pub this: Box<Expression>,
12955 pub unit: String,
12956 #[serde(default)]
12957 pub zone: Option<Box<Expression>>,
12958}
12959
12960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12962#[cfg_attr(feature = "bindings", derive(TS))]
12963pub struct DateFromParts {
12964 #[serde(default)]
12965 pub year: Option<Box<Expression>>,
12966 #[serde(default)]
12967 pub month: Option<Box<Expression>>,
12968 #[serde(default)]
12969 pub day: Option<Box<Expression>>,
12970 #[serde(default)]
12971 pub allow_overflow: Option<Box<Expression>>,
12972}
12973
12974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12976#[cfg_attr(feature = "bindings", derive(TS))]
12977pub struct TimeFromParts {
12978 #[serde(default)]
12979 pub hour: Option<Box<Expression>>,
12980 #[serde(default)]
12981 pub min: Option<Box<Expression>>,
12982 #[serde(default)]
12983 pub sec: Option<Box<Expression>>,
12984 #[serde(default)]
12985 pub nano: Option<Box<Expression>>,
12986 #[serde(default)]
12987 pub fractions: Option<Box<Expression>>,
12988 #[serde(default)]
12989 pub precision: Option<i64>,
12990}
12991
12992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12994#[cfg_attr(feature = "bindings", derive(TS))]
12995pub struct DecodeCase {
12996 #[serde(default)]
12997 pub expressions: Vec<Expression>,
12998}
12999
13000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13002#[cfg_attr(feature = "bindings", derive(TS))]
13003pub struct Decrypt {
13004 pub this: Box<Expression>,
13005 #[serde(default)]
13006 pub passphrase: Option<Box<Expression>>,
13007 #[serde(default)]
13008 pub aad: Option<Box<Expression>>,
13009 #[serde(default)]
13010 pub encryption_method: Option<Box<Expression>>,
13011 #[serde(default)]
13012 pub safe: Option<Box<Expression>>,
13013}
13014
13015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13017#[cfg_attr(feature = "bindings", derive(TS))]
13018pub struct DecryptRaw {
13019 pub this: Box<Expression>,
13020 #[serde(default)]
13021 pub key: Option<Box<Expression>>,
13022 #[serde(default)]
13023 pub iv: Option<Box<Expression>>,
13024 #[serde(default)]
13025 pub aad: Option<Box<Expression>>,
13026 #[serde(default)]
13027 pub encryption_method: Option<Box<Expression>>,
13028 #[serde(default)]
13029 pub aead: Option<Box<Expression>>,
13030 #[serde(default)]
13031 pub safe: Option<Box<Expression>>,
13032}
13033
13034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13036#[cfg_attr(feature = "bindings", derive(TS))]
13037pub struct Encode {
13038 pub this: Box<Expression>,
13039 #[serde(default)]
13040 pub charset: Option<Box<Expression>>,
13041}
13042
13043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13045#[cfg_attr(feature = "bindings", derive(TS))]
13046pub struct Encrypt {
13047 pub this: Box<Expression>,
13048 #[serde(default)]
13049 pub passphrase: Option<Box<Expression>>,
13050 #[serde(default)]
13051 pub aad: Option<Box<Expression>>,
13052 #[serde(default)]
13053 pub encryption_method: Option<Box<Expression>>,
13054}
13055
13056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13058#[cfg_attr(feature = "bindings", derive(TS))]
13059pub struct EncryptRaw {
13060 pub this: Box<Expression>,
13061 #[serde(default)]
13062 pub key: Option<Box<Expression>>,
13063 #[serde(default)]
13064 pub iv: Option<Box<Expression>>,
13065 #[serde(default)]
13066 pub aad: Option<Box<Expression>>,
13067 #[serde(default)]
13068 pub encryption_method: Option<Box<Expression>>,
13069}
13070
13071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13073#[cfg_attr(feature = "bindings", derive(TS))]
13074pub struct EqualNull {
13075 pub this: Box<Expression>,
13076 pub expression: Box<Expression>,
13077}
13078
13079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13081#[cfg_attr(feature = "bindings", derive(TS))]
13082pub struct ToBinary {
13083 pub this: Box<Expression>,
13084 #[serde(default)]
13085 pub format: Option<String>,
13086 #[serde(default)]
13087 pub safe: Option<Box<Expression>>,
13088}
13089
13090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13092#[cfg_attr(feature = "bindings", derive(TS))]
13093pub struct Base64DecodeBinary {
13094 pub this: Box<Expression>,
13095 #[serde(default)]
13096 pub alphabet: Option<Box<Expression>>,
13097}
13098
13099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13101#[cfg_attr(feature = "bindings", derive(TS))]
13102pub struct Base64DecodeString {
13103 pub this: Box<Expression>,
13104 #[serde(default)]
13105 pub alphabet: Option<Box<Expression>>,
13106}
13107
13108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13110#[cfg_attr(feature = "bindings", derive(TS))]
13111pub struct Base64Encode {
13112 pub this: Box<Expression>,
13113 #[serde(default)]
13114 pub max_line_length: Option<Box<Expression>>,
13115 #[serde(default)]
13116 pub alphabet: Option<Box<Expression>>,
13117}
13118
13119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13121#[cfg_attr(feature = "bindings", derive(TS))]
13122pub struct TryBase64DecodeBinary {
13123 pub this: Box<Expression>,
13124 #[serde(default)]
13125 pub alphabet: Option<Box<Expression>>,
13126}
13127
13128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13130#[cfg_attr(feature = "bindings", derive(TS))]
13131pub struct TryBase64DecodeString {
13132 pub this: Box<Expression>,
13133 #[serde(default)]
13134 pub alphabet: Option<Box<Expression>>,
13135}
13136
13137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13139#[cfg_attr(feature = "bindings", derive(TS))]
13140pub struct GapFill {
13141 pub this: Box<Expression>,
13142 #[serde(default)]
13143 pub ts_column: Option<Box<Expression>>,
13144 #[serde(default)]
13145 pub bucket_width: Option<Box<Expression>>,
13146 #[serde(default)]
13147 pub partitioning_columns: Option<Box<Expression>>,
13148 #[serde(default)]
13149 pub value_columns: Option<Box<Expression>>,
13150 #[serde(default)]
13151 pub origin: Option<Box<Expression>>,
13152 #[serde(default)]
13153 pub ignore_nulls: Option<Box<Expression>>,
13154}
13155
13156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13158#[cfg_attr(feature = "bindings", derive(TS))]
13159pub struct GenerateDateArray {
13160 #[serde(default)]
13161 pub start: Option<Box<Expression>>,
13162 #[serde(default)]
13163 pub end: Option<Box<Expression>>,
13164 #[serde(default)]
13165 pub step: Option<Box<Expression>>,
13166}
13167
13168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13170#[cfg_attr(feature = "bindings", derive(TS))]
13171pub struct GenerateTimestampArray {
13172 #[serde(default)]
13173 pub start: Option<Box<Expression>>,
13174 #[serde(default)]
13175 pub end: Option<Box<Expression>>,
13176 #[serde(default)]
13177 pub step: Option<Box<Expression>>,
13178}
13179
13180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13182#[cfg_attr(feature = "bindings", derive(TS))]
13183pub struct GetExtract {
13184 pub this: Box<Expression>,
13185 pub expression: Box<Expression>,
13186}
13187
13188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13190#[cfg_attr(feature = "bindings", derive(TS))]
13191pub struct Getbit {
13192 pub this: Box<Expression>,
13193 pub expression: Box<Expression>,
13194 #[serde(default)]
13195 pub zero_is_msb: Option<Box<Expression>>,
13196}
13197
13198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13200#[cfg_attr(feature = "bindings", derive(TS))]
13201pub struct OverflowTruncateBehavior {
13202 #[serde(default)]
13203 pub this: Option<Box<Expression>>,
13204 #[serde(default)]
13205 pub with_count: Option<Box<Expression>>,
13206}
13207
13208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13210#[cfg_attr(feature = "bindings", derive(TS))]
13211pub struct HexEncode {
13212 pub this: Box<Expression>,
13213 #[serde(default)]
13214 pub case: Option<Box<Expression>>,
13215}
13216
13217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13219#[cfg_attr(feature = "bindings", derive(TS))]
13220pub struct Compress {
13221 pub this: Box<Expression>,
13222 #[serde(default)]
13223 pub method: Option<String>,
13224}
13225
13226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13228#[cfg_attr(feature = "bindings", derive(TS))]
13229pub struct DecompressBinary {
13230 pub this: Box<Expression>,
13231 pub method: String,
13232}
13233
13234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13236#[cfg_attr(feature = "bindings", derive(TS))]
13237pub struct DecompressString {
13238 pub this: Box<Expression>,
13239 pub method: String,
13240}
13241
13242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13244#[cfg_attr(feature = "bindings", derive(TS))]
13245pub struct Xor {
13246 #[serde(default)]
13247 pub this: Option<Box<Expression>>,
13248 #[serde(default)]
13249 pub expression: Option<Box<Expression>>,
13250 #[serde(default)]
13251 pub expressions: Vec<Expression>,
13252}
13253
13254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13256#[cfg_attr(feature = "bindings", derive(TS))]
13257pub struct Nullif {
13258 pub this: Box<Expression>,
13259 pub expression: Box<Expression>,
13260}
13261
13262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13264#[cfg_attr(feature = "bindings", derive(TS))]
13265pub struct JSON {
13266 #[serde(default)]
13267 pub this: Option<Box<Expression>>,
13268 #[serde(default)]
13269 pub with_: Option<Box<Expression>>,
13270 #[serde(default)]
13271 pub unique: bool,
13272}
13273
13274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13276#[cfg_attr(feature = "bindings", derive(TS))]
13277pub struct JSONPath {
13278 #[serde(default)]
13279 pub expressions: Vec<Expression>,
13280 #[serde(default)]
13281 pub escape: Option<Box<Expression>>,
13282}
13283
13284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13286#[cfg_attr(feature = "bindings", derive(TS))]
13287pub struct JSONPathFilter {
13288 pub this: Box<Expression>,
13289}
13290
13291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13293#[cfg_attr(feature = "bindings", derive(TS))]
13294pub struct JSONPathKey {
13295 pub this: Box<Expression>,
13296}
13297
13298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13300#[cfg_attr(feature = "bindings", derive(TS))]
13301pub struct JSONPathRecursive {
13302 #[serde(default)]
13303 pub this: Option<Box<Expression>>,
13304}
13305
13306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13308#[cfg_attr(feature = "bindings", derive(TS))]
13309pub struct JSONPathScript {
13310 pub this: Box<Expression>,
13311}
13312
13313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13315#[cfg_attr(feature = "bindings", derive(TS))]
13316pub struct JSONPathSlice {
13317 #[serde(default)]
13318 pub start: Option<Box<Expression>>,
13319 #[serde(default)]
13320 pub end: Option<Box<Expression>>,
13321 #[serde(default)]
13322 pub step: Option<Box<Expression>>,
13323}
13324
13325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13327#[cfg_attr(feature = "bindings", derive(TS))]
13328pub struct JSONPathSelector {
13329 pub this: Box<Expression>,
13330}
13331
13332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13334#[cfg_attr(feature = "bindings", derive(TS))]
13335pub struct JSONPathSubscript {
13336 pub this: Box<Expression>,
13337}
13338
13339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13341#[cfg_attr(feature = "bindings", derive(TS))]
13342pub struct JSONPathUnion {
13343 #[serde(default)]
13344 pub expressions: Vec<Expression>,
13345}
13346
13347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13349#[cfg_attr(feature = "bindings", derive(TS))]
13350pub struct Format {
13351 pub this: Box<Expression>,
13352 #[serde(default)]
13353 pub expressions: Vec<Expression>,
13354}
13355
13356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13358#[cfg_attr(feature = "bindings", derive(TS))]
13359pub struct JSONKeys {
13360 pub this: Box<Expression>,
13361 #[serde(default)]
13362 pub expression: Option<Box<Expression>>,
13363 #[serde(default)]
13364 pub expressions: Vec<Expression>,
13365}
13366
13367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13369#[cfg_attr(feature = "bindings", derive(TS))]
13370pub struct JSONKeyValue {
13371 pub this: Box<Expression>,
13372 pub expression: Box<Expression>,
13373}
13374
13375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13377#[cfg_attr(feature = "bindings", derive(TS))]
13378pub struct JSONKeysAtDepth {
13379 pub this: Box<Expression>,
13380 #[serde(default)]
13381 pub expression: Option<Box<Expression>>,
13382 #[serde(default)]
13383 pub mode: Option<Box<Expression>>,
13384}
13385
13386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13388#[cfg_attr(feature = "bindings", derive(TS))]
13389pub struct JSONObject {
13390 #[serde(default)]
13391 pub expressions: Vec<Expression>,
13392 #[serde(default)]
13393 pub null_handling: Option<Box<Expression>>,
13394 #[serde(default)]
13395 pub unique_keys: Option<Box<Expression>>,
13396 #[serde(default)]
13397 pub return_type: Option<Box<Expression>>,
13398 #[serde(default)]
13399 pub encoding: Option<Box<Expression>>,
13400}
13401
13402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13404#[cfg_attr(feature = "bindings", derive(TS))]
13405pub struct JSONObjectAgg {
13406 #[serde(default)]
13407 pub expressions: Vec<Expression>,
13408 #[serde(default)]
13409 pub null_handling: Option<Box<Expression>>,
13410 #[serde(default)]
13411 pub unique_keys: Option<Box<Expression>>,
13412 #[serde(default)]
13413 pub return_type: Option<Box<Expression>>,
13414 #[serde(default)]
13415 pub encoding: Option<Box<Expression>>,
13416}
13417
13418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13420#[cfg_attr(feature = "bindings", derive(TS))]
13421pub struct JSONBObjectAgg {
13422 pub this: Box<Expression>,
13423 pub expression: Box<Expression>,
13424}
13425
13426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13428#[cfg_attr(feature = "bindings", derive(TS))]
13429pub struct JSONArray {
13430 #[serde(default)]
13431 pub expressions: Vec<Expression>,
13432 #[serde(default)]
13433 pub null_handling: Option<Box<Expression>>,
13434 #[serde(default)]
13435 pub return_type: Option<Box<Expression>>,
13436 #[serde(default)]
13437 pub strict: Option<Box<Expression>>,
13438}
13439
13440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13442#[cfg_attr(feature = "bindings", derive(TS))]
13443pub struct JSONArrayAgg {
13444 pub this: Box<Expression>,
13445 #[serde(default)]
13446 pub order: Option<Box<Expression>>,
13447 #[serde(default)]
13448 pub null_handling: Option<Box<Expression>>,
13449 #[serde(default)]
13450 pub return_type: Option<Box<Expression>>,
13451 #[serde(default)]
13452 pub strict: Option<Box<Expression>>,
13453}
13454
13455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13457#[cfg_attr(feature = "bindings", derive(TS))]
13458pub struct JSONExists {
13459 pub this: Box<Expression>,
13460 #[serde(default)]
13461 pub path: Option<Box<Expression>>,
13462 #[serde(default)]
13463 pub passing: Option<Box<Expression>>,
13464 #[serde(default)]
13465 pub on_condition: Option<Box<Expression>>,
13466 #[serde(default)]
13467 pub from_dcolonqmark: Option<Box<Expression>>,
13468}
13469
13470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13472#[cfg_attr(feature = "bindings", derive(TS))]
13473pub struct JSONColumnDef {
13474 #[serde(default)]
13475 pub this: Option<Box<Expression>>,
13476 #[serde(default)]
13477 pub kind: Option<String>,
13478 #[serde(default)]
13479 pub path: Option<Box<Expression>>,
13480 #[serde(default)]
13481 pub nested_schema: Option<Box<Expression>>,
13482 #[serde(default)]
13483 pub ordinality: Option<Box<Expression>>,
13484}
13485
13486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13488#[cfg_attr(feature = "bindings", derive(TS))]
13489pub struct JSONSchema {
13490 #[serde(default)]
13491 pub expressions: Vec<Expression>,
13492}
13493
13494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13496#[cfg_attr(feature = "bindings", derive(TS))]
13497pub struct JSONSet {
13498 pub this: Box<Expression>,
13499 #[serde(default)]
13500 pub expressions: Vec<Expression>,
13501}
13502
13503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13505#[cfg_attr(feature = "bindings", derive(TS))]
13506pub struct JSONStripNulls {
13507 pub this: Box<Expression>,
13508 #[serde(default)]
13509 pub expression: Option<Box<Expression>>,
13510 #[serde(default)]
13511 pub include_arrays: Option<Box<Expression>>,
13512 #[serde(default)]
13513 pub remove_empty: Option<Box<Expression>>,
13514}
13515
13516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13518#[cfg_attr(feature = "bindings", derive(TS))]
13519pub struct JSONValue {
13520 pub this: Box<Expression>,
13521 #[serde(default)]
13522 pub path: Option<Box<Expression>>,
13523 #[serde(default)]
13524 pub returning: Option<Box<Expression>>,
13525 #[serde(default)]
13526 pub on_condition: Option<Box<Expression>>,
13527}
13528
13529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13531#[cfg_attr(feature = "bindings", derive(TS))]
13532pub struct JSONValueArray {
13533 pub this: Box<Expression>,
13534 #[serde(default)]
13535 pub expression: Option<Box<Expression>>,
13536}
13537
13538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13540#[cfg_attr(feature = "bindings", derive(TS))]
13541pub struct JSONRemove {
13542 pub this: Box<Expression>,
13543 #[serde(default)]
13544 pub expressions: Vec<Expression>,
13545}
13546
13547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13549#[cfg_attr(feature = "bindings", derive(TS))]
13550pub struct JSONTable {
13551 pub this: Box<Expression>,
13552 #[serde(default)]
13553 pub schema: Option<Box<Expression>>,
13554 #[serde(default)]
13555 pub path: Option<Box<Expression>>,
13556 #[serde(default)]
13557 pub error_handling: Option<Box<Expression>>,
13558 #[serde(default)]
13559 pub empty_handling: Option<Box<Expression>>,
13560}
13561
13562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13564#[cfg_attr(feature = "bindings", derive(TS))]
13565pub struct JSONType {
13566 pub this: Box<Expression>,
13567 #[serde(default)]
13568 pub expression: Option<Box<Expression>>,
13569}
13570
13571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13573#[cfg_attr(feature = "bindings", derive(TS))]
13574pub struct ObjectInsert {
13575 pub this: Box<Expression>,
13576 #[serde(default)]
13577 pub key: Option<Box<Expression>>,
13578 #[serde(default)]
13579 pub value: Option<Box<Expression>>,
13580 #[serde(default)]
13581 pub update_flag: Option<Box<Expression>>,
13582}
13583
13584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13586#[cfg_attr(feature = "bindings", derive(TS))]
13587pub struct OpenJSONColumnDef {
13588 pub this: Box<Expression>,
13589 pub kind: String,
13590 #[serde(default)]
13591 pub path: Option<Box<Expression>>,
13592 #[serde(default)]
13593 pub as_json: Option<Box<Expression>>,
13594 #[serde(default, skip_serializing_if = "Option::is_none")]
13596 pub data_type: Option<DataType>,
13597}
13598
13599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13601#[cfg_attr(feature = "bindings", derive(TS))]
13602pub struct OpenJSON {
13603 pub this: Box<Expression>,
13604 #[serde(default)]
13605 pub path: Option<Box<Expression>>,
13606 #[serde(default)]
13607 pub expressions: Vec<Expression>,
13608}
13609
13610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13612#[cfg_attr(feature = "bindings", derive(TS))]
13613pub struct JSONBExists {
13614 pub this: Box<Expression>,
13615 #[serde(default)]
13616 pub path: Option<Box<Expression>>,
13617}
13618
13619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13621#[cfg_attr(feature = "bindings", derive(TS))]
13622pub struct JSONCast {
13623 pub this: Box<Expression>,
13624 pub to: DataType,
13625}
13626
13627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13629#[cfg_attr(feature = "bindings", derive(TS))]
13630pub struct JSONExtract {
13631 pub this: Box<Expression>,
13632 pub expression: Box<Expression>,
13633 #[serde(default)]
13634 pub only_json_types: Option<Box<Expression>>,
13635 #[serde(default)]
13636 pub expressions: Vec<Expression>,
13637 #[serde(default)]
13638 pub variant_extract: Option<Box<Expression>>,
13639 #[serde(default)]
13640 pub json_query: Option<Box<Expression>>,
13641 #[serde(default)]
13642 pub option: Option<Box<Expression>>,
13643 #[serde(default)]
13644 pub quote: Option<Box<Expression>>,
13645 #[serde(default)]
13646 pub on_condition: Option<Box<Expression>>,
13647 #[serde(default)]
13648 pub requires_json: Option<Box<Expression>>,
13649}
13650
13651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13653#[cfg_attr(feature = "bindings", derive(TS))]
13654pub struct JSONExtractQuote {
13655 #[serde(default)]
13656 pub option: Option<Box<Expression>>,
13657 #[serde(default)]
13658 pub scalar: Option<Box<Expression>>,
13659}
13660
13661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13663#[cfg_attr(feature = "bindings", derive(TS))]
13664pub struct JSONExtractArray {
13665 pub this: Box<Expression>,
13666 #[serde(default)]
13667 pub expression: Option<Box<Expression>>,
13668}
13669
13670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13672#[cfg_attr(feature = "bindings", derive(TS))]
13673pub struct JSONExtractScalar {
13674 pub this: Box<Expression>,
13675 pub expression: Box<Expression>,
13676 #[serde(default)]
13677 pub only_json_types: Option<Box<Expression>>,
13678 #[serde(default)]
13679 pub expressions: Vec<Expression>,
13680 #[serde(default)]
13681 pub json_type: Option<Box<Expression>>,
13682 #[serde(default)]
13683 pub scalar_only: Option<Box<Expression>>,
13684}
13685
13686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13688#[cfg_attr(feature = "bindings", derive(TS))]
13689pub struct JSONBExtractScalar {
13690 pub this: Box<Expression>,
13691 pub expression: Box<Expression>,
13692 #[serde(default)]
13693 pub json_type: Option<Box<Expression>>,
13694}
13695
13696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13698#[cfg_attr(feature = "bindings", derive(TS))]
13699pub struct JSONFormat {
13700 #[serde(default)]
13701 pub this: Option<Box<Expression>>,
13702 #[serde(default)]
13703 pub options: Vec<Expression>,
13704 #[serde(default)]
13705 pub is_json: Option<Box<Expression>>,
13706 #[serde(default)]
13707 pub to_json: Option<Box<Expression>>,
13708}
13709
13710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13712#[cfg_attr(feature = "bindings", derive(TS))]
13713pub struct JSONArrayAppend {
13714 pub this: Box<Expression>,
13715 #[serde(default)]
13716 pub expressions: Vec<Expression>,
13717}
13718
13719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13721#[cfg_attr(feature = "bindings", derive(TS))]
13722pub struct JSONArrayContains {
13723 pub this: Box<Expression>,
13724 pub expression: Box<Expression>,
13725 #[serde(default)]
13726 pub json_type: Option<Box<Expression>>,
13727}
13728
13729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13731#[cfg_attr(feature = "bindings", derive(TS))]
13732pub struct JSONArrayInsert {
13733 pub this: Box<Expression>,
13734 #[serde(default)]
13735 pub expressions: Vec<Expression>,
13736}
13737
13738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13740#[cfg_attr(feature = "bindings", derive(TS))]
13741pub struct ParseJSON {
13742 pub this: Box<Expression>,
13743 #[serde(default)]
13744 pub expression: Option<Box<Expression>>,
13745 #[serde(default)]
13746 pub safe: Option<Box<Expression>>,
13747}
13748
13749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13751#[cfg_attr(feature = "bindings", derive(TS))]
13752pub struct ParseUrl {
13753 pub this: Box<Expression>,
13754 #[serde(default)]
13755 pub part_to_extract: Option<Box<Expression>>,
13756 #[serde(default)]
13757 pub key: Option<Box<Expression>>,
13758 #[serde(default)]
13759 pub permissive: Option<Box<Expression>>,
13760}
13761
13762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13764#[cfg_attr(feature = "bindings", derive(TS))]
13765pub struct ParseIp {
13766 pub this: Box<Expression>,
13767 #[serde(default)]
13768 pub type_: Option<Box<Expression>>,
13769 #[serde(default)]
13770 pub permissive: Option<Box<Expression>>,
13771}
13772
13773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13775#[cfg_attr(feature = "bindings", derive(TS))]
13776pub struct ParseTime {
13777 pub this: Box<Expression>,
13778 pub format: String,
13779}
13780
13781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13783#[cfg_attr(feature = "bindings", derive(TS))]
13784pub struct ParseDatetime {
13785 pub this: Box<Expression>,
13786 #[serde(default)]
13787 pub format: Option<String>,
13788 #[serde(default)]
13789 pub zone: Option<Box<Expression>>,
13790}
13791
13792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13794#[cfg_attr(feature = "bindings", derive(TS))]
13795pub struct Map {
13796 #[serde(default)]
13797 pub keys: Vec<Expression>,
13798 #[serde(default)]
13799 pub values: Vec<Expression>,
13800}
13801
13802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13804#[cfg_attr(feature = "bindings", derive(TS))]
13805pub struct MapCat {
13806 pub this: Box<Expression>,
13807 pub expression: Box<Expression>,
13808}
13809
13810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13812#[cfg_attr(feature = "bindings", derive(TS))]
13813pub struct MapDelete {
13814 pub this: Box<Expression>,
13815 #[serde(default)]
13816 pub expressions: Vec<Expression>,
13817}
13818
13819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13821#[cfg_attr(feature = "bindings", derive(TS))]
13822pub struct MapInsert {
13823 pub this: Box<Expression>,
13824 #[serde(default)]
13825 pub key: Option<Box<Expression>>,
13826 #[serde(default)]
13827 pub value: Option<Box<Expression>>,
13828 #[serde(default)]
13829 pub update_flag: Option<Box<Expression>>,
13830}
13831
13832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13834#[cfg_attr(feature = "bindings", derive(TS))]
13835pub struct MapPick {
13836 pub this: Box<Expression>,
13837 #[serde(default)]
13838 pub expressions: Vec<Expression>,
13839}
13840
13841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13843#[cfg_attr(feature = "bindings", derive(TS))]
13844pub struct ScopeResolution {
13845 #[serde(default)]
13846 pub this: Option<Box<Expression>>,
13847 pub expression: Box<Expression>,
13848}
13849
13850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13852#[cfg_attr(feature = "bindings", derive(TS))]
13853pub struct Slice {
13854 #[serde(default)]
13855 pub this: Option<Box<Expression>>,
13856 #[serde(default)]
13857 pub expression: Option<Box<Expression>>,
13858 #[serde(default)]
13859 pub step: Option<Box<Expression>>,
13860}
13861
13862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13864#[cfg_attr(feature = "bindings", derive(TS))]
13865pub struct VarMap {
13866 #[serde(default)]
13867 pub keys: Vec<Expression>,
13868 #[serde(default)]
13869 pub values: Vec<Expression>,
13870}
13871
13872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13874#[cfg_attr(feature = "bindings", derive(TS))]
13875pub struct MatchAgainst {
13876 pub this: Box<Expression>,
13877 #[serde(default)]
13878 pub expressions: Vec<Expression>,
13879 #[serde(default)]
13880 pub modifier: Option<Box<Expression>>,
13881}
13882
13883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13885#[cfg_attr(feature = "bindings", derive(TS))]
13886pub struct MD5Digest {
13887 pub this: Box<Expression>,
13888 #[serde(default)]
13889 pub expressions: Vec<Expression>,
13890}
13891
13892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13894#[cfg_attr(feature = "bindings", derive(TS))]
13895pub struct Monthname {
13896 pub this: Box<Expression>,
13897 #[serde(default)]
13898 pub abbreviated: Option<Box<Expression>>,
13899}
13900
13901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13903#[cfg_attr(feature = "bindings", derive(TS))]
13904pub struct Ntile {
13905 #[serde(default)]
13906 pub this: Option<Box<Expression>>,
13907}
13908
13909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13911#[cfg_attr(feature = "bindings", derive(TS))]
13912pub struct Normalize {
13913 pub this: Box<Expression>,
13914 #[serde(default)]
13915 pub form: Option<Box<Expression>>,
13916 #[serde(default)]
13917 pub is_casefold: Option<Box<Expression>>,
13918}
13919
13920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13922#[cfg_attr(feature = "bindings", derive(TS))]
13923pub struct Normal {
13924 pub this: Box<Expression>,
13925 #[serde(default)]
13926 pub stddev: Option<Box<Expression>>,
13927 #[serde(default)]
13928 pub gen: Option<Box<Expression>>,
13929}
13930
13931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13933#[cfg_attr(feature = "bindings", derive(TS))]
13934pub struct Predict {
13935 pub this: Box<Expression>,
13936 pub expression: Box<Expression>,
13937 #[serde(default)]
13938 pub params_struct: Option<Box<Expression>>,
13939}
13940
13941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13943#[cfg_attr(feature = "bindings", derive(TS))]
13944pub struct MLTranslate {
13945 pub this: Box<Expression>,
13946 pub expression: Box<Expression>,
13947 #[serde(default)]
13948 pub params_struct: Option<Box<Expression>>,
13949}
13950
13951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13953#[cfg_attr(feature = "bindings", derive(TS))]
13954pub struct FeaturesAtTime {
13955 pub this: Box<Expression>,
13956 #[serde(default)]
13957 pub time: Option<Box<Expression>>,
13958 #[serde(default)]
13959 pub num_rows: Option<Box<Expression>>,
13960 #[serde(default)]
13961 pub ignore_feature_nulls: Option<Box<Expression>>,
13962}
13963
13964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13966#[cfg_attr(feature = "bindings", derive(TS))]
13967pub struct GenerateEmbedding {
13968 pub this: Box<Expression>,
13969 pub expression: Box<Expression>,
13970 #[serde(default)]
13971 pub params_struct: Option<Box<Expression>>,
13972 #[serde(default)]
13973 pub is_text: Option<Box<Expression>>,
13974}
13975
13976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13978#[cfg_attr(feature = "bindings", derive(TS))]
13979pub struct MLForecast {
13980 pub this: Box<Expression>,
13981 #[serde(default)]
13982 pub expression: Option<Box<Expression>>,
13983 #[serde(default)]
13984 pub params_struct: Option<Box<Expression>>,
13985}
13986
13987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13989#[cfg_attr(feature = "bindings", derive(TS))]
13990pub struct ModelAttribute {
13991 pub this: Box<Expression>,
13992 pub expression: Box<Expression>,
13993}
13994
13995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13997#[cfg_attr(feature = "bindings", derive(TS))]
13998pub struct VectorSearch {
13999 pub this: Box<Expression>,
14000 #[serde(default)]
14001 pub column_to_search: Option<Box<Expression>>,
14002 #[serde(default)]
14003 pub query_table: Option<Box<Expression>>,
14004 #[serde(default)]
14005 pub query_column_to_search: Option<Box<Expression>>,
14006 #[serde(default)]
14007 pub top_k: Option<Box<Expression>>,
14008 #[serde(default)]
14009 pub distance_type: Option<Box<Expression>>,
14010 #[serde(default)]
14011 pub options: Vec<Expression>,
14012}
14013
14014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14016#[cfg_attr(feature = "bindings", derive(TS))]
14017pub struct Quantile {
14018 pub this: Box<Expression>,
14019 #[serde(default)]
14020 pub quantile: Option<Box<Expression>>,
14021}
14022
14023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14025#[cfg_attr(feature = "bindings", derive(TS))]
14026pub struct ApproxQuantile {
14027 pub this: Box<Expression>,
14028 #[serde(default)]
14029 pub quantile: Option<Box<Expression>>,
14030 #[serde(default)]
14031 pub accuracy: Option<Box<Expression>>,
14032 #[serde(default)]
14033 pub weight: Option<Box<Expression>>,
14034 #[serde(default)]
14035 pub error_tolerance: Option<Box<Expression>>,
14036}
14037
14038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14040#[cfg_attr(feature = "bindings", derive(TS))]
14041pub struct ApproxPercentileEstimate {
14042 pub this: Box<Expression>,
14043 #[serde(default)]
14044 pub percentile: Option<Box<Expression>>,
14045}
14046
14047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14049#[cfg_attr(feature = "bindings", derive(TS))]
14050pub struct Randn {
14051 #[serde(default)]
14052 pub this: Option<Box<Expression>>,
14053}
14054
14055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14057#[cfg_attr(feature = "bindings", derive(TS))]
14058pub struct Randstr {
14059 pub this: Box<Expression>,
14060 #[serde(default)]
14061 pub generator: Option<Box<Expression>>,
14062}
14063
14064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14066#[cfg_attr(feature = "bindings", derive(TS))]
14067pub struct RangeN {
14068 pub this: Box<Expression>,
14069 #[serde(default)]
14070 pub expressions: Vec<Expression>,
14071 #[serde(default)]
14072 pub each: Option<Box<Expression>>,
14073}
14074
14075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14077#[cfg_attr(feature = "bindings", derive(TS))]
14078pub struct RangeBucket {
14079 pub this: Box<Expression>,
14080 pub expression: Box<Expression>,
14081}
14082
14083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14085#[cfg_attr(feature = "bindings", derive(TS))]
14086pub struct ReadCSV {
14087 pub this: Box<Expression>,
14088 #[serde(default)]
14089 pub expressions: Vec<Expression>,
14090}
14091
14092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14094#[cfg_attr(feature = "bindings", derive(TS))]
14095pub struct ReadParquet {
14096 #[serde(default)]
14097 pub expressions: Vec<Expression>,
14098}
14099
14100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14102#[cfg_attr(feature = "bindings", derive(TS))]
14103pub struct Reduce {
14104 pub this: Box<Expression>,
14105 #[serde(default)]
14106 pub initial: Option<Box<Expression>>,
14107 #[serde(default)]
14108 pub merge: Option<Box<Expression>>,
14109 #[serde(default)]
14110 pub finish: Option<Box<Expression>>,
14111}
14112
14113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14115#[cfg_attr(feature = "bindings", derive(TS))]
14116pub struct RegexpExtractAll {
14117 pub this: Box<Expression>,
14118 pub expression: Box<Expression>,
14119 #[serde(default)]
14120 pub group: Option<Box<Expression>>,
14121 #[serde(default)]
14122 pub parameters: Option<Box<Expression>>,
14123 #[serde(default)]
14124 pub position: Option<Box<Expression>>,
14125 #[serde(default)]
14126 pub occurrence: Option<Box<Expression>>,
14127}
14128
14129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14131#[cfg_attr(feature = "bindings", derive(TS))]
14132pub struct RegexpILike {
14133 pub this: Box<Expression>,
14134 pub expression: Box<Expression>,
14135 #[serde(default)]
14136 pub flag: Option<Box<Expression>>,
14137}
14138
14139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14141#[cfg_attr(feature = "bindings", derive(TS))]
14142pub struct RegexpFullMatch {
14143 pub this: Box<Expression>,
14144 pub expression: Box<Expression>,
14145 #[serde(default)]
14146 pub options: Vec<Expression>,
14147}
14148
14149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14151#[cfg_attr(feature = "bindings", derive(TS))]
14152pub struct RegexpInstr {
14153 pub this: Box<Expression>,
14154 pub expression: Box<Expression>,
14155 #[serde(default)]
14156 pub position: Option<Box<Expression>>,
14157 #[serde(default)]
14158 pub occurrence: Option<Box<Expression>>,
14159 #[serde(default)]
14160 pub option: Option<Box<Expression>>,
14161 #[serde(default)]
14162 pub parameters: Option<Box<Expression>>,
14163 #[serde(default)]
14164 pub group: Option<Box<Expression>>,
14165}
14166
14167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14169#[cfg_attr(feature = "bindings", derive(TS))]
14170pub struct RegexpSplit {
14171 pub this: Box<Expression>,
14172 pub expression: Box<Expression>,
14173 #[serde(default)]
14174 pub limit: Option<Box<Expression>>,
14175}
14176
14177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14179#[cfg_attr(feature = "bindings", derive(TS))]
14180pub struct RegexpCount {
14181 pub this: Box<Expression>,
14182 pub expression: Box<Expression>,
14183 #[serde(default)]
14184 pub position: Option<Box<Expression>>,
14185 #[serde(default)]
14186 pub parameters: Option<Box<Expression>>,
14187}
14188
14189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14191#[cfg_attr(feature = "bindings", derive(TS))]
14192pub struct RegrValx {
14193 pub this: Box<Expression>,
14194 pub expression: Box<Expression>,
14195}
14196
14197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14199#[cfg_attr(feature = "bindings", derive(TS))]
14200pub struct RegrValy {
14201 pub this: Box<Expression>,
14202 pub expression: Box<Expression>,
14203}
14204
14205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14207#[cfg_attr(feature = "bindings", derive(TS))]
14208pub struct RegrAvgy {
14209 pub this: Box<Expression>,
14210 pub expression: Box<Expression>,
14211}
14212
14213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14215#[cfg_attr(feature = "bindings", derive(TS))]
14216pub struct RegrAvgx {
14217 pub this: Box<Expression>,
14218 pub expression: Box<Expression>,
14219}
14220
14221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14223#[cfg_attr(feature = "bindings", derive(TS))]
14224pub struct RegrCount {
14225 pub this: Box<Expression>,
14226 pub expression: Box<Expression>,
14227}
14228
14229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14231#[cfg_attr(feature = "bindings", derive(TS))]
14232pub struct RegrIntercept {
14233 pub this: Box<Expression>,
14234 pub expression: Box<Expression>,
14235}
14236
14237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14239#[cfg_attr(feature = "bindings", derive(TS))]
14240pub struct RegrR2 {
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 RegrSxx {
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 RegrSxy {
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 RegrSyy {
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 RegrSlope {
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 SafeAdd {
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 SafeDivide {
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 SafeMultiply {
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 SafeSubtract {
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 SHA2 {
14313 pub this: Box<Expression>,
14314 #[serde(default)]
14315 pub length: Option<i64>,
14316}
14317
14318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14320#[cfg_attr(feature = "bindings", derive(TS))]
14321pub struct SHA2Digest {
14322 pub this: Box<Expression>,
14323 #[serde(default)]
14324 pub length: Option<i64>,
14325}
14326
14327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14329#[cfg_attr(feature = "bindings", derive(TS))]
14330pub struct SortArray {
14331 pub this: Box<Expression>,
14332 #[serde(default)]
14333 pub asc: Option<Box<Expression>>,
14334 #[serde(default)]
14335 pub nulls_first: Option<Box<Expression>>,
14336}
14337
14338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14340#[cfg_attr(feature = "bindings", derive(TS))]
14341pub struct SplitPart {
14342 pub this: Box<Expression>,
14343 #[serde(default)]
14344 pub delimiter: Option<Box<Expression>>,
14345 #[serde(default)]
14346 pub part_index: Option<Box<Expression>>,
14347}
14348
14349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14351#[cfg_attr(feature = "bindings", derive(TS))]
14352pub struct SubstringIndex {
14353 pub this: Box<Expression>,
14354 #[serde(default)]
14355 pub delimiter: Option<Box<Expression>>,
14356 #[serde(default)]
14357 pub count: Option<Box<Expression>>,
14358}
14359
14360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14362#[cfg_attr(feature = "bindings", derive(TS))]
14363pub struct StandardHash {
14364 pub this: Box<Expression>,
14365 #[serde(default)]
14366 pub expression: Option<Box<Expression>>,
14367}
14368
14369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14371#[cfg_attr(feature = "bindings", derive(TS))]
14372pub struct StrPosition {
14373 pub this: Box<Expression>,
14374 #[serde(default)]
14375 pub substr: Option<Box<Expression>>,
14376 #[serde(default)]
14377 pub position: Option<Box<Expression>>,
14378 #[serde(default)]
14379 pub occurrence: Option<Box<Expression>>,
14380}
14381
14382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14384#[cfg_attr(feature = "bindings", derive(TS))]
14385pub struct Search {
14386 pub this: Box<Expression>,
14387 pub expression: Box<Expression>,
14388 #[serde(default)]
14389 pub json_scope: Option<Box<Expression>>,
14390 #[serde(default)]
14391 pub analyzer: Option<Box<Expression>>,
14392 #[serde(default)]
14393 pub analyzer_options: Option<Box<Expression>>,
14394 #[serde(default)]
14395 pub search_mode: Option<Box<Expression>>,
14396}
14397
14398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14400#[cfg_attr(feature = "bindings", derive(TS))]
14401pub struct SearchIp {
14402 pub this: Box<Expression>,
14403 pub expression: Box<Expression>,
14404}
14405
14406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14408#[cfg_attr(feature = "bindings", derive(TS))]
14409pub struct StrToDate {
14410 pub this: Box<Expression>,
14411 #[serde(default)]
14412 pub format: Option<String>,
14413 #[serde(default)]
14414 pub safe: Option<Box<Expression>>,
14415}
14416
14417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14419#[cfg_attr(feature = "bindings", derive(TS))]
14420pub struct StrToTime {
14421 pub this: Box<Expression>,
14422 pub format: String,
14423 #[serde(default)]
14424 pub zone: Option<Box<Expression>>,
14425 #[serde(default)]
14426 pub safe: Option<Box<Expression>>,
14427 #[serde(default)]
14428 pub target_type: Option<Box<Expression>>,
14429}
14430
14431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14433#[cfg_attr(feature = "bindings", derive(TS))]
14434pub struct StrToUnix {
14435 #[serde(default)]
14436 pub this: Option<Box<Expression>>,
14437 #[serde(default)]
14438 pub format: Option<String>,
14439}
14440
14441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14443#[cfg_attr(feature = "bindings", derive(TS))]
14444pub struct StrToMap {
14445 pub this: Box<Expression>,
14446 #[serde(default)]
14447 pub pair_delim: Option<Box<Expression>>,
14448 #[serde(default)]
14449 pub key_value_delim: Option<Box<Expression>>,
14450 #[serde(default)]
14451 pub duplicate_resolution_callback: Option<Box<Expression>>,
14452}
14453
14454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14456#[cfg_attr(feature = "bindings", derive(TS))]
14457pub struct NumberToStr {
14458 pub this: Box<Expression>,
14459 pub format: String,
14460 #[serde(default)]
14461 pub culture: Option<Box<Expression>>,
14462}
14463
14464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14466#[cfg_attr(feature = "bindings", derive(TS))]
14467pub struct FromBase {
14468 pub this: Box<Expression>,
14469 pub expression: Box<Expression>,
14470}
14471
14472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14474#[cfg_attr(feature = "bindings", derive(TS))]
14475pub struct Stuff {
14476 pub this: Box<Expression>,
14477 #[serde(default)]
14478 pub start: Option<Box<Expression>>,
14479 #[serde(default)]
14480 pub length: Option<i64>,
14481 pub expression: Box<Expression>,
14482}
14483
14484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14486#[cfg_attr(feature = "bindings", derive(TS))]
14487pub struct TimeToStr {
14488 pub this: Box<Expression>,
14489 pub format: String,
14490 #[serde(default)]
14491 pub culture: Option<Box<Expression>>,
14492 #[serde(default)]
14493 pub zone: Option<Box<Expression>>,
14494}
14495
14496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14498#[cfg_attr(feature = "bindings", derive(TS))]
14499pub struct TimeStrToTime {
14500 pub this: Box<Expression>,
14501 #[serde(default)]
14502 pub zone: Option<Box<Expression>>,
14503}
14504
14505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14507#[cfg_attr(feature = "bindings", derive(TS))]
14508pub struct TsOrDsAdd {
14509 pub this: Box<Expression>,
14510 pub expression: Box<Expression>,
14511 #[serde(default)]
14512 pub unit: Option<String>,
14513 #[serde(default)]
14514 pub return_type: Option<Box<Expression>>,
14515}
14516
14517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14519#[cfg_attr(feature = "bindings", derive(TS))]
14520pub struct TsOrDsDiff {
14521 pub this: Box<Expression>,
14522 pub expression: Box<Expression>,
14523 #[serde(default)]
14524 pub unit: Option<String>,
14525}
14526
14527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14529#[cfg_attr(feature = "bindings", derive(TS))]
14530pub struct TsOrDsToDate {
14531 pub this: Box<Expression>,
14532 #[serde(default)]
14533 pub format: Option<String>,
14534 #[serde(default)]
14535 pub safe: Option<Box<Expression>>,
14536}
14537
14538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14540#[cfg_attr(feature = "bindings", derive(TS))]
14541pub struct TsOrDsToTime {
14542 pub this: Box<Expression>,
14543 #[serde(default)]
14544 pub format: Option<String>,
14545 #[serde(default)]
14546 pub safe: Option<Box<Expression>>,
14547}
14548
14549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14551#[cfg_attr(feature = "bindings", derive(TS))]
14552pub struct Unhex {
14553 pub this: Box<Expression>,
14554 #[serde(default)]
14555 pub expression: Option<Box<Expression>>,
14556}
14557
14558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14560#[cfg_attr(feature = "bindings", derive(TS))]
14561pub struct Uniform {
14562 pub this: Box<Expression>,
14563 pub expression: Box<Expression>,
14564 #[serde(default)]
14565 pub gen: Option<Box<Expression>>,
14566 #[serde(default)]
14567 pub seed: Option<Box<Expression>>,
14568}
14569
14570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14572#[cfg_attr(feature = "bindings", derive(TS))]
14573pub struct UnixToStr {
14574 pub this: Box<Expression>,
14575 #[serde(default)]
14576 pub format: Option<String>,
14577}
14578
14579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14581#[cfg_attr(feature = "bindings", derive(TS))]
14582pub struct UnixToTime {
14583 pub this: Box<Expression>,
14584 #[serde(default)]
14585 pub scale: Option<i64>,
14586 #[serde(default)]
14587 pub zone: Option<Box<Expression>>,
14588 #[serde(default)]
14589 pub hours: Option<Box<Expression>>,
14590 #[serde(default)]
14591 pub minutes: Option<Box<Expression>>,
14592 #[serde(default)]
14593 pub format: Option<String>,
14594 #[serde(default)]
14595 pub target_type: Option<Box<Expression>>,
14596}
14597
14598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14600#[cfg_attr(feature = "bindings", derive(TS))]
14601pub struct Uuid {
14602 #[serde(default)]
14603 pub this: Option<Box<Expression>>,
14604 #[serde(default)]
14605 pub name: Option<String>,
14606 #[serde(default)]
14607 pub is_string: Option<Box<Expression>>,
14608}
14609
14610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14612#[cfg_attr(feature = "bindings", derive(TS))]
14613pub struct TimestampFromParts {
14614 #[serde(default)]
14615 pub zone: Option<Box<Expression>>,
14616 #[serde(default)]
14617 pub milli: Option<Box<Expression>>,
14618 #[serde(default)]
14619 pub this: Option<Box<Expression>>,
14620 #[serde(default)]
14621 pub expression: Option<Box<Expression>>,
14622}
14623
14624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14626#[cfg_attr(feature = "bindings", derive(TS))]
14627pub struct TimestampTzFromParts {
14628 #[serde(default)]
14629 pub zone: Option<Box<Expression>>,
14630}
14631
14632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14634#[cfg_attr(feature = "bindings", derive(TS))]
14635pub struct Corr {
14636 pub this: Box<Expression>,
14637 pub expression: Box<Expression>,
14638 #[serde(default)]
14639 pub null_on_zero_variance: Option<Box<Expression>>,
14640}
14641
14642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14644#[cfg_attr(feature = "bindings", derive(TS))]
14645pub struct WidthBucket {
14646 pub this: Box<Expression>,
14647 #[serde(default)]
14648 pub min_value: Option<Box<Expression>>,
14649 #[serde(default)]
14650 pub max_value: Option<Box<Expression>>,
14651 #[serde(default)]
14652 pub num_buckets: Option<Box<Expression>>,
14653 #[serde(default)]
14654 pub threshold: Option<Box<Expression>>,
14655}
14656
14657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14659#[cfg_attr(feature = "bindings", derive(TS))]
14660pub struct CovarSamp {
14661 pub this: Box<Expression>,
14662 pub expression: Box<Expression>,
14663}
14664
14665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14667#[cfg_attr(feature = "bindings", derive(TS))]
14668pub struct CovarPop {
14669 pub this: Box<Expression>,
14670 pub expression: Box<Expression>,
14671}
14672
14673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14675#[cfg_attr(feature = "bindings", derive(TS))]
14676pub struct Week {
14677 pub this: Box<Expression>,
14678 #[serde(default)]
14679 pub mode: Option<Box<Expression>>,
14680}
14681
14682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14684#[cfg_attr(feature = "bindings", derive(TS))]
14685pub struct XMLElement {
14686 pub this: Box<Expression>,
14687 #[serde(default)]
14688 pub expressions: Vec<Expression>,
14689 #[serde(default)]
14690 pub evalname: Option<Box<Expression>>,
14691}
14692
14693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14695#[cfg_attr(feature = "bindings", derive(TS))]
14696pub struct XMLGet {
14697 pub this: Box<Expression>,
14698 pub expression: Box<Expression>,
14699 #[serde(default)]
14700 pub instance: Option<Box<Expression>>,
14701}
14702
14703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14705#[cfg_attr(feature = "bindings", derive(TS))]
14706pub struct XMLTable {
14707 pub this: Box<Expression>,
14708 #[serde(default)]
14709 pub namespaces: Option<Box<Expression>>,
14710 #[serde(default)]
14711 pub passing: Option<Box<Expression>>,
14712 #[serde(default)]
14713 pub columns: Vec<Expression>,
14714 #[serde(default)]
14715 pub by_ref: Option<Box<Expression>>,
14716}
14717
14718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14720#[cfg_attr(feature = "bindings", derive(TS))]
14721pub struct XMLKeyValueOption {
14722 pub this: Box<Expression>,
14723 #[serde(default)]
14724 pub expression: Option<Box<Expression>>,
14725}
14726
14727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14729#[cfg_attr(feature = "bindings", derive(TS))]
14730pub struct Zipf {
14731 pub this: Box<Expression>,
14732 #[serde(default)]
14733 pub elementcount: Option<Box<Expression>>,
14734 #[serde(default)]
14735 pub gen: Option<Box<Expression>>,
14736}
14737
14738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14740#[cfg_attr(feature = "bindings", derive(TS))]
14741pub struct Merge {
14742 pub this: Box<Expression>,
14743 pub using: Box<Expression>,
14744 #[serde(default)]
14745 pub on: Option<Box<Expression>>,
14746 #[serde(default)]
14747 pub using_cond: Option<Box<Expression>>,
14748 #[serde(default)]
14749 pub whens: Option<Box<Expression>>,
14750 #[serde(default)]
14751 pub with_: Option<Box<Expression>>,
14752 #[serde(default)]
14753 pub returning: Option<Box<Expression>>,
14754}
14755
14756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14758#[cfg_attr(feature = "bindings", derive(TS))]
14759pub struct When {
14760 #[serde(default)]
14761 pub matched: Option<Box<Expression>>,
14762 #[serde(default)]
14763 pub source: Option<Box<Expression>>,
14764 #[serde(default)]
14765 pub condition: Option<Box<Expression>>,
14766 pub then: Box<Expression>,
14767}
14768
14769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14771#[cfg_attr(feature = "bindings", derive(TS))]
14772pub struct Whens {
14773 #[serde(default)]
14774 pub expressions: Vec<Expression>,
14775}
14776
14777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14779#[cfg_attr(feature = "bindings", derive(TS))]
14780pub struct NextValueFor {
14781 pub this: Box<Expression>,
14782 #[serde(default)]
14783 pub order: Option<Box<Expression>>,
14784}
14785
14786#[cfg(test)]
14787mod tests {
14788 use super::*;
14789
14790 #[test]
14791 #[cfg(feature = "bindings")]
14792 fn export_typescript_types() {
14793 Expression::export_all(&ts_rs::Config::default())
14796 .expect("Failed to export Expression types");
14797 }
14798
14799 #[test]
14800 fn test_simple_select_builder() {
14801 let select = Select::new()
14802 .column(Expression::star())
14803 .from(Expression::Table(Box::new(TableRef::new("users"))));
14804
14805 assert_eq!(select.expressions.len(), 1);
14806 assert!(select.from.is_some());
14807 }
14808
14809 #[test]
14810 fn test_expression_alias() {
14811 let expr = Expression::column("id").alias("user_id");
14812
14813 match expr {
14814 Expression::Alias(a) => {
14815 assert_eq!(a.alias.name, "user_id");
14816 }
14817 _ => panic!("Expected Alias"),
14818 }
14819 }
14820
14821 #[test]
14822 fn test_literal_creation() {
14823 let num = Expression::number(42);
14824 let str = Expression::string("hello");
14825
14826 match num {
14827 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14828 let Literal::Number(n) = lit.as_ref() else {
14829 unreachable!()
14830 };
14831 assert_eq!(n, "42")
14832 }
14833 _ => panic!("Expected Number"),
14834 }
14835
14836 match str {
14837 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
14838 let Literal::String(s) = lit.as_ref() else {
14839 unreachable!()
14840 };
14841 assert_eq!(s, "hello")
14842 }
14843 _ => panic!("Expected String"),
14844 }
14845 }
14846
14847 #[test]
14848 fn test_expression_sql() {
14849 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
14850 assert_eq!(expr.sql(), "SELECT 1 + 2");
14851 }
14852
14853 #[test]
14854 fn test_expression_sql_for() {
14855 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
14856 let sql = expr.sql_for(crate::DialectType::Generic);
14857 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
14859 }
14860}