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 TryCatch(Box<TryCatch>),
118
119 Alias(Box<Alias>),
121 Cast(Box<Cast>),
122 Collation(Box<CollationExpr>),
123 Case(Box<Case>),
124
125 And(Box<BinaryOp>),
127 Or(Box<BinaryOp>),
128 Add(Box<BinaryOp>),
129 Sub(Box<BinaryOp>),
130 Mul(Box<BinaryOp>),
131 Div(Box<BinaryOp>),
132 Mod(Box<BinaryOp>),
133 Eq(Box<BinaryOp>),
134 Neq(Box<BinaryOp>),
135 Lt(Box<BinaryOp>),
136 Lte(Box<BinaryOp>),
137 Gt(Box<BinaryOp>),
138 Gte(Box<BinaryOp>),
139 Like(Box<LikeOp>),
140 ILike(Box<LikeOp>),
141 Match(Box<BinaryOp>),
143 BitwiseAnd(Box<BinaryOp>),
144 BitwiseOr(Box<BinaryOp>),
145 BitwiseXor(Box<BinaryOp>),
146 Concat(Box<BinaryOp>),
147 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>),
163 Neg(Box<UnaryOp>),
164 BitwiseNot(Box<UnaryOp>),
165
166 In(Box<In>),
168 Between(Box<Between>),
169 IsNull(Box<IsNull>),
170 IsTrue(Box<IsTrueFalse>),
171 IsFalse(Box<IsTrueFalse>),
172 IsJson(Box<IsJson>),
173 Is(Box<BinaryOp>), Exists(Box<Exists>),
175 MemberOf(Box<BinaryOp>),
177
178 Function(Box<Function>),
180 AggregateFunction(Box<AggregateFunction>),
181 WindowFunction(Box<WindowFunction>),
182
183 From(Box<From>),
185 Join(Box<Join>),
186 JoinedTable(Box<JoinedTable>),
187 Where(Box<Where>),
188 GroupBy(Box<GroupBy>),
189 Having(Box<Having>),
190 OrderBy(Box<OrderBy>),
191 Limit(Box<Limit>),
192 Offset(Box<Offset>),
193 Qualify(Box<Qualify>),
194 With(Box<With>),
195 Cte(Box<Cte>),
196 DistributeBy(Box<DistributeBy>),
197 ClusterBy(Box<ClusterBy>),
198 SortBy(Box<SortBy>),
199 LateralView(Box<LateralView>),
200 Hint(Box<Hint>),
201 Pseudocolumn(Pseudocolumn),
202
203 Connect(Box<Connect>),
205 Prior(Box<Prior>),
206 ConnectByRoot(Box<ConnectByRoot>),
207
208 MatchRecognize(Box<MatchRecognize>),
210
211 Ordered(Box<Ordered>),
213
214 Window(Box<WindowSpec>),
216 Over(Box<Over>),
217 WithinGroup(Box<WithinGroup>),
218
219 DataType(DataType),
221
222 Array(Box<Array>),
224 Struct(Box<Struct>),
225 Tuple(Box<Tuple>),
226
227 Interval(Box<Interval>),
229
230 ConcatWs(Box<ConcatWs>),
232 Substring(Box<SubstringFunc>),
233 Upper(Box<UnaryFunc>),
234 Lower(Box<UnaryFunc>),
235 Length(Box<UnaryFunc>),
236 Trim(Box<TrimFunc>),
237 LTrim(Box<UnaryFunc>),
238 RTrim(Box<UnaryFunc>),
239 Replace(Box<ReplaceFunc>),
240 Reverse(Box<UnaryFunc>),
241 Left(Box<LeftRightFunc>),
242 Right(Box<LeftRightFunc>),
243 Repeat(Box<RepeatFunc>),
244 Lpad(Box<PadFunc>),
245 Rpad(Box<PadFunc>),
246 Split(Box<SplitFunc>),
247 RegexpLike(Box<RegexpFunc>),
248 RegexpReplace(Box<RegexpReplaceFunc>),
249 RegexpExtract(Box<RegexpExtractFunc>),
250 Overlay(Box<OverlayFunc>),
251
252 Abs(Box<UnaryFunc>),
254 Round(Box<RoundFunc>),
255 Floor(Box<FloorFunc>),
256 Ceil(Box<CeilFunc>),
257 Power(Box<BinaryFunc>),
258 Sqrt(Box<UnaryFunc>),
259 Cbrt(Box<UnaryFunc>),
260 Ln(Box<UnaryFunc>),
261 Log(Box<LogFunc>),
262 Exp(Box<UnaryFunc>),
263 Sign(Box<UnaryFunc>),
264 Greatest(Box<VarArgFunc>),
265 Least(Box<VarArgFunc>),
266
267 CurrentDate(CurrentDate),
269 CurrentTime(CurrentTime),
270 CurrentTimestamp(CurrentTimestamp),
271 CurrentTimestampLTZ(CurrentTimestampLTZ),
272 AtTimeZone(Box<AtTimeZone>),
273 DateAdd(Box<DateAddFunc>),
274 DateSub(Box<DateAddFunc>),
275 DateDiff(Box<DateDiffFunc>),
276 DateTrunc(Box<DateTruncFunc>),
277 Extract(Box<ExtractFunc>),
278 ToDate(Box<ToDateFunc>),
279 ToTimestamp(Box<ToTimestampFunc>),
280 Date(Box<UnaryFunc>),
281 Time(Box<UnaryFunc>),
282 DateFromUnixDate(Box<UnaryFunc>),
283 UnixDate(Box<UnaryFunc>),
284 UnixSeconds(Box<UnaryFunc>),
285 UnixMillis(Box<UnaryFunc>),
286 UnixMicros(Box<UnaryFunc>),
287 UnixToTimeStr(Box<BinaryFunc>),
288 TimeStrToDate(Box<UnaryFunc>),
289 DateToDi(Box<UnaryFunc>),
290 DiToDate(Box<UnaryFunc>),
291 TsOrDiToDi(Box<UnaryFunc>),
292 TsOrDsToDatetime(Box<UnaryFunc>),
293 TsOrDsToTimestamp(Box<UnaryFunc>),
294 YearOfWeek(Box<UnaryFunc>),
295 YearOfWeekIso(Box<UnaryFunc>),
296
297 Coalesce(Box<VarArgFunc>),
299 NullIf(Box<BinaryFunc>),
300 IfFunc(Box<IfFunc>),
301 IfNull(Box<BinaryFunc>),
302 Nvl(Box<BinaryFunc>),
303 Nvl2(Box<Nvl2Func>),
304
305 TryCast(Box<Cast>),
307 SafeCast(Box<Cast>),
308
309 Count(Box<CountFunc>),
311 Sum(Box<AggFunc>),
312 Avg(Box<AggFunc>),
313 Min(Box<AggFunc>),
314 Max(Box<AggFunc>),
315 GroupConcat(Box<GroupConcatFunc>),
316 StringAgg(Box<StringAggFunc>),
317 ListAgg(Box<ListAggFunc>),
318 ArrayAgg(Box<AggFunc>),
319 CountIf(Box<AggFunc>),
320 SumIf(Box<SumIfFunc>),
321 Stddev(Box<AggFunc>),
322 StddevPop(Box<AggFunc>),
323 StddevSamp(Box<AggFunc>),
324 Variance(Box<AggFunc>),
325 VarPop(Box<AggFunc>),
326 VarSamp(Box<AggFunc>),
327 Median(Box<AggFunc>),
328 Mode(Box<AggFunc>),
329 First(Box<AggFunc>),
330 Last(Box<AggFunc>),
331 AnyValue(Box<AggFunc>),
332 ApproxDistinct(Box<AggFunc>),
333 ApproxCountDistinct(Box<AggFunc>),
334 ApproxPercentile(Box<ApproxPercentileFunc>),
335 Percentile(Box<PercentileFunc>),
336 LogicalAnd(Box<AggFunc>),
337 LogicalOr(Box<AggFunc>),
338 Skewness(Box<AggFunc>),
339 BitwiseCount(Box<UnaryFunc>),
340 ArrayConcatAgg(Box<AggFunc>),
341 ArrayUniqueAgg(Box<AggFunc>),
342 BoolXorAgg(Box<AggFunc>),
343
344 RowNumber(RowNumber),
346 Rank(Rank),
347 DenseRank(DenseRank),
348 NTile(Box<NTileFunc>),
349 Lead(Box<LeadLagFunc>),
350 Lag(Box<LeadLagFunc>),
351 FirstValue(Box<ValueFunc>),
352 LastValue(Box<ValueFunc>),
353 NthValue(Box<NthValueFunc>),
354 PercentRank(PercentRank),
355 CumeDist(CumeDist),
356 PercentileCont(Box<PercentileFunc>),
357 PercentileDisc(Box<PercentileFunc>),
358
359 Contains(Box<BinaryFunc>),
361 StartsWith(Box<BinaryFunc>),
362 EndsWith(Box<BinaryFunc>),
363 Position(Box<PositionFunc>),
364 Initcap(Box<UnaryFunc>),
365 Ascii(Box<UnaryFunc>),
366 Chr(Box<UnaryFunc>),
367 CharFunc(Box<CharFunc>),
369 Soundex(Box<UnaryFunc>),
370 Levenshtein(Box<BinaryFunc>),
371 ByteLength(Box<UnaryFunc>),
372 Hex(Box<UnaryFunc>),
373 LowerHex(Box<UnaryFunc>),
374 Unicode(Box<UnaryFunc>),
375
376 ModFunc(Box<BinaryFunc>),
378 Random(Random),
379 Rand(Box<Rand>),
380 TruncFunc(Box<TruncateFunc>),
381 Pi(Pi),
382 Radians(Box<UnaryFunc>),
383 Degrees(Box<UnaryFunc>),
384 Sin(Box<UnaryFunc>),
385 Cos(Box<UnaryFunc>),
386 Tan(Box<UnaryFunc>),
387 Asin(Box<UnaryFunc>),
388 Acos(Box<UnaryFunc>),
389 Atan(Box<UnaryFunc>),
390 Atan2(Box<BinaryFunc>),
391 IsNan(Box<UnaryFunc>),
392 IsInf(Box<UnaryFunc>),
393 IntDiv(Box<BinaryFunc>),
394
395 Decode(Box<DecodeFunc>),
397
398 DateFormat(Box<DateFormatFunc>),
400 FormatDate(Box<DateFormatFunc>),
401 Year(Box<UnaryFunc>),
402 Month(Box<UnaryFunc>),
403 Day(Box<UnaryFunc>),
404 Hour(Box<UnaryFunc>),
405 Minute(Box<UnaryFunc>),
406 Second(Box<UnaryFunc>),
407 DayOfWeek(Box<UnaryFunc>),
408 DayOfWeekIso(Box<UnaryFunc>),
409 DayOfMonth(Box<UnaryFunc>),
410 DayOfYear(Box<UnaryFunc>),
411 WeekOfYear(Box<UnaryFunc>),
412 Quarter(Box<UnaryFunc>),
413 AddMonths(Box<BinaryFunc>),
414 MonthsBetween(Box<BinaryFunc>),
415 LastDay(Box<LastDayFunc>),
416 NextDay(Box<BinaryFunc>),
417 Epoch(Box<UnaryFunc>),
418 EpochMs(Box<UnaryFunc>),
419 FromUnixtime(Box<FromUnixtimeFunc>),
420 UnixTimestamp(Box<UnixTimestampFunc>),
421 MakeDate(Box<MakeDateFunc>),
422 MakeTimestamp(Box<MakeTimestampFunc>),
423 TimestampTrunc(Box<DateTruncFunc>),
424 TimeStrToUnix(Box<UnaryFunc>),
425
426 SessionUser(SessionUser),
428
429 SHA(Box<UnaryFunc>),
431 SHA1Digest(Box<UnaryFunc>),
432
433 TimeToUnix(Box<UnaryFunc>),
435
436 ArrayFunc(Box<ArrayConstructor>),
438 ArrayLength(Box<UnaryFunc>),
439 ArraySize(Box<UnaryFunc>),
440 Cardinality(Box<UnaryFunc>),
441 ArrayContains(Box<BinaryFunc>),
442 ArrayPosition(Box<BinaryFunc>),
443 ArrayAppend(Box<BinaryFunc>),
444 ArrayPrepend(Box<BinaryFunc>),
445 ArrayConcat(Box<VarArgFunc>),
446 ArraySort(Box<ArraySortFunc>),
447 ArrayReverse(Box<UnaryFunc>),
448 ArrayDistinct(Box<UnaryFunc>),
449 ArrayJoin(Box<ArrayJoinFunc>),
450 ArrayToString(Box<ArrayJoinFunc>),
451 Unnest(Box<UnnestFunc>),
452 Explode(Box<UnaryFunc>),
453 ExplodeOuter(Box<UnaryFunc>),
454 ArrayFilter(Box<ArrayFilterFunc>),
455 ArrayTransform(Box<ArrayTransformFunc>),
456 ArrayFlatten(Box<UnaryFunc>),
457 ArrayCompact(Box<UnaryFunc>),
458 ArrayIntersect(Box<VarArgFunc>),
459 ArrayUnion(Box<BinaryFunc>),
460 ArrayExcept(Box<BinaryFunc>),
461 ArrayRemove(Box<BinaryFunc>),
462 ArrayZip(Box<VarArgFunc>),
463 Sequence(Box<SequenceFunc>),
464 Generate(Box<SequenceFunc>),
465 ExplodingGenerateSeries(Box<SequenceFunc>),
466 ToArray(Box<UnaryFunc>),
467 StarMap(Box<BinaryFunc>),
468
469 StructFunc(Box<StructConstructor>),
471 StructExtract(Box<StructExtractFunc>),
472 NamedStruct(Box<NamedStructFunc>),
473
474 MapFunc(Box<MapConstructor>),
476 MapFromEntries(Box<UnaryFunc>),
477 MapFromArrays(Box<BinaryFunc>),
478 MapKeys(Box<UnaryFunc>),
479 MapValues(Box<UnaryFunc>),
480 MapContainsKey(Box<BinaryFunc>),
481 MapConcat(Box<VarArgFunc>),
482 ElementAt(Box<BinaryFunc>),
483 TransformKeys(Box<TransformFunc>),
484 TransformValues(Box<TransformFunc>),
485
486 FunctionEmits(Box<FunctionEmits>),
488
489 JsonExtract(Box<JsonExtractFunc>),
491 JsonExtractScalar(Box<JsonExtractFunc>),
492 JsonExtractPath(Box<JsonPathFunc>),
493 JsonArray(Box<VarArgFunc>),
494 JsonObject(Box<JsonObjectFunc>),
495 JsonQuery(Box<JsonExtractFunc>),
496 JsonValue(Box<JsonExtractFunc>),
497 JsonArrayLength(Box<UnaryFunc>),
498 JsonKeys(Box<UnaryFunc>),
499 JsonType(Box<UnaryFunc>),
500 ParseJson(Box<UnaryFunc>),
501 ToJson(Box<UnaryFunc>),
502 JsonSet(Box<JsonModifyFunc>),
503 JsonInsert(Box<JsonModifyFunc>),
504 JsonRemove(Box<JsonPathFunc>),
505 JsonMergePatch(Box<BinaryFunc>),
506 JsonArrayAgg(Box<JsonArrayAggFunc>),
507 JsonObjectAgg(Box<JsonObjectAggFunc>),
508
509 Convert(Box<ConvertFunc>),
511 Typeof(Box<UnaryFunc>),
512
513 Lambda(Box<LambdaExpr>),
515 Parameter(Box<Parameter>),
516 Placeholder(Placeholder),
517 NamedArgument(Box<NamedArgument>),
518 TableArgument(Box<TableArgument>),
521 SqlComment(Box<SqlComment>),
522
523 NullSafeEq(Box<BinaryOp>),
525 NullSafeNeq(Box<BinaryOp>),
526 Glob(Box<BinaryOp>),
527 SimilarTo(Box<SimilarToExpr>),
528 Any(Box<QuantifiedExpr>),
529 All(Box<QuantifiedExpr>),
530 Overlaps(Box<OverlapsExpr>),
531
532 BitwiseLeftShift(Box<BinaryOp>),
534 BitwiseRightShift(Box<BinaryOp>),
535 BitwiseAndAgg(Box<AggFunc>),
536 BitwiseOrAgg(Box<AggFunc>),
537 BitwiseXorAgg(Box<AggFunc>),
538
539 Subscript(Box<Subscript>),
541 Dot(Box<DotAccess>),
542 MethodCall(Box<MethodCall>),
543 ArraySlice(Box<ArraySlice>),
544
545 CreateTable(Box<CreateTable>),
547 DropTable(Box<DropTable>),
548 Undrop(Box<Undrop>),
549 AlterTable(Box<AlterTable>),
550 CreateIndex(Box<CreateIndex>),
551 DropIndex(Box<DropIndex>),
552 CreateView(Box<CreateView>),
553 DropView(Box<DropView>),
554 AlterView(Box<AlterView>),
555 AlterIndex(Box<AlterIndex>),
556 Truncate(Box<Truncate>),
557 Use(Box<Use>),
558 Cache(Box<Cache>),
559 Uncache(Box<Uncache>),
560 LoadData(Box<LoadData>),
561 Pragma(Box<Pragma>),
562 Grant(Box<Grant>),
563 Revoke(Box<Revoke>),
564 Comment(Box<Comment>),
565 SetStatement(Box<SetStatement>),
566 CreateSchema(Box<CreateSchema>),
568 DropSchema(Box<DropSchema>),
569 DropNamespace(Box<DropNamespace>),
570 CreateDatabase(Box<CreateDatabase>),
571 DropDatabase(Box<DropDatabase>),
572 CreateFunction(Box<CreateFunction>),
573 DropFunction(Box<DropFunction>),
574 CreateProcedure(Box<CreateProcedure>),
575 DropProcedure(Box<DropProcedure>),
576 CreateSequence(Box<CreateSequence>),
577 CreateSynonym(Box<CreateSynonym>),
578 DropSequence(Box<DropSequence>),
579 AlterSequence(Box<AlterSequence>),
580 CreateTrigger(Box<CreateTrigger>),
581 DropTrigger(Box<DropTrigger>),
582 CreateType(Box<CreateType>),
583 DropType(Box<DropType>),
584 Describe(Box<Describe>),
585 Show(Box<Show>),
586
587 Command(Box<Command>),
589 Kill(Box<Kill>),
590 Prepare(Box<PrepareStatement>),
592 Execute(Box<ExecuteStatement>),
594
595 CreateTask(Box<CreateTask>),
597
598 Raw(Raw),
600
601 Paren(Box<Paren>),
603
604 Annotated(Box<Annotated>),
606
607 Refresh(Box<Refresh>),
610 LockingStatement(Box<LockingStatement>),
611 SequenceProperties(Box<SequenceProperties>),
612 TruncateTable(Box<TruncateTable>),
613 Clone(Box<Clone>),
614 Attach(Box<Attach>),
615 Detach(Box<Detach>),
616 Install(Box<Install>),
617 Summarize(Box<Summarize>),
618 Declare(Box<Declare>),
619 DeclareItem(Box<DeclareItem>),
620 Set(Box<Set>),
621 Heredoc(Box<Heredoc>),
622 SetItem(Box<SetItem>),
623 QueryBand(Box<QueryBand>),
624 UserDefinedFunction(Box<UserDefinedFunction>),
625 RecursiveWithSearch(Box<RecursiveWithSearch>),
626 ProjectionDef(Box<ProjectionDef>),
627 TableAlias(Box<TableAlias>),
628 ByteString(Box<ByteString>),
629 HexStringExpr(Box<HexStringExpr>),
630 UnicodeString(Box<UnicodeString>),
631 ColumnPosition(Box<ColumnPosition>),
632 ColumnDef(Box<ColumnDef>),
633 AlterColumn(Box<AlterColumn>),
634 AlterSortKey(Box<AlterSortKey>),
635 AlterSet(Box<AlterSet>),
636 RenameColumn(Box<RenameColumn>),
637 Comprehension(Box<Comprehension>),
638 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
639 MergeTreeTTL(Box<MergeTreeTTL>),
640 IndexConstraintOption(Box<IndexConstraintOption>),
641 ColumnConstraint(Box<ColumnConstraint>),
642 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
643 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
644 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
645 CheckColumnConstraint(Box<CheckColumnConstraint>),
646 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
647 CompressColumnConstraint(Box<CompressColumnConstraint>),
648 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
649 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
650 WithOperator(Box<WithOperator>),
651 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
652 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
653 CommentColumnConstraint(CommentColumnConstraint),
654 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
655 IndexColumnConstraint(Box<IndexColumnConstraint>),
656 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
657 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
658 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
659 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
660 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
661 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
662 InOutColumnConstraint(Box<InOutColumnConstraint>),
663 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
664 PathColumnConstraint(Box<PathColumnConstraint>),
665 Constraint(Box<Constraint>),
666 Export(Box<Export>),
667 Filter(Box<Filter>),
668 Changes(Box<Changes>),
669 CopyParameter(Box<CopyParameter>),
670 Credentials(Box<Credentials>),
671 Directory(Box<Directory>),
672 ForeignKey(Box<ForeignKey>),
673 ColumnPrefix(Box<ColumnPrefix>),
674 PrimaryKey(Box<PrimaryKey>),
675 IntoClause(Box<IntoClause>),
676 JoinHint(Box<JoinHint>),
677 Opclass(Box<Opclass>),
678 Index(Box<Index>),
679 IndexParameters(Box<IndexParameters>),
680 ConditionalInsert(Box<ConditionalInsert>),
681 MultitableInserts(Box<MultitableInserts>),
682 OnConflict(Box<OnConflict>),
683 OnCondition(Box<OnCondition>),
684 Returning(Box<Returning>),
685 Introducer(Box<Introducer>),
686 PartitionRange(Box<PartitionRange>),
687 Fetch(Box<Fetch>),
688 Group(Box<Group>),
689 Cube(Box<Cube>),
690 Rollup(Box<Rollup>),
691 GroupingSets(Box<GroupingSets>),
692 LimitOptions(Box<LimitOptions>),
693 Lateral(Box<Lateral>),
694 TableFromRows(Box<TableFromRows>),
695 RowsFrom(Box<RowsFrom>),
696 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
697 WithFill(Box<WithFill>),
698 Property(Box<Property>),
699 GrantPrivilege(Box<GrantPrivilege>),
700 GrantPrincipal(Box<GrantPrincipal>),
701 AllowedValuesProperty(Box<AllowedValuesProperty>),
702 AlgorithmProperty(Box<AlgorithmProperty>),
703 AutoIncrementProperty(Box<AutoIncrementProperty>),
704 AutoRefreshProperty(Box<AutoRefreshProperty>),
705 BackupProperty(Box<BackupProperty>),
706 BuildProperty(Box<BuildProperty>),
707 BlockCompressionProperty(Box<BlockCompressionProperty>),
708 CharacterSetProperty(Box<CharacterSetProperty>),
709 ChecksumProperty(Box<ChecksumProperty>),
710 CollateProperty(Box<CollateProperty>),
711 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
712 DataDeletionProperty(Box<DataDeletionProperty>),
713 DefinerProperty(Box<DefinerProperty>),
714 DistKeyProperty(Box<DistKeyProperty>),
715 DistributedByProperty(Box<DistributedByProperty>),
716 DistStyleProperty(Box<DistStyleProperty>),
717 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
718 EngineProperty(Box<EngineProperty>),
719 ToTableProperty(Box<ToTableProperty>),
720 ExecuteAsProperty(Box<ExecuteAsProperty>),
721 ExternalProperty(Box<ExternalProperty>),
722 FallbackProperty(Box<FallbackProperty>),
723 FileFormatProperty(Box<FileFormatProperty>),
724 CredentialsProperty(Box<CredentialsProperty>),
725 FreespaceProperty(Box<FreespaceProperty>),
726 InheritsProperty(Box<InheritsProperty>),
727 InputModelProperty(Box<InputModelProperty>),
728 OutputModelProperty(Box<OutputModelProperty>),
729 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
730 JournalProperty(Box<JournalProperty>),
731 LanguageProperty(Box<LanguageProperty>),
732 EnviromentProperty(Box<EnviromentProperty>),
733 ClusteredByProperty(Box<ClusteredByProperty>),
734 DictProperty(Box<DictProperty>),
735 DictRange(Box<DictRange>),
736 OnCluster(Box<OnCluster>),
737 LikeProperty(Box<LikeProperty>),
738 LocationProperty(Box<LocationProperty>),
739 LockProperty(Box<LockProperty>),
740 LockingProperty(Box<LockingProperty>),
741 LogProperty(Box<LogProperty>),
742 MaterializedProperty(Box<MaterializedProperty>),
743 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
744 OnProperty(Box<OnProperty>),
745 OnCommitProperty(Box<OnCommitProperty>),
746 PartitionedByProperty(Box<PartitionedByProperty>),
747 PartitionByProperty(Box<PartitionByProperty>),
748 PartitionedByBucket(Box<PartitionedByBucket>),
749 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
750 PartitionByTruncate(Box<PartitionByTruncate>),
751 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
752 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
753 PartitionByListProperty(Box<PartitionByListProperty>),
754 PartitionList(Box<PartitionList>),
755 Partition(Box<Partition>),
756 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
757 UniqueKeyProperty(Box<UniqueKeyProperty>),
758 RollupProperty(Box<RollupProperty>),
759 PartitionBoundSpec(Box<PartitionBoundSpec>),
760 PartitionedOfProperty(Box<PartitionedOfProperty>),
761 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
762 ReturnsProperty(Box<ReturnsProperty>),
763 RowFormatProperty(Box<RowFormatProperty>),
764 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
765 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
766 QueryTransform(Box<QueryTransform>),
767 SampleProperty(Box<SampleProperty>),
768 SecurityProperty(Box<SecurityProperty>),
769 SchemaCommentProperty(Box<SchemaCommentProperty>),
770 SemanticView(Box<SemanticView>),
771 SerdeProperties(Box<SerdeProperties>),
772 SetProperty(Box<SetProperty>),
773 SharingProperty(Box<SharingProperty>),
774 SetConfigProperty(Box<SetConfigProperty>),
775 SettingsProperty(Box<SettingsProperty>),
776 SortKeyProperty(Box<SortKeyProperty>),
777 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
778 SqlSecurityProperty(Box<SqlSecurityProperty>),
779 StabilityProperty(Box<StabilityProperty>),
780 StorageHandlerProperty(Box<StorageHandlerProperty>),
781 TemporaryProperty(Box<TemporaryProperty>),
782 Tags(Box<Tags>),
783 TransformModelProperty(Box<TransformModelProperty>),
784 TransientProperty(Box<TransientProperty>),
785 UsingTemplateProperty(Box<UsingTemplateProperty>),
786 ViewAttributeProperty(Box<ViewAttributeProperty>),
787 VolatileProperty(Box<VolatileProperty>),
788 WithDataProperty(Box<WithDataProperty>),
789 WithJournalTableProperty(Box<WithJournalTableProperty>),
790 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
791 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
792 WithProcedureOptions(Box<WithProcedureOptions>),
793 EncodeProperty(Box<EncodeProperty>),
794 IncludeProperty(Box<IncludeProperty>),
795 Properties(Box<Properties>),
796 OptionsProperty(Box<OptionsProperty>),
797 InputOutputFormat(Box<InputOutputFormat>),
798 Reference(Box<Reference>),
799 QueryOption(Box<QueryOption>),
800 WithTableHint(Box<WithTableHint>),
801 IndexTableHint(Box<IndexTableHint>),
802 HistoricalData(Box<HistoricalData>),
803 Get(Box<Get>),
804 SetOperation(Box<SetOperation>),
805 Var(Box<Var>),
806 Variadic(Box<Variadic>),
807 Version(Box<Version>),
808 Schema(Box<Schema>),
809 Lock(Box<Lock>),
810 TableSample(Box<TableSample>),
811 Tag(Box<Tag>),
812 UnpivotColumns(Box<UnpivotColumns>),
813 WindowSpec(Box<WindowSpec>),
814 SessionParameter(Box<SessionParameter>),
815 PseudoType(Box<PseudoType>),
816 ObjectIdentifier(Box<ObjectIdentifier>),
817 Transaction(Box<Transaction>),
818 Commit(Box<Commit>),
819 Rollback(Box<Rollback>),
820 AlterSession(Box<AlterSession>),
821 Analyze(Box<Analyze>),
822 AnalyzeStatistics(Box<AnalyzeStatistics>),
823 AnalyzeHistogram(Box<AnalyzeHistogram>),
824 AnalyzeSample(Box<AnalyzeSample>),
825 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
826 AnalyzeDelete(Box<AnalyzeDelete>),
827 AnalyzeWith(Box<AnalyzeWith>),
828 AnalyzeValidate(Box<AnalyzeValidate>),
829 AddPartition(Box<AddPartition>),
830 AttachOption(Box<AttachOption>),
831 DropPartition(Box<DropPartition>),
832 ReplacePartition(Box<ReplacePartition>),
833 DPipe(Box<DPipe>),
834 Operator(Box<Operator>),
835 PivotAny(Box<PivotAny>),
836 Aliases(Box<Aliases>),
837 AtIndex(Box<AtIndex>),
838 FromTimeZone(Box<FromTimeZone>),
839 FormatPhrase(Box<FormatPhrase>),
840 ForIn(Box<ForIn>),
841 TimeUnit(Box<TimeUnit>),
842 IntervalOp(Box<IntervalOp>),
843 IntervalSpan(Box<IntervalSpan>),
844 HavingMax(Box<HavingMax>),
845 CosineDistance(Box<CosineDistance>),
846 DotProduct(Box<DotProduct>),
847 EuclideanDistance(Box<EuclideanDistance>),
848 ManhattanDistance(Box<ManhattanDistance>),
849 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
850 Booland(Box<Booland>),
851 Boolor(Box<Boolor>),
852 ParameterizedAgg(Box<ParameterizedAgg>),
853 ArgMax(Box<ArgMax>),
854 ArgMin(Box<ArgMin>),
855 ApproxTopK(Box<ApproxTopK>),
856 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
857 ApproxTopKCombine(Box<ApproxTopKCombine>),
858 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
859 ApproxTopSum(Box<ApproxTopSum>),
860 ApproxQuantiles(Box<ApproxQuantiles>),
861 Minhash(Box<Minhash>),
862 FarmFingerprint(Box<FarmFingerprint>),
863 Float64(Box<Float64>),
864 Transform(Box<Transform>),
865 Translate(Box<Translate>),
866 Grouping(Box<Grouping>),
867 GroupingId(Box<GroupingId>),
868 Anonymous(Box<Anonymous>),
869 AnonymousAggFunc(Box<AnonymousAggFunc>),
870 CombinedAggFunc(Box<CombinedAggFunc>),
871 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
872 HashAgg(Box<HashAgg>),
873 Hll(Box<Hll>),
874 Apply(Box<Apply>),
875 ToBoolean(Box<ToBoolean>),
876 List(Box<List>),
877 ToMap(Box<ToMap>),
878 Pad(Box<Pad>),
879 ToChar(Box<ToChar>),
880 ToNumber(Box<ToNumber>),
881 ToDouble(Box<ToDouble>),
882 Int64(Box<UnaryFunc>),
883 StringFunc(Box<StringFunc>),
884 ToDecfloat(Box<ToDecfloat>),
885 TryToDecfloat(Box<TryToDecfloat>),
886 ToFile(Box<ToFile>),
887 Columns(Box<Columns>),
888 ConvertToCharset(Box<ConvertToCharset>),
889 ConvertTimezone(Box<ConvertTimezone>),
890 GenerateSeries(Box<GenerateSeries>),
891 AIAgg(Box<AIAgg>),
892 AIClassify(Box<AIClassify>),
893 ArrayAll(Box<ArrayAll>),
894 ArrayAny(Box<ArrayAny>),
895 ArrayConstructCompact(Box<ArrayConstructCompact>),
896 StPoint(Box<StPoint>),
897 StDistance(Box<StDistance>),
898 StringToArray(Box<StringToArray>),
899 ArraySum(Box<ArraySum>),
900 ObjectAgg(Box<ObjectAgg>),
901 CastToStrType(Box<CastToStrType>),
902 CheckJson(Box<CheckJson>),
903 CheckXml(Box<CheckXml>),
904 TranslateCharacters(Box<TranslateCharacters>),
905 CurrentSchemas(Box<CurrentSchemas>),
906 CurrentDatetime(Box<CurrentDatetime>),
907 Localtime(Box<Localtime>),
908 Localtimestamp(Box<Localtimestamp>),
909 Systimestamp(Box<Systimestamp>),
910 CurrentSchema(Box<CurrentSchema>),
911 CurrentUser(Box<CurrentUser>),
912 UtcTime(Box<UtcTime>),
913 UtcTimestamp(Box<UtcTimestamp>),
914 Timestamp(Box<TimestampFunc>),
915 DateBin(Box<DateBin>),
916 Datetime(Box<Datetime>),
917 DatetimeAdd(Box<DatetimeAdd>),
918 DatetimeSub(Box<DatetimeSub>),
919 DatetimeDiff(Box<DatetimeDiff>),
920 DatetimeTrunc(Box<DatetimeTrunc>),
921 Dayname(Box<Dayname>),
922 MakeInterval(Box<MakeInterval>),
923 PreviousDay(Box<PreviousDay>),
924 Elt(Box<Elt>),
925 TimestampAdd(Box<TimestampAdd>),
926 TimestampSub(Box<TimestampSub>),
927 TimestampDiff(Box<TimestampDiff>),
928 TimeSlice(Box<TimeSlice>),
929 TimeAdd(Box<TimeAdd>),
930 TimeSub(Box<TimeSub>),
931 TimeDiff(Box<TimeDiff>),
932 TimeTrunc(Box<TimeTrunc>),
933 DateFromParts(Box<DateFromParts>),
934 TimeFromParts(Box<TimeFromParts>),
935 DecodeCase(Box<DecodeCase>),
936 Decrypt(Box<Decrypt>),
937 DecryptRaw(Box<DecryptRaw>),
938 Encode(Box<Encode>),
939 Encrypt(Box<Encrypt>),
940 EncryptRaw(Box<EncryptRaw>),
941 EqualNull(Box<EqualNull>),
942 ToBinary(Box<ToBinary>),
943 Base64DecodeBinary(Box<Base64DecodeBinary>),
944 Base64DecodeString(Box<Base64DecodeString>),
945 Base64Encode(Box<Base64Encode>),
946 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
947 TryBase64DecodeString(Box<TryBase64DecodeString>),
948 GapFill(Box<GapFill>),
949 GenerateDateArray(Box<GenerateDateArray>),
950 GenerateTimestampArray(Box<GenerateTimestampArray>),
951 GetExtract(Box<GetExtract>),
952 Getbit(Box<Getbit>),
953 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
954 HexEncode(Box<HexEncode>),
955 Compress(Box<Compress>),
956 DecompressBinary(Box<DecompressBinary>),
957 DecompressString(Box<DecompressString>),
958 Xor(Box<Xor>),
959 Nullif(Box<Nullif>),
960 JSON(Box<JSON>),
961 JSONPath(Box<JSONPath>),
962 JSONPathFilter(Box<JSONPathFilter>),
963 JSONPathKey(Box<JSONPathKey>),
964 JSONPathRecursive(Box<JSONPathRecursive>),
965 JSONPathScript(Box<JSONPathScript>),
966 JSONPathSlice(Box<JSONPathSlice>),
967 JSONPathSelector(Box<JSONPathSelector>),
968 JSONPathSubscript(Box<JSONPathSubscript>),
969 JSONPathUnion(Box<JSONPathUnion>),
970 Format(Box<Format>),
971 JSONKeys(Box<JSONKeys>),
972 JSONKeyValue(Box<JSONKeyValue>),
973 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
974 JSONObject(Box<JSONObject>),
975 JSONObjectAgg(Box<JSONObjectAgg>),
976 JSONBObjectAgg(Box<JSONBObjectAgg>),
977 JSONArray(Box<JSONArray>),
978 JSONArrayAgg(Box<JSONArrayAgg>),
979 JSONExists(Box<JSONExists>),
980 JSONColumnDef(Box<JSONColumnDef>),
981 JSONSchema(Box<JSONSchema>),
982 JSONSet(Box<JSONSet>),
983 JSONStripNulls(Box<JSONStripNulls>),
984 JSONValue(Box<JSONValue>),
985 JSONValueArray(Box<JSONValueArray>),
986 JSONRemove(Box<JSONRemove>),
987 JSONTable(Box<JSONTable>),
988 JSONType(Box<JSONType>),
989 ObjectInsert(Box<ObjectInsert>),
990 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
991 OpenJSON(Box<OpenJSON>),
992 JSONBExists(Box<JSONBExists>),
993 JSONBContains(Box<BinaryFunc>),
994 JSONBExtract(Box<BinaryFunc>),
995 JSONCast(Box<JSONCast>),
996 JSONExtract(Box<JSONExtract>),
997 JSONExtractQuote(Box<JSONExtractQuote>),
998 JSONExtractArray(Box<JSONExtractArray>),
999 JSONExtractScalar(Box<JSONExtractScalar>),
1000 JSONBExtractScalar(Box<JSONBExtractScalar>),
1001 JSONFormat(Box<JSONFormat>),
1002 JSONBool(Box<UnaryFunc>),
1003 JSONPathRoot(JSONPathRoot),
1004 JSONArrayAppend(Box<JSONArrayAppend>),
1005 JSONArrayContains(Box<JSONArrayContains>),
1006 JSONArrayInsert(Box<JSONArrayInsert>),
1007 ParseJSON(Box<ParseJSON>),
1008 ParseUrl(Box<ParseUrl>),
1009 ParseIp(Box<ParseIp>),
1010 ParseTime(Box<ParseTime>),
1011 ParseDatetime(Box<ParseDatetime>),
1012 Map(Box<Map>),
1013 MapCat(Box<MapCat>),
1014 MapDelete(Box<MapDelete>),
1015 MapInsert(Box<MapInsert>),
1016 MapPick(Box<MapPick>),
1017 ScopeResolution(Box<ScopeResolution>),
1018 Slice(Box<Slice>),
1019 VarMap(Box<VarMap>),
1020 MatchAgainst(Box<MatchAgainst>),
1021 MD5Digest(Box<MD5Digest>),
1022 MD5NumberLower64(Box<UnaryFunc>),
1023 MD5NumberUpper64(Box<UnaryFunc>),
1024 Monthname(Box<Monthname>),
1025 Ntile(Box<Ntile>),
1026 Normalize(Box<Normalize>),
1027 Normal(Box<Normal>),
1028 Predict(Box<Predict>),
1029 MLTranslate(Box<MLTranslate>),
1030 FeaturesAtTime(Box<FeaturesAtTime>),
1031 GenerateEmbedding(Box<GenerateEmbedding>),
1032 MLForecast(Box<MLForecast>),
1033 ModelAttribute(Box<ModelAttribute>),
1034 VectorSearch(Box<VectorSearch>),
1035 Quantile(Box<Quantile>),
1036 ApproxQuantile(Box<ApproxQuantile>),
1037 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1038 Randn(Box<Randn>),
1039 Randstr(Box<Randstr>),
1040 RangeN(Box<RangeN>),
1041 RangeBucket(Box<RangeBucket>),
1042 ReadCSV(Box<ReadCSV>),
1043 ReadParquet(Box<ReadParquet>),
1044 Reduce(Box<Reduce>),
1045 RegexpExtractAll(Box<RegexpExtractAll>),
1046 RegexpILike(Box<RegexpILike>),
1047 RegexpFullMatch(Box<RegexpFullMatch>),
1048 RegexpInstr(Box<RegexpInstr>),
1049 RegexpSplit(Box<RegexpSplit>),
1050 RegexpCount(Box<RegexpCount>),
1051 RegrValx(Box<RegrValx>),
1052 RegrValy(Box<RegrValy>),
1053 RegrAvgy(Box<RegrAvgy>),
1054 RegrAvgx(Box<RegrAvgx>),
1055 RegrCount(Box<RegrCount>),
1056 RegrIntercept(Box<RegrIntercept>),
1057 RegrR2(Box<RegrR2>),
1058 RegrSxx(Box<RegrSxx>),
1059 RegrSxy(Box<RegrSxy>),
1060 RegrSyy(Box<RegrSyy>),
1061 RegrSlope(Box<RegrSlope>),
1062 SafeAdd(Box<SafeAdd>),
1063 SafeDivide(Box<SafeDivide>),
1064 SafeMultiply(Box<SafeMultiply>),
1065 SafeSubtract(Box<SafeSubtract>),
1066 SHA2(Box<SHA2>),
1067 SHA2Digest(Box<SHA2Digest>),
1068 SortArray(Box<SortArray>),
1069 SplitPart(Box<SplitPart>),
1070 SubstringIndex(Box<SubstringIndex>),
1071 StandardHash(Box<StandardHash>),
1072 StrPosition(Box<StrPosition>),
1073 Search(Box<Search>),
1074 SearchIp(Box<SearchIp>),
1075 StrToDate(Box<StrToDate>),
1076 DateStrToDate(Box<UnaryFunc>),
1077 DateToDateStr(Box<UnaryFunc>),
1078 StrToTime(Box<StrToTime>),
1079 StrToUnix(Box<StrToUnix>),
1080 StrToMap(Box<StrToMap>),
1081 NumberToStr(Box<NumberToStr>),
1082 FromBase(Box<FromBase>),
1083 Stuff(Box<Stuff>),
1084 TimeToStr(Box<TimeToStr>),
1085 TimeStrToTime(Box<TimeStrToTime>),
1086 TsOrDsAdd(Box<TsOrDsAdd>),
1087 TsOrDsDiff(Box<TsOrDsDiff>),
1088 TsOrDsToDate(Box<TsOrDsToDate>),
1089 TsOrDsToTime(Box<TsOrDsToTime>),
1090 Unhex(Box<Unhex>),
1091 Uniform(Box<Uniform>),
1092 UnixToStr(Box<UnixToStr>),
1093 UnixToTime(Box<UnixToTime>),
1094 Uuid(Box<Uuid>),
1095 TimestampFromParts(Box<TimestampFromParts>),
1096 TimestampTzFromParts(Box<TimestampTzFromParts>),
1097 Corr(Box<Corr>),
1098 WidthBucket(Box<WidthBucket>),
1099 CovarSamp(Box<CovarSamp>),
1100 CovarPop(Box<CovarPop>),
1101 Week(Box<Week>),
1102 XMLElement(Box<XMLElement>),
1103 XMLGet(Box<XMLGet>),
1104 XMLTable(Box<XMLTable>),
1105 XMLKeyValueOption(Box<XMLKeyValueOption>),
1106 Zipf(Box<Zipf>),
1107 Merge(Box<Merge>),
1108 When(Box<When>),
1109 Whens(Box<Whens>),
1110 NextValueFor(Box<NextValueFor>),
1111 ReturnStmt(Box<Expression>),
1113}
1114
1115impl Expression {
1116 #[inline]
1118 pub fn boxed_column(col: Column) -> Self {
1119 Expression::Column(Box::new(col))
1120 }
1121
1122 #[inline]
1124 pub fn boxed_table(t: TableRef) -> Self {
1125 Expression::Table(Box::new(t))
1126 }
1127
1128 pub fn is_statement(&self) -> bool {
1135 match self {
1136 Expression::Select(_)
1138 | Expression::Union(_)
1139 | Expression::Intersect(_)
1140 | Expression::Except(_)
1141 | Expression::Subquery(_)
1142 | Expression::Values(_)
1143 | Expression::PipeOperator(_)
1144
1145 | Expression::Insert(_)
1147 | Expression::Update(_)
1148 | Expression::Delete(_)
1149 | Expression::Copy(_)
1150 | Expression::Put(_)
1151 | Expression::Merge(_)
1152 | Expression::TryCatch(_)
1153
1154 | Expression::CreateTable(_)
1156 | Expression::DropTable(_)
1157 | Expression::Undrop(_)
1158 | Expression::AlterTable(_)
1159 | Expression::CreateIndex(_)
1160 | Expression::DropIndex(_)
1161 | Expression::CreateView(_)
1162 | Expression::DropView(_)
1163 | Expression::AlterView(_)
1164 | Expression::AlterIndex(_)
1165 | Expression::Truncate(_)
1166 | Expression::TruncateTable(_)
1167 | Expression::CreateSchema(_)
1168 | Expression::DropSchema(_)
1169 | Expression::DropNamespace(_)
1170 | Expression::CreateDatabase(_)
1171 | Expression::DropDatabase(_)
1172 | Expression::CreateFunction(_)
1173 | Expression::DropFunction(_)
1174 | Expression::CreateProcedure(_)
1175 | Expression::DropProcedure(_)
1176 | Expression::CreateSequence(_)
1177 | Expression::CreateSynonym(_)
1178 | Expression::DropSequence(_)
1179 | Expression::AlterSequence(_)
1180 | Expression::CreateTrigger(_)
1181 | Expression::DropTrigger(_)
1182 | Expression::CreateType(_)
1183 | Expression::DropType(_)
1184 | Expression::Comment(_)
1185
1186 | Expression::Use(_)
1188 | Expression::Set(_)
1189 | Expression::SetStatement(_)
1190 | Expression::Transaction(_)
1191 | Expression::Commit(_)
1192 | Expression::Rollback(_)
1193 | Expression::Grant(_)
1194 | Expression::Revoke(_)
1195 | Expression::Cache(_)
1196 | Expression::Uncache(_)
1197 | Expression::LoadData(_)
1198 | Expression::Pragma(_)
1199 | Expression::Describe(_)
1200 | Expression::Show(_)
1201 | Expression::Kill(_)
1202 | Expression::Prepare(_)
1203 | Expression::Execute(_)
1204 | Expression::Declare(_)
1205 | Expression::Refresh(_)
1206 | Expression::AlterSession(_)
1207 | Expression::LockingStatement(_)
1208
1209 | Expression::Analyze(_)
1211 | Expression::AnalyzeStatistics(_)
1212 | Expression::AnalyzeHistogram(_)
1213 | Expression::AnalyzeSample(_)
1214 | Expression::AnalyzeListChainedRows(_)
1215 | Expression::AnalyzeDelete(_)
1216
1217 | Expression::Attach(_)
1219 | Expression::Detach(_)
1220 | Expression::Install(_)
1221 | Expression::Summarize(_)
1222
1223 | Expression::Pivot(_)
1225 | Expression::Unpivot(_)
1226
1227 | Expression::Command(_)
1229 | Expression::Raw(_)
1230 | Expression::CreateTask(_)
1231
1232 | Expression::ReturnStmt(_) => true,
1234
1235 Expression::Annotated(a) => a.this.is_statement(),
1237
1238 Expression::Alias(a) => a.this.is_statement(),
1240
1241 _ => false,
1243 }
1244 }
1245
1246 pub fn number(n: i64) -> Self {
1248 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1249 }
1250
1251 pub fn string(s: impl Into<String>) -> Self {
1253 Expression::Literal(Box::new(Literal::String(s.into())))
1254 }
1255
1256 pub fn float(f: f64) -> Self {
1258 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1259 }
1260
1261 pub fn inferred_type(&self) -> Option<&DataType> {
1267 match self {
1268 Expression::And(op)
1270 | Expression::Or(op)
1271 | Expression::Add(op)
1272 | Expression::Sub(op)
1273 | Expression::Mul(op)
1274 | Expression::Div(op)
1275 | Expression::Mod(op)
1276 | Expression::Eq(op)
1277 | Expression::Neq(op)
1278 | Expression::Lt(op)
1279 | Expression::Lte(op)
1280 | Expression::Gt(op)
1281 | Expression::Gte(op)
1282 | Expression::Concat(op)
1283 | Expression::BitwiseAnd(op)
1284 | Expression::BitwiseOr(op)
1285 | Expression::BitwiseXor(op)
1286 | Expression::Adjacent(op)
1287 | Expression::TsMatch(op)
1288 | Expression::PropertyEQ(op)
1289 | Expression::ArrayContainsAll(op)
1290 | Expression::ArrayContainedBy(op)
1291 | Expression::ArrayOverlaps(op)
1292 | Expression::JSONBContainsAllTopKeys(op)
1293 | Expression::JSONBContainsAnyTopKeys(op)
1294 | Expression::JSONBDeleteAtPath(op)
1295 | Expression::ExtendsLeft(op)
1296 | Expression::ExtendsRight(op)
1297 | Expression::Is(op)
1298 | Expression::MemberOf(op)
1299 | Expression::Match(op)
1300 | Expression::NullSafeEq(op)
1301 | Expression::NullSafeNeq(op)
1302 | Expression::Glob(op)
1303 | Expression::BitwiseLeftShift(op)
1304 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1305
1306 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1307 op.inferred_type.as_ref()
1308 }
1309
1310 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1311
1312 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1313 c.inferred_type.as_ref()
1314 }
1315
1316 Expression::Column(c) => c.inferred_type.as_ref(),
1317 Expression::Function(f) => f.inferred_type.as_ref(),
1318 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1319 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1320 Expression::Case(c) => c.inferred_type.as_ref(),
1321 Expression::Subquery(s) => s.inferred_type.as_ref(),
1322 Expression::Alias(a) => a.inferred_type.as_ref(),
1323 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1324 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1325 Expression::Count(f) => f.inferred_type.as_ref(),
1326 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1327 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1328 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1329 Expression::SumIf(f) => f.inferred_type.as_ref(),
1330
1331 Expression::Upper(f)
1333 | Expression::Lower(f)
1334 | Expression::Length(f)
1335 | Expression::LTrim(f)
1336 | Expression::RTrim(f)
1337 | Expression::Reverse(f)
1338 | Expression::Abs(f)
1339 | Expression::Sqrt(f)
1340 | Expression::Cbrt(f)
1341 | Expression::Ln(f)
1342 | Expression::Exp(f)
1343 | Expression::Sign(f)
1344 | Expression::Date(f)
1345 | Expression::Time(f)
1346 | Expression::Initcap(f)
1347 | Expression::Ascii(f)
1348 | Expression::Chr(f)
1349 | Expression::Soundex(f)
1350 | Expression::ByteLength(f)
1351 | Expression::Hex(f)
1352 | Expression::LowerHex(f)
1353 | Expression::Unicode(f)
1354 | Expression::Typeof(f)
1355 | Expression::Explode(f)
1356 | Expression::ExplodeOuter(f)
1357 | Expression::MapFromEntries(f)
1358 | Expression::MapKeys(f)
1359 | Expression::MapValues(f)
1360 | Expression::ArrayLength(f)
1361 | Expression::ArraySize(f)
1362 | Expression::Cardinality(f)
1363 | Expression::ArrayReverse(f)
1364 | Expression::ArrayDistinct(f)
1365 | Expression::ArrayFlatten(f)
1366 | Expression::ArrayCompact(f)
1367 | Expression::ToArray(f)
1368 | Expression::JsonArrayLength(f)
1369 | Expression::JsonKeys(f)
1370 | Expression::JsonType(f)
1371 | Expression::ParseJson(f)
1372 | Expression::ToJson(f)
1373 | Expression::Radians(f)
1374 | Expression::Degrees(f)
1375 | Expression::Sin(f)
1376 | Expression::Cos(f)
1377 | Expression::Tan(f)
1378 | Expression::Asin(f)
1379 | Expression::Acos(f)
1380 | Expression::Atan(f)
1381 | Expression::IsNan(f)
1382 | Expression::IsInf(f)
1383 | Expression::Year(f)
1384 | Expression::Month(f)
1385 | Expression::Day(f)
1386 | Expression::Hour(f)
1387 | Expression::Minute(f)
1388 | Expression::Second(f)
1389 | Expression::DayOfWeek(f)
1390 | Expression::DayOfWeekIso(f)
1391 | Expression::DayOfMonth(f)
1392 | Expression::DayOfYear(f)
1393 | Expression::WeekOfYear(f)
1394 | Expression::Quarter(f)
1395 | Expression::Epoch(f)
1396 | Expression::EpochMs(f)
1397 | Expression::BitwiseCount(f)
1398 | Expression::DateFromUnixDate(f)
1399 | Expression::UnixDate(f)
1400 | Expression::UnixSeconds(f)
1401 | Expression::UnixMillis(f)
1402 | Expression::UnixMicros(f)
1403 | Expression::TimeStrToDate(f)
1404 | Expression::DateToDi(f)
1405 | Expression::DiToDate(f)
1406 | Expression::TsOrDiToDi(f)
1407 | Expression::TsOrDsToDatetime(f)
1408 | Expression::TsOrDsToTimestamp(f)
1409 | Expression::YearOfWeek(f)
1410 | Expression::YearOfWeekIso(f)
1411 | Expression::SHA(f)
1412 | Expression::SHA1Digest(f)
1413 | Expression::TimeToUnix(f)
1414 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1415
1416 Expression::Power(f)
1418 | Expression::NullIf(f)
1419 | Expression::IfNull(f)
1420 | Expression::Nvl(f)
1421 | Expression::Contains(f)
1422 | Expression::StartsWith(f)
1423 | Expression::EndsWith(f)
1424 | Expression::Levenshtein(f)
1425 | Expression::ModFunc(f)
1426 | Expression::IntDiv(f)
1427 | Expression::Atan2(f)
1428 | Expression::AddMonths(f)
1429 | Expression::MonthsBetween(f)
1430 | Expression::NextDay(f)
1431 | Expression::UnixToTimeStr(f)
1432 | Expression::ArrayContains(f)
1433 | Expression::ArrayPosition(f)
1434 | Expression::ArrayAppend(f)
1435 | Expression::ArrayPrepend(f)
1436 | Expression::ArrayUnion(f)
1437 | Expression::ArrayExcept(f)
1438 | Expression::ArrayRemove(f)
1439 | Expression::StarMap(f)
1440 | Expression::MapFromArrays(f)
1441 | Expression::MapContainsKey(f)
1442 | Expression::ElementAt(f)
1443 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1444
1445 Expression::Coalesce(f)
1447 | Expression::Greatest(f)
1448 | Expression::Least(f)
1449 | Expression::ArrayConcat(f)
1450 | Expression::ArrayIntersect(f)
1451 | Expression::ArrayZip(f)
1452 | Expression::MapConcat(f)
1453 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1454
1455 Expression::Sum(f)
1457 | Expression::Avg(f)
1458 | Expression::Min(f)
1459 | Expression::Max(f)
1460 | Expression::ArrayAgg(f)
1461 | Expression::CountIf(f)
1462 | Expression::Stddev(f)
1463 | Expression::StddevPop(f)
1464 | Expression::StddevSamp(f)
1465 | Expression::Variance(f)
1466 | Expression::VarPop(f)
1467 | Expression::VarSamp(f)
1468 | Expression::Median(f)
1469 | Expression::Mode(f)
1470 | Expression::First(f)
1471 | Expression::Last(f)
1472 | Expression::AnyValue(f)
1473 | Expression::ApproxDistinct(f)
1474 | Expression::ApproxCountDistinct(f)
1475 | Expression::LogicalAnd(f)
1476 | Expression::LogicalOr(f)
1477 | Expression::Skewness(f)
1478 | Expression::ArrayConcatAgg(f)
1479 | Expression::ArrayUniqueAgg(f)
1480 | Expression::BoolXorAgg(f)
1481 | Expression::BitwiseAndAgg(f)
1482 | Expression::BitwiseOrAgg(f)
1483 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1484
1485 _ => None,
1487 }
1488 }
1489
1490 pub fn set_inferred_type(&mut self, dt: DataType) {
1495 match self {
1496 Expression::And(op)
1497 | Expression::Or(op)
1498 | Expression::Add(op)
1499 | Expression::Sub(op)
1500 | Expression::Mul(op)
1501 | Expression::Div(op)
1502 | Expression::Mod(op)
1503 | Expression::Eq(op)
1504 | Expression::Neq(op)
1505 | Expression::Lt(op)
1506 | Expression::Lte(op)
1507 | Expression::Gt(op)
1508 | Expression::Gte(op)
1509 | Expression::Concat(op)
1510 | Expression::BitwiseAnd(op)
1511 | Expression::BitwiseOr(op)
1512 | Expression::BitwiseXor(op)
1513 | Expression::Adjacent(op)
1514 | Expression::TsMatch(op)
1515 | Expression::PropertyEQ(op)
1516 | Expression::ArrayContainsAll(op)
1517 | Expression::ArrayContainedBy(op)
1518 | Expression::ArrayOverlaps(op)
1519 | Expression::JSONBContainsAllTopKeys(op)
1520 | Expression::JSONBContainsAnyTopKeys(op)
1521 | Expression::JSONBDeleteAtPath(op)
1522 | Expression::ExtendsLeft(op)
1523 | Expression::ExtendsRight(op)
1524 | Expression::Is(op)
1525 | Expression::MemberOf(op)
1526 | Expression::Match(op)
1527 | Expression::NullSafeEq(op)
1528 | Expression::NullSafeNeq(op)
1529 | Expression::Glob(op)
1530 | Expression::BitwiseLeftShift(op)
1531 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1532
1533 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1534 op.inferred_type = Some(dt)
1535 }
1536
1537 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1538
1539 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1540 c.inferred_type = Some(dt)
1541 }
1542
1543 Expression::Column(c) => c.inferred_type = Some(dt),
1544 Expression::Function(f) => f.inferred_type = Some(dt),
1545 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1546 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1547 Expression::Case(c) => c.inferred_type = Some(dt),
1548 Expression::Subquery(s) => s.inferred_type = Some(dt),
1549 Expression::Alias(a) => a.inferred_type = Some(dt),
1550 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1551 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1552 Expression::Count(f) => f.inferred_type = Some(dt),
1553 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1554 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1555 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1556 Expression::SumIf(f) => f.inferred_type = Some(dt),
1557
1558 Expression::Upper(f)
1560 | Expression::Lower(f)
1561 | Expression::Length(f)
1562 | Expression::LTrim(f)
1563 | Expression::RTrim(f)
1564 | Expression::Reverse(f)
1565 | Expression::Abs(f)
1566 | Expression::Sqrt(f)
1567 | Expression::Cbrt(f)
1568 | Expression::Ln(f)
1569 | Expression::Exp(f)
1570 | Expression::Sign(f)
1571 | Expression::Date(f)
1572 | Expression::Time(f)
1573 | Expression::Initcap(f)
1574 | Expression::Ascii(f)
1575 | Expression::Chr(f)
1576 | Expression::Soundex(f)
1577 | Expression::ByteLength(f)
1578 | Expression::Hex(f)
1579 | Expression::LowerHex(f)
1580 | Expression::Unicode(f)
1581 | Expression::Typeof(f)
1582 | Expression::Explode(f)
1583 | Expression::ExplodeOuter(f)
1584 | Expression::MapFromEntries(f)
1585 | Expression::MapKeys(f)
1586 | Expression::MapValues(f)
1587 | Expression::ArrayLength(f)
1588 | Expression::ArraySize(f)
1589 | Expression::Cardinality(f)
1590 | Expression::ArrayReverse(f)
1591 | Expression::ArrayDistinct(f)
1592 | Expression::ArrayFlatten(f)
1593 | Expression::ArrayCompact(f)
1594 | Expression::ToArray(f)
1595 | Expression::JsonArrayLength(f)
1596 | Expression::JsonKeys(f)
1597 | Expression::JsonType(f)
1598 | Expression::ParseJson(f)
1599 | Expression::ToJson(f)
1600 | Expression::Radians(f)
1601 | Expression::Degrees(f)
1602 | Expression::Sin(f)
1603 | Expression::Cos(f)
1604 | Expression::Tan(f)
1605 | Expression::Asin(f)
1606 | Expression::Acos(f)
1607 | Expression::Atan(f)
1608 | Expression::IsNan(f)
1609 | Expression::IsInf(f)
1610 | Expression::Year(f)
1611 | Expression::Month(f)
1612 | Expression::Day(f)
1613 | Expression::Hour(f)
1614 | Expression::Minute(f)
1615 | Expression::Second(f)
1616 | Expression::DayOfWeek(f)
1617 | Expression::DayOfWeekIso(f)
1618 | Expression::DayOfMonth(f)
1619 | Expression::DayOfYear(f)
1620 | Expression::WeekOfYear(f)
1621 | Expression::Quarter(f)
1622 | Expression::Epoch(f)
1623 | Expression::EpochMs(f)
1624 | Expression::BitwiseCount(f)
1625 | Expression::DateFromUnixDate(f)
1626 | Expression::UnixDate(f)
1627 | Expression::UnixSeconds(f)
1628 | Expression::UnixMillis(f)
1629 | Expression::UnixMicros(f)
1630 | Expression::TimeStrToDate(f)
1631 | Expression::DateToDi(f)
1632 | Expression::DiToDate(f)
1633 | Expression::TsOrDiToDi(f)
1634 | Expression::TsOrDsToDatetime(f)
1635 | Expression::TsOrDsToTimestamp(f)
1636 | Expression::YearOfWeek(f)
1637 | Expression::YearOfWeekIso(f)
1638 | Expression::SHA(f)
1639 | Expression::SHA1Digest(f)
1640 | Expression::TimeToUnix(f)
1641 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1642
1643 Expression::Power(f)
1645 | Expression::NullIf(f)
1646 | Expression::IfNull(f)
1647 | Expression::Nvl(f)
1648 | Expression::Contains(f)
1649 | Expression::StartsWith(f)
1650 | Expression::EndsWith(f)
1651 | Expression::Levenshtein(f)
1652 | Expression::ModFunc(f)
1653 | Expression::IntDiv(f)
1654 | Expression::Atan2(f)
1655 | Expression::AddMonths(f)
1656 | Expression::MonthsBetween(f)
1657 | Expression::NextDay(f)
1658 | Expression::UnixToTimeStr(f)
1659 | Expression::ArrayContains(f)
1660 | Expression::ArrayPosition(f)
1661 | Expression::ArrayAppend(f)
1662 | Expression::ArrayPrepend(f)
1663 | Expression::ArrayUnion(f)
1664 | Expression::ArrayExcept(f)
1665 | Expression::ArrayRemove(f)
1666 | Expression::StarMap(f)
1667 | Expression::MapFromArrays(f)
1668 | Expression::MapContainsKey(f)
1669 | Expression::ElementAt(f)
1670 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1671
1672 Expression::Coalesce(f)
1674 | Expression::Greatest(f)
1675 | Expression::Least(f)
1676 | Expression::ArrayConcat(f)
1677 | Expression::ArrayIntersect(f)
1678 | Expression::ArrayZip(f)
1679 | Expression::MapConcat(f)
1680 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1681
1682 Expression::Sum(f)
1684 | Expression::Avg(f)
1685 | Expression::Min(f)
1686 | Expression::Max(f)
1687 | Expression::ArrayAgg(f)
1688 | Expression::CountIf(f)
1689 | Expression::Stddev(f)
1690 | Expression::StddevPop(f)
1691 | Expression::StddevSamp(f)
1692 | Expression::Variance(f)
1693 | Expression::VarPop(f)
1694 | Expression::VarSamp(f)
1695 | Expression::Median(f)
1696 | Expression::Mode(f)
1697 | Expression::First(f)
1698 | Expression::Last(f)
1699 | Expression::AnyValue(f)
1700 | Expression::ApproxDistinct(f)
1701 | Expression::ApproxCountDistinct(f)
1702 | Expression::LogicalAnd(f)
1703 | Expression::LogicalOr(f)
1704 | Expression::Skewness(f)
1705 | Expression::ArrayConcatAgg(f)
1706 | Expression::ArrayUniqueAgg(f)
1707 | Expression::BoolXorAgg(f)
1708 | Expression::BitwiseAndAgg(f)
1709 | Expression::BitwiseOrAgg(f)
1710 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1711
1712 _ => {}
1714 }
1715 }
1716
1717 pub fn column(name: impl Into<String>) -> Self {
1719 Expression::Column(Box::new(Column {
1720 name: Identifier::new(name),
1721 table: None,
1722 join_mark: false,
1723 trailing_comments: Vec::new(),
1724 span: None,
1725 inferred_type: None,
1726 }))
1727 }
1728
1729 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1731 Expression::Column(Box::new(Column {
1732 name: Identifier::new(column),
1733 table: Some(Identifier::new(table)),
1734 join_mark: false,
1735 trailing_comments: Vec::new(),
1736 span: None,
1737 inferred_type: None,
1738 }))
1739 }
1740
1741 pub fn identifier(name: impl Into<String>) -> Self {
1743 Expression::Identifier(Identifier::new(name))
1744 }
1745
1746 pub fn null() -> Self {
1748 Expression::Null(Null)
1749 }
1750
1751 pub fn true_() -> Self {
1753 Expression::Boolean(BooleanLiteral { value: true })
1754 }
1755
1756 pub fn false_() -> Self {
1758 Expression::Boolean(BooleanLiteral { value: false })
1759 }
1760
1761 pub fn star() -> Self {
1763 Expression::Star(Star {
1764 table: None,
1765 except: None,
1766 replace: None,
1767 rename: None,
1768 trailing_comments: Vec::new(),
1769 span: None,
1770 })
1771 }
1772
1773 pub fn alias(self, name: impl Into<String>) -> Self {
1775 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1776 }
1777
1778 pub fn is_select(&self) -> bool {
1780 matches!(self, Expression::Select(_))
1781 }
1782
1783 pub fn as_select(&self) -> Option<&Select> {
1785 match self {
1786 Expression::Select(s) => Some(s),
1787 _ => None,
1788 }
1789 }
1790
1791 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1793 match self {
1794 Expression::Select(s) => Some(s),
1795 _ => None,
1796 }
1797 }
1798
1799 #[cfg(feature = "generate")]
1804 pub fn sql(&self) -> String {
1805 crate::generator::Generator::sql(self).unwrap_or_default()
1806 }
1807
1808 #[cfg(feature = "generate")]
1814 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1815 crate::generate(self, dialect).unwrap_or_default()
1816 }
1817}
1818
1819impl Expression {
1822 pub fn variant_name(&self) -> &'static str {
1825 match self {
1826 Expression::Literal(_) => "literal",
1827 Expression::Boolean(_) => "boolean",
1828 Expression::Null(_) => "null",
1829 Expression::Identifier(_) => "identifier",
1830 Expression::Column(_) => "column",
1831 Expression::Table(_) => "table",
1832 Expression::Star(_) => "star",
1833 Expression::BracedWildcard(_) => "braced_wildcard",
1834 Expression::Select(_) => "select",
1835 Expression::Union(_) => "union",
1836 Expression::Intersect(_) => "intersect",
1837 Expression::Except(_) => "except",
1838 Expression::Subquery(_) => "subquery",
1839 Expression::PipeOperator(_) => "pipe_operator",
1840 Expression::Pivot(_) => "pivot",
1841 Expression::PivotAlias(_) => "pivot_alias",
1842 Expression::Unpivot(_) => "unpivot",
1843 Expression::Values(_) => "values",
1844 Expression::PreWhere(_) => "pre_where",
1845 Expression::Stream(_) => "stream",
1846 Expression::UsingData(_) => "using_data",
1847 Expression::XmlNamespace(_) => "xml_namespace",
1848 Expression::Insert(_) => "insert",
1849 Expression::Update(_) => "update",
1850 Expression::Delete(_) => "delete",
1851 Expression::Copy(_) => "copy",
1852 Expression::Put(_) => "put",
1853 Expression::StageReference(_) => "stage_reference",
1854 Expression::Alias(_) => "alias",
1855 Expression::Cast(_) => "cast",
1856 Expression::Collation(_) => "collation",
1857 Expression::Case(_) => "case",
1858 Expression::And(_) => "and",
1859 Expression::Or(_) => "or",
1860 Expression::Add(_) => "add",
1861 Expression::Sub(_) => "sub",
1862 Expression::Mul(_) => "mul",
1863 Expression::Div(_) => "div",
1864 Expression::Mod(_) => "mod",
1865 Expression::Eq(_) => "eq",
1866 Expression::Neq(_) => "neq",
1867 Expression::Lt(_) => "lt",
1868 Expression::Lte(_) => "lte",
1869 Expression::Gt(_) => "gt",
1870 Expression::Gte(_) => "gte",
1871 Expression::Like(_) => "like",
1872 Expression::ILike(_) => "i_like",
1873 Expression::Match(_) => "match",
1874 Expression::BitwiseAnd(_) => "bitwise_and",
1875 Expression::BitwiseOr(_) => "bitwise_or",
1876 Expression::BitwiseXor(_) => "bitwise_xor",
1877 Expression::Concat(_) => "concat",
1878 Expression::Adjacent(_) => "adjacent",
1879 Expression::TsMatch(_) => "ts_match",
1880 Expression::PropertyEQ(_) => "property_e_q",
1881 Expression::ArrayContainsAll(_) => "array_contains_all",
1882 Expression::ArrayContainedBy(_) => "array_contained_by",
1883 Expression::ArrayOverlaps(_) => "array_overlaps",
1884 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1885 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1886 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1887 Expression::ExtendsLeft(_) => "extends_left",
1888 Expression::ExtendsRight(_) => "extends_right",
1889 Expression::Not(_) => "not",
1890 Expression::Neg(_) => "neg",
1891 Expression::BitwiseNot(_) => "bitwise_not",
1892 Expression::In(_) => "in",
1893 Expression::Between(_) => "between",
1894 Expression::IsNull(_) => "is_null",
1895 Expression::IsTrue(_) => "is_true",
1896 Expression::IsFalse(_) => "is_false",
1897 Expression::IsJson(_) => "is_json",
1898 Expression::Is(_) => "is",
1899 Expression::Exists(_) => "exists",
1900 Expression::MemberOf(_) => "member_of",
1901 Expression::Function(_) => "function",
1902 Expression::AggregateFunction(_) => "aggregate_function",
1903 Expression::WindowFunction(_) => "window_function",
1904 Expression::From(_) => "from",
1905 Expression::Join(_) => "join",
1906 Expression::JoinedTable(_) => "joined_table",
1907 Expression::Where(_) => "where",
1908 Expression::GroupBy(_) => "group_by",
1909 Expression::Having(_) => "having",
1910 Expression::OrderBy(_) => "order_by",
1911 Expression::Limit(_) => "limit",
1912 Expression::Offset(_) => "offset",
1913 Expression::Qualify(_) => "qualify",
1914 Expression::With(_) => "with",
1915 Expression::Cte(_) => "cte",
1916 Expression::DistributeBy(_) => "distribute_by",
1917 Expression::ClusterBy(_) => "cluster_by",
1918 Expression::SortBy(_) => "sort_by",
1919 Expression::LateralView(_) => "lateral_view",
1920 Expression::Hint(_) => "hint",
1921 Expression::Pseudocolumn(_) => "pseudocolumn",
1922 Expression::Connect(_) => "connect",
1923 Expression::Prior(_) => "prior",
1924 Expression::ConnectByRoot(_) => "connect_by_root",
1925 Expression::MatchRecognize(_) => "match_recognize",
1926 Expression::Ordered(_) => "ordered",
1927 Expression::Window(_) => "window",
1928 Expression::Over(_) => "over",
1929 Expression::WithinGroup(_) => "within_group",
1930 Expression::DataType(_) => "data_type",
1931 Expression::Array(_) => "array",
1932 Expression::Struct(_) => "struct",
1933 Expression::Tuple(_) => "tuple",
1934 Expression::Interval(_) => "interval",
1935 Expression::ConcatWs(_) => "concat_ws",
1936 Expression::Substring(_) => "substring",
1937 Expression::Upper(_) => "upper",
1938 Expression::Lower(_) => "lower",
1939 Expression::Length(_) => "length",
1940 Expression::Trim(_) => "trim",
1941 Expression::LTrim(_) => "l_trim",
1942 Expression::RTrim(_) => "r_trim",
1943 Expression::Replace(_) => "replace",
1944 Expression::Reverse(_) => "reverse",
1945 Expression::Left(_) => "left",
1946 Expression::Right(_) => "right",
1947 Expression::Repeat(_) => "repeat",
1948 Expression::Lpad(_) => "lpad",
1949 Expression::Rpad(_) => "rpad",
1950 Expression::Split(_) => "split",
1951 Expression::RegexpLike(_) => "regexp_like",
1952 Expression::RegexpReplace(_) => "regexp_replace",
1953 Expression::RegexpExtract(_) => "regexp_extract",
1954 Expression::Overlay(_) => "overlay",
1955 Expression::Abs(_) => "abs",
1956 Expression::Round(_) => "round",
1957 Expression::Floor(_) => "floor",
1958 Expression::Ceil(_) => "ceil",
1959 Expression::Power(_) => "power",
1960 Expression::Sqrt(_) => "sqrt",
1961 Expression::Cbrt(_) => "cbrt",
1962 Expression::Ln(_) => "ln",
1963 Expression::Log(_) => "log",
1964 Expression::Exp(_) => "exp",
1965 Expression::Sign(_) => "sign",
1966 Expression::Greatest(_) => "greatest",
1967 Expression::Least(_) => "least",
1968 Expression::CurrentDate(_) => "current_date",
1969 Expression::CurrentTime(_) => "current_time",
1970 Expression::CurrentTimestamp(_) => "current_timestamp",
1971 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1972 Expression::AtTimeZone(_) => "at_time_zone",
1973 Expression::DateAdd(_) => "date_add",
1974 Expression::DateSub(_) => "date_sub",
1975 Expression::DateDiff(_) => "date_diff",
1976 Expression::DateTrunc(_) => "date_trunc",
1977 Expression::Extract(_) => "extract",
1978 Expression::ToDate(_) => "to_date",
1979 Expression::ToTimestamp(_) => "to_timestamp",
1980 Expression::Date(_) => "date",
1981 Expression::Time(_) => "time",
1982 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1983 Expression::UnixDate(_) => "unix_date",
1984 Expression::UnixSeconds(_) => "unix_seconds",
1985 Expression::UnixMillis(_) => "unix_millis",
1986 Expression::UnixMicros(_) => "unix_micros",
1987 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1988 Expression::TimeStrToDate(_) => "time_str_to_date",
1989 Expression::DateToDi(_) => "date_to_di",
1990 Expression::DiToDate(_) => "di_to_date",
1991 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1992 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1993 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1994 Expression::YearOfWeek(_) => "year_of_week",
1995 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1996 Expression::Coalesce(_) => "coalesce",
1997 Expression::NullIf(_) => "null_if",
1998 Expression::IfFunc(_) => "if_func",
1999 Expression::IfNull(_) => "if_null",
2000 Expression::Nvl(_) => "nvl",
2001 Expression::Nvl2(_) => "nvl2",
2002 Expression::TryCast(_) => "try_cast",
2003 Expression::SafeCast(_) => "safe_cast",
2004 Expression::Count(_) => "count",
2005 Expression::Sum(_) => "sum",
2006 Expression::Avg(_) => "avg",
2007 Expression::Min(_) => "min",
2008 Expression::Max(_) => "max",
2009 Expression::GroupConcat(_) => "group_concat",
2010 Expression::StringAgg(_) => "string_agg",
2011 Expression::ListAgg(_) => "list_agg",
2012 Expression::ArrayAgg(_) => "array_agg",
2013 Expression::CountIf(_) => "count_if",
2014 Expression::SumIf(_) => "sum_if",
2015 Expression::Stddev(_) => "stddev",
2016 Expression::StddevPop(_) => "stddev_pop",
2017 Expression::StddevSamp(_) => "stddev_samp",
2018 Expression::Variance(_) => "variance",
2019 Expression::VarPop(_) => "var_pop",
2020 Expression::VarSamp(_) => "var_samp",
2021 Expression::Median(_) => "median",
2022 Expression::Mode(_) => "mode",
2023 Expression::First(_) => "first",
2024 Expression::Last(_) => "last",
2025 Expression::AnyValue(_) => "any_value",
2026 Expression::ApproxDistinct(_) => "approx_distinct",
2027 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2028 Expression::ApproxPercentile(_) => "approx_percentile",
2029 Expression::Percentile(_) => "percentile",
2030 Expression::LogicalAnd(_) => "logical_and",
2031 Expression::LogicalOr(_) => "logical_or",
2032 Expression::Skewness(_) => "skewness",
2033 Expression::BitwiseCount(_) => "bitwise_count",
2034 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2035 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2036 Expression::BoolXorAgg(_) => "bool_xor_agg",
2037 Expression::RowNumber(_) => "row_number",
2038 Expression::Rank(_) => "rank",
2039 Expression::DenseRank(_) => "dense_rank",
2040 Expression::NTile(_) => "n_tile",
2041 Expression::Lead(_) => "lead",
2042 Expression::Lag(_) => "lag",
2043 Expression::FirstValue(_) => "first_value",
2044 Expression::LastValue(_) => "last_value",
2045 Expression::NthValue(_) => "nth_value",
2046 Expression::PercentRank(_) => "percent_rank",
2047 Expression::CumeDist(_) => "cume_dist",
2048 Expression::PercentileCont(_) => "percentile_cont",
2049 Expression::PercentileDisc(_) => "percentile_disc",
2050 Expression::Contains(_) => "contains",
2051 Expression::StartsWith(_) => "starts_with",
2052 Expression::EndsWith(_) => "ends_with",
2053 Expression::Position(_) => "position",
2054 Expression::Initcap(_) => "initcap",
2055 Expression::Ascii(_) => "ascii",
2056 Expression::Chr(_) => "chr",
2057 Expression::CharFunc(_) => "char_func",
2058 Expression::Soundex(_) => "soundex",
2059 Expression::Levenshtein(_) => "levenshtein",
2060 Expression::ByteLength(_) => "byte_length",
2061 Expression::Hex(_) => "hex",
2062 Expression::LowerHex(_) => "lower_hex",
2063 Expression::Unicode(_) => "unicode",
2064 Expression::ModFunc(_) => "mod_func",
2065 Expression::Random(_) => "random",
2066 Expression::Rand(_) => "rand",
2067 Expression::TruncFunc(_) => "trunc_func",
2068 Expression::Pi(_) => "pi",
2069 Expression::Radians(_) => "radians",
2070 Expression::Degrees(_) => "degrees",
2071 Expression::Sin(_) => "sin",
2072 Expression::Cos(_) => "cos",
2073 Expression::Tan(_) => "tan",
2074 Expression::Asin(_) => "asin",
2075 Expression::Acos(_) => "acos",
2076 Expression::Atan(_) => "atan",
2077 Expression::Atan2(_) => "atan2",
2078 Expression::IsNan(_) => "is_nan",
2079 Expression::IsInf(_) => "is_inf",
2080 Expression::IntDiv(_) => "int_div",
2081 Expression::Decode(_) => "decode",
2082 Expression::DateFormat(_) => "date_format",
2083 Expression::FormatDate(_) => "format_date",
2084 Expression::Year(_) => "year",
2085 Expression::Month(_) => "month",
2086 Expression::Day(_) => "day",
2087 Expression::Hour(_) => "hour",
2088 Expression::Minute(_) => "minute",
2089 Expression::Second(_) => "second",
2090 Expression::DayOfWeek(_) => "day_of_week",
2091 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2092 Expression::DayOfMonth(_) => "day_of_month",
2093 Expression::DayOfYear(_) => "day_of_year",
2094 Expression::WeekOfYear(_) => "week_of_year",
2095 Expression::Quarter(_) => "quarter",
2096 Expression::AddMonths(_) => "add_months",
2097 Expression::MonthsBetween(_) => "months_between",
2098 Expression::LastDay(_) => "last_day",
2099 Expression::NextDay(_) => "next_day",
2100 Expression::Epoch(_) => "epoch",
2101 Expression::EpochMs(_) => "epoch_ms",
2102 Expression::FromUnixtime(_) => "from_unixtime",
2103 Expression::UnixTimestamp(_) => "unix_timestamp",
2104 Expression::MakeDate(_) => "make_date",
2105 Expression::MakeTimestamp(_) => "make_timestamp",
2106 Expression::TimestampTrunc(_) => "timestamp_trunc",
2107 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2108 Expression::SessionUser(_) => "session_user",
2109 Expression::SHA(_) => "s_h_a",
2110 Expression::SHA1Digest(_) => "s_h_a1_digest",
2111 Expression::TimeToUnix(_) => "time_to_unix",
2112 Expression::ArrayFunc(_) => "array_func",
2113 Expression::ArrayLength(_) => "array_length",
2114 Expression::ArraySize(_) => "array_size",
2115 Expression::Cardinality(_) => "cardinality",
2116 Expression::ArrayContains(_) => "array_contains",
2117 Expression::ArrayPosition(_) => "array_position",
2118 Expression::ArrayAppend(_) => "array_append",
2119 Expression::ArrayPrepend(_) => "array_prepend",
2120 Expression::ArrayConcat(_) => "array_concat",
2121 Expression::ArraySort(_) => "array_sort",
2122 Expression::ArrayReverse(_) => "array_reverse",
2123 Expression::ArrayDistinct(_) => "array_distinct",
2124 Expression::ArrayJoin(_) => "array_join",
2125 Expression::ArrayToString(_) => "array_to_string",
2126 Expression::Unnest(_) => "unnest",
2127 Expression::Explode(_) => "explode",
2128 Expression::ExplodeOuter(_) => "explode_outer",
2129 Expression::ArrayFilter(_) => "array_filter",
2130 Expression::ArrayTransform(_) => "array_transform",
2131 Expression::ArrayFlatten(_) => "array_flatten",
2132 Expression::ArrayCompact(_) => "array_compact",
2133 Expression::ArrayIntersect(_) => "array_intersect",
2134 Expression::ArrayUnion(_) => "array_union",
2135 Expression::ArrayExcept(_) => "array_except",
2136 Expression::ArrayRemove(_) => "array_remove",
2137 Expression::ArrayZip(_) => "array_zip",
2138 Expression::Sequence(_) => "sequence",
2139 Expression::Generate(_) => "generate",
2140 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2141 Expression::ToArray(_) => "to_array",
2142 Expression::StarMap(_) => "star_map",
2143 Expression::StructFunc(_) => "struct_func",
2144 Expression::StructExtract(_) => "struct_extract",
2145 Expression::NamedStruct(_) => "named_struct",
2146 Expression::MapFunc(_) => "map_func",
2147 Expression::MapFromEntries(_) => "map_from_entries",
2148 Expression::MapFromArrays(_) => "map_from_arrays",
2149 Expression::MapKeys(_) => "map_keys",
2150 Expression::MapValues(_) => "map_values",
2151 Expression::MapContainsKey(_) => "map_contains_key",
2152 Expression::MapConcat(_) => "map_concat",
2153 Expression::ElementAt(_) => "element_at",
2154 Expression::TransformKeys(_) => "transform_keys",
2155 Expression::TransformValues(_) => "transform_values",
2156 Expression::FunctionEmits(_) => "function_emits",
2157 Expression::JsonExtract(_) => "json_extract",
2158 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2159 Expression::JsonExtractPath(_) => "json_extract_path",
2160 Expression::JsonArray(_) => "json_array",
2161 Expression::JsonObject(_) => "json_object",
2162 Expression::JsonQuery(_) => "json_query",
2163 Expression::JsonValue(_) => "json_value",
2164 Expression::JsonArrayLength(_) => "json_array_length",
2165 Expression::JsonKeys(_) => "json_keys",
2166 Expression::JsonType(_) => "json_type",
2167 Expression::ParseJson(_) => "parse_json",
2168 Expression::ToJson(_) => "to_json",
2169 Expression::JsonSet(_) => "json_set",
2170 Expression::JsonInsert(_) => "json_insert",
2171 Expression::JsonRemove(_) => "json_remove",
2172 Expression::JsonMergePatch(_) => "json_merge_patch",
2173 Expression::JsonArrayAgg(_) => "json_array_agg",
2174 Expression::JsonObjectAgg(_) => "json_object_agg",
2175 Expression::Convert(_) => "convert",
2176 Expression::Typeof(_) => "typeof",
2177 Expression::Lambda(_) => "lambda",
2178 Expression::Parameter(_) => "parameter",
2179 Expression::Placeholder(_) => "placeholder",
2180 Expression::NamedArgument(_) => "named_argument",
2181 Expression::TableArgument(_) => "table_argument",
2182 Expression::SqlComment(_) => "sql_comment",
2183 Expression::NullSafeEq(_) => "null_safe_eq",
2184 Expression::NullSafeNeq(_) => "null_safe_neq",
2185 Expression::Glob(_) => "glob",
2186 Expression::SimilarTo(_) => "similar_to",
2187 Expression::Any(_) => "any",
2188 Expression::All(_) => "all",
2189 Expression::Overlaps(_) => "overlaps",
2190 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2191 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2192 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2193 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2194 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2195 Expression::Subscript(_) => "subscript",
2196 Expression::Dot(_) => "dot",
2197 Expression::MethodCall(_) => "method_call",
2198 Expression::ArraySlice(_) => "array_slice",
2199 Expression::CreateTable(_) => "create_table",
2200 Expression::DropTable(_) => "drop_table",
2201 Expression::Undrop(_) => "undrop",
2202 Expression::AlterTable(_) => "alter_table",
2203 Expression::CreateIndex(_) => "create_index",
2204 Expression::DropIndex(_) => "drop_index",
2205 Expression::CreateView(_) => "create_view",
2206 Expression::DropView(_) => "drop_view",
2207 Expression::AlterView(_) => "alter_view",
2208 Expression::AlterIndex(_) => "alter_index",
2209 Expression::Truncate(_) => "truncate",
2210 Expression::Use(_) => "use",
2211 Expression::Cache(_) => "cache",
2212 Expression::Uncache(_) => "uncache",
2213 Expression::LoadData(_) => "load_data",
2214 Expression::Pragma(_) => "pragma",
2215 Expression::Grant(_) => "grant",
2216 Expression::Revoke(_) => "revoke",
2217 Expression::Comment(_) => "comment",
2218 Expression::SetStatement(_) => "set_statement",
2219 Expression::CreateSchema(_) => "create_schema",
2220 Expression::DropSchema(_) => "drop_schema",
2221 Expression::DropNamespace(_) => "drop_namespace",
2222 Expression::CreateDatabase(_) => "create_database",
2223 Expression::DropDatabase(_) => "drop_database",
2224 Expression::CreateFunction(_) => "create_function",
2225 Expression::DropFunction(_) => "drop_function",
2226 Expression::CreateProcedure(_) => "create_procedure",
2227 Expression::DropProcedure(_) => "drop_procedure",
2228 Expression::CreateSequence(_) => "create_sequence",
2229 Expression::CreateSynonym(_) => "create_synonym",
2230 Expression::DropSequence(_) => "drop_sequence",
2231 Expression::AlterSequence(_) => "alter_sequence",
2232 Expression::CreateTrigger(_) => "create_trigger",
2233 Expression::DropTrigger(_) => "drop_trigger",
2234 Expression::CreateType(_) => "create_type",
2235 Expression::DropType(_) => "drop_type",
2236 Expression::Describe(_) => "describe",
2237 Expression::Show(_) => "show",
2238 Expression::Command(_) => "command",
2239 Expression::TryCatch(_) => "try_catch",
2240 Expression::Kill(_) => "kill",
2241 Expression::Prepare(_) => "prepare",
2242 Expression::Execute(_) => "execute",
2243 Expression::Raw(_) => "raw",
2244 Expression::CreateTask(_) => "create_task",
2245 Expression::Paren(_) => "paren",
2246 Expression::Annotated(_) => "annotated",
2247 Expression::Refresh(_) => "refresh",
2248 Expression::LockingStatement(_) => "locking_statement",
2249 Expression::SequenceProperties(_) => "sequence_properties",
2250 Expression::TruncateTable(_) => "truncate_table",
2251 Expression::Clone(_) => "clone",
2252 Expression::Attach(_) => "attach",
2253 Expression::Detach(_) => "detach",
2254 Expression::Install(_) => "install",
2255 Expression::Summarize(_) => "summarize",
2256 Expression::Declare(_) => "declare",
2257 Expression::DeclareItem(_) => "declare_item",
2258 Expression::Set(_) => "set",
2259 Expression::Heredoc(_) => "heredoc",
2260 Expression::SetItem(_) => "set_item",
2261 Expression::QueryBand(_) => "query_band",
2262 Expression::UserDefinedFunction(_) => "user_defined_function",
2263 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2264 Expression::ProjectionDef(_) => "projection_def",
2265 Expression::TableAlias(_) => "table_alias",
2266 Expression::ByteString(_) => "byte_string",
2267 Expression::HexStringExpr(_) => "hex_string_expr",
2268 Expression::UnicodeString(_) => "unicode_string",
2269 Expression::ColumnPosition(_) => "column_position",
2270 Expression::ColumnDef(_) => "column_def",
2271 Expression::AlterColumn(_) => "alter_column",
2272 Expression::AlterSortKey(_) => "alter_sort_key",
2273 Expression::AlterSet(_) => "alter_set",
2274 Expression::RenameColumn(_) => "rename_column",
2275 Expression::Comprehension(_) => "comprehension",
2276 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2277 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2278 Expression::IndexConstraintOption(_) => "index_constraint_option",
2279 Expression::ColumnConstraint(_) => "column_constraint",
2280 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2281 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2282 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2283 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2284 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2285 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2286 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2287 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2288 Expression::WithOperator(_) => "with_operator",
2289 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2290 "generated_as_identity_column_constraint"
2291 }
2292 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2293 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2294 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2295 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2296 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2297 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2298 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2299 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2300 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2301 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2302 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2303 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2304 Expression::PathColumnConstraint(_) => "path_column_constraint",
2305 Expression::Constraint(_) => "constraint",
2306 Expression::Export(_) => "export",
2307 Expression::Filter(_) => "filter",
2308 Expression::Changes(_) => "changes",
2309 Expression::CopyParameter(_) => "copy_parameter",
2310 Expression::Credentials(_) => "credentials",
2311 Expression::Directory(_) => "directory",
2312 Expression::ForeignKey(_) => "foreign_key",
2313 Expression::ColumnPrefix(_) => "column_prefix",
2314 Expression::PrimaryKey(_) => "primary_key",
2315 Expression::IntoClause(_) => "into_clause",
2316 Expression::JoinHint(_) => "join_hint",
2317 Expression::Opclass(_) => "opclass",
2318 Expression::Index(_) => "index",
2319 Expression::IndexParameters(_) => "index_parameters",
2320 Expression::ConditionalInsert(_) => "conditional_insert",
2321 Expression::MultitableInserts(_) => "multitable_inserts",
2322 Expression::OnConflict(_) => "on_conflict",
2323 Expression::OnCondition(_) => "on_condition",
2324 Expression::Returning(_) => "returning",
2325 Expression::Introducer(_) => "introducer",
2326 Expression::PartitionRange(_) => "partition_range",
2327 Expression::Fetch(_) => "fetch",
2328 Expression::Group(_) => "group",
2329 Expression::Cube(_) => "cube",
2330 Expression::Rollup(_) => "rollup",
2331 Expression::GroupingSets(_) => "grouping_sets",
2332 Expression::LimitOptions(_) => "limit_options",
2333 Expression::Lateral(_) => "lateral",
2334 Expression::TableFromRows(_) => "table_from_rows",
2335 Expression::RowsFrom(_) => "rows_from",
2336 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2337 Expression::WithFill(_) => "with_fill",
2338 Expression::Property(_) => "property",
2339 Expression::GrantPrivilege(_) => "grant_privilege",
2340 Expression::GrantPrincipal(_) => "grant_principal",
2341 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2342 Expression::AlgorithmProperty(_) => "algorithm_property",
2343 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2344 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2345 Expression::BackupProperty(_) => "backup_property",
2346 Expression::BuildProperty(_) => "build_property",
2347 Expression::BlockCompressionProperty(_) => "block_compression_property",
2348 Expression::CharacterSetProperty(_) => "character_set_property",
2349 Expression::ChecksumProperty(_) => "checksum_property",
2350 Expression::CollateProperty(_) => "collate_property",
2351 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2352 Expression::DataDeletionProperty(_) => "data_deletion_property",
2353 Expression::DefinerProperty(_) => "definer_property",
2354 Expression::DistKeyProperty(_) => "dist_key_property",
2355 Expression::DistributedByProperty(_) => "distributed_by_property",
2356 Expression::DistStyleProperty(_) => "dist_style_property",
2357 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2358 Expression::EngineProperty(_) => "engine_property",
2359 Expression::ToTableProperty(_) => "to_table_property",
2360 Expression::ExecuteAsProperty(_) => "execute_as_property",
2361 Expression::ExternalProperty(_) => "external_property",
2362 Expression::FallbackProperty(_) => "fallback_property",
2363 Expression::FileFormatProperty(_) => "file_format_property",
2364 Expression::CredentialsProperty(_) => "credentials_property",
2365 Expression::FreespaceProperty(_) => "freespace_property",
2366 Expression::InheritsProperty(_) => "inherits_property",
2367 Expression::InputModelProperty(_) => "input_model_property",
2368 Expression::OutputModelProperty(_) => "output_model_property",
2369 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2370 Expression::JournalProperty(_) => "journal_property",
2371 Expression::LanguageProperty(_) => "language_property",
2372 Expression::EnviromentProperty(_) => "enviroment_property",
2373 Expression::ClusteredByProperty(_) => "clustered_by_property",
2374 Expression::DictProperty(_) => "dict_property",
2375 Expression::DictRange(_) => "dict_range",
2376 Expression::OnCluster(_) => "on_cluster",
2377 Expression::LikeProperty(_) => "like_property",
2378 Expression::LocationProperty(_) => "location_property",
2379 Expression::LockProperty(_) => "lock_property",
2380 Expression::LockingProperty(_) => "locking_property",
2381 Expression::LogProperty(_) => "log_property",
2382 Expression::MaterializedProperty(_) => "materialized_property",
2383 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2384 Expression::OnProperty(_) => "on_property",
2385 Expression::OnCommitProperty(_) => "on_commit_property",
2386 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2387 Expression::PartitionByProperty(_) => "partition_by_property",
2388 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2389 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2390 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2391 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2392 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2393 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2394 Expression::PartitionList(_) => "partition_list",
2395 Expression::Partition(_) => "partition",
2396 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2397 Expression::UniqueKeyProperty(_) => "unique_key_property",
2398 Expression::RollupProperty(_) => "rollup_property",
2399 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2400 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2401 Expression::RemoteWithConnectionModelProperty(_) => {
2402 "remote_with_connection_model_property"
2403 }
2404 Expression::ReturnsProperty(_) => "returns_property",
2405 Expression::RowFormatProperty(_) => "row_format_property",
2406 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2407 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2408 Expression::QueryTransform(_) => "query_transform",
2409 Expression::SampleProperty(_) => "sample_property",
2410 Expression::SecurityProperty(_) => "security_property",
2411 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2412 Expression::SemanticView(_) => "semantic_view",
2413 Expression::SerdeProperties(_) => "serde_properties",
2414 Expression::SetProperty(_) => "set_property",
2415 Expression::SharingProperty(_) => "sharing_property",
2416 Expression::SetConfigProperty(_) => "set_config_property",
2417 Expression::SettingsProperty(_) => "settings_property",
2418 Expression::SortKeyProperty(_) => "sort_key_property",
2419 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2420 Expression::SqlSecurityProperty(_) => "sql_security_property",
2421 Expression::StabilityProperty(_) => "stability_property",
2422 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2423 Expression::TemporaryProperty(_) => "temporary_property",
2424 Expression::Tags(_) => "tags",
2425 Expression::TransformModelProperty(_) => "transform_model_property",
2426 Expression::TransientProperty(_) => "transient_property",
2427 Expression::UsingTemplateProperty(_) => "using_template_property",
2428 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2429 Expression::VolatileProperty(_) => "volatile_property",
2430 Expression::WithDataProperty(_) => "with_data_property",
2431 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2432 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2433 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2434 Expression::WithProcedureOptions(_) => "with_procedure_options",
2435 Expression::EncodeProperty(_) => "encode_property",
2436 Expression::IncludeProperty(_) => "include_property",
2437 Expression::Properties(_) => "properties",
2438 Expression::OptionsProperty(_) => "options_property",
2439 Expression::InputOutputFormat(_) => "input_output_format",
2440 Expression::Reference(_) => "reference",
2441 Expression::QueryOption(_) => "query_option",
2442 Expression::WithTableHint(_) => "with_table_hint",
2443 Expression::IndexTableHint(_) => "index_table_hint",
2444 Expression::HistoricalData(_) => "historical_data",
2445 Expression::Get(_) => "get",
2446 Expression::SetOperation(_) => "set_operation",
2447 Expression::Var(_) => "var",
2448 Expression::Variadic(_) => "variadic",
2449 Expression::Version(_) => "version",
2450 Expression::Schema(_) => "schema",
2451 Expression::Lock(_) => "lock",
2452 Expression::TableSample(_) => "table_sample",
2453 Expression::Tag(_) => "tag",
2454 Expression::UnpivotColumns(_) => "unpivot_columns",
2455 Expression::WindowSpec(_) => "window_spec",
2456 Expression::SessionParameter(_) => "session_parameter",
2457 Expression::PseudoType(_) => "pseudo_type",
2458 Expression::ObjectIdentifier(_) => "object_identifier",
2459 Expression::Transaction(_) => "transaction",
2460 Expression::Commit(_) => "commit",
2461 Expression::Rollback(_) => "rollback",
2462 Expression::AlterSession(_) => "alter_session",
2463 Expression::Analyze(_) => "analyze",
2464 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2465 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2466 Expression::AnalyzeSample(_) => "analyze_sample",
2467 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2468 Expression::AnalyzeDelete(_) => "analyze_delete",
2469 Expression::AnalyzeWith(_) => "analyze_with",
2470 Expression::AnalyzeValidate(_) => "analyze_validate",
2471 Expression::AddPartition(_) => "add_partition",
2472 Expression::AttachOption(_) => "attach_option",
2473 Expression::DropPartition(_) => "drop_partition",
2474 Expression::ReplacePartition(_) => "replace_partition",
2475 Expression::DPipe(_) => "d_pipe",
2476 Expression::Operator(_) => "operator",
2477 Expression::PivotAny(_) => "pivot_any",
2478 Expression::Aliases(_) => "aliases",
2479 Expression::AtIndex(_) => "at_index",
2480 Expression::FromTimeZone(_) => "from_time_zone",
2481 Expression::FormatPhrase(_) => "format_phrase",
2482 Expression::ForIn(_) => "for_in",
2483 Expression::TimeUnit(_) => "time_unit",
2484 Expression::IntervalOp(_) => "interval_op",
2485 Expression::IntervalSpan(_) => "interval_span",
2486 Expression::HavingMax(_) => "having_max",
2487 Expression::CosineDistance(_) => "cosine_distance",
2488 Expression::DotProduct(_) => "dot_product",
2489 Expression::EuclideanDistance(_) => "euclidean_distance",
2490 Expression::ManhattanDistance(_) => "manhattan_distance",
2491 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2492 Expression::Booland(_) => "booland",
2493 Expression::Boolor(_) => "boolor",
2494 Expression::ParameterizedAgg(_) => "parameterized_agg",
2495 Expression::ArgMax(_) => "arg_max",
2496 Expression::ArgMin(_) => "arg_min",
2497 Expression::ApproxTopK(_) => "approx_top_k",
2498 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2499 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2500 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2501 Expression::ApproxTopSum(_) => "approx_top_sum",
2502 Expression::ApproxQuantiles(_) => "approx_quantiles",
2503 Expression::Minhash(_) => "minhash",
2504 Expression::FarmFingerprint(_) => "farm_fingerprint",
2505 Expression::Float64(_) => "float64",
2506 Expression::Transform(_) => "transform",
2507 Expression::Translate(_) => "translate",
2508 Expression::Grouping(_) => "grouping",
2509 Expression::GroupingId(_) => "grouping_id",
2510 Expression::Anonymous(_) => "anonymous",
2511 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2512 Expression::CombinedAggFunc(_) => "combined_agg_func",
2513 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2514 Expression::HashAgg(_) => "hash_agg",
2515 Expression::Hll(_) => "hll",
2516 Expression::Apply(_) => "apply",
2517 Expression::ToBoolean(_) => "to_boolean",
2518 Expression::List(_) => "list",
2519 Expression::ToMap(_) => "to_map",
2520 Expression::Pad(_) => "pad",
2521 Expression::ToChar(_) => "to_char",
2522 Expression::ToNumber(_) => "to_number",
2523 Expression::ToDouble(_) => "to_double",
2524 Expression::Int64(_) => "int64",
2525 Expression::StringFunc(_) => "string_func",
2526 Expression::ToDecfloat(_) => "to_decfloat",
2527 Expression::TryToDecfloat(_) => "try_to_decfloat",
2528 Expression::ToFile(_) => "to_file",
2529 Expression::Columns(_) => "columns",
2530 Expression::ConvertToCharset(_) => "convert_to_charset",
2531 Expression::ConvertTimezone(_) => "convert_timezone",
2532 Expression::GenerateSeries(_) => "generate_series",
2533 Expression::AIAgg(_) => "a_i_agg",
2534 Expression::AIClassify(_) => "a_i_classify",
2535 Expression::ArrayAll(_) => "array_all",
2536 Expression::ArrayAny(_) => "array_any",
2537 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2538 Expression::StPoint(_) => "st_point",
2539 Expression::StDistance(_) => "st_distance",
2540 Expression::StringToArray(_) => "string_to_array",
2541 Expression::ArraySum(_) => "array_sum",
2542 Expression::ObjectAgg(_) => "object_agg",
2543 Expression::CastToStrType(_) => "cast_to_str_type",
2544 Expression::CheckJson(_) => "check_json",
2545 Expression::CheckXml(_) => "check_xml",
2546 Expression::TranslateCharacters(_) => "translate_characters",
2547 Expression::CurrentSchemas(_) => "current_schemas",
2548 Expression::CurrentDatetime(_) => "current_datetime",
2549 Expression::Localtime(_) => "localtime",
2550 Expression::Localtimestamp(_) => "localtimestamp",
2551 Expression::Systimestamp(_) => "systimestamp",
2552 Expression::CurrentSchema(_) => "current_schema",
2553 Expression::CurrentUser(_) => "current_user",
2554 Expression::UtcTime(_) => "utc_time",
2555 Expression::UtcTimestamp(_) => "utc_timestamp",
2556 Expression::Timestamp(_) => "timestamp",
2557 Expression::DateBin(_) => "date_bin",
2558 Expression::Datetime(_) => "datetime",
2559 Expression::DatetimeAdd(_) => "datetime_add",
2560 Expression::DatetimeSub(_) => "datetime_sub",
2561 Expression::DatetimeDiff(_) => "datetime_diff",
2562 Expression::DatetimeTrunc(_) => "datetime_trunc",
2563 Expression::Dayname(_) => "dayname",
2564 Expression::MakeInterval(_) => "make_interval",
2565 Expression::PreviousDay(_) => "previous_day",
2566 Expression::Elt(_) => "elt",
2567 Expression::TimestampAdd(_) => "timestamp_add",
2568 Expression::TimestampSub(_) => "timestamp_sub",
2569 Expression::TimestampDiff(_) => "timestamp_diff",
2570 Expression::TimeSlice(_) => "time_slice",
2571 Expression::TimeAdd(_) => "time_add",
2572 Expression::TimeSub(_) => "time_sub",
2573 Expression::TimeDiff(_) => "time_diff",
2574 Expression::TimeTrunc(_) => "time_trunc",
2575 Expression::DateFromParts(_) => "date_from_parts",
2576 Expression::TimeFromParts(_) => "time_from_parts",
2577 Expression::DecodeCase(_) => "decode_case",
2578 Expression::Decrypt(_) => "decrypt",
2579 Expression::DecryptRaw(_) => "decrypt_raw",
2580 Expression::Encode(_) => "encode",
2581 Expression::Encrypt(_) => "encrypt",
2582 Expression::EncryptRaw(_) => "encrypt_raw",
2583 Expression::EqualNull(_) => "equal_null",
2584 Expression::ToBinary(_) => "to_binary",
2585 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2586 Expression::Base64DecodeString(_) => "base64_decode_string",
2587 Expression::Base64Encode(_) => "base64_encode",
2588 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2589 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2590 Expression::GapFill(_) => "gap_fill",
2591 Expression::GenerateDateArray(_) => "generate_date_array",
2592 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2593 Expression::GetExtract(_) => "get_extract",
2594 Expression::Getbit(_) => "getbit",
2595 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2596 Expression::HexEncode(_) => "hex_encode",
2597 Expression::Compress(_) => "compress",
2598 Expression::DecompressBinary(_) => "decompress_binary",
2599 Expression::DecompressString(_) => "decompress_string",
2600 Expression::Xor(_) => "xor",
2601 Expression::Nullif(_) => "nullif",
2602 Expression::JSON(_) => "j_s_o_n",
2603 Expression::JSONPath(_) => "j_s_o_n_path",
2604 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2605 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2606 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2607 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2608 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2609 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2610 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2611 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2612 Expression::Format(_) => "format",
2613 Expression::JSONKeys(_) => "j_s_o_n_keys",
2614 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2615 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2616 Expression::JSONObject(_) => "j_s_o_n_object",
2617 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2618 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2619 Expression::JSONArray(_) => "j_s_o_n_array",
2620 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2621 Expression::JSONExists(_) => "j_s_o_n_exists",
2622 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2623 Expression::JSONSchema(_) => "j_s_o_n_schema",
2624 Expression::JSONSet(_) => "j_s_o_n_set",
2625 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2626 Expression::JSONValue(_) => "j_s_o_n_value",
2627 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2628 Expression::JSONRemove(_) => "j_s_o_n_remove",
2629 Expression::JSONTable(_) => "j_s_o_n_table",
2630 Expression::JSONType(_) => "j_s_o_n_type",
2631 Expression::ObjectInsert(_) => "object_insert",
2632 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2633 Expression::OpenJSON(_) => "open_j_s_o_n",
2634 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2635 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2636 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2637 Expression::JSONCast(_) => "j_s_o_n_cast",
2638 Expression::JSONExtract(_) => "j_s_o_n_extract",
2639 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2640 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2641 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2642 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2643 Expression::JSONFormat(_) => "j_s_o_n_format",
2644 Expression::JSONBool(_) => "j_s_o_n_bool",
2645 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2646 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2647 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2648 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2649 Expression::ParseJSON(_) => "parse_j_s_o_n",
2650 Expression::ParseUrl(_) => "parse_url",
2651 Expression::ParseIp(_) => "parse_ip",
2652 Expression::ParseTime(_) => "parse_time",
2653 Expression::ParseDatetime(_) => "parse_datetime",
2654 Expression::Map(_) => "map",
2655 Expression::MapCat(_) => "map_cat",
2656 Expression::MapDelete(_) => "map_delete",
2657 Expression::MapInsert(_) => "map_insert",
2658 Expression::MapPick(_) => "map_pick",
2659 Expression::ScopeResolution(_) => "scope_resolution",
2660 Expression::Slice(_) => "slice",
2661 Expression::VarMap(_) => "var_map",
2662 Expression::MatchAgainst(_) => "match_against",
2663 Expression::MD5Digest(_) => "m_d5_digest",
2664 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2665 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2666 Expression::Monthname(_) => "monthname",
2667 Expression::Ntile(_) => "ntile",
2668 Expression::Normalize(_) => "normalize",
2669 Expression::Normal(_) => "normal",
2670 Expression::Predict(_) => "predict",
2671 Expression::MLTranslate(_) => "m_l_translate",
2672 Expression::FeaturesAtTime(_) => "features_at_time",
2673 Expression::GenerateEmbedding(_) => "generate_embedding",
2674 Expression::MLForecast(_) => "m_l_forecast",
2675 Expression::ModelAttribute(_) => "model_attribute",
2676 Expression::VectorSearch(_) => "vector_search",
2677 Expression::Quantile(_) => "quantile",
2678 Expression::ApproxQuantile(_) => "approx_quantile",
2679 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2680 Expression::Randn(_) => "randn",
2681 Expression::Randstr(_) => "randstr",
2682 Expression::RangeN(_) => "range_n",
2683 Expression::RangeBucket(_) => "range_bucket",
2684 Expression::ReadCSV(_) => "read_c_s_v",
2685 Expression::ReadParquet(_) => "read_parquet",
2686 Expression::Reduce(_) => "reduce",
2687 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2688 Expression::RegexpILike(_) => "regexp_i_like",
2689 Expression::RegexpFullMatch(_) => "regexp_full_match",
2690 Expression::RegexpInstr(_) => "regexp_instr",
2691 Expression::RegexpSplit(_) => "regexp_split",
2692 Expression::RegexpCount(_) => "regexp_count",
2693 Expression::RegrValx(_) => "regr_valx",
2694 Expression::RegrValy(_) => "regr_valy",
2695 Expression::RegrAvgy(_) => "regr_avgy",
2696 Expression::RegrAvgx(_) => "regr_avgx",
2697 Expression::RegrCount(_) => "regr_count",
2698 Expression::RegrIntercept(_) => "regr_intercept",
2699 Expression::RegrR2(_) => "regr_r2",
2700 Expression::RegrSxx(_) => "regr_sxx",
2701 Expression::RegrSxy(_) => "regr_sxy",
2702 Expression::RegrSyy(_) => "regr_syy",
2703 Expression::RegrSlope(_) => "regr_slope",
2704 Expression::SafeAdd(_) => "safe_add",
2705 Expression::SafeDivide(_) => "safe_divide",
2706 Expression::SafeMultiply(_) => "safe_multiply",
2707 Expression::SafeSubtract(_) => "safe_subtract",
2708 Expression::SHA2(_) => "s_h_a2",
2709 Expression::SHA2Digest(_) => "s_h_a2_digest",
2710 Expression::SortArray(_) => "sort_array",
2711 Expression::SplitPart(_) => "split_part",
2712 Expression::SubstringIndex(_) => "substring_index",
2713 Expression::StandardHash(_) => "standard_hash",
2714 Expression::StrPosition(_) => "str_position",
2715 Expression::Search(_) => "search",
2716 Expression::SearchIp(_) => "search_ip",
2717 Expression::StrToDate(_) => "str_to_date",
2718 Expression::DateStrToDate(_) => "date_str_to_date",
2719 Expression::DateToDateStr(_) => "date_to_date_str",
2720 Expression::StrToTime(_) => "str_to_time",
2721 Expression::StrToUnix(_) => "str_to_unix",
2722 Expression::StrToMap(_) => "str_to_map",
2723 Expression::NumberToStr(_) => "number_to_str",
2724 Expression::FromBase(_) => "from_base",
2725 Expression::Stuff(_) => "stuff",
2726 Expression::TimeToStr(_) => "time_to_str",
2727 Expression::TimeStrToTime(_) => "time_str_to_time",
2728 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2729 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2730 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2731 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2732 Expression::Unhex(_) => "unhex",
2733 Expression::Uniform(_) => "uniform",
2734 Expression::UnixToStr(_) => "unix_to_str",
2735 Expression::UnixToTime(_) => "unix_to_time",
2736 Expression::Uuid(_) => "uuid",
2737 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2738 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2739 Expression::Corr(_) => "corr",
2740 Expression::WidthBucket(_) => "width_bucket",
2741 Expression::CovarSamp(_) => "covar_samp",
2742 Expression::CovarPop(_) => "covar_pop",
2743 Expression::Week(_) => "week",
2744 Expression::XMLElement(_) => "x_m_l_element",
2745 Expression::XMLGet(_) => "x_m_l_get",
2746 Expression::XMLTable(_) => "x_m_l_table",
2747 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2748 Expression::Zipf(_) => "zipf",
2749 Expression::Merge(_) => "merge",
2750 Expression::When(_) => "when",
2751 Expression::Whens(_) => "whens",
2752 Expression::NextValueFor(_) => "next_value_for",
2753 Expression::ReturnStmt(_) => "return_stmt",
2754 }
2755 }
2756
2757 pub fn get_this(&self) -> Option<&Expression> {
2759 match self {
2760 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2762 Expression::Upper(f)
2764 | Expression::Lower(f)
2765 | Expression::Length(f)
2766 | Expression::LTrim(f)
2767 | Expression::RTrim(f)
2768 | Expression::Reverse(f)
2769 | Expression::Abs(f)
2770 | Expression::Sqrt(f)
2771 | Expression::Cbrt(f)
2772 | Expression::Ln(f)
2773 | Expression::Exp(f)
2774 | Expression::Sign(f)
2775 | Expression::Date(f)
2776 | Expression::Time(f)
2777 | Expression::Initcap(f)
2778 | Expression::Ascii(f)
2779 | Expression::Chr(f)
2780 | Expression::Soundex(f)
2781 | Expression::ByteLength(f)
2782 | Expression::Hex(f)
2783 | Expression::LowerHex(f)
2784 | Expression::Unicode(f)
2785 | Expression::Typeof(f)
2786 | Expression::Explode(f)
2787 | Expression::ExplodeOuter(f)
2788 | Expression::MapFromEntries(f)
2789 | Expression::MapKeys(f)
2790 | Expression::MapValues(f)
2791 | Expression::ArrayLength(f)
2792 | Expression::ArraySize(f)
2793 | Expression::Cardinality(f)
2794 | Expression::ArrayReverse(f)
2795 | Expression::ArrayDistinct(f)
2796 | Expression::ArrayFlatten(f)
2797 | Expression::ArrayCompact(f)
2798 | Expression::ToArray(f)
2799 | Expression::JsonArrayLength(f)
2800 | Expression::JsonKeys(f)
2801 | Expression::JsonType(f)
2802 | Expression::ParseJson(f)
2803 | Expression::ToJson(f)
2804 | Expression::Radians(f)
2805 | Expression::Degrees(f)
2806 | Expression::Sin(f)
2807 | Expression::Cos(f)
2808 | Expression::Tan(f)
2809 | Expression::Asin(f)
2810 | Expression::Acos(f)
2811 | Expression::Atan(f)
2812 | Expression::IsNan(f)
2813 | Expression::IsInf(f)
2814 | Expression::Year(f)
2815 | Expression::Month(f)
2816 | Expression::Day(f)
2817 | Expression::Hour(f)
2818 | Expression::Minute(f)
2819 | Expression::Second(f)
2820 | Expression::DayOfWeek(f)
2821 | Expression::DayOfWeekIso(f)
2822 | Expression::DayOfMonth(f)
2823 | Expression::DayOfYear(f)
2824 | Expression::WeekOfYear(f)
2825 | Expression::Quarter(f)
2826 | Expression::Epoch(f)
2827 | Expression::EpochMs(f)
2828 | Expression::BitwiseCount(f)
2829 | Expression::DateFromUnixDate(f)
2830 | Expression::UnixDate(f)
2831 | Expression::UnixSeconds(f)
2832 | Expression::UnixMillis(f)
2833 | Expression::UnixMicros(f)
2834 | Expression::TimeStrToDate(f)
2835 | Expression::DateToDi(f)
2836 | Expression::DiToDate(f)
2837 | Expression::TsOrDiToDi(f)
2838 | Expression::TsOrDsToDatetime(f)
2839 | Expression::TsOrDsToTimestamp(f)
2840 | Expression::YearOfWeek(f)
2841 | Expression::YearOfWeekIso(f)
2842 | Expression::SHA(f)
2843 | Expression::SHA1Digest(f)
2844 | Expression::TimeToUnix(f)
2845 | Expression::TimeStrToUnix(f)
2846 | Expression::Int64(f)
2847 | Expression::JSONBool(f)
2848 | Expression::MD5NumberLower64(f)
2849 | Expression::MD5NumberUpper64(f)
2850 | Expression::DateStrToDate(f)
2851 | Expression::DateToDateStr(f) => Some(&f.this),
2852 Expression::Power(f)
2854 | Expression::NullIf(f)
2855 | Expression::IfNull(f)
2856 | Expression::Nvl(f)
2857 | Expression::Contains(f)
2858 | Expression::StartsWith(f)
2859 | Expression::EndsWith(f)
2860 | Expression::Levenshtein(f)
2861 | Expression::ModFunc(f)
2862 | Expression::IntDiv(f)
2863 | Expression::Atan2(f)
2864 | Expression::AddMonths(f)
2865 | Expression::MonthsBetween(f)
2866 | Expression::NextDay(f)
2867 | Expression::UnixToTimeStr(f)
2868 | Expression::ArrayContains(f)
2869 | Expression::ArrayPosition(f)
2870 | Expression::ArrayAppend(f)
2871 | Expression::ArrayPrepend(f)
2872 | Expression::ArrayUnion(f)
2873 | Expression::ArrayExcept(f)
2874 | Expression::ArrayRemove(f)
2875 | Expression::StarMap(f)
2876 | Expression::MapFromArrays(f)
2877 | Expression::MapContainsKey(f)
2878 | Expression::ElementAt(f)
2879 | Expression::JsonMergePatch(f)
2880 | Expression::JSONBContains(f)
2881 | Expression::JSONBExtract(f) => Some(&f.this),
2882 Expression::Sum(af)
2884 | Expression::Avg(af)
2885 | Expression::Min(af)
2886 | Expression::Max(af)
2887 | Expression::ArrayAgg(af)
2888 | Expression::CountIf(af)
2889 | Expression::Stddev(af)
2890 | Expression::StddevPop(af)
2891 | Expression::StddevSamp(af)
2892 | Expression::Variance(af)
2893 | Expression::VarPop(af)
2894 | Expression::VarSamp(af)
2895 | Expression::Median(af)
2896 | Expression::Mode(af)
2897 | Expression::First(af)
2898 | Expression::Last(af)
2899 | Expression::AnyValue(af)
2900 | Expression::ApproxDistinct(af)
2901 | Expression::ApproxCountDistinct(af)
2902 | Expression::LogicalAnd(af)
2903 | Expression::LogicalOr(af)
2904 | Expression::Skewness(af)
2905 | Expression::ArrayConcatAgg(af)
2906 | Expression::ArrayUniqueAgg(af)
2907 | Expression::BoolXorAgg(af)
2908 | Expression::BitwiseAndAgg(af)
2909 | Expression::BitwiseOrAgg(af)
2910 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2911 Expression::And(op)
2913 | Expression::Or(op)
2914 | Expression::Add(op)
2915 | Expression::Sub(op)
2916 | Expression::Mul(op)
2917 | Expression::Div(op)
2918 | Expression::Mod(op)
2919 | Expression::Eq(op)
2920 | Expression::Neq(op)
2921 | Expression::Lt(op)
2922 | Expression::Lte(op)
2923 | Expression::Gt(op)
2924 | Expression::Gte(op)
2925 | Expression::BitwiseAnd(op)
2926 | Expression::BitwiseOr(op)
2927 | Expression::BitwiseXor(op)
2928 | Expression::Concat(op)
2929 | Expression::Adjacent(op)
2930 | Expression::TsMatch(op)
2931 | Expression::PropertyEQ(op)
2932 | Expression::ArrayContainsAll(op)
2933 | Expression::ArrayContainedBy(op)
2934 | Expression::ArrayOverlaps(op)
2935 | Expression::JSONBContainsAllTopKeys(op)
2936 | Expression::JSONBContainsAnyTopKeys(op)
2937 | Expression::JSONBDeleteAtPath(op)
2938 | Expression::ExtendsLeft(op)
2939 | Expression::ExtendsRight(op)
2940 | Expression::Is(op)
2941 | Expression::MemberOf(op)
2942 | Expression::Match(op)
2943 | Expression::NullSafeEq(op)
2944 | Expression::NullSafeNeq(op)
2945 | Expression::Glob(op)
2946 | Expression::BitwiseLeftShift(op)
2947 | Expression::BitwiseRightShift(op) => Some(&op.left),
2948 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2950 Expression::Alias(a) => Some(&a.this),
2952 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2953 Expression::Paren(p) => Some(&p.this),
2954 Expression::Annotated(a) => Some(&a.this),
2955 Expression::Subquery(s) => Some(&s.this),
2956 Expression::Where(w) => Some(&w.this),
2957 Expression::Having(h) => Some(&h.this),
2958 Expression::Qualify(q) => Some(&q.this),
2959 Expression::IsNull(i) => Some(&i.this),
2960 Expression::Exists(e) => Some(&e.this),
2961 Expression::Ordered(o) => Some(&o.this),
2962 Expression::WindowFunction(wf) => Some(&wf.this),
2963 Expression::Cte(cte) => Some(&cte.this),
2964 Expression::Between(b) => Some(&b.this),
2965 Expression::In(i) => Some(&i.this),
2966 Expression::ReturnStmt(e) => Some(e),
2967 _ => None,
2968 }
2969 }
2970
2971 pub fn get_expression(&self) -> Option<&Expression> {
2973 match self {
2974 Expression::And(op)
2976 | Expression::Or(op)
2977 | Expression::Add(op)
2978 | Expression::Sub(op)
2979 | Expression::Mul(op)
2980 | Expression::Div(op)
2981 | Expression::Mod(op)
2982 | Expression::Eq(op)
2983 | Expression::Neq(op)
2984 | Expression::Lt(op)
2985 | Expression::Lte(op)
2986 | Expression::Gt(op)
2987 | Expression::Gte(op)
2988 | Expression::BitwiseAnd(op)
2989 | Expression::BitwiseOr(op)
2990 | Expression::BitwiseXor(op)
2991 | Expression::Concat(op)
2992 | Expression::Adjacent(op)
2993 | Expression::TsMatch(op)
2994 | Expression::PropertyEQ(op)
2995 | Expression::ArrayContainsAll(op)
2996 | Expression::ArrayContainedBy(op)
2997 | Expression::ArrayOverlaps(op)
2998 | Expression::JSONBContainsAllTopKeys(op)
2999 | Expression::JSONBContainsAnyTopKeys(op)
3000 | Expression::JSONBDeleteAtPath(op)
3001 | Expression::ExtendsLeft(op)
3002 | Expression::ExtendsRight(op)
3003 | Expression::Is(op)
3004 | Expression::MemberOf(op)
3005 | Expression::Match(op)
3006 | Expression::NullSafeEq(op)
3007 | Expression::NullSafeNeq(op)
3008 | Expression::Glob(op)
3009 | Expression::BitwiseLeftShift(op)
3010 | Expression::BitwiseRightShift(op) => Some(&op.right),
3011 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3013 Expression::Power(f)
3015 | Expression::NullIf(f)
3016 | Expression::IfNull(f)
3017 | Expression::Nvl(f)
3018 | Expression::Contains(f)
3019 | Expression::StartsWith(f)
3020 | Expression::EndsWith(f)
3021 | Expression::Levenshtein(f)
3022 | Expression::ModFunc(f)
3023 | Expression::IntDiv(f)
3024 | Expression::Atan2(f)
3025 | Expression::AddMonths(f)
3026 | Expression::MonthsBetween(f)
3027 | Expression::NextDay(f)
3028 | Expression::UnixToTimeStr(f)
3029 | Expression::ArrayContains(f)
3030 | Expression::ArrayPosition(f)
3031 | Expression::ArrayAppend(f)
3032 | Expression::ArrayPrepend(f)
3033 | Expression::ArrayUnion(f)
3034 | Expression::ArrayExcept(f)
3035 | Expression::ArrayRemove(f)
3036 | Expression::StarMap(f)
3037 | Expression::MapFromArrays(f)
3038 | Expression::MapContainsKey(f)
3039 | Expression::ElementAt(f)
3040 | Expression::JsonMergePatch(f)
3041 | Expression::JSONBContains(f)
3042 | Expression::JSONBExtract(f) => Some(&f.expression),
3043 _ => None,
3044 }
3045 }
3046
3047 pub fn get_expressions(&self) -> &[Expression] {
3049 match self {
3050 Expression::Select(s) => &s.expressions,
3051 Expression::Function(f) => &f.args,
3052 Expression::AggregateFunction(f) => &f.args,
3053 Expression::From(f) => &f.expressions,
3054 Expression::GroupBy(g) => &g.expressions,
3055 Expression::In(i) => &i.expressions,
3056 Expression::Array(a) => &a.expressions,
3057 Expression::Tuple(t) => &t.expressions,
3058 Expression::Coalesce(f)
3059 | Expression::Greatest(f)
3060 | Expression::Least(f)
3061 | Expression::ArrayConcat(f)
3062 | Expression::ArrayIntersect(f)
3063 | Expression::ArrayZip(f)
3064 | Expression::MapConcat(f)
3065 | Expression::JsonArray(f) => &f.expressions,
3066 _ => &[],
3067 }
3068 }
3069
3070 pub fn get_name(&self) -> &str {
3072 match self {
3073 Expression::Identifier(id) => &id.name,
3074 Expression::Column(col) => &col.name.name,
3075 Expression::Table(t) => &t.name.name,
3076 Expression::Literal(lit) => lit.value_str(),
3077 Expression::Star(_) => "*",
3078 Expression::Function(f) => &f.name,
3079 Expression::AggregateFunction(f) => &f.name,
3080 Expression::Alias(a) => a.this.get_name(),
3081 Expression::Boolean(b) => {
3082 if b.value {
3083 "TRUE"
3084 } else {
3085 "FALSE"
3086 }
3087 }
3088 Expression::Null(_) => "NULL",
3089 _ => "",
3090 }
3091 }
3092
3093 pub fn get_alias(&self) -> &str {
3095 match self {
3096 Expression::Alias(a) => &a.alias.name,
3097 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3098 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3099 _ => "",
3100 }
3101 }
3102
3103 pub fn get_output_name(&self) -> &str {
3105 match self {
3106 Expression::Alias(a) => &a.alias.name,
3107 Expression::Column(c) => &c.name.name,
3108 Expression::Identifier(id) => &id.name,
3109 Expression::Literal(lit) => lit.value_str(),
3110 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3111 Expression::Star(_) => "*",
3112 _ => "",
3113 }
3114 }
3115
3116 pub fn get_comments(&self) -> Vec<&str> {
3118 match self {
3119 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3120 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3121 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3122 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3123 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3124 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3125 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3126 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3127 }
3128 Expression::And(op)
3129 | Expression::Or(op)
3130 | Expression::Add(op)
3131 | Expression::Sub(op)
3132 | Expression::Mul(op)
3133 | Expression::Div(op)
3134 | Expression::Mod(op)
3135 | Expression::Eq(op)
3136 | Expression::Neq(op)
3137 | Expression::Lt(op)
3138 | Expression::Lte(op)
3139 | Expression::Gt(op)
3140 | Expression::Gte(op)
3141 | Expression::Concat(op)
3142 | Expression::BitwiseAnd(op)
3143 | Expression::BitwiseOr(op)
3144 | Expression::BitwiseXor(op) => {
3145 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3146 }
3147 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3148 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3149 _ => Vec::new(),
3150 }
3151 }
3152}
3153
3154impl fmt::Display for Expression {
3155 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3156 match self {
3158 Expression::Literal(lit) => write!(f, "{}", lit),
3159 Expression::Identifier(id) => write!(f, "{}", id),
3160 Expression::Column(col) => write!(f, "{}", col),
3161 Expression::Star(_) => write!(f, "*"),
3162 Expression::Null(_) => write!(f, "NULL"),
3163 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3164 Expression::Select(_) => write!(f, "SELECT ..."),
3165 _ => write!(f, "{:?}", self),
3166 }
3167 }
3168}
3169
3170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3180#[cfg_attr(feature = "bindings", derive(TS))]
3181#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3182pub enum Literal {
3183 String(String),
3185 Number(String),
3187 HexString(String),
3189 HexNumber(String),
3191 BitString(String),
3192 ByteString(String),
3194 NationalString(String),
3196 Date(String),
3198 Time(String),
3200 Timestamp(String),
3202 Datetime(String),
3204 TripleQuotedString(String, char),
3207 EscapeString(String),
3209 DollarString(String),
3211 RawString(String),
3215}
3216
3217impl Literal {
3218 pub fn value_str(&self) -> &str {
3220 match self {
3221 Literal::String(s)
3222 | Literal::Number(s)
3223 | Literal::HexString(s)
3224 | Literal::HexNumber(s)
3225 | Literal::BitString(s)
3226 | Literal::ByteString(s)
3227 | Literal::NationalString(s)
3228 | Literal::Date(s)
3229 | Literal::Time(s)
3230 | Literal::Timestamp(s)
3231 | Literal::Datetime(s)
3232 | Literal::EscapeString(s)
3233 | Literal::DollarString(s)
3234 | Literal::RawString(s) => s.as_str(),
3235 Literal::TripleQuotedString(s, _) => s.as_str(),
3236 }
3237 }
3238
3239 pub fn is_string(&self) -> bool {
3241 matches!(
3242 self,
3243 Literal::String(_)
3244 | Literal::NationalString(_)
3245 | Literal::EscapeString(_)
3246 | Literal::DollarString(_)
3247 | Literal::RawString(_)
3248 | Literal::TripleQuotedString(_, _)
3249 )
3250 }
3251
3252 pub fn is_number(&self) -> bool {
3254 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3255 }
3256}
3257
3258impl fmt::Display for Literal {
3259 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3260 match self {
3261 Literal::String(s) => write!(f, "'{}'", s),
3262 Literal::Number(n) => write!(f, "{}", n),
3263 Literal::HexString(h) => write!(f, "X'{}'", h),
3264 Literal::HexNumber(h) => write!(f, "0x{}", h),
3265 Literal::BitString(b) => write!(f, "B'{}'", b),
3266 Literal::ByteString(b) => write!(f, "b'{}'", b),
3267 Literal::NationalString(s) => write!(f, "N'{}'", s),
3268 Literal::Date(d) => write!(f, "DATE '{}'", d),
3269 Literal::Time(t) => write!(f, "TIME '{}'", t),
3270 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3271 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3272 Literal::TripleQuotedString(s, q) => {
3273 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3274 }
3275 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3276 Literal::DollarString(s) => write!(f, "$${}$$", s),
3277 Literal::RawString(s) => write!(f, "r'{}'", s),
3278 }
3279 }
3280}
3281
3282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3284#[cfg_attr(feature = "bindings", derive(TS))]
3285pub struct BooleanLiteral {
3286 pub value: bool,
3287}
3288
3289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3291#[cfg_attr(feature = "bindings", derive(TS))]
3292pub struct Null;
3293
3294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3301#[cfg_attr(feature = "bindings", derive(TS))]
3302pub struct Identifier {
3303 pub name: String,
3305 pub quoted: bool,
3307 #[serde(default)]
3308 pub trailing_comments: Vec<String>,
3309 #[serde(default, skip_serializing_if = "Option::is_none")]
3311 pub span: Option<Span>,
3312}
3313
3314impl Identifier {
3315 pub fn new(name: impl Into<String>) -> Self {
3316 Self {
3317 name: name.into(),
3318 quoted: false,
3319 trailing_comments: Vec::new(),
3320 span: None,
3321 }
3322 }
3323
3324 pub fn quoted(name: impl Into<String>) -> Self {
3325 Self {
3326 name: name.into(),
3327 quoted: true,
3328 trailing_comments: Vec::new(),
3329 span: None,
3330 }
3331 }
3332
3333 pub fn empty() -> Self {
3334 Self {
3335 name: String::new(),
3336 quoted: false,
3337 trailing_comments: Vec::new(),
3338 span: None,
3339 }
3340 }
3341
3342 pub fn is_empty(&self) -> bool {
3343 self.name.is_empty()
3344 }
3345
3346 pub fn with_span(mut self, span: Span) -> Self {
3348 self.span = Some(span);
3349 self
3350 }
3351}
3352
3353impl fmt::Display for Identifier {
3354 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3355 if self.quoted {
3356 write!(f, "\"{}\"", self.name)
3357 } else {
3358 write!(f, "{}", self.name)
3359 }
3360 }
3361}
3362
3363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3369#[cfg_attr(feature = "bindings", derive(TS))]
3370pub struct Column {
3371 pub name: Identifier,
3373 pub table: Option<Identifier>,
3375 #[serde(default)]
3377 pub join_mark: bool,
3378 #[serde(default)]
3380 pub trailing_comments: Vec<String>,
3381 #[serde(default, skip_serializing_if = "Option::is_none")]
3383 pub span: Option<Span>,
3384 #[serde(default, skip_serializing_if = "Option::is_none")]
3386 pub inferred_type: Option<DataType>,
3387}
3388
3389impl fmt::Display for Column {
3390 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3391 if let Some(table) = &self.table {
3392 write!(f, "{}.{}", table, self.name)
3393 } else {
3394 write!(f, "{}", self.name)
3395 }
3396 }
3397}
3398
3399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3406#[cfg_attr(feature = "bindings", derive(TS))]
3407pub struct TableRef {
3408 pub name: Identifier,
3410 pub schema: Option<Identifier>,
3412 pub catalog: Option<Identifier>,
3414 pub alias: Option<Identifier>,
3416 #[serde(default)]
3418 pub alias_explicit_as: bool,
3419 #[serde(default)]
3421 pub column_aliases: Vec<Identifier>,
3422 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3424 pub leading_comments: Vec<String>,
3425 #[serde(default)]
3427 pub trailing_comments: Vec<String>,
3428 #[serde(default)]
3430 pub when: Option<Box<HistoricalData>>,
3431 #[serde(default)]
3433 pub only: bool,
3434 #[serde(default)]
3436 pub final_: bool,
3437 #[serde(default, skip_serializing_if = "Option::is_none")]
3439 pub table_sample: Option<Box<Sample>>,
3440 #[serde(default)]
3442 pub hints: Vec<Expression>,
3443 #[serde(default, skip_serializing_if = "Option::is_none")]
3446 pub system_time: Option<String>,
3447 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3449 pub partitions: Vec<Identifier>,
3450 #[serde(default, skip_serializing_if = "Option::is_none")]
3453 pub identifier_func: Option<Box<Expression>>,
3454 #[serde(default, skip_serializing_if = "Option::is_none")]
3456 pub changes: Option<Box<Changes>>,
3457 #[serde(default, skip_serializing_if = "Option::is_none")]
3459 pub version: Option<Box<Version>>,
3460 #[serde(default, skip_serializing_if = "Option::is_none")]
3462 pub span: Option<Span>,
3463}
3464
3465impl TableRef {
3466 pub fn new(name: impl Into<String>) -> Self {
3467 Self {
3468 name: Identifier::new(name),
3469 schema: None,
3470 catalog: None,
3471 alias: None,
3472 alias_explicit_as: false,
3473 column_aliases: Vec::new(),
3474 leading_comments: Vec::new(),
3475 trailing_comments: Vec::new(),
3476 when: None,
3477 only: false,
3478 final_: false,
3479 table_sample: None,
3480 hints: Vec::new(),
3481 system_time: None,
3482 partitions: Vec::new(),
3483 identifier_func: None,
3484 changes: None,
3485 version: None,
3486 span: None,
3487 }
3488 }
3489
3490 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3492 let mut t = Self::new(name);
3493 t.schema = Some(Identifier::new(schema));
3494 t
3495 }
3496
3497 pub fn new_with_catalog(
3499 name: impl Into<String>,
3500 schema: impl Into<String>,
3501 catalog: impl Into<String>,
3502 ) -> Self {
3503 let mut t = Self::new(name);
3504 t.schema = Some(Identifier::new(schema));
3505 t.catalog = Some(Identifier::new(catalog));
3506 t
3507 }
3508
3509 pub fn from_identifier(name: Identifier) -> Self {
3511 Self {
3512 name,
3513 schema: None,
3514 catalog: None,
3515 alias: None,
3516 alias_explicit_as: false,
3517 column_aliases: Vec::new(),
3518 leading_comments: Vec::new(),
3519 trailing_comments: Vec::new(),
3520 when: None,
3521 only: false,
3522 final_: false,
3523 table_sample: None,
3524 hints: Vec::new(),
3525 system_time: None,
3526 partitions: Vec::new(),
3527 identifier_func: None,
3528 changes: None,
3529 version: None,
3530 span: None,
3531 }
3532 }
3533
3534 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3535 self.alias = Some(Identifier::new(alias));
3536 self
3537 }
3538
3539 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3540 self.schema = Some(Identifier::new(schema));
3541 self
3542 }
3543}
3544
3545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3550#[cfg_attr(feature = "bindings", derive(TS))]
3551pub struct Star {
3552 pub table: Option<Identifier>,
3554 pub except: Option<Vec<Identifier>>,
3556 pub replace: Option<Vec<Alias>>,
3558 pub rename: Option<Vec<(Identifier, Identifier)>>,
3560 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3562 pub trailing_comments: Vec<String>,
3563 #[serde(default, skip_serializing_if = "Option::is_none")]
3565 pub span: Option<Span>,
3566}
3567
3568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3592#[cfg_attr(feature = "bindings", derive(TS))]
3593pub struct Select {
3594 pub expressions: Vec<Expression>,
3596 pub from: Option<From>,
3598 pub joins: Vec<Join>,
3600 pub lateral_views: Vec<LateralView>,
3601 #[serde(default, skip_serializing_if = "Option::is_none")]
3603 pub prewhere: Option<Expression>,
3604 pub where_clause: Option<Where>,
3605 pub group_by: Option<GroupBy>,
3606 pub having: Option<Having>,
3607 pub qualify: Option<Qualify>,
3608 pub order_by: Option<OrderBy>,
3609 pub distribute_by: Option<DistributeBy>,
3610 pub cluster_by: Option<ClusterBy>,
3611 pub sort_by: Option<SortBy>,
3612 pub limit: Option<Limit>,
3613 pub offset: Option<Offset>,
3614 #[serde(default, skip_serializing_if = "Option::is_none")]
3616 pub limit_by: Option<Vec<Expression>>,
3617 pub fetch: Option<Fetch>,
3618 pub distinct: bool,
3619 pub distinct_on: Option<Vec<Expression>>,
3620 pub top: Option<Top>,
3621 pub with: Option<With>,
3622 pub sample: Option<Sample>,
3623 #[serde(default, skip_serializing_if = "Option::is_none")]
3625 pub settings: Option<Vec<Expression>>,
3626 #[serde(default, skip_serializing_if = "Option::is_none")]
3628 pub format: Option<Expression>,
3629 pub windows: Option<Vec<NamedWindow>>,
3630 pub hint: Option<Hint>,
3631 pub connect: Option<Connect>,
3633 pub into: Option<SelectInto>,
3635 #[serde(default)]
3637 pub locks: Vec<Lock>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3640 pub for_xml: Vec<Expression>,
3641 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3643 pub for_json: Vec<Expression>,
3644 #[serde(default)]
3646 pub leading_comments: Vec<String>,
3647 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3650 pub post_select_comments: Vec<String>,
3651 #[serde(default, skip_serializing_if = "Option::is_none")]
3653 pub kind: Option<String>,
3654 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3656 pub operation_modifiers: Vec<String>,
3657 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3659 pub qualify_after_window: bool,
3660 #[serde(default, skip_serializing_if = "Option::is_none")]
3662 pub option: Option<String>,
3663 #[serde(default, skip_serializing_if = "Option::is_none")]
3666 pub exclude: Option<Vec<Expression>>,
3667}
3668
3669impl Select {
3670 pub fn new() -> Self {
3671 Self {
3672 expressions: Vec::new(),
3673 from: None,
3674 joins: Vec::new(),
3675 lateral_views: Vec::new(),
3676 prewhere: None,
3677 where_clause: None,
3678 group_by: None,
3679 having: None,
3680 qualify: None,
3681 order_by: None,
3682 distribute_by: None,
3683 cluster_by: None,
3684 sort_by: None,
3685 limit: None,
3686 offset: None,
3687 limit_by: None,
3688 fetch: None,
3689 distinct: false,
3690 distinct_on: None,
3691 top: None,
3692 with: None,
3693 sample: None,
3694 settings: None,
3695 format: None,
3696 windows: None,
3697 hint: None,
3698 connect: None,
3699 into: None,
3700 locks: Vec::new(),
3701 for_xml: Vec::new(),
3702 for_json: Vec::new(),
3703 leading_comments: Vec::new(),
3704 post_select_comments: Vec::new(),
3705 kind: None,
3706 operation_modifiers: Vec::new(),
3707 qualify_after_window: false,
3708 option: None,
3709 exclude: None,
3710 }
3711 }
3712
3713 pub fn column(mut self, expr: Expression) -> Self {
3715 self.expressions.push(expr);
3716 self
3717 }
3718
3719 pub fn from(mut self, table: Expression) -> Self {
3721 self.from = Some(From {
3722 expressions: vec![table],
3723 });
3724 self
3725 }
3726
3727 pub fn where_(mut self, condition: Expression) -> Self {
3729 self.where_clause = Some(Where { this: condition });
3730 self
3731 }
3732
3733 pub fn distinct(mut self) -> Self {
3735 self.distinct = true;
3736 self
3737 }
3738
3739 pub fn join(mut self, join: Join) -> Self {
3741 self.joins.push(join);
3742 self
3743 }
3744
3745 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3747 self.order_by = Some(OrderBy {
3748 expressions,
3749 siblings: false,
3750 comments: Vec::new(),
3751 });
3752 self
3753 }
3754
3755 pub fn limit(mut self, n: Expression) -> Self {
3757 self.limit = Some(Limit {
3758 this: n,
3759 percent: false,
3760 comments: Vec::new(),
3761 });
3762 self
3763 }
3764
3765 pub fn offset(mut self, n: Expression) -> Self {
3767 self.offset = Some(Offset {
3768 this: n,
3769 rows: None,
3770 });
3771 self
3772 }
3773}
3774
3775impl Default for Select {
3776 fn default() -> Self {
3777 Self::new()
3778 }
3779}
3780
3781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3787#[cfg_attr(feature = "bindings", derive(TS))]
3788pub struct Union {
3789 pub left: Expression,
3791 pub right: Expression,
3793 pub all: bool,
3795 #[serde(default)]
3797 pub distinct: bool,
3798 pub with: Option<With>,
3800 pub order_by: Option<OrderBy>,
3802 pub limit: Option<Box<Expression>>,
3804 pub offset: Option<Box<Expression>>,
3806 #[serde(default, skip_serializing_if = "Option::is_none")]
3808 pub distribute_by: Option<DistributeBy>,
3809 #[serde(default, skip_serializing_if = "Option::is_none")]
3811 pub sort_by: Option<SortBy>,
3812 #[serde(default, skip_serializing_if = "Option::is_none")]
3814 pub cluster_by: Option<ClusterBy>,
3815 #[serde(default)]
3817 pub by_name: bool,
3818 #[serde(default, skip_serializing_if = "Option::is_none")]
3820 pub side: Option<String>,
3821 #[serde(default, skip_serializing_if = "Option::is_none")]
3823 pub kind: Option<String>,
3824 #[serde(default)]
3826 pub corresponding: bool,
3827 #[serde(default)]
3829 pub strict: bool,
3830 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3832 pub on_columns: Vec<Expression>,
3833}
3834
3835impl Drop for Union {
3838 fn drop(&mut self) {
3839 loop {
3840 if let Expression::Union(ref mut inner) = self.left {
3841 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3842 let old_left = std::mem::replace(&mut self.left, next_left);
3843 drop(old_left);
3844 } else {
3845 break;
3846 }
3847 }
3848 }
3849}
3850
3851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3856#[cfg_attr(feature = "bindings", derive(TS))]
3857pub struct Intersect {
3858 pub left: Expression,
3860 pub right: Expression,
3862 pub all: bool,
3864 #[serde(default)]
3866 pub distinct: bool,
3867 pub with: Option<With>,
3869 pub order_by: Option<OrderBy>,
3871 pub limit: Option<Box<Expression>>,
3873 pub offset: Option<Box<Expression>>,
3875 #[serde(default, skip_serializing_if = "Option::is_none")]
3877 pub distribute_by: Option<DistributeBy>,
3878 #[serde(default, skip_serializing_if = "Option::is_none")]
3880 pub sort_by: Option<SortBy>,
3881 #[serde(default, skip_serializing_if = "Option::is_none")]
3883 pub cluster_by: Option<ClusterBy>,
3884 #[serde(default)]
3886 pub by_name: bool,
3887 #[serde(default, skip_serializing_if = "Option::is_none")]
3889 pub side: Option<String>,
3890 #[serde(default, skip_serializing_if = "Option::is_none")]
3892 pub kind: Option<String>,
3893 #[serde(default)]
3895 pub corresponding: bool,
3896 #[serde(default)]
3898 pub strict: bool,
3899 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3901 pub on_columns: Vec<Expression>,
3902}
3903
3904impl Drop for Intersect {
3905 fn drop(&mut self) {
3906 loop {
3907 if let Expression::Intersect(ref mut inner) = self.left {
3908 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3909 let old_left = std::mem::replace(&mut self.left, next_left);
3910 drop(old_left);
3911 } else {
3912 break;
3913 }
3914 }
3915 }
3916}
3917
3918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3923#[cfg_attr(feature = "bindings", derive(TS))]
3924pub struct Except {
3925 pub left: Expression,
3927 pub right: Expression,
3929 pub all: bool,
3931 #[serde(default)]
3933 pub distinct: bool,
3934 pub with: Option<With>,
3936 pub order_by: Option<OrderBy>,
3938 pub limit: Option<Box<Expression>>,
3940 pub offset: Option<Box<Expression>>,
3942 #[serde(default, skip_serializing_if = "Option::is_none")]
3944 pub distribute_by: Option<DistributeBy>,
3945 #[serde(default, skip_serializing_if = "Option::is_none")]
3947 pub sort_by: Option<SortBy>,
3948 #[serde(default, skip_serializing_if = "Option::is_none")]
3950 pub cluster_by: Option<ClusterBy>,
3951 #[serde(default)]
3953 pub by_name: bool,
3954 #[serde(default, skip_serializing_if = "Option::is_none")]
3956 pub side: Option<String>,
3957 #[serde(default, skip_serializing_if = "Option::is_none")]
3959 pub kind: Option<String>,
3960 #[serde(default)]
3962 pub corresponding: bool,
3963 #[serde(default)]
3965 pub strict: bool,
3966 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3968 pub on_columns: Vec<Expression>,
3969}
3970
3971impl Drop for Except {
3972 fn drop(&mut self) {
3973 loop {
3974 if let Expression::Except(ref mut inner) = self.left {
3975 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3976 let old_left = std::mem::replace(&mut self.left, next_left);
3977 drop(old_left);
3978 } else {
3979 break;
3980 }
3981 }
3982 }
3983}
3984
3985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3987#[cfg_attr(feature = "bindings", derive(TS))]
3988pub struct SelectInto {
3989 pub this: Expression,
3991 #[serde(default)]
3993 pub temporary: bool,
3994 #[serde(default)]
3996 pub unlogged: bool,
3997 #[serde(default)]
3999 pub bulk_collect: bool,
4000 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4002 pub expressions: Vec<Expression>,
4003}
4004
4005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4015#[cfg_attr(feature = "bindings", derive(TS))]
4016pub struct Subquery {
4017 pub this: Expression,
4019 pub alias: Option<Identifier>,
4021 pub column_aliases: Vec<Identifier>,
4023 #[serde(default)]
4025 pub alias_explicit_as: bool,
4026 #[serde(skip_serializing_if = "Option::is_none", default)]
4028 pub alias_keyword: Option<String>,
4029 pub order_by: Option<OrderBy>,
4031 pub limit: Option<Limit>,
4033 pub offset: Option<Offset>,
4035 #[serde(default, skip_serializing_if = "Option::is_none")]
4037 pub distribute_by: Option<DistributeBy>,
4038 #[serde(default, skip_serializing_if = "Option::is_none")]
4040 pub sort_by: Option<SortBy>,
4041 #[serde(default, skip_serializing_if = "Option::is_none")]
4043 pub cluster_by: Option<ClusterBy>,
4044 #[serde(default)]
4046 pub lateral: bool,
4047 #[serde(default)]
4051 pub modifiers_inside: bool,
4052 #[serde(default)]
4054 pub trailing_comments: Vec<String>,
4055 #[serde(default, skip_serializing_if = "Option::is_none")]
4057 pub inferred_type: Option<DataType>,
4058}
4059
4060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4065#[cfg_attr(feature = "bindings", derive(TS))]
4066pub struct PipeOperator {
4067 pub this: Expression,
4069 pub expression: Expression,
4071}
4072
4073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4075#[cfg_attr(feature = "bindings", derive(TS))]
4076pub struct Values {
4077 pub expressions: Vec<Tuple>,
4079 pub alias: Option<Identifier>,
4081 pub column_aliases: Vec<Identifier>,
4083}
4084
4085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4095#[cfg_attr(feature = "bindings", derive(TS))]
4096pub struct Pivot {
4097 pub this: Expression,
4099 #[serde(default)]
4102 pub expressions: Vec<Expression>,
4103 #[serde(default)]
4105 pub fields: Vec<Expression>,
4106 #[serde(default)]
4108 pub using: Vec<Expression>,
4109 #[serde(default)]
4111 pub group: Option<Box<Expression>>,
4112 #[serde(default)]
4114 pub unpivot: bool,
4115 #[serde(default)]
4117 pub into: Option<Box<Expression>>,
4118 #[serde(default)]
4120 pub alias: Option<Identifier>,
4121 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4123 pub alias_columns: Vec<Identifier>,
4124 #[serde(default)]
4126 pub include_nulls: Option<bool>,
4127 #[serde(default)]
4129 pub default_on_null: Option<Box<Expression>>,
4130 #[serde(default, skip_serializing_if = "Option::is_none")]
4132 pub with: Option<With>,
4133}
4134
4135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4137#[cfg_attr(feature = "bindings", derive(TS))]
4138pub struct Unpivot {
4139 pub this: Expression,
4140 pub value_column: Identifier,
4141 pub name_column: Identifier,
4142 pub columns: Vec<Expression>,
4143 pub alias: Option<Identifier>,
4144 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4146 pub alias_columns: Vec<Identifier>,
4147 #[serde(default)]
4149 pub value_column_parenthesized: bool,
4150 #[serde(default)]
4152 pub include_nulls: Option<bool>,
4153 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4155 pub extra_value_columns: Vec<Identifier>,
4156}
4157
4158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4161#[cfg_attr(feature = "bindings", derive(TS))]
4162pub struct PivotAlias {
4163 pub this: Expression,
4164 pub alias: Expression,
4165}
4166
4167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4169#[cfg_attr(feature = "bindings", derive(TS))]
4170pub struct PreWhere {
4171 pub this: Expression,
4172}
4173
4174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4176#[cfg_attr(feature = "bindings", derive(TS))]
4177pub struct Stream {
4178 pub this: Expression,
4179 #[serde(skip_serializing_if = "Option::is_none")]
4180 pub on: Option<Expression>,
4181 #[serde(skip_serializing_if = "Option::is_none")]
4182 pub show_initial_rows: Option<bool>,
4183}
4184
4185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4187#[cfg_attr(feature = "bindings", derive(TS))]
4188pub struct UsingData {
4189 pub this: Expression,
4190}
4191
4192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4194#[cfg_attr(feature = "bindings", derive(TS))]
4195pub struct XmlNamespace {
4196 pub this: Expression,
4197 #[serde(skip_serializing_if = "Option::is_none")]
4198 pub alias: Option<Identifier>,
4199}
4200
4201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4203#[cfg_attr(feature = "bindings", derive(TS))]
4204pub struct RowFormat {
4205 pub delimited: bool,
4206 pub fields_terminated_by: Option<String>,
4207 pub collection_items_terminated_by: Option<String>,
4208 pub map_keys_terminated_by: Option<String>,
4209 pub lines_terminated_by: Option<String>,
4210 pub null_defined_as: Option<String>,
4211}
4212
4213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4215#[cfg_attr(feature = "bindings", derive(TS))]
4216pub struct DirectoryInsert {
4217 pub local: bool,
4218 pub path: String,
4219 pub row_format: Option<RowFormat>,
4220 #[serde(default)]
4222 pub stored_as: Option<String>,
4223}
4224
4225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4227#[cfg_attr(feature = "bindings", derive(TS))]
4228pub struct Insert {
4229 pub table: TableRef,
4230 pub columns: Vec<Identifier>,
4231 pub values: Vec<Vec<Expression>>,
4232 pub query: Option<Expression>,
4233 pub overwrite: bool,
4235 pub partition: Vec<(Identifier, Option<Expression>)>,
4237 #[serde(default)]
4239 pub directory: Option<DirectoryInsert>,
4240 #[serde(default)]
4242 pub returning: Vec<Expression>,
4243 #[serde(default)]
4245 pub output: Option<OutputClause>,
4246 #[serde(default)]
4248 pub on_conflict: Option<Box<Expression>>,
4249 #[serde(default)]
4251 pub leading_comments: Vec<String>,
4252 #[serde(default)]
4254 pub if_exists: bool,
4255 #[serde(default)]
4257 pub with: Option<With>,
4258 #[serde(default)]
4260 pub ignore: bool,
4261 #[serde(default)]
4263 pub source_alias: Option<Identifier>,
4264 #[serde(default)]
4266 pub alias: Option<Identifier>,
4267 #[serde(default)]
4269 pub alias_explicit_as: bool,
4270 #[serde(default)]
4272 pub default_values: bool,
4273 #[serde(default)]
4275 pub by_name: bool,
4276 #[serde(default, skip_serializing_if = "Option::is_none")]
4278 pub conflict_action: Option<String>,
4279 #[serde(default)]
4281 pub is_replace: bool,
4282 #[serde(default, skip_serializing_if = "Option::is_none")]
4284 pub hint: Option<Hint>,
4285 #[serde(default)]
4287 pub replace_where: Option<Box<Expression>>,
4288 #[serde(default)]
4290 pub source: Option<Box<Expression>>,
4291 #[serde(default, skip_serializing_if = "Option::is_none")]
4293 pub function_target: Option<Box<Expression>>,
4294 #[serde(default, skip_serializing_if = "Option::is_none")]
4296 pub partition_by: Option<Box<Expression>>,
4297 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4299 pub settings: Vec<Expression>,
4300}
4301
4302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4304#[cfg_attr(feature = "bindings", derive(TS))]
4305pub struct OutputClause {
4306 pub columns: Vec<Expression>,
4308 #[serde(default)]
4310 pub into_table: Option<Expression>,
4311}
4312
4313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4315#[cfg_attr(feature = "bindings", derive(TS))]
4316pub struct Update {
4317 pub table: TableRef,
4318 #[serde(default)]
4319 pub hint: Option<Hint>,
4320 #[serde(default)]
4322 pub extra_tables: Vec<TableRef>,
4323 #[serde(default)]
4325 pub table_joins: Vec<Join>,
4326 pub set: Vec<(Identifier, Expression)>,
4327 pub from_clause: Option<From>,
4328 #[serde(default)]
4330 pub from_joins: Vec<Join>,
4331 pub where_clause: Option<Where>,
4332 #[serde(default)]
4334 pub returning: Vec<Expression>,
4335 #[serde(default)]
4337 pub output: Option<OutputClause>,
4338 #[serde(default)]
4340 pub with: Option<With>,
4341 #[serde(default)]
4343 pub leading_comments: Vec<String>,
4344 #[serde(default)]
4346 pub limit: Option<Expression>,
4347 #[serde(default)]
4349 pub order_by: Option<OrderBy>,
4350 #[serde(default)]
4352 pub from_before_set: bool,
4353}
4354
4355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4357#[cfg_attr(feature = "bindings", derive(TS))]
4358pub struct Delete {
4359 pub table: TableRef,
4360 #[serde(default)]
4361 pub hint: Option<Hint>,
4362 #[serde(default, skip_serializing_if = "Option::is_none")]
4364 pub on_cluster: Option<OnCluster>,
4365 pub alias: Option<Identifier>,
4367 #[serde(default)]
4369 pub alias_explicit_as: bool,
4370 pub using: Vec<TableRef>,
4372 pub where_clause: Option<Where>,
4373 #[serde(default)]
4375 pub output: Option<OutputClause>,
4376 #[serde(default)]
4378 pub leading_comments: Vec<String>,
4379 #[serde(default)]
4381 pub with: Option<With>,
4382 #[serde(default)]
4384 pub limit: Option<Expression>,
4385 #[serde(default)]
4387 pub order_by: Option<OrderBy>,
4388 #[serde(default)]
4390 pub returning: Vec<Expression>,
4391 #[serde(default)]
4394 pub tables: Vec<TableRef>,
4395 #[serde(default)]
4398 pub tables_from_using: bool,
4399 #[serde(default)]
4401 pub joins: Vec<Join>,
4402 #[serde(default)]
4404 pub force_index: Option<String>,
4405 #[serde(default)]
4407 pub no_from: bool,
4408}
4409
4410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4412#[cfg_attr(feature = "bindings", derive(TS))]
4413pub struct CopyStmt {
4414 pub this: Expression,
4416 pub kind: bool,
4418 pub files: Vec<Expression>,
4420 #[serde(default)]
4422 pub params: Vec<CopyParameter>,
4423 #[serde(default)]
4425 pub credentials: Option<Box<Credentials>>,
4426 #[serde(default)]
4428 pub is_into: bool,
4429 #[serde(default)]
4431 pub with_wrapped: bool,
4432}
4433
4434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4436#[cfg_attr(feature = "bindings", derive(TS))]
4437pub struct CopyParameter {
4438 pub name: String,
4439 pub value: Option<Expression>,
4440 pub values: Vec<Expression>,
4441 #[serde(default)]
4443 pub eq: bool,
4444}
4445
4446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4448#[cfg_attr(feature = "bindings", derive(TS))]
4449pub struct Credentials {
4450 pub credentials: Vec<(String, String)>,
4451 pub encryption: Option<String>,
4452 pub storage: Option<String>,
4453}
4454
4455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4457#[cfg_attr(feature = "bindings", derive(TS))]
4458pub struct PutStmt {
4459 pub source: String,
4461 #[serde(default)]
4463 pub source_quoted: bool,
4464 pub target: Expression,
4466 #[serde(default)]
4468 pub params: Vec<CopyParameter>,
4469}
4470
4471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4473#[cfg_attr(feature = "bindings", derive(TS))]
4474pub struct StageReference {
4475 pub name: String,
4477 #[serde(default)]
4479 pub path: Option<String>,
4480 #[serde(default)]
4482 pub file_format: Option<Expression>,
4483 #[serde(default)]
4485 pub pattern: Option<String>,
4486 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4488 pub quoted: bool,
4489}
4490
4491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4493#[cfg_attr(feature = "bindings", derive(TS))]
4494pub struct HistoricalData {
4495 pub this: Box<Expression>,
4497 pub kind: String,
4499 pub expression: Box<Expression>,
4501}
4502
4503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4508#[cfg_attr(feature = "bindings", derive(TS))]
4509pub struct Alias {
4510 pub this: Expression,
4512 pub alias: Identifier,
4514 #[serde(default)]
4516 pub column_aliases: Vec<Identifier>,
4517 #[serde(default)]
4519 pub alias_explicit_as: bool,
4520 #[serde(skip_serializing_if = "Option::is_none", default)]
4522 pub alias_keyword: Option<String>,
4523 #[serde(default)]
4525 pub pre_alias_comments: Vec<String>,
4526 #[serde(default)]
4528 pub trailing_comments: Vec<String>,
4529 #[serde(default, skip_serializing_if = "Option::is_none")]
4531 pub inferred_type: Option<DataType>,
4532}
4533
4534impl Alias {
4535 pub fn new(this: Expression, alias: Identifier) -> Self {
4537 Self {
4538 this,
4539 alias,
4540 column_aliases: Vec::new(),
4541 alias_explicit_as: false,
4542 alias_keyword: None,
4543 pre_alias_comments: Vec::new(),
4544 trailing_comments: Vec::new(),
4545 inferred_type: None,
4546 }
4547 }
4548
4549 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4551 Self {
4552 this,
4553 alias: Identifier::empty(),
4554 column_aliases,
4555 alias_explicit_as: false,
4556 alias_keyword: None,
4557 pre_alias_comments: Vec::new(),
4558 trailing_comments: Vec::new(),
4559 inferred_type: None,
4560 }
4561 }
4562}
4563
4564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4571#[cfg_attr(feature = "bindings", derive(TS))]
4572pub struct Cast {
4573 pub this: Expression,
4575 pub to: DataType,
4577 #[serde(default)]
4578 pub trailing_comments: Vec<String>,
4579 #[serde(default)]
4581 pub double_colon_syntax: bool,
4582 #[serde(skip_serializing_if = "Option::is_none", default)]
4584 pub format: Option<Box<Expression>>,
4585 #[serde(skip_serializing_if = "Option::is_none", default)]
4587 pub default: Option<Box<Expression>>,
4588 #[serde(default, skip_serializing_if = "Option::is_none")]
4590 pub inferred_type: Option<DataType>,
4591}
4592
4593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4595#[cfg_attr(feature = "bindings", derive(TS))]
4596pub struct CollationExpr {
4597 pub this: Expression,
4598 pub collation: String,
4599 #[serde(default)]
4601 pub quoted: bool,
4602 #[serde(default)]
4604 pub double_quoted: bool,
4605}
4606
4607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4613#[cfg_attr(feature = "bindings", derive(TS))]
4614pub struct Case {
4615 pub operand: Option<Expression>,
4617 pub whens: Vec<(Expression, Expression)>,
4619 pub else_: Option<Expression>,
4621 #[serde(default)]
4623 #[serde(skip_serializing_if = "Vec::is_empty")]
4624 pub comments: Vec<String>,
4625 #[serde(default, skip_serializing_if = "Option::is_none")]
4627 pub inferred_type: Option<DataType>,
4628}
4629
4630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4638#[cfg_attr(feature = "bindings", derive(TS))]
4639pub struct BinaryOp {
4640 pub left: Expression,
4641 pub right: Expression,
4642 #[serde(default)]
4644 pub left_comments: Vec<String>,
4645 #[serde(default)]
4647 pub operator_comments: Vec<String>,
4648 #[serde(default)]
4650 pub trailing_comments: Vec<String>,
4651 #[serde(default, skip_serializing_if = "Option::is_none")]
4653 pub inferred_type: Option<DataType>,
4654}
4655
4656impl BinaryOp {
4657 pub fn new(left: Expression, right: Expression) -> Self {
4658 Self {
4659 left,
4660 right,
4661 left_comments: Vec::new(),
4662 operator_comments: Vec::new(),
4663 trailing_comments: Vec::new(),
4664 inferred_type: None,
4665 }
4666 }
4667}
4668
4669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4671#[cfg_attr(feature = "bindings", derive(TS))]
4672pub struct LikeOp {
4673 pub left: Expression,
4674 pub right: Expression,
4675 #[serde(default)]
4677 pub escape: Option<Expression>,
4678 #[serde(default)]
4680 pub quantifier: Option<String>,
4681 #[serde(default, skip_serializing_if = "Option::is_none")]
4683 pub inferred_type: Option<DataType>,
4684}
4685
4686impl LikeOp {
4687 pub fn new(left: Expression, right: Expression) -> Self {
4688 Self {
4689 left,
4690 right,
4691 escape: None,
4692 quantifier: None,
4693 inferred_type: None,
4694 }
4695 }
4696
4697 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4698 Self {
4699 left,
4700 right,
4701 escape: Some(escape),
4702 quantifier: None,
4703 inferred_type: None,
4704 }
4705 }
4706}
4707
4708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4712#[cfg_attr(feature = "bindings", derive(TS))]
4713pub struct UnaryOp {
4714 pub this: Expression,
4716 #[serde(default, skip_serializing_if = "Option::is_none")]
4718 pub inferred_type: Option<DataType>,
4719}
4720
4721impl UnaryOp {
4722 pub fn new(this: Expression) -> Self {
4723 Self {
4724 this,
4725 inferred_type: None,
4726 }
4727 }
4728}
4729
4730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4735#[cfg_attr(feature = "bindings", derive(TS))]
4736pub struct In {
4737 pub this: Expression,
4739 pub expressions: Vec<Expression>,
4741 pub query: Option<Expression>,
4743 pub not: bool,
4745 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4746 pub global: bool,
4747 #[serde(default, skip_serializing_if = "Option::is_none")]
4749 pub unnest: Option<Box<Expression>>,
4750 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4754 pub is_field: bool,
4755}
4756
4757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4759#[cfg_attr(feature = "bindings", derive(TS))]
4760pub struct Between {
4761 pub this: Expression,
4763 pub low: Expression,
4765 pub high: Expression,
4767 pub not: bool,
4769 #[serde(default)]
4771 pub symmetric: Option<bool>,
4772}
4773
4774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4776#[cfg_attr(feature = "bindings", derive(TS))]
4777pub struct IsNull {
4778 pub this: Expression,
4779 pub not: bool,
4780 #[serde(default)]
4782 pub postfix_form: bool,
4783}
4784
4785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4787#[cfg_attr(feature = "bindings", derive(TS))]
4788pub struct IsTrueFalse {
4789 pub this: Expression,
4790 pub not: bool,
4791}
4792
4793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4796#[cfg_attr(feature = "bindings", derive(TS))]
4797pub struct IsJson {
4798 pub this: Expression,
4799 pub json_type: Option<String>,
4801 pub unique_keys: Option<JsonUniqueKeys>,
4803 pub negated: bool,
4805}
4806
4807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4809#[cfg_attr(feature = "bindings", derive(TS))]
4810pub enum JsonUniqueKeys {
4811 With,
4813 Without,
4815 Shorthand,
4817}
4818
4819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4821#[cfg_attr(feature = "bindings", derive(TS))]
4822pub struct Exists {
4823 pub this: Expression,
4825 pub not: bool,
4827}
4828
4829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4836#[cfg_attr(feature = "bindings", derive(TS))]
4837pub struct Function {
4838 pub name: String,
4840 pub args: Vec<Expression>,
4842 pub distinct: bool,
4844 #[serde(default)]
4845 pub trailing_comments: Vec<String>,
4846 #[serde(default)]
4848 pub use_bracket_syntax: bool,
4849 #[serde(default)]
4851 pub no_parens: bool,
4852 #[serde(default)]
4854 pub quoted: bool,
4855 #[serde(default, skip_serializing_if = "Option::is_none")]
4857 pub span: Option<Span>,
4858 #[serde(default, skip_serializing_if = "Option::is_none")]
4860 pub inferred_type: Option<DataType>,
4861}
4862
4863impl Default for Function {
4864 fn default() -> Self {
4865 Self {
4866 name: String::new(),
4867 args: Vec::new(),
4868 distinct: false,
4869 trailing_comments: Vec::new(),
4870 use_bracket_syntax: false,
4871 no_parens: false,
4872 quoted: false,
4873 span: None,
4874 inferred_type: None,
4875 }
4876 }
4877}
4878
4879impl Function {
4880 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4881 Self {
4882 name: name.into(),
4883 args,
4884 distinct: false,
4885 trailing_comments: Vec::new(),
4886 use_bracket_syntax: false,
4887 no_parens: false,
4888 quoted: false,
4889 span: None,
4890 inferred_type: None,
4891 }
4892 }
4893}
4894
4895#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4902#[cfg_attr(feature = "bindings", derive(TS))]
4903pub struct AggregateFunction {
4904 pub name: String,
4906 pub args: Vec<Expression>,
4908 pub distinct: bool,
4910 pub filter: Option<Expression>,
4912 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4914 pub order_by: Vec<Ordered>,
4915 #[serde(default, skip_serializing_if = "Option::is_none")]
4917 pub limit: Option<Box<Expression>>,
4918 #[serde(default, skip_serializing_if = "Option::is_none")]
4920 pub ignore_nulls: Option<bool>,
4921 #[serde(default, skip_serializing_if = "Option::is_none")]
4923 pub inferred_type: Option<DataType>,
4924}
4925
4926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4933#[cfg_attr(feature = "bindings", derive(TS))]
4934pub struct WindowFunction {
4935 pub this: Expression,
4937 pub over: Over,
4939 #[serde(default, skip_serializing_if = "Option::is_none")]
4941 pub keep: Option<Keep>,
4942 #[serde(default, skip_serializing_if = "Option::is_none")]
4944 pub inferred_type: Option<DataType>,
4945}
4946
4947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4950#[cfg_attr(feature = "bindings", derive(TS))]
4951pub struct Keep {
4952 pub first: bool,
4954 pub order_by: Vec<Ordered>,
4956}
4957
4958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4960#[cfg_attr(feature = "bindings", derive(TS))]
4961pub struct WithinGroup {
4962 pub this: Expression,
4964 pub order_by: Vec<Ordered>,
4966}
4967
4968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4973#[cfg_attr(feature = "bindings", derive(TS))]
4974pub struct From {
4975 pub expressions: Vec<Expression>,
4977}
4978
4979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4985#[cfg_attr(feature = "bindings", derive(TS))]
4986pub struct Join {
4987 pub this: Expression,
4989 pub on: Option<Expression>,
4991 pub using: Vec<Identifier>,
4993 pub kind: JoinKind,
4995 pub use_inner_keyword: bool,
4997 pub use_outer_keyword: bool,
4999 pub deferred_condition: bool,
5001 #[serde(default, skip_serializing_if = "Option::is_none")]
5003 pub join_hint: Option<String>,
5004 #[serde(default, skip_serializing_if = "Option::is_none")]
5006 pub match_condition: Option<Expression>,
5007 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5009 pub pivots: Vec<Expression>,
5010 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5012 pub comments: Vec<String>,
5013 #[serde(default)]
5017 pub nesting_group: usize,
5018 #[serde(default)]
5020 pub directed: bool,
5021}
5022
5023#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5030#[cfg_attr(feature = "bindings", derive(TS))]
5031pub enum JoinKind {
5032 Inner,
5033 Left,
5034 Right,
5035 Full,
5036 Outer, Cross,
5038 Natural,
5039 NaturalLeft,
5040 NaturalRight,
5041 NaturalFull,
5042 Semi,
5043 Anti,
5044 LeftSemi,
5046 LeftAnti,
5047 RightSemi,
5048 RightAnti,
5049 CrossApply,
5051 OuterApply,
5052 AsOf,
5054 AsOfLeft,
5055 AsOfRight,
5056 Lateral,
5058 LeftLateral,
5059 Straight,
5061 Implicit,
5063 Array,
5065 LeftArray,
5066 Paste,
5068 Positional,
5070}
5071
5072impl Default for JoinKind {
5073 fn default() -> Self {
5074 JoinKind::Inner
5075 }
5076}
5077
5078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5081#[cfg_attr(feature = "bindings", derive(TS))]
5082pub struct JoinedTable {
5083 pub left: Expression,
5085 pub joins: Vec<Join>,
5087 pub lateral_views: Vec<LateralView>,
5089 pub alias: Option<Identifier>,
5091}
5092
5093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5095#[cfg_attr(feature = "bindings", derive(TS))]
5096pub struct Where {
5097 pub this: Expression,
5099}
5100
5101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5106#[cfg_attr(feature = "bindings", derive(TS))]
5107pub struct GroupBy {
5108 pub expressions: Vec<Expression>,
5110 #[serde(default)]
5112 pub all: Option<bool>,
5113 #[serde(default)]
5115 pub totals: bool,
5116 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5118 pub comments: Vec<String>,
5119}
5120
5121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5123#[cfg_attr(feature = "bindings", derive(TS))]
5124pub struct Having {
5125 pub this: Expression,
5127 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5129 pub comments: Vec<String>,
5130}
5131
5132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5134#[cfg_attr(feature = "bindings", derive(TS))]
5135pub struct OrderBy {
5136 pub expressions: Vec<Ordered>,
5138 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5140 pub siblings: bool,
5141 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5143 pub comments: Vec<String>,
5144}
5145
5146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5153#[cfg_attr(feature = "bindings", derive(TS))]
5154pub struct Ordered {
5155 pub this: Expression,
5157 pub desc: bool,
5159 pub nulls_first: Option<bool>,
5161 #[serde(default)]
5163 pub explicit_asc: bool,
5164 #[serde(default, skip_serializing_if = "Option::is_none")]
5166 pub with_fill: Option<Box<WithFill>>,
5167}
5168
5169impl Ordered {
5170 pub fn asc(expr: Expression) -> Self {
5171 Self {
5172 this: expr,
5173 desc: false,
5174 nulls_first: None,
5175 explicit_asc: false,
5176 with_fill: None,
5177 }
5178 }
5179
5180 pub fn desc(expr: Expression) -> Self {
5181 Self {
5182 this: expr,
5183 desc: true,
5184 nulls_first: None,
5185 explicit_asc: false,
5186 with_fill: None,
5187 }
5188 }
5189}
5190
5191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5194#[cfg_attr(feature = "bindings", derive(TS))]
5195#[cfg_attr(feature = "bindings", ts(export))]
5196pub struct DistributeBy {
5197 pub expressions: Vec<Expression>,
5198}
5199
5200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5203#[cfg_attr(feature = "bindings", derive(TS))]
5204#[cfg_attr(feature = "bindings", ts(export))]
5205pub struct ClusterBy {
5206 pub expressions: Vec<Ordered>,
5207}
5208
5209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5212#[cfg_attr(feature = "bindings", derive(TS))]
5213#[cfg_attr(feature = "bindings", ts(export))]
5214pub struct SortBy {
5215 pub expressions: Vec<Ordered>,
5216}
5217
5218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5221#[cfg_attr(feature = "bindings", derive(TS))]
5222#[cfg_attr(feature = "bindings", ts(export))]
5223pub struct LateralView {
5224 pub this: Expression,
5226 pub table_alias: Option<Identifier>,
5228 pub column_aliases: Vec<Identifier>,
5230 pub outer: bool,
5232}
5233
5234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5236#[cfg_attr(feature = "bindings", derive(TS))]
5237#[cfg_attr(feature = "bindings", ts(export))]
5238pub struct Hint {
5239 pub expressions: Vec<HintExpression>,
5240}
5241
5242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5244#[cfg_attr(feature = "bindings", derive(TS))]
5245#[cfg_attr(feature = "bindings", ts(export))]
5246pub enum HintExpression {
5247 Function { name: String, args: Vec<Expression> },
5249 Identifier(String),
5251 Raw(String),
5253}
5254
5255#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5257#[cfg_attr(feature = "bindings", derive(TS))]
5258#[cfg_attr(feature = "bindings", ts(export))]
5259pub enum PseudocolumnType {
5260 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5267
5268impl PseudocolumnType {
5269 pub fn as_str(&self) -> &'static str {
5270 match self {
5271 PseudocolumnType::Rownum => "ROWNUM",
5272 PseudocolumnType::Rowid => "ROWID",
5273 PseudocolumnType::Level => "LEVEL",
5274 PseudocolumnType::Sysdate => "SYSDATE",
5275 PseudocolumnType::ObjectId => "OBJECT_ID",
5276 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5277 }
5278 }
5279
5280 pub fn from_str(s: &str) -> Option<Self> {
5281 match s.to_uppercase().as_str() {
5282 "ROWNUM" => Some(PseudocolumnType::Rownum),
5283 "ROWID" => Some(PseudocolumnType::Rowid),
5284 "LEVEL" => Some(PseudocolumnType::Level),
5285 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5286 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5287 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5288 _ => None,
5289 }
5290 }
5291}
5292
5293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5296#[cfg_attr(feature = "bindings", derive(TS))]
5297#[cfg_attr(feature = "bindings", ts(export))]
5298pub struct Pseudocolumn {
5299 pub kind: PseudocolumnType,
5300}
5301
5302impl Pseudocolumn {
5303 pub fn rownum() -> Self {
5304 Self {
5305 kind: PseudocolumnType::Rownum,
5306 }
5307 }
5308
5309 pub fn rowid() -> Self {
5310 Self {
5311 kind: PseudocolumnType::Rowid,
5312 }
5313 }
5314
5315 pub fn level() -> Self {
5316 Self {
5317 kind: PseudocolumnType::Level,
5318 }
5319 }
5320}
5321
5322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5324#[cfg_attr(feature = "bindings", derive(TS))]
5325#[cfg_attr(feature = "bindings", ts(export))]
5326pub struct Connect {
5327 pub start: Option<Expression>,
5329 pub connect: Expression,
5331 pub nocycle: bool,
5333}
5334
5335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5337#[cfg_attr(feature = "bindings", derive(TS))]
5338#[cfg_attr(feature = "bindings", ts(export))]
5339pub struct Prior {
5340 pub this: Expression,
5341}
5342
5343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5345#[cfg_attr(feature = "bindings", derive(TS))]
5346#[cfg_attr(feature = "bindings", ts(export))]
5347pub struct ConnectByRoot {
5348 pub this: Expression,
5349}
5350
5351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5353#[cfg_attr(feature = "bindings", derive(TS))]
5354#[cfg_attr(feature = "bindings", ts(export))]
5355pub struct MatchRecognize {
5356 pub this: Option<Box<Expression>>,
5358 pub partition_by: Option<Vec<Expression>>,
5360 pub order_by: Option<Vec<Ordered>>,
5362 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5364 pub rows: Option<MatchRecognizeRows>,
5366 pub after: Option<MatchRecognizeAfter>,
5368 pub pattern: Option<String>,
5370 pub define: Option<Vec<(Identifier, Expression)>>,
5372 pub alias: Option<Identifier>,
5374 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5376 pub alias_explicit_as: bool,
5377}
5378
5379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5381#[cfg_attr(feature = "bindings", derive(TS))]
5382#[cfg_attr(feature = "bindings", ts(export))]
5383pub struct MatchRecognizeMeasure {
5384 pub this: Expression,
5386 pub window_frame: Option<MatchRecognizeSemantics>,
5388}
5389
5390#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5392#[cfg_attr(feature = "bindings", derive(TS))]
5393#[cfg_attr(feature = "bindings", ts(export))]
5394pub enum MatchRecognizeSemantics {
5395 Running,
5396 Final,
5397}
5398
5399#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5401#[cfg_attr(feature = "bindings", derive(TS))]
5402#[cfg_attr(feature = "bindings", ts(export))]
5403pub enum MatchRecognizeRows {
5404 OneRowPerMatch,
5405 AllRowsPerMatch,
5406 AllRowsPerMatchShowEmptyMatches,
5407 AllRowsPerMatchOmitEmptyMatches,
5408 AllRowsPerMatchWithUnmatchedRows,
5409}
5410
5411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5413#[cfg_attr(feature = "bindings", derive(TS))]
5414#[cfg_attr(feature = "bindings", ts(export))]
5415pub enum MatchRecognizeAfter {
5416 PastLastRow,
5417 ToNextRow,
5418 ToFirst(Identifier),
5419 ToLast(Identifier),
5420}
5421
5422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5424#[cfg_attr(feature = "bindings", derive(TS))]
5425pub struct Limit {
5426 pub this: Expression,
5428 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5430 pub percent: bool,
5431 #[serde(default)]
5433 #[serde(skip_serializing_if = "Vec::is_empty")]
5434 pub comments: Vec<String>,
5435}
5436
5437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5439#[cfg_attr(feature = "bindings", derive(TS))]
5440pub struct Offset {
5441 pub this: Expression,
5442 #[serde(skip_serializing_if = "Option::is_none", default)]
5444 pub rows: Option<bool>,
5445}
5446
5447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5449#[cfg_attr(feature = "bindings", derive(TS))]
5450pub struct Top {
5451 pub this: Expression,
5452 pub percent: bool,
5453 pub with_ties: bool,
5454 #[serde(default)]
5456 pub parenthesized: bool,
5457}
5458
5459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5461#[cfg_attr(feature = "bindings", derive(TS))]
5462pub struct Fetch {
5463 pub direction: String,
5465 pub count: Option<Expression>,
5467 pub percent: bool,
5469 pub rows: bool,
5471 pub with_ties: bool,
5473}
5474
5475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5481#[cfg_attr(feature = "bindings", derive(TS))]
5482pub struct Qualify {
5483 pub this: Expression,
5485}
5486
5487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5489#[cfg_attr(feature = "bindings", derive(TS))]
5490pub struct Sample {
5491 pub method: SampleMethod,
5492 pub size: Expression,
5493 pub seed: Option<Expression>,
5494 #[serde(default)]
5496 pub offset: Option<Expression>,
5497 pub unit_after_size: bool,
5499 #[serde(default)]
5501 pub use_sample_keyword: bool,
5502 #[serde(default)]
5504 pub explicit_method: bool,
5505 #[serde(default)]
5507 pub method_before_size: bool,
5508 #[serde(default)]
5510 pub use_seed_keyword: bool,
5511 pub bucket_numerator: Option<Box<Expression>>,
5513 pub bucket_denominator: Option<Box<Expression>>,
5515 pub bucket_field: Option<Box<Expression>>,
5517 #[serde(default)]
5519 pub is_using_sample: bool,
5520 #[serde(default)]
5522 pub is_percent: bool,
5523 #[serde(default)]
5525 pub suppress_method_output: bool,
5526}
5527
5528#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5530#[cfg_attr(feature = "bindings", derive(TS))]
5531pub enum SampleMethod {
5532 Bernoulli,
5533 System,
5534 Block,
5535 Row,
5536 Percent,
5537 Bucket,
5539 Reservoir,
5541}
5542
5543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5545#[cfg_attr(feature = "bindings", derive(TS))]
5546pub struct NamedWindow {
5547 pub name: Identifier,
5548 pub spec: Over,
5549}
5550
5551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5557#[cfg_attr(feature = "bindings", derive(TS))]
5558pub struct With {
5559 pub ctes: Vec<Cte>,
5561 pub recursive: bool,
5563 #[serde(default)]
5565 pub leading_comments: Vec<String>,
5566 #[serde(default, skip_serializing_if = "Option::is_none")]
5568 pub search: Option<Box<Expression>>,
5569}
5570
5571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5578#[cfg_attr(feature = "bindings", derive(TS))]
5579pub struct Cte {
5580 pub alias: Identifier,
5582 pub this: Expression,
5584 pub columns: Vec<Identifier>,
5586 pub materialized: Option<bool>,
5588 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5590 pub key_expressions: Vec<Identifier>,
5591 #[serde(default)]
5593 pub alias_first: bool,
5594 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5596 pub comments: Vec<String>,
5597}
5598
5599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5601#[cfg_attr(feature = "bindings", derive(TS))]
5602pub struct WindowSpec {
5603 pub partition_by: Vec<Expression>,
5604 pub order_by: Vec<Ordered>,
5605 pub frame: Option<WindowFrame>,
5606}
5607
5608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5610#[cfg_attr(feature = "bindings", derive(TS))]
5611pub struct Over {
5612 pub window_name: Option<Identifier>,
5614 pub partition_by: Vec<Expression>,
5615 pub order_by: Vec<Ordered>,
5616 pub frame: Option<WindowFrame>,
5617 pub alias: Option<Identifier>,
5618}
5619
5620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5622#[cfg_attr(feature = "bindings", derive(TS))]
5623pub struct WindowFrame {
5624 pub kind: WindowFrameKind,
5625 pub start: WindowFrameBound,
5626 pub end: Option<WindowFrameBound>,
5627 pub exclude: Option<WindowFrameExclude>,
5628 #[serde(default, skip_serializing_if = "Option::is_none")]
5630 pub kind_text: Option<String>,
5631 #[serde(default, skip_serializing_if = "Option::is_none")]
5633 pub start_side_text: Option<String>,
5634 #[serde(default, skip_serializing_if = "Option::is_none")]
5636 pub end_side_text: Option<String>,
5637}
5638
5639#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5640#[cfg_attr(feature = "bindings", derive(TS))]
5641pub enum WindowFrameKind {
5642 Rows,
5643 Range,
5644 Groups,
5645}
5646
5647#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5649#[cfg_attr(feature = "bindings", derive(TS))]
5650pub enum WindowFrameExclude {
5651 CurrentRow,
5652 Group,
5653 Ties,
5654 NoOthers,
5655}
5656
5657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5658#[cfg_attr(feature = "bindings", derive(TS))]
5659pub enum WindowFrameBound {
5660 CurrentRow,
5661 UnboundedPreceding,
5662 UnboundedFollowing,
5663 Preceding(Box<Expression>),
5664 Following(Box<Expression>),
5665 BarePreceding,
5667 BareFollowing,
5669 Value(Box<Expression>),
5671}
5672
5673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5675#[cfg_attr(feature = "bindings", derive(TS))]
5676pub struct StructField {
5677 pub name: String,
5678 pub data_type: DataType,
5679 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5680 pub options: Vec<Expression>,
5681 #[serde(default, skip_serializing_if = "Option::is_none")]
5682 pub comment: Option<String>,
5683}
5684
5685impl StructField {
5686 pub fn new(name: String, data_type: DataType) -> Self {
5688 Self {
5689 name,
5690 data_type,
5691 options: Vec::new(),
5692 comment: None,
5693 }
5694 }
5695
5696 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5698 Self {
5699 name,
5700 data_type,
5701 options,
5702 comment: None,
5703 }
5704 }
5705
5706 pub fn with_options_and_comment(
5708 name: String,
5709 data_type: DataType,
5710 options: Vec<Expression>,
5711 comment: Option<String>,
5712 ) -> Self {
5713 Self {
5714 name,
5715 data_type,
5716 options,
5717 comment,
5718 }
5719 }
5720}
5721
5722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5734#[cfg_attr(feature = "bindings", derive(TS))]
5735#[serde(tag = "data_type", rename_all = "snake_case")]
5736pub enum DataType {
5737 Boolean,
5739 TinyInt {
5740 length: Option<u32>,
5741 },
5742 SmallInt {
5743 length: Option<u32>,
5744 },
5745 Int {
5749 length: Option<u32>,
5750 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5751 integer_spelling: bool,
5752 },
5753 BigInt {
5754 length: Option<u32>,
5755 },
5756 Float {
5760 precision: Option<u32>,
5761 scale: Option<u32>,
5762 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5763 real_spelling: bool,
5764 },
5765 Double {
5766 precision: Option<u32>,
5767 scale: Option<u32>,
5768 },
5769 Decimal {
5770 precision: Option<u32>,
5771 scale: Option<u32>,
5772 },
5773
5774 Char {
5776 length: Option<u32>,
5777 },
5778 VarChar {
5781 length: Option<u32>,
5782 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5783 parenthesized_length: bool,
5784 },
5785 String {
5787 length: Option<u32>,
5788 },
5789 Text,
5790 TextWithLength {
5792 length: u32,
5793 },
5794
5795 Binary {
5797 length: Option<u32>,
5798 },
5799 VarBinary {
5800 length: Option<u32>,
5801 },
5802 Blob,
5803
5804 Bit {
5806 length: Option<u32>,
5807 },
5808 VarBit {
5809 length: Option<u32>,
5810 },
5811
5812 Date,
5814 Time {
5815 precision: Option<u32>,
5816 #[serde(default)]
5817 timezone: bool,
5818 },
5819 Timestamp {
5820 precision: Option<u32>,
5821 timezone: bool,
5822 },
5823 Interval {
5824 unit: Option<String>,
5825 #[serde(default, skip_serializing_if = "Option::is_none")]
5827 to: Option<String>,
5828 },
5829
5830 Json,
5832 JsonB,
5833
5834 Uuid,
5836
5837 Array {
5839 element_type: Box<DataType>,
5840 #[serde(default, skip_serializing_if = "Option::is_none")]
5842 dimension: Option<u32>,
5843 },
5844
5845 List {
5848 element_type: Box<DataType>,
5849 },
5850
5851 Struct {
5855 fields: Vec<StructField>,
5856 nested: bool,
5857 },
5858 Map {
5859 key_type: Box<DataType>,
5860 value_type: Box<DataType>,
5861 },
5862
5863 Enum {
5865 values: Vec<String>,
5866 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5867 assignments: Vec<Option<String>>,
5868 },
5869
5870 Set {
5872 values: Vec<String>,
5873 },
5874
5875 Union {
5877 fields: Vec<(String, DataType)>,
5878 },
5879
5880 Vector {
5882 #[serde(default)]
5883 element_type: Option<Box<DataType>>,
5884 dimension: Option<u32>,
5885 },
5886
5887 Object {
5890 fields: Vec<(String, DataType, bool)>,
5891 modifier: Option<String>,
5892 },
5893
5894 Nullable {
5896 inner: Box<DataType>,
5897 },
5898
5899 Custom {
5901 name: String,
5902 },
5903
5904 Geometry {
5906 subtype: Option<String>,
5907 srid: Option<u32>,
5908 },
5909 Geography {
5910 subtype: Option<String>,
5911 srid: Option<u32>,
5912 },
5913
5914 CharacterSet {
5917 name: String,
5918 },
5919
5920 Unknown,
5922}
5923
5924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5926#[cfg_attr(feature = "bindings", derive(TS))]
5927#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5928pub struct Array {
5929 pub expressions: Vec<Expression>,
5930}
5931
5932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5934#[cfg_attr(feature = "bindings", derive(TS))]
5935pub struct Struct {
5936 pub fields: Vec<(Option<String>, Expression)>,
5937}
5938
5939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5941#[cfg_attr(feature = "bindings", derive(TS))]
5942pub struct Tuple {
5943 pub expressions: Vec<Expression>,
5944}
5945
5946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5948#[cfg_attr(feature = "bindings", derive(TS))]
5949pub struct Interval {
5950 pub this: Option<Expression>,
5952 pub unit: Option<IntervalUnitSpec>,
5954}
5955
5956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5958#[cfg_attr(feature = "bindings", derive(TS))]
5959#[serde(tag = "type", rename_all = "snake_case")]
5960pub enum IntervalUnitSpec {
5961 Simple {
5963 unit: IntervalUnit,
5964 use_plural: bool,
5966 },
5967 Span(IntervalSpan),
5969 ExprSpan(IntervalSpanExpr),
5972 Expr(Box<Expression>),
5974}
5975
5976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5978#[cfg_attr(feature = "bindings", derive(TS))]
5979pub struct IntervalSpan {
5980 pub this: IntervalUnit,
5982 pub expression: IntervalUnit,
5984}
5985
5986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5989#[cfg_attr(feature = "bindings", derive(TS))]
5990pub struct IntervalSpanExpr {
5991 pub this: Box<Expression>,
5993 pub expression: Box<Expression>,
5995}
5996
5997#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5998#[cfg_attr(feature = "bindings", derive(TS))]
5999pub enum IntervalUnit {
6000 Year,
6001 Quarter,
6002 Month,
6003 Week,
6004 Day,
6005 Hour,
6006 Minute,
6007 Second,
6008 Millisecond,
6009 Microsecond,
6010 Nanosecond,
6011}
6012
6013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6015#[cfg_attr(feature = "bindings", derive(TS))]
6016pub struct Command {
6017 pub this: String,
6019}
6020
6021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6024#[cfg_attr(feature = "bindings", derive(TS))]
6025pub struct PrepareStatement {
6026 pub name: Identifier,
6028 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6030 pub parameter_types: Vec<DataType>,
6031 pub statement: Expression,
6033}
6034
6035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6037#[cfg_attr(feature = "bindings", derive(TS))]
6038pub struct TryCatch {
6039 #[serde(default)]
6041 pub try_body: Vec<Expression>,
6042 #[serde(default, skip_serializing_if = "Option::is_none")]
6044 pub catch_body: Option<Vec<Expression>>,
6045}
6046
6047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6050#[cfg_attr(feature = "bindings", derive(TS))]
6051pub struct ExecuteStatement {
6052 pub this: Expression,
6054 #[serde(default)]
6056 pub parameters: Vec<ExecuteParameter>,
6057 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6059 pub arguments: Vec<Expression>,
6060 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6062 pub prepared: bool,
6063 #[serde(default, skip_serializing_if = "Option::is_none")]
6065 pub suffix: Option<String>,
6066}
6067
6068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6070#[cfg_attr(feature = "bindings", derive(TS))]
6071pub struct ExecuteParameter {
6072 pub name: String,
6074 pub value: Expression,
6076 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6078 pub positional: bool,
6079 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6081 pub output: bool,
6082}
6083
6084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6087#[cfg_attr(feature = "bindings", derive(TS))]
6088pub struct Kill {
6089 pub this: Expression,
6091 pub kind: Option<String>,
6093}
6094
6095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6097#[cfg_attr(feature = "bindings", derive(TS))]
6098pub struct CreateTask {
6099 pub or_replace: bool,
6100 pub if_not_exists: bool,
6101 pub name: String,
6103 pub properties: String,
6105 pub body: Expression,
6107}
6108
6109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6111#[cfg_attr(feature = "bindings", derive(TS))]
6112pub struct Raw {
6113 pub sql: String,
6114}
6115
6116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6122#[cfg_attr(feature = "bindings", derive(TS))]
6123pub struct UnaryFunc {
6124 pub this: Expression,
6125 #[serde(skip_serializing_if = "Option::is_none", default)]
6127 pub original_name: Option<String>,
6128 #[serde(default, skip_serializing_if = "Option::is_none")]
6130 pub inferred_type: Option<DataType>,
6131}
6132
6133impl UnaryFunc {
6134 pub fn new(this: Expression) -> Self {
6136 Self {
6137 this,
6138 original_name: None,
6139 inferred_type: None,
6140 }
6141 }
6142
6143 pub fn with_name(this: Expression, name: String) -> Self {
6145 Self {
6146 this,
6147 original_name: Some(name),
6148 inferred_type: None,
6149 }
6150 }
6151}
6152
6153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6157#[cfg_attr(feature = "bindings", derive(TS))]
6158pub struct CharFunc {
6159 pub args: Vec<Expression>,
6160 #[serde(skip_serializing_if = "Option::is_none", default)]
6161 pub charset: Option<String>,
6162 #[serde(skip_serializing_if = "Option::is_none", default)]
6164 pub name: Option<String>,
6165}
6166
6167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6169#[cfg_attr(feature = "bindings", derive(TS))]
6170pub struct BinaryFunc {
6171 pub this: Expression,
6172 pub expression: Expression,
6173 #[serde(skip_serializing_if = "Option::is_none", default)]
6175 pub original_name: Option<String>,
6176 #[serde(default, skip_serializing_if = "Option::is_none")]
6178 pub inferred_type: Option<DataType>,
6179}
6180
6181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6183#[cfg_attr(feature = "bindings", derive(TS))]
6184pub struct VarArgFunc {
6185 pub expressions: Vec<Expression>,
6186 #[serde(skip_serializing_if = "Option::is_none", default)]
6188 pub original_name: Option<String>,
6189 #[serde(default, skip_serializing_if = "Option::is_none")]
6191 pub inferred_type: Option<DataType>,
6192}
6193
6194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6196#[cfg_attr(feature = "bindings", derive(TS))]
6197pub struct ConcatWs {
6198 pub separator: Expression,
6199 pub expressions: Vec<Expression>,
6200}
6201
6202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6204#[cfg_attr(feature = "bindings", derive(TS))]
6205pub struct SubstringFunc {
6206 pub this: Expression,
6207 pub start: Expression,
6208 pub length: Option<Expression>,
6209 #[serde(default)]
6211 pub from_for_syntax: bool,
6212}
6213
6214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6216#[cfg_attr(feature = "bindings", derive(TS))]
6217pub struct OverlayFunc {
6218 pub this: Expression,
6219 pub replacement: Expression,
6220 pub from: Expression,
6221 pub length: Option<Expression>,
6222}
6223
6224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6226#[cfg_attr(feature = "bindings", derive(TS))]
6227pub struct TrimFunc {
6228 pub this: Expression,
6229 pub characters: Option<Expression>,
6230 pub position: TrimPosition,
6231 #[serde(default)]
6233 pub sql_standard_syntax: bool,
6234 #[serde(default)]
6236 pub position_explicit: bool,
6237}
6238
6239#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6240#[cfg_attr(feature = "bindings", derive(TS))]
6241pub enum TrimPosition {
6242 Both,
6243 Leading,
6244 Trailing,
6245}
6246
6247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6249#[cfg_attr(feature = "bindings", derive(TS))]
6250pub struct ReplaceFunc {
6251 pub this: Expression,
6252 pub old: Expression,
6253 pub new: Expression,
6254}
6255
6256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6258#[cfg_attr(feature = "bindings", derive(TS))]
6259pub struct LeftRightFunc {
6260 pub this: Expression,
6261 pub length: Expression,
6262}
6263
6264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6266#[cfg_attr(feature = "bindings", derive(TS))]
6267pub struct RepeatFunc {
6268 pub this: Expression,
6269 pub times: Expression,
6270}
6271
6272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6274#[cfg_attr(feature = "bindings", derive(TS))]
6275pub struct PadFunc {
6276 pub this: Expression,
6277 pub length: Expression,
6278 pub fill: Option<Expression>,
6279}
6280
6281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6283#[cfg_attr(feature = "bindings", derive(TS))]
6284pub struct SplitFunc {
6285 pub this: Expression,
6286 pub delimiter: Expression,
6287}
6288
6289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6291#[cfg_attr(feature = "bindings", derive(TS))]
6292pub struct RegexpFunc {
6293 pub this: Expression,
6294 pub pattern: Expression,
6295 pub flags: Option<Expression>,
6296}
6297
6298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6300#[cfg_attr(feature = "bindings", derive(TS))]
6301pub struct RegexpReplaceFunc {
6302 pub this: Expression,
6303 pub pattern: Expression,
6304 pub replacement: Expression,
6305 pub flags: Option<Expression>,
6306}
6307
6308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6310#[cfg_attr(feature = "bindings", derive(TS))]
6311pub struct RegexpExtractFunc {
6312 pub this: Expression,
6313 pub pattern: Expression,
6314 pub group: Option<Expression>,
6315}
6316
6317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6319#[cfg_attr(feature = "bindings", derive(TS))]
6320pub struct RoundFunc {
6321 pub this: Expression,
6322 pub decimals: Option<Expression>,
6323}
6324
6325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6327#[cfg_attr(feature = "bindings", derive(TS))]
6328pub struct FloorFunc {
6329 pub this: Expression,
6330 pub scale: Option<Expression>,
6331 #[serde(skip_serializing_if = "Option::is_none", default)]
6333 pub to: Option<Expression>,
6334}
6335
6336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6338#[cfg_attr(feature = "bindings", derive(TS))]
6339pub struct CeilFunc {
6340 pub this: Expression,
6341 #[serde(skip_serializing_if = "Option::is_none", default)]
6342 pub decimals: Option<Expression>,
6343 #[serde(skip_serializing_if = "Option::is_none", default)]
6345 pub to: Option<Expression>,
6346}
6347
6348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6350#[cfg_attr(feature = "bindings", derive(TS))]
6351pub struct LogFunc {
6352 pub this: Expression,
6353 pub base: Option<Expression>,
6354}
6355
6356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6358#[cfg_attr(feature = "bindings", derive(TS))]
6359pub struct CurrentDate;
6360
6361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6363#[cfg_attr(feature = "bindings", derive(TS))]
6364pub struct CurrentTime {
6365 pub precision: Option<u32>,
6366}
6367
6368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6370#[cfg_attr(feature = "bindings", derive(TS))]
6371pub struct CurrentTimestamp {
6372 pub precision: Option<u32>,
6373 #[serde(default)]
6375 pub sysdate: bool,
6376}
6377
6378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6380#[cfg_attr(feature = "bindings", derive(TS))]
6381pub struct CurrentTimestampLTZ {
6382 pub precision: Option<u32>,
6383}
6384
6385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6387#[cfg_attr(feature = "bindings", derive(TS))]
6388pub struct AtTimeZone {
6389 pub this: Expression,
6391 pub zone: Expression,
6393}
6394
6395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6397#[cfg_attr(feature = "bindings", derive(TS))]
6398pub struct DateAddFunc {
6399 pub this: Expression,
6400 pub interval: Expression,
6401 pub unit: IntervalUnit,
6402}
6403
6404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6406#[cfg_attr(feature = "bindings", derive(TS))]
6407pub struct DateDiffFunc {
6408 pub this: Expression,
6409 pub expression: Expression,
6410 pub unit: Option<IntervalUnit>,
6411}
6412
6413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6415#[cfg_attr(feature = "bindings", derive(TS))]
6416pub struct DateTruncFunc {
6417 pub this: Expression,
6418 pub unit: DateTimeField,
6419}
6420
6421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6423#[cfg_attr(feature = "bindings", derive(TS))]
6424pub struct ExtractFunc {
6425 pub this: Expression,
6426 pub field: DateTimeField,
6427}
6428
6429#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6430#[cfg_attr(feature = "bindings", derive(TS))]
6431pub enum DateTimeField {
6432 Year,
6433 Month,
6434 Day,
6435 Hour,
6436 Minute,
6437 Second,
6438 Millisecond,
6439 Microsecond,
6440 DayOfWeek,
6441 DayOfYear,
6442 Week,
6443 WeekWithModifier(String),
6445 Quarter,
6446 Epoch,
6447 Timezone,
6448 TimezoneHour,
6449 TimezoneMinute,
6450 Date,
6451 Time,
6452 Custom(String),
6454}
6455
6456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6458#[cfg_attr(feature = "bindings", derive(TS))]
6459pub struct ToDateFunc {
6460 pub this: Expression,
6461 pub format: Option<Expression>,
6462}
6463
6464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6466#[cfg_attr(feature = "bindings", derive(TS))]
6467pub struct ToTimestampFunc {
6468 pub this: Expression,
6469 pub format: Option<Expression>,
6470}
6471
6472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6474#[cfg_attr(feature = "bindings", derive(TS))]
6475pub struct IfFunc {
6476 pub condition: Expression,
6477 pub true_value: Expression,
6478 pub false_value: Option<Expression>,
6479 #[serde(skip_serializing_if = "Option::is_none", default)]
6481 pub original_name: Option<String>,
6482 #[serde(default, skip_serializing_if = "Option::is_none")]
6484 pub inferred_type: Option<DataType>,
6485}
6486
6487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6489#[cfg_attr(feature = "bindings", derive(TS))]
6490pub struct Nvl2Func {
6491 pub this: Expression,
6492 pub true_value: Expression,
6493 pub false_value: Expression,
6494 #[serde(default, skip_serializing_if = "Option::is_none")]
6496 pub inferred_type: Option<DataType>,
6497}
6498
6499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6505#[cfg_attr(feature = "bindings", derive(TS))]
6506pub struct AggFunc {
6507 pub this: Expression,
6508 pub distinct: bool,
6509 pub filter: Option<Expression>,
6510 pub order_by: Vec<Ordered>,
6511 #[serde(skip_serializing_if = "Option::is_none", default)]
6513 pub name: Option<String>,
6514 #[serde(skip_serializing_if = "Option::is_none", default)]
6516 pub ignore_nulls: Option<bool>,
6517 #[serde(skip_serializing_if = "Option::is_none", default)]
6520 pub having_max: Option<(Box<Expression>, bool)>,
6521 #[serde(skip_serializing_if = "Option::is_none", default)]
6523 pub limit: Option<Box<Expression>>,
6524 #[serde(default, skip_serializing_if = "Option::is_none")]
6526 pub inferred_type: Option<DataType>,
6527}
6528
6529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6531#[cfg_attr(feature = "bindings", derive(TS))]
6532pub struct CountFunc {
6533 pub this: Option<Expression>,
6534 pub star: bool,
6535 pub distinct: bool,
6536 pub filter: Option<Expression>,
6537 #[serde(default, skip_serializing_if = "Option::is_none")]
6539 pub ignore_nulls: Option<bool>,
6540 #[serde(default, skip_serializing_if = "Option::is_none")]
6542 pub original_name: Option<String>,
6543 #[serde(default, skip_serializing_if = "Option::is_none")]
6545 pub inferred_type: Option<DataType>,
6546}
6547
6548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6550#[cfg_attr(feature = "bindings", derive(TS))]
6551pub struct GroupConcatFunc {
6552 pub this: Expression,
6553 pub separator: Option<Expression>,
6554 pub order_by: Option<Vec<Ordered>>,
6555 pub distinct: bool,
6556 pub filter: Option<Expression>,
6557 #[serde(default, skip_serializing_if = "Option::is_none")]
6559 pub limit: Option<Box<Expression>>,
6560 #[serde(default, skip_serializing_if = "Option::is_none")]
6562 pub inferred_type: Option<DataType>,
6563}
6564
6565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6567#[cfg_attr(feature = "bindings", derive(TS))]
6568pub struct StringAggFunc {
6569 pub this: Expression,
6570 #[serde(default)]
6571 pub separator: Option<Expression>,
6572 #[serde(default)]
6573 pub order_by: Option<Vec<Ordered>>,
6574 #[serde(default)]
6575 pub distinct: bool,
6576 #[serde(default)]
6577 pub filter: Option<Expression>,
6578 #[serde(default, skip_serializing_if = "Option::is_none")]
6580 pub limit: Option<Box<Expression>>,
6581 #[serde(default, skip_serializing_if = "Option::is_none")]
6583 pub inferred_type: Option<DataType>,
6584}
6585
6586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6588#[cfg_attr(feature = "bindings", derive(TS))]
6589pub struct ListAggFunc {
6590 pub this: Expression,
6591 pub separator: Option<Expression>,
6592 pub on_overflow: Option<ListAggOverflow>,
6593 pub order_by: Option<Vec<Ordered>>,
6594 pub distinct: bool,
6595 pub filter: Option<Expression>,
6596 #[serde(default, skip_serializing_if = "Option::is_none")]
6598 pub inferred_type: Option<DataType>,
6599}
6600
6601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6603#[cfg_attr(feature = "bindings", derive(TS))]
6604pub enum ListAggOverflow {
6605 Error,
6606 Truncate {
6607 filler: Option<Expression>,
6608 with_count: bool,
6609 },
6610}
6611
6612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6614#[cfg_attr(feature = "bindings", derive(TS))]
6615pub struct SumIfFunc {
6616 pub this: Expression,
6617 pub condition: Expression,
6618 pub filter: Option<Expression>,
6619 #[serde(default, skip_serializing_if = "Option::is_none")]
6621 pub inferred_type: Option<DataType>,
6622}
6623
6624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6626#[cfg_attr(feature = "bindings", derive(TS))]
6627pub struct ApproxPercentileFunc {
6628 pub this: Expression,
6629 pub percentile: Expression,
6630 pub accuracy: Option<Expression>,
6631 pub filter: Option<Expression>,
6632}
6633
6634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6636#[cfg_attr(feature = "bindings", derive(TS))]
6637pub struct PercentileFunc {
6638 pub this: Expression,
6639 pub percentile: Expression,
6640 pub order_by: Option<Vec<Ordered>>,
6641 pub filter: Option<Expression>,
6642}
6643
6644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6650#[cfg_attr(feature = "bindings", derive(TS))]
6651pub struct RowNumber;
6652
6653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6655#[cfg_attr(feature = "bindings", derive(TS))]
6656pub struct Rank {
6657 #[serde(default, skip_serializing_if = "Option::is_none")]
6659 pub order_by: Option<Vec<Ordered>>,
6660 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6662 pub args: Vec<Expression>,
6663}
6664
6665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6667#[cfg_attr(feature = "bindings", derive(TS))]
6668pub struct DenseRank {
6669 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6671 pub args: Vec<Expression>,
6672}
6673
6674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6676#[cfg_attr(feature = "bindings", derive(TS))]
6677pub struct NTileFunc {
6678 #[serde(default, skip_serializing_if = "Option::is_none")]
6680 pub num_buckets: Option<Expression>,
6681 #[serde(default, skip_serializing_if = "Option::is_none")]
6683 pub order_by: Option<Vec<Ordered>>,
6684}
6685
6686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6688#[cfg_attr(feature = "bindings", derive(TS))]
6689pub struct LeadLagFunc {
6690 pub this: Expression,
6691 pub offset: Option<Expression>,
6692 pub default: Option<Expression>,
6693 #[serde(default, skip_serializing_if = "Option::is_none")]
6695 pub ignore_nulls: Option<bool>,
6696}
6697
6698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6700#[cfg_attr(feature = "bindings", derive(TS))]
6701pub struct ValueFunc {
6702 pub this: Expression,
6703 #[serde(default, skip_serializing_if = "Option::is_none")]
6705 pub ignore_nulls: Option<bool>,
6706 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6708 pub order_by: Vec<Ordered>,
6709}
6710
6711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6713#[cfg_attr(feature = "bindings", derive(TS))]
6714pub struct NthValueFunc {
6715 pub this: Expression,
6716 pub offset: Expression,
6717 #[serde(default, skip_serializing_if = "Option::is_none")]
6719 pub ignore_nulls: Option<bool>,
6720 #[serde(default, skip_serializing_if = "Option::is_none")]
6723 pub from_first: Option<bool>,
6724}
6725
6726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6728#[cfg_attr(feature = "bindings", derive(TS))]
6729pub struct PercentRank {
6730 #[serde(default, skip_serializing_if = "Option::is_none")]
6732 pub order_by: Option<Vec<Ordered>>,
6733 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6735 pub args: Vec<Expression>,
6736}
6737
6738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6740#[cfg_attr(feature = "bindings", derive(TS))]
6741pub struct CumeDist {
6742 #[serde(default, skip_serializing_if = "Option::is_none")]
6744 pub order_by: Option<Vec<Ordered>>,
6745 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6747 pub args: Vec<Expression>,
6748}
6749
6750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6756#[cfg_attr(feature = "bindings", derive(TS))]
6757pub struct PositionFunc {
6758 pub substring: Expression,
6759 pub string: Expression,
6760 pub start: Option<Expression>,
6761}
6762
6763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6769#[cfg_attr(feature = "bindings", derive(TS))]
6770pub struct Random;
6771
6772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6774#[cfg_attr(feature = "bindings", derive(TS))]
6775pub struct Rand {
6776 pub seed: Option<Box<Expression>>,
6777 #[serde(default)]
6779 pub lower: Option<Box<Expression>>,
6780 #[serde(default)]
6782 pub upper: Option<Box<Expression>>,
6783}
6784
6785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6787#[cfg_attr(feature = "bindings", derive(TS))]
6788pub struct TruncateFunc {
6789 pub this: Expression,
6790 pub decimals: Option<Expression>,
6791}
6792
6793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6795#[cfg_attr(feature = "bindings", derive(TS))]
6796pub struct Pi;
6797
6798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6804#[cfg_attr(feature = "bindings", derive(TS))]
6805pub struct DecodeFunc {
6806 pub this: Expression,
6807 pub search_results: Vec<(Expression, Expression)>,
6808 pub default: Option<Expression>,
6809}
6810
6811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6817#[cfg_attr(feature = "bindings", derive(TS))]
6818pub struct DateFormatFunc {
6819 pub this: Expression,
6820 pub format: Expression,
6821}
6822
6823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6825#[cfg_attr(feature = "bindings", derive(TS))]
6826pub struct FromUnixtimeFunc {
6827 pub this: Expression,
6828 pub format: Option<Expression>,
6829}
6830
6831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6833#[cfg_attr(feature = "bindings", derive(TS))]
6834pub struct UnixTimestampFunc {
6835 pub this: Option<Expression>,
6836 pub format: Option<Expression>,
6837}
6838
6839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6841#[cfg_attr(feature = "bindings", derive(TS))]
6842pub struct MakeDateFunc {
6843 pub year: Expression,
6844 pub month: Expression,
6845 pub day: Expression,
6846}
6847
6848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6850#[cfg_attr(feature = "bindings", derive(TS))]
6851pub struct MakeTimestampFunc {
6852 pub year: Expression,
6853 pub month: Expression,
6854 pub day: Expression,
6855 pub hour: Expression,
6856 pub minute: Expression,
6857 pub second: Expression,
6858 pub timezone: Option<Expression>,
6859}
6860
6861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6863#[cfg_attr(feature = "bindings", derive(TS))]
6864pub struct LastDayFunc {
6865 pub this: Expression,
6866 #[serde(skip_serializing_if = "Option::is_none", default)]
6868 pub unit: Option<DateTimeField>,
6869}
6870
6871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6877#[cfg_attr(feature = "bindings", derive(TS))]
6878pub struct ArrayConstructor {
6879 pub expressions: Vec<Expression>,
6880 pub bracket_notation: bool,
6881 pub use_list_keyword: bool,
6883}
6884
6885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6887#[cfg_attr(feature = "bindings", derive(TS))]
6888pub struct ArraySortFunc {
6889 pub this: Expression,
6890 pub comparator: Option<Expression>,
6891 pub desc: bool,
6892 pub nulls_first: Option<bool>,
6893}
6894
6895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6897#[cfg_attr(feature = "bindings", derive(TS))]
6898pub struct ArrayJoinFunc {
6899 pub this: Expression,
6900 pub separator: Expression,
6901 pub null_replacement: Option<Expression>,
6902}
6903
6904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6906#[cfg_attr(feature = "bindings", derive(TS))]
6907pub struct UnnestFunc {
6908 pub this: Expression,
6909 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6911 pub expressions: Vec<Expression>,
6912 pub with_ordinality: bool,
6913 pub alias: Option<Identifier>,
6914 #[serde(default, skip_serializing_if = "Option::is_none")]
6916 pub offset_alias: Option<Identifier>,
6917}
6918
6919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6921#[cfg_attr(feature = "bindings", derive(TS))]
6922pub struct ArrayFilterFunc {
6923 pub this: Expression,
6924 pub filter: Expression,
6925}
6926
6927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6929#[cfg_attr(feature = "bindings", derive(TS))]
6930pub struct ArrayTransformFunc {
6931 pub this: Expression,
6932 pub transform: Expression,
6933}
6934
6935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6937#[cfg_attr(feature = "bindings", derive(TS))]
6938pub struct SequenceFunc {
6939 pub start: Expression,
6940 pub stop: Expression,
6941 pub step: Option<Expression>,
6942}
6943
6944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6950#[cfg_attr(feature = "bindings", derive(TS))]
6951pub struct StructConstructor {
6952 pub fields: Vec<(Option<Identifier>, Expression)>,
6953}
6954
6955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6957#[cfg_attr(feature = "bindings", derive(TS))]
6958pub struct StructExtractFunc {
6959 pub this: Expression,
6960 pub field: Identifier,
6961}
6962
6963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6965#[cfg_attr(feature = "bindings", derive(TS))]
6966pub struct NamedStructFunc {
6967 pub pairs: Vec<(Expression, Expression)>,
6968}
6969
6970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6976#[cfg_attr(feature = "bindings", derive(TS))]
6977pub struct MapConstructor {
6978 pub keys: Vec<Expression>,
6979 pub values: Vec<Expression>,
6980 #[serde(default)]
6982 pub curly_brace_syntax: bool,
6983 #[serde(default)]
6985 pub with_map_keyword: bool,
6986}
6987
6988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6990#[cfg_attr(feature = "bindings", derive(TS))]
6991pub struct TransformFunc {
6992 pub this: Expression,
6993 pub transform: Expression,
6994}
6995
6996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6999#[cfg_attr(feature = "bindings", derive(TS))]
7000pub struct FunctionEmits {
7001 pub this: Expression,
7003 pub emits: Expression,
7005}
7006
7007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7013#[cfg_attr(feature = "bindings", derive(TS))]
7014pub struct JsonExtractFunc {
7015 pub this: Expression,
7016 pub path: Expression,
7017 pub returning: Option<DataType>,
7018 #[serde(default)]
7020 pub arrow_syntax: bool,
7021 #[serde(default)]
7023 pub hash_arrow_syntax: bool,
7024 #[serde(default)]
7026 pub wrapper_option: Option<String>,
7027 #[serde(default)]
7029 pub quotes_option: Option<String>,
7030 #[serde(default)]
7032 pub on_scalar_string: bool,
7033 #[serde(default)]
7035 pub on_error: Option<String>,
7036}
7037
7038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7040#[cfg_attr(feature = "bindings", derive(TS))]
7041pub struct JsonPathFunc {
7042 pub this: Expression,
7043 pub paths: Vec<Expression>,
7044}
7045
7046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7048#[cfg_attr(feature = "bindings", derive(TS))]
7049pub struct JsonObjectFunc {
7050 pub pairs: Vec<(Expression, Expression)>,
7051 pub null_handling: Option<JsonNullHandling>,
7052 #[serde(default)]
7053 pub with_unique_keys: bool,
7054 #[serde(default)]
7055 pub returning_type: Option<DataType>,
7056 #[serde(default)]
7057 pub format_json: bool,
7058 #[serde(default)]
7059 pub encoding: Option<String>,
7060 #[serde(default)]
7062 pub star: bool,
7063}
7064
7065#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7067#[cfg_attr(feature = "bindings", derive(TS))]
7068pub enum JsonNullHandling {
7069 NullOnNull,
7070 AbsentOnNull,
7071}
7072
7073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7075#[cfg_attr(feature = "bindings", derive(TS))]
7076pub struct JsonModifyFunc {
7077 pub this: Expression,
7078 pub path_values: Vec<(Expression, Expression)>,
7079}
7080
7081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7083#[cfg_attr(feature = "bindings", derive(TS))]
7084pub struct JsonArrayAggFunc {
7085 pub this: Expression,
7086 pub order_by: Option<Vec<Ordered>>,
7087 pub null_handling: Option<JsonNullHandling>,
7088 pub filter: Option<Expression>,
7089}
7090
7091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7093#[cfg_attr(feature = "bindings", derive(TS))]
7094pub struct JsonObjectAggFunc {
7095 pub key: Expression,
7096 pub value: Expression,
7097 pub null_handling: Option<JsonNullHandling>,
7098 pub filter: Option<Expression>,
7099}
7100
7101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7107#[cfg_attr(feature = "bindings", derive(TS))]
7108pub struct ConvertFunc {
7109 pub this: Expression,
7110 pub to: DataType,
7111 pub style: Option<Expression>,
7112}
7113
7114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7120#[cfg_attr(feature = "bindings", derive(TS))]
7121pub struct LambdaExpr {
7122 pub parameters: Vec<Identifier>,
7123 pub body: Expression,
7124 #[serde(default)]
7126 pub colon: bool,
7127 #[serde(default)]
7130 pub parameter_types: Vec<Option<DataType>>,
7131}
7132
7133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7135#[cfg_attr(feature = "bindings", derive(TS))]
7136pub struct Parameter {
7137 pub name: Option<String>,
7138 pub index: Option<u32>,
7139 pub style: ParameterStyle,
7140 #[serde(default)]
7142 pub quoted: bool,
7143 #[serde(default)]
7145 pub string_quoted: bool,
7146 #[serde(default)]
7148 pub expression: Option<String>,
7149}
7150
7151#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7153#[cfg_attr(feature = "bindings", derive(TS))]
7154pub enum ParameterStyle {
7155 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7165
7166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7168#[cfg_attr(feature = "bindings", derive(TS))]
7169pub struct Placeholder {
7170 pub index: Option<u32>,
7171}
7172
7173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7175#[cfg_attr(feature = "bindings", derive(TS))]
7176pub struct NamedArgument {
7177 pub name: Identifier,
7178 pub value: Expression,
7179 pub separator: NamedArgSeparator,
7181}
7182
7183#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7185#[cfg_attr(feature = "bindings", derive(TS))]
7186pub enum NamedArgSeparator {
7187 DArrow,
7189 ColonEq,
7191 Eq,
7193}
7194
7195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7198#[cfg_attr(feature = "bindings", derive(TS))]
7199pub struct TableArgument {
7200 pub prefix: String,
7202 pub this: Expression,
7204}
7205
7206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7208#[cfg_attr(feature = "bindings", derive(TS))]
7209pub struct SqlComment {
7210 pub text: String,
7211 pub is_block: bool,
7212}
7213
7214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7220#[cfg_attr(feature = "bindings", derive(TS))]
7221pub struct SimilarToExpr {
7222 pub this: Expression,
7223 pub pattern: Expression,
7224 pub escape: Option<Expression>,
7225 pub not: bool,
7226}
7227
7228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7230#[cfg_attr(feature = "bindings", derive(TS))]
7231pub struct QuantifiedExpr {
7232 pub this: Expression,
7233 pub subquery: Expression,
7234 pub op: Option<QuantifiedOp>,
7235}
7236
7237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7239#[cfg_attr(feature = "bindings", derive(TS))]
7240pub enum QuantifiedOp {
7241 Eq,
7242 Neq,
7243 Lt,
7244 Lte,
7245 Gt,
7246 Gte,
7247}
7248
7249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7254#[cfg_attr(feature = "bindings", derive(TS))]
7255pub struct OverlapsExpr {
7256 #[serde(skip_serializing_if = "Option::is_none")]
7258 pub this: Option<Expression>,
7259 #[serde(skip_serializing_if = "Option::is_none")]
7261 pub expression: Option<Expression>,
7262 #[serde(skip_serializing_if = "Option::is_none")]
7264 pub left_start: Option<Expression>,
7265 #[serde(skip_serializing_if = "Option::is_none")]
7267 pub left_end: Option<Expression>,
7268 #[serde(skip_serializing_if = "Option::is_none")]
7270 pub right_start: Option<Expression>,
7271 #[serde(skip_serializing_if = "Option::is_none")]
7273 pub right_end: Option<Expression>,
7274}
7275
7276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7282#[cfg_attr(feature = "bindings", derive(TS))]
7283pub struct Subscript {
7284 pub this: Expression,
7285 pub index: Expression,
7286}
7287
7288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7290#[cfg_attr(feature = "bindings", derive(TS))]
7291pub struct DotAccess {
7292 pub this: Expression,
7293 pub field: Identifier,
7294}
7295
7296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7298#[cfg_attr(feature = "bindings", derive(TS))]
7299pub struct MethodCall {
7300 pub this: Expression,
7301 pub method: Identifier,
7302 pub args: Vec<Expression>,
7303}
7304
7305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7307#[cfg_attr(feature = "bindings", derive(TS))]
7308pub struct ArraySlice {
7309 pub this: Expression,
7310 pub start: Option<Expression>,
7311 pub end: Option<Expression>,
7312}
7313
7314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7320#[cfg_attr(feature = "bindings", derive(TS))]
7321pub enum OnCommit {
7322 PreserveRows,
7324 DeleteRows,
7326}
7327
7328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7330#[cfg_attr(feature = "bindings", derive(TS))]
7331pub struct CreateTable {
7332 pub name: TableRef,
7333 #[serde(default, skip_serializing_if = "Option::is_none")]
7335 pub on_cluster: Option<OnCluster>,
7336 pub columns: Vec<ColumnDef>,
7337 pub constraints: Vec<TableConstraint>,
7338 pub if_not_exists: bool,
7339 pub temporary: bool,
7340 pub or_replace: bool,
7341 #[serde(default, skip_serializing_if = "Option::is_none")]
7343 pub table_modifier: Option<String>,
7344 pub as_select: Option<Expression>,
7345 #[serde(default)]
7347 pub as_select_parenthesized: bool,
7348 #[serde(default)]
7350 pub on_commit: Option<OnCommit>,
7351 #[serde(default)]
7353 pub clone_source: Option<TableRef>,
7354 #[serde(default, skip_serializing_if = "Option::is_none")]
7356 pub clone_at_clause: Option<Expression>,
7357 #[serde(default)]
7359 pub is_copy: bool,
7360 #[serde(default)]
7362 pub shallow_clone: bool,
7363 #[serde(default)]
7365 pub deep_clone: bool,
7366 #[serde(default)]
7368 pub leading_comments: Vec<String>,
7369 #[serde(default)]
7371 pub with_properties: Vec<(String, String)>,
7372 #[serde(default)]
7374 pub teradata_post_name_options: Vec<String>,
7375 #[serde(default)]
7377 pub with_data: Option<bool>,
7378 #[serde(default)]
7380 pub with_statistics: Option<bool>,
7381 #[serde(default)]
7383 pub teradata_indexes: Vec<TeradataIndex>,
7384 #[serde(default)]
7386 pub with_cte: Option<With>,
7387 #[serde(default)]
7389 pub properties: Vec<Expression>,
7390 #[serde(default, skip_serializing_if = "Option::is_none")]
7392 pub partition_of: Option<Expression>,
7393 #[serde(default)]
7395 pub post_table_properties: Vec<Expression>,
7396 #[serde(default)]
7398 pub mysql_table_options: Vec<(String, String)>,
7399 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7401 pub inherits: Vec<TableRef>,
7402 #[serde(default, skip_serializing_if = "Option::is_none")]
7404 pub on_property: Option<OnProperty>,
7405 #[serde(default)]
7407 pub copy_grants: bool,
7408 #[serde(default, skip_serializing_if = "Option::is_none")]
7410 pub using_template: Option<Box<Expression>>,
7411 #[serde(default, skip_serializing_if = "Option::is_none")]
7413 pub rollup: Option<RollupProperty>,
7414 #[serde(default, skip_serializing_if = "Option::is_none")]
7416 pub uuid: Option<String>,
7417 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7421 pub with_partition_columns: Vec<ColumnDef>,
7422 #[serde(default, skip_serializing_if = "Option::is_none")]
7425 pub with_connection: Option<TableRef>,
7426}
7427
7428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7430#[cfg_attr(feature = "bindings", derive(TS))]
7431pub struct TeradataIndex {
7432 pub kind: TeradataIndexKind,
7434 pub name: Option<String>,
7436 pub columns: Vec<String>,
7438}
7439
7440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7442#[cfg_attr(feature = "bindings", derive(TS))]
7443pub enum TeradataIndexKind {
7444 NoPrimary,
7446 Primary,
7448 PrimaryAmp,
7450 Unique,
7452 UniquePrimary,
7454 Secondary,
7456}
7457
7458impl CreateTable {
7459 pub fn new(name: impl Into<String>) -> Self {
7460 Self {
7461 name: TableRef::new(name),
7462 on_cluster: None,
7463 columns: Vec::new(),
7464 constraints: Vec::new(),
7465 if_not_exists: false,
7466 temporary: false,
7467 or_replace: false,
7468 table_modifier: None,
7469 as_select: None,
7470 as_select_parenthesized: false,
7471 on_commit: None,
7472 clone_source: None,
7473 clone_at_clause: None,
7474 shallow_clone: false,
7475 deep_clone: false,
7476 is_copy: false,
7477 leading_comments: Vec::new(),
7478 with_properties: Vec::new(),
7479 teradata_post_name_options: Vec::new(),
7480 with_data: None,
7481 with_statistics: None,
7482 teradata_indexes: Vec::new(),
7483 with_cte: None,
7484 properties: Vec::new(),
7485 partition_of: None,
7486 post_table_properties: Vec::new(),
7487 mysql_table_options: Vec::new(),
7488 inherits: Vec::new(),
7489 on_property: None,
7490 copy_grants: false,
7491 using_template: None,
7492 rollup: None,
7493 uuid: None,
7494 with_partition_columns: Vec::new(),
7495 with_connection: None,
7496 }
7497 }
7498}
7499
7500#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7502#[cfg_attr(feature = "bindings", derive(TS))]
7503pub enum SortOrder {
7504 Asc,
7505 Desc,
7506}
7507
7508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7510#[cfg_attr(feature = "bindings", derive(TS))]
7511pub enum ConstraintType {
7512 NotNull,
7513 Null,
7514 PrimaryKey,
7515 Unique,
7516 Default,
7517 AutoIncrement,
7518 Collate,
7519 Comment,
7520 References,
7521 Check,
7522 GeneratedAsIdentity,
7523 Tags,
7525 ComputedColumn,
7527 GeneratedAsRow,
7529 OnUpdate,
7531 Path,
7533 Encode,
7535}
7536
7537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7539#[cfg_attr(feature = "bindings", derive(TS))]
7540pub struct ColumnDef {
7541 pub name: Identifier,
7542 pub data_type: DataType,
7543 pub nullable: Option<bool>,
7544 pub default: Option<Expression>,
7545 pub primary_key: bool,
7546 #[serde(default)]
7548 pub primary_key_order: Option<SortOrder>,
7549 pub unique: bool,
7550 #[serde(default)]
7552 pub unique_nulls_not_distinct: bool,
7553 pub auto_increment: bool,
7554 pub comment: Option<String>,
7555 pub constraints: Vec<ColumnConstraint>,
7556 #[serde(default)]
7558 pub constraint_order: Vec<ConstraintType>,
7559 #[serde(default)]
7561 pub format: Option<String>,
7562 #[serde(default)]
7564 pub title: Option<String>,
7565 #[serde(default)]
7567 pub inline_length: Option<u64>,
7568 #[serde(default)]
7570 pub compress: Option<Vec<Expression>>,
7571 #[serde(default)]
7573 pub character_set: Option<String>,
7574 #[serde(default)]
7576 pub uppercase: bool,
7577 #[serde(default)]
7579 pub casespecific: Option<bool>,
7580 #[serde(default)]
7582 pub auto_increment_start: Option<Box<Expression>>,
7583 #[serde(default)]
7585 pub auto_increment_increment: Option<Box<Expression>>,
7586 #[serde(default)]
7588 pub auto_increment_order: Option<bool>,
7589 #[serde(default)]
7591 pub unsigned: bool,
7592 #[serde(default)]
7594 pub zerofill: bool,
7595 #[serde(default, skip_serializing_if = "Option::is_none")]
7597 pub on_update: Option<Expression>,
7598 #[serde(default, skip_serializing_if = "Option::is_none")]
7600 pub visible: Option<bool>,
7601 #[serde(default, skip_serializing_if = "Option::is_none")]
7603 pub unique_constraint_name: Option<String>,
7604 #[serde(default, skip_serializing_if = "Option::is_none")]
7606 pub not_null_constraint_name: Option<String>,
7607 #[serde(default, skip_serializing_if = "Option::is_none")]
7609 pub primary_key_constraint_name: Option<String>,
7610 #[serde(default, skip_serializing_if = "Option::is_none")]
7612 pub check_constraint_name: Option<String>,
7613 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7615 pub options: Vec<Expression>,
7616 #[serde(default)]
7618 pub no_type: bool,
7619 #[serde(default, skip_serializing_if = "Option::is_none")]
7621 pub encoding: Option<String>,
7622 #[serde(default, skip_serializing_if = "Option::is_none")]
7624 pub codec: Option<String>,
7625 #[serde(default, skip_serializing_if = "Option::is_none")]
7627 pub ephemeral: Option<Option<Box<Expression>>>,
7628 #[serde(default, skip_serializing_if = "Option::is_none")]
7630 pub materialized_expr: Option<Box<Expression>>,
7631 #[serde(default, skip_serializing_if = "Option::is_none")]
7633 pub alias_expr: Option<Box<Expression>>,
7634 #[serde(default, skip_serializing_if = "Option::is_none")]
7636 pub ttl_expr: Option<Box<Expression>>,
7637 #[serde(default)]
7639 pub not_for_replication: bool,
7640}
7641
7642impl ColumnDef {
7643 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7644 Self {
7645 name: Identifier::new(name),
7646 data_type,
7647 nullable: None,
7648 default: None,
7649 primary_key: false,
7650 primary_key_order: None,
7651 unique: false,
7652 unique_nulls_not_distinct: false,
7653 auto_increment: false,
7654 comment: None,
7655 constraints: Vec::new(),
7656 constraint_order: Vec::new(),
7657 format: None,
7658 title: None,
7659 inline_length: None,
7660 compress: None,
7661 character_set: None,
7662 uppercase: false,
7663 casespecific: None,
7664 auto_increment_start: None,
7665 auto_increment_increment: None,
7666 auto_increment_order: None,
7667 unsigned: false,
7668 zerofill: false,
7669 on_update: None,
7670 visible: None,
7671 unique_constraint_name: None,
7672 not_null_constraint_name: None,
7673 primary_key_constraint_name: None,
7674 check_constraint_name: None,
7675 options: Vec::new(),
7676 no_type: false,
7677 encoding: None,
7678 codec: None,
7679 ephemeral: None,
7680 materialized_expr: None,
7681 alias_expr: None,
7682 ttl_expr: None,
7683 not_for_replication: false,
7684 }
7685 }
7686}
7687
7688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7690#[cfg_attr(feature = "bindings", derive(TS))]
7691pub enum ColumnConstraint {
7692 NotNull,
7693 Null,
7694 Unique,
7695 PrimaryKey,
7696 Default(Expression),
7697 Check(Expression),
7698 References(ForeignKeyRef),
7699 GeneratedAsIdentity(GeneratedAsIdentity),
7700 Collate(Identifier),
7701 Comment(String),
7702 Tags(Tags),
7704 ComputedColumn(ComputedColumn),
7707 GeneratedAsRow(GeneratedAsRow),
7709 Path(Expression),
7711}
7712
7713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7715#[cfg_attr(feature = "bindings", derive(TS))]
7716pub struct ComputedColumn {
7717 pub expression: Box<Expression>,
7719 #[serde(default)]
7721 pub persisted: bool,
7722 #[serde(default)]
7724 pub not_null: bool,
7725 #[serde(default)]
7728 pub persistence_kind: Option<String>,
7729 #[serde(default, skip_serializing_if = "Option::is_none")]
7731 pub data_type: Option<DataType>,
7732}
7733
7734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7736#[cfg_attr(feature = "bindings", derive(TS))]
7737pub struct GeneratedAsRow {
7738 pub start: bool,
7740 #[serde(default)]
7742 pub hidden: bool,
7743}
7744
7745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7747#[cfg_attr(feature = "bindings", derive(TS))]
7748pub struct GeneratedAsIdentity {
7749 pub always: bool,
7751 pub on_null: bool,
7753 pub start: Option<Box<Expression>>,
7755 pub increment: Option<Box<Expression>>,
7757 pub minvalue: Option<Box<Expression>>,
7759 pub maxvalue: Option<Box<Expression>>,
7761 pub cycle: Option<bool>,
7763}
7764
7765#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7767#[cfg_attr(feature = "bindings", derive(TS))]
7768pub struct ConstraintModifiers {
7769 pub enforced: Option<bool>,
7771 pub deferrable: Option<bool>,
7773 pub initially_deferred: Option<bool>,
7775 pub norely: bool,
7777 pub rely: bool,
7779 #[serde(default)]
7781 pub using: Option<String>,
7782 #[serde(default)]
7784 pub using_before_columns: bool,
7785 #[serde(default, skip_serializing_if = "Option::is_none")]
7787 pub comment: Option<String>,
7788 #[serde(default, skip_serializing_if = "Option::is_none")]
7790 pub visible: Option<bool>,
7791 #[serde(default, skip_serializing_if = "Option::is_none")]
7793 pub engine_attribute: Option<String>,
7794 #[serde(default, skip_serializing_if = "Option::is_none")]
7796 pub with_parser: Option<String>,
7797 #[serde(default)]
7799 pub not_valid: bool,
7800 #[serde(default, skip_serializing_if = "Option::is_none")]
7802 pub clustered: Option<String>,
7803 #[serde(default, skip_serializing_if = "Option::is_none")]
7805 pub on_conflict: Option<String>,
7806 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7808 pub with_options: Vec<(String, String)>,
7809 #[serde(default, skip_serializing_if = "Option::is_none")]
7811 pub on_filegroup: Option<Identifier>,
7812}
7813
7814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7816#[cfg_attr(feature = "bindings", derive(TS))]
7817pub enum TableConstraint {
7818 PrimaryKey {
7819 name: Option<Identifier>,
7820 columns: Vec<Identifier>,
7821 #[serde(default)]
7823 include_columns: Vec<Identifier>,
7824 #[serde(default)]
7825 modifiers: ConstraintModifiers,
7826 #[serde(default)]
7828 has_constraint_keyword: bool,
7829 },
7830 Unique {
7831 name: Option<Identifier>,
7832 columns: Vec<Identifier>,
7833 #[serde(default)]
7835 columns_parenthesized: bool,
7836 #[serde(default)]
7837 modifiers: ConstraintModifiers,
7838 #[serde(default)]
7840 has_constraint_keyword: bool,
7841 #[serde(default)]
7843 nulls_not_distinct: bool,
7844 },
7845 ForeignKey {
7846 name: Option<Identifier>,
7847 columns: Vec<Identifier>,
7848 #[serde(default)]
7849 references: Option<ForeignKeyRef>,
7850 #[serde(default)]
7852 on_delete: Option<ReferentialAction>,
7853 #[serde(default)]
7855 on_update: Option<ReferentialAction>,
7856 #[serde(default)]
7857 modifiers: ConstraintModifiers,
7858 },
7859 Check {
7860 name: Option<Identifier>,
7861 expression: Expression,
7862 #[serde(default)]
7863 modifiers: ConstraintModifiers,
7864 },
7865 Assume {
7867 name: Option<Identifier>,
7868 expression: Expression,
7869 },
7870 Default {
7872 name: Option<Identifier>,
7873 expression: Expression,
7874 column: Identifier,
7875 },
7876 Index {
7878 name: Option<Identifier>,
7879 columns: Vec<Identifier>,
7880 #[serde(default)]
7882 kind: Option<String>,
7883 #[serde(default)]
7884 modifiers: ConstraintModifiers,
7885 #[serde(default)]
7887 use_key_keyword: bool,
7888 #[serde(default, skip_serializing_if = "Option::is_none")]
7890 expression: Option<Box<Expression>>,
7891 #[serde(default, skip_serializing_if = "Option::is_none")]
7893 index_type: Option<Box<Expression>>,
7894 #[serde(default, skip_serializing_if = "Option::is_none")]
7896 granularity: Option<Box<Expression>>,
7897 },
7898 Projection {
7900 name: Identifier,
7901 expression: Expression,
7902 },
7903 Like {
7905 source: TableRef,
7906 options: Vec<(LikeOptionAction, String)>,
7908 },
7909 PeriodForSystemTime {
7911 start_col: Identifier,
7912 end_col: Identifier,
7913 },
7914 Exclude {
7917 name: Option<Identifier>,
7918 #[serde(default)]
7920 using: Option<String>,
7921 elements: Vec<ExcludeElement>,
7923 #[serde(default)]
7925 include_columns: Vec<Identifier>,
7926 #[serde(default)]
7928 where_clause: Option<Box<Expression>>,
7929 #[serde(default)]
7931 with_params: Vec<(String, String)>,
7932 #[serde(default)]
7934 using_index_tablespace: Option<String>,
7935 #[serde(default)]
7936 modifiers: ConstraintModifiers,
7937 },
7938 Tags(Tags),
7940 InitiallyDeferred {
7944 deferred: bool,
7946 },
7947}
7948
7949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7951#[cfg_attr(feature = "bindings", derive(TS))]
7952pub struct ExcludeElement {
7953 pub expression: String,
7955 pub operator: String,
7957}
7958
7959#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7961#[cfg_attr(feature = "bindings", derive(TS))]
7962pub enum LikeOptionAction {
7963 Including,
7964 Excluding,
7965}
7966
7967#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7969#[cfg_attr(feature = "bindings", derive(TS))]
7970pub enum MatchType {
7971 Full,
7972 Partial,
7973 Simple,
7974}
7975
7976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7978#[cfg_attr(feature = "bindings", derive(TS))]
7979pub struct ForeignKeyRef {
7980 pub table: TableRef,
7981 pub columns: Vec<Identifier>,
7982 pub on_delete: Option<ReferentialAction>,
7983 pub on_update: Option<ReferentialAction>,
7984 #[serde(default)]
7986 pub on_update_first: bool,
7987 #[serde(default)]
7989 pub match_type: Option<MatchType>,
7990 #[serde(default)]
7992 pub match_after_actions: bool,
7993 #[serde(default)]
7995 pub constraint_name: Option<String>,
7996 #[serde(default)]
7998 pub deferrable: Option<bool>,
7999 #[serde(default)]
8001 pub has_foreign_key_keywords: bool,
8002}
8003
8004#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8006#[cfg_attr(feature = "bindings", derive(TS))]
8007pub enum ReferentialAction {
8008 Cascade,
8009 SetNull,
8010 SetDefault,
8011 Restrict,
8012 NoAction,
8013}
8014
8015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8017#[cfg_attr(feature = "bindings", derive(TS))]
8018pub struct DropTable {
8019 pub names: Vec<TableRef>,
8020 pub if_exists: bool,
8021 pub cascade: bool,
8022 #[serde(default)]
8024 pub cascade_constraints: bool,
8025 #[serde(default)]
8027 pub purge: bool,
8028 #[serde(default)]
8030 pub leading_comments: Vec<String>,
8031 #[serde(default, skip_serializing_if = "Option::is_none")]
8034 pub object_id_args: Option<String>,
8035 #[serde(default)]
8037 pub sync: bool,
8038 #[serde(default)]
8040 pub iceberg: bool,
8041 #[serde(default)]
8043 pub restrict: bool,
8044}
8045
8046impl DropTable {
8047 pub fn new(name: impl Into<String>) -> Self {
8048 Self {
8049 names: vec![TableRef::new(name)],
8050 if_exists: false,
8051 cascade: false,
8052 cascade_constraints: false,
8053 purge: false,
8054 leading_comments: Vec::new(),
8055 object_id_args: None,
8056 sync: false,
8057 iceberg: false,
8058 restrict: false,
8059 }
8060 }
8061}
8062
8063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8065#[cfg_attr(feature = "bindings", derive(TS))]
8066pub struct Undrop {
8067 pub kind: String,
8069 pub name: TableRef,
8071 #[serde(default)]
8073 pub if_exists: bool,
8074}
8075
8076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8078#[cfg_attr(feature = "bindings", derive(TS))]
8079pub struct AlterTable {
8080 pub name: TableRef,
8081 pub actions: Vec<AlterTableAction>,
8082 #[serde(default)]
8084 pub if_exists: bool,
8085 #[serde(default, skip_serializing_if = "Option::is_none")]
8087 pub algorithm: Option<String>,
8088 #[serde(default, skip_serializing_if = "Option::is_none")]
8090 pub lock: Option<String>,
8091 #[serde(default, skip_serializing_if = "Option::is_none")]
8093 pub with_check: Option<String>,
8094 #[serde(default, skip_serializing_if = "Option::is_none")]
8096 pub partition: Option<Vec<(Identifier, Expression)>>,
8097 #[serde(default, skip_serializing_if = "Option::is_none")]
8099 pub on_cluster: Option<OnCluster>,
8100 #[serde(default, skip_serializing_if = "Option::is_none")]
8102 pub table_modifier: Option<String>,
8103}
8104
8105impl AlterTable {
8106 pub fn new(name: impl Into<String>) -> Self {
8107 Self {
8108 name: TableRef::new(name),
8109 actions: Vec::new(),
8110 if_exists: false,
8111 algorithm: None,
8112 lock: None,
8113 with_check: None,
8114 partition: None,
8115 on_cluster: None,
8116 table_modifier: None,
8117 }
8118 }
8119}
8120
8121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8123#[cfg_attr(feature = "bindings", derive(TS))]
8124pub enum ColumnPosition {
8125 First,
8126 After(Identifier),
8127}
8128
8129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8131#[cfg_attr(feature = "bindings", derive(TS))]
8132pub enum AlterTableAction {
8133 AddColumn {
8134 column: ColumnDef,
8135 if_not_exists: bool,
8136 position: Option<ColumnPosition>,
8137 },
8138 DropColumn {
8139 name: Identifier,
8140 if_exists: bool,
8141 cascade: bool,
8142 },
8143 RenameColumn {
8144 old_name: Identifier,
8145 new_name: Identifier,
8146 if_exists: bool,
8147 },
8148 AlterColumn {
8149 name: Identifier,
8150 action: AlterColumnAction,
8151 #[serde(default)]
8153 use_modify_keyword: bool,
8154 },
8155 RenameTable(TableRef),
8156 AddConstraint(TableConstraint),
8157 DropConstraint {
8158 name: Identifier,
8159 if_exists: bool,
8160 },
8161 DropForeignKey {
8163 name: Identifier,
8164 },
8165 DropPartition {
8167 partitions: Vec<Vec<(Identifier, Expression)>>,
8169 if_exists: bool,
8170 },
8171 AddPartition {
8173 partition: Expression,
8175 if_not_exists: bool,
8176 location: Option<Expression>,
8177 },
8178 Delete {
8180 where_clause: Expression,
8181 },
8182 SwapWith(TableRef),
8184 SetProperty {
8186 properties: Vec<(String, Expression)>,
8187 },
8188 UnsetProperty {
8190 properties: Vec<String>,
8191 },
8192 ClusterBy {
8194 expressions: Vec<Expression>,
8195 },
8196 SetTag {
8198 expressions: Vec<(String, Expression)>,
8199 },
8200 UnsetTag {
8202 names: Vec<String>,
8203 },
8204 SetOptions {
8206 expressions: Vec<Expression>,
8207 },
8208 AlterIndex {
8210 name: Identifier,
8211 visible: bool,
8212 },
8213 SetAttribute {
8215 attribute: String,
8216 },
8217 SetStageFileFormat {
8219 options: Option<Expression>,
8220 },
8221 SetStageCopyOptions {
8223 options: Option<Expression>,
8224 },
8225 AddColumns {
8227 columns: Vec<ColumnDef>,
8228 cascade: bool,
8229 },
8230 DropColumns {
8232 names: Vec<Identifier>,
8233 },
8234 ChangeColumn {
8237 old_name: Identifier,
8238 new_name: Identifier,
8239 #[serde(default, skip_serializing_if = "Option::is_none")]
8240 data_type: Option<DataType>,
8241 comment: Option<String>,
8242 #[serde(default)]
8243 cascade: bool,
8244 },
8245 AlterSortKey {
8248 this: Option<String>,
8250 expressions: Vec<Expression>,
8252 compound: bool,
8254 },
8255 AlterDistStyle {
8259 style: String,
8261 distkey: Option<Identifier>,
8263 },
8264 SetTableProperties {
8266 properties: Vec<(Expression, Expression)>,
8267 },
8268 SetLocation {
8270 location: String,
8271 },
8272 SetFileFormat {
8274 format: String,
8275 },
8276 ReplacePartition {
8278 partition: Expression,
8279 source: Option<Box<Expression>>,
8280 },
8281 Raw {
8283 sql: String,
8284 },
8285}
8286
8287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8289#[cfg_attr(feature = "bindings", derive(TS))]
8290pub enum AlterColumnAction {
8291 SetDataType {
8292 data_type: DataType,
8293 using: Option<Expression>,
8295 #[serde(default, skip_serializing_if = "Option::is_none")]
8297 collate: Option<String>,
8298 },
8299 SetDefault(Expression),
8300 DropDefault,
8301 SetNotNull,
8302 DropNotNull,
8303 Comment(String),
8305 SetVisible,
8307 SetInvisible,
8309}
8310
8311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8313#[cfg_attr(feature = "bindings", derive(TS))]
8314pub struct CreateIndex {
8315 pub name: Identifier,
8316 pub table: TableRef,
8317 pub columns: Vec<IndexColumn>,
8318 pub unique: bool,
8319 pub if_not_exists: bool,
8320 pub using: Option<String>,
8321 #[serde(default)]
8323 pub clustered: Option<String>,
8324 #[serde(default)]
8326 pub concurrently: bool,
8327 #[serde(default)]
8329 pub where_clause: Option<Box<Expression>>,
8330 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8332 pub include_columns: Vec<Identifier>,
8333 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8335 pub with_options: Vec<(String, String)>,
8336 #[serde(default)]
8338 pub on_filegroup: Option<String>,
8339}
8340
8341impl CreateIndex {
8342 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8343 Self {
8344 name: Identifier::new(name),
8345 table: TableRef::new(table),
8346 columns: Vec::new(),
8347 unique: false,
8348 if_not_exists: false,
8349 using: None,
8350 clustered: None,
8351 concurrently: false,
8352 where_clause: None,
8353 include_columns: Vec::new(),
8354 with_options: Vec::new(),
8355 on_filegroup: None,
8356 }
8357 }
8358}
8359
8360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8362#[cfg_attr(feature = "bindings", derive(TS))]
8363pub struct IndexColumn {
8364 pub column: Identifier,
8365 pub desc: bool,
8366 #[serde(default)]
8368 pub asc: bool,
8369 pub nulls_first: Option<bool>,
8370 #[serde(default, skip_serializing_if = "Option::is_none")]
8372 pub opclass: Option<String>,
8373}
8374
8375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8377#[cfg_attr(feature = "bindings", derive(TS))]
8378pub struct DropIndex {
8379 pub name: TableRef,
8380 pub table: Option<TableRef>,
8381 pub if_exists: bool,
8382 #[serde(default)]
8384 pub concurrently: bool,
8385}
8386
8387impl DropIndex {
8388 pub fn new(name: impl Into<String>) -> Self {
8389 Self {
8390 name: TableRef::new(name),
8391 table: None,
8392 if_exists: false,
8393 concurrently: false,
8394 }
8395 }
8396}
8397
8398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8400#[cfg_attr(feature = "bindings", derive(TS))]
8401pub struct ViewColumn {
8402 pub name: Identifier,
8403 pub comment: Option<String>,
8404 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8406 pub options: Vec<Expression>,
8407}
8408
8409impl ViewColumn {
8410 pub fn new(name: impl Into<String>) -> Self {
8411 Self {
8412 name: Identifier::new(name),
8413 comment: None,
8414 options: Vec::new(),
8415 }
8416 }
8417
8418 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8419 Self {
8420 name: Identifier::new(name),
8421 comment: Some(comment.into()),
8422 options: Vec::new(),
8423 }
8424 }
8425}
8426
8427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8429#[cfg_attr(feature = "bindings", derive(TS))]
8430pub struct CreateView {
8431 pub name: TableRef,
8432 pub columns: Vec<ViewColumn>,
8433 pub query: Expression,
8434 pub or_replace: bool,
8435 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8437 pub or_alter: bool,
8438 pub if_not_exists: bool,
8439 pub materialized: bool,
8440 pub temporary: bool,
8441 #[serde(default)]
8443 pub secure: bool,
8444 #[serde(skip_serializing_if = "Option::is_none")]
8446 pub algorithm: Option<String>,
8447 #[serde(skip_serializing_if = "Option::is_none")]
8449 pub definer: Option<String>,
8450 #[serde(skip_serializing_if = "Option::is_none")]
8452 pub security: Option<FunctionSecurity>,
8453 #[serde(default = "default_true")]
8455 pub security_sql_style: bool,
8456 #[serde(default)]
8458 pub security_after_name: bool,
8459 #[serde(default)]
8461 pub query_parenthesized: bool,
8462 #[serde(skip_serializing_if = "Option::is_none")]
8464 pub locking_mode: Option<String>,
8465 #[serde(skip_serializing_if = "Option::is_none")]
8467 pub locking_access: Option<String>,
8468 #[serde(default)]
8470 pub copy_grants: bool,
8471 #[serde(skip_serializing_if = "Option::is_none", default)]
8473 pub comment: Option<String>,
8474 #[serde(skip_serializing_if = "Option::is_none", default)]
8476 pub row_access_policy: Option<String>,
8477 #[serde(default)]
8479 pub tags: Vec<(String, String)>,
8480 #[serde(default)]
8482 pub options: Vec<Expression>,
8483 #[serde(skip_serializing_if = "Option::is_none", default)]
8485 pub build: Option<String>,
8486 #[serde(skip_serializing_if = "Option::is_none", default)]
8488 pub refresh: Option<Box<RefreshTriggerProperty>>,
8489 #[serde(skip_serializing_if = "Option::is_none", default)]
8492 pub schema: Option<Box<Schema>>,
8493 #[serde(skip_serializing_if = "Option::is_none", default)]
8495 pub unique_key: Option<Box<UniqueKeyProperty>>,
8496 #[serde(default)]
8498 pub no_schema_binding: bool,
8499 #[serde(skip_serializing_if = "Option::is_none", default)]
8501 pub auto_refresh: Option<bool>,
8502 #[serde(skip_serializing_if = "Option::is_none", default)]
8504 pub clickhouse_population: Option<String>,
8505 #[serde(default, skip_serializing_if = "Option::is_none")]
8507 pub on_cluster: Option<OnCluster>,
8508 #[serde(default, skip_serializing_if = "Option::is_none")]
8510 pub to_table: Option<TableRef>,
8511 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8513 pub table_properties: Vec<Expression>,
8514}
8515
8516impl CreateView {
8517 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8518 Self {
8519 name: TableRef::new(name),
8520 columns: Vec::new(),
8521 query,
8522 or_replace: false,
8523 or_alter: false,
8524 if_not_exists: false,
8525 materialized: false,
8526 temporary: false,
8527 secure: false,
8528 algorithm: None,
8529 definer: None,
8530 security: None,
8531 security_sql_style: true,
8532 security_after_name: false,
8533 query_parenthesized: false,
8534 locking_mode: None,
8535 locking_access: None,
8536 copy_grants: false,
8537 comment: None,
8538 row_access_policy: None,
8539 tags: Vec::new(),
8540 options: Vec::new(),
8541 build: None,
8542 refresh: None,
8543 schema: None,
8544 unique_key: None,
8545 no_schema_binding: false,
8546 auto_refresh: None,
8547 clickhouse_population: None,
8548 on_cluster: None,
8549 to_table: None,
8550 table_properties: Vec::new(),
8551 }
8552 }
8553}
8554
8555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8557#[cfg_attr(feature = "bindings", derive(TS))]
8558pub struct DropView {
8559 pub name: TableRef,
8560 pub if_exists: bool,
8561 pub materialized: bool,
8562}
8563
8564impl DropView {
8565 pub fn new(name: impl Into<String>) -> Self {
8566 Self {
8567 name: TableRef::new(name),
8568 if_exists: false,
8569 materialized: false,
8570 }
8571 }
8572}
8573
8574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8576#[cfg_attr(feature = "bindings", derive(TS))]
8577pub struct Truncate {
8578 #[serde(default)]
8580 pub target: TruncateTarget,
8581 #[serde(default)]
8583 pub if_exists: bool,
8584 pub table: TableRef,
8585 #[serde(default, skip_serializing_if = "Option::is_none")]
8587 pub on_cluster: Option<OnCluster>,
8588 pub cascade: bool,
8589 #[serde(default)]
8591 pub extra_tables: Vec<TruncateTableEntry>,
8592 #[serde(default)]
8594 pub identity: Option<TruncateIdentity>,
8595 #[serde(default)]
8597 pub restrict: bool,
8598 #[serde(default, skip_serializing_if = "Option::is_none")]
8600 pub partition: Option<Box<Expression>>,
8601}
8602
8603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8605#[cfg_attr(feature = "bindings", derive(TS))]
8606pub struct TruncateTableEntry {
8607 pub table: TableRef,
8608 #[serde(default)]
8610 pub star: bool,
8611}
8612
8613#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8615#[cfg_attr(feature = "bindings", derive(TS))]
8616pub enum TruncateTarget {
8617 Table,
8618 Database,
8619}
8620
8621impl Default for TruncateTarget {
8622 fn default() -> Self {
8623 TruncateTarget::Table
8624 }
8625}
8626
8627#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8629#[cfg_attr(feature = "bindings", derive(TS))]
8630pub enum TruncateIdentity {
8631 Restart,
8632 Continue,
8633}
8634
8635impl Truncate {
8636 pub fn new(table: impl Into<String>) -> Self {
8637 Self {
8638 target: TruncateTarget::Table,
8639 if_exists: false,
8640 table: TableRef::new(table),
8641 on_cluster: None,
8642 cascade: false,
8643 extra_tables: Vec::new(),
8644 identity: None,
8645 restrict: false,
8646 partition: None,
8647 }
8648 }
8649}
8650
8651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8653#[cfg_attr(feature = "bindings", derive(TS))]
8654pub struct Use {
8655 pub kind: Option<UseKind>,
8657 pub this: Identifier,
8659}
8660
8661#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8663#[cfg_attr(feature = "bindings", derive(TS))]
8664pub enum UseKind {
8665 Database,
8666 Schema,
8667 Role,
8668 Warehouse,
8669 Catalog,
8670 SecondaryRoles,
8672}
8673
8674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8676#[cfg_attr(feature = "bindings", derive(TS))]
8677pub struct SetStatement {
8678 pub items: Vec<SetItem>,
8680}
8681
8682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8684#[cfg_attr(feature = "bindings", derive(TS))]
8685pub struct SetItem {
8686 pub name: Expression,
8688 pub value: Expression,
8690 pub kind: Option<String>,
8692 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8694 pub no_equals: bool,
8695}
8696
8697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8699#[cfg_attr(feature = "bindings", derive(TS))]
8700pub struct Cache {
8701 pub table: Identifier,
8703 pub lazy: bool,
8705 pub options: Vec<(Expression, Expression)>,
8707 pub query: Option<Expression>,
8709}
8710
8711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8713#[cfg_attr(feature = "bindings", derive(TS))]
8714pub struct Uncache {
8715 pub table: Identifier,
8717 pub if_exists: bool,
8719}
8720
8721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8723#[cfg_attr(feature = "bindings", derive(TS))]
8724pub struct LoadData {
8725 pub local: bool,
8727 pub inpath: String,
8729 pub overwrite: bool,
8731 pub table: Expression,
8733 pub partition: Vec<(Identifier, Expression)>,
8735 pub input_format: Option<String>,
8737 pub serde: Option<String>,
8739}
8740
8741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8743#[cfg_attr(feature = "bindings", derive(TS))]
8744pub struct Pragma {
8745 pub schema: Option<Identifier>,
8747 pub name: Identifier,
8749 pub value: Option<Expression>,
8751 pub args: Vec<Expression>,
8753 #[serde(default)]
8755 pub use_assignment_syntax: bool,
8756}
8757
8758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8761#[cfg_attr(feature = "bindings", derive(TS))]
8762pub struct Privilege {
8763 pub name: String,
8765 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8767 pub columns: Vec<String>,
8768}
8769
8770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8772#[cfg_attr(feature = "bindings", derive(TS))]
8773pub struct GrantPrincipal {
8774 pub name: Identifier,
8776 pub is_role: bool,
8778 #[serde(default)]
8780 pub is_group: bool,
8781 #[serde(default)]
8783 pub is_share: bool,
8784}
8785
8786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8788#[cfg_attr(feature = "bindings", derive(TS))]
8789pub struct Grant {
8790 pub privileges: Vec<Privilege>,
8792 pub kind: Option<String>,
8794 pub securable: Identifier,
8796 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8798 pub function_params: Vec<String>,
8799 pub principals: Vec<GrantPrincipal>,
8801 pub grant_option: bool,
8803 #[serde(default, skip_serializing_if = "Option::is_none")]
8805 pub as_principal: Option<Identifier>,
8806}
8807
8808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8810#[cfg_attr(feature = "bindings", derive(TS))]
8811pub struct Revoke {
8812 pub privileges: Vec<Privilege>,
8814 pub kind: Option<String>,
8816 pub securable: Identifier,
8818 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8820 pub function_params: Vec<String>,
8821 pub principals: Vec<GrantPrincipal>,
8823 pub grant_option: bool,
8825 pub cascade: bool,
8827 #[serde(default)]
8829 pub restrict: bool,
8830}
8831
8832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8834#[cfg_attr(feature = "bindings", derive(TS))]
8835pub struct Comment {
8836 pub this: Expression,
8838 pub kind: String,
8840 pub expression: Expression,
8842 pub exists: bool,
8844 pub materialized: bool,
8846}
8847
8848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8854#[cfg_attr(feature = "bindings", derive(TS))]
8855pub struct AlterView {
8856 pub name: TableRef,
8857 pub actions: Vec<AlterViewAction>,
8858 #[serde(default, skip_serializing_if = "Option::is_none")]
8860 pub algorithm: Option<String>,
8861 #[serde(default, skip_serializing_if = "Option::is_none")]
8863 pub definer: Option<String>,
8864 #[serde(default, skip_serializing_if = "Option::is_none")]
8866 pub sql_security: Option<String>,
8867 #[serde(default, skip_serializing_if = "Option::is_none")]
8869 pub with_option: Option<String>,
8870 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8872 pub columns: Vec<ViewColumn>,
8873}
8874
8875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8877#[cfg_attr(feature = "bindings", derive(TS))]
8878pub enum AlterViewAction {
8879 Rename(TableRef),
8881 OwnerTo(Identifier),
8883 SetSchema(Identifier),
8885 SetAuthorization(String),
8887 AlterColumn {
8889 name: Identifier,
8890 action: AlterColumnAction,
8891 },
8892 AsSelect(Box<Expression>),
8894 SetTblproperties(Vec<(String, String)>),
8896 UnsetTblproperties(Vec<String>),
8898}
8899
8900impl AlterView {
8901 pub fn new(name: impl Into<String>) -> Self {
8902 Self {
8903 name: TableRef::new(name),
8904 actions: Vec::new(),
8905 algorithm: None,
8906 definer: None,
8907 sql_security: None,
8908 with_option: None,
8909 columns: Vec::new(),
8910 }
8911 }
8912}
8913
8914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8916#[cfg_attr(feature = "bindings", derive(TS))]
8917pub struct AlterIndex {
8918 pub name: Identifier,
8919 pub table: Option<TableRef>,
8920 pub actions: Vec<AlterIndexAction>,
8921}
8922
8923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8925#[cfg_attr(feature = "bindings", derive(TS))]
8926pub enum AlterIndexAction {
8927 Rename(Identifier),
8929 SetTablespace(Identifier),
8931 Visible(bool),
8933}
8934
8935impl AlterIndex {
8936 pub fn new(name: impl Into<String>) -> Self {
8937 Self {
8938 name: Identifier::new(name),
8939 table: None,
8940 actions: Vec::new(),
8941 }
8942 }
8943}
8944
8945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8947#[cfg_attr(feature = "bindings", derive(TS))]
8948pub struct CreateSchema {
8949 pub name: Vec<Identifier>,
8951 pub if_not_exists: bool,
8952 pub authorization: Option<Identifier>,
8953 #[serde(default)]
8955 pub clone_from: Option<Vec<Identifier>>,
8956 #[serde(default)]
8958 pub at_clause: Option<Expression>,
8959 #[serde(default)]
8961 pub properties: Vec<Expression>,
8962 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8964 pub leading_comments: Vec<String>,
8965}
8966
8967impl CreateSchema {
8968 pub fn new(name: impl Into<String>) -> Self {
8969 Self {
8970 name: vec![Identifier::new(name)],
8971 if_not_exists: false,
8972 authorization: None,
8973 clone_from: None,
8974 at_clause: None,
8975 properties: Vec::new(),
8976 leading_comments: Vec::new(),
8977 }
8978 }
8979}
8980
8981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8983#[cfg_attr(feature = "bindings", derive(TS))]
8984pub struct DropSchema {
8985 pub name: Identifier,
8986 pub if_exists: bool,
8987 pub cascade: bool,
8988}
8989
8990impl DropSchema {
8991 pub fn new(name: impl Into<String>) -> Self {
8992 Self {
8993 name: Identifier::new(name),
8994 if_exists: false,
8995 cascade: false,
8996 }
8997 }
8998}
8999
9000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9002#[cfg_attr(feature = "bindings", derive(TS))]
9003pub struct DropNamespace {
9004 pub name: Identifier,
9005 pub if_exists: bool,
9006 pub cascade: bool,
9007}
9008
9009impl DropNamespace {
9010 pub fn new(name: impl Into<String>) -> Self {
9011 Self {
9012 name: Identifier::new(name),
9013 if_exists: false,
9014 cascade: false,
9015 }
9016 }
9017}
9018
9019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9021#[cfg_attr(feature = "bindings", derive(TS))]
9022pub struct CreateDatabase {
9023 pub name: Identifier,
9024 pub if_not_exists: bool,
9025 pub options: Vec<DatabaseOption>,
9026 #[serde(default)]
9028 pub clone_from: Option<Identifier>,
9029 #[serde(default)]
9031 pub at_clause: Option<Expression>,
9032}
9033
9034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9036#[cfg_attr(feature = "bindings", derive(TS))]
9037pub enum DatabaseOption {
9038 CharacterSet(String),
9039 Collate(String),
9040 Owner(Identifier),
9041 Template(Identifier),
9042 Encoding(String),
9043 Location(String),
9044}
9045
9046impl CreateDatabase {
9047 pub fn new(name: impl Into<String>) -> Self {
9048 Self {
9049 name: Identifier::new(name),
9050 if_not_exists: false,
9051 options: Vec::new(),
9052 clone_from: None,
9053 at_clause: None,
9054 }
9055 }
9056}
9057
9058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9060#[cfg_attr(feature = "bindings", derive(TS))]
9061pub struct DropDatabase {
9062 pub name: Identifier,
9063 pub if_exists: bool,
9064 #[serde(default)]
9066 pub sync: bool,
9067}
9068
9069impl DropDatabase {
9070 pub fn new(name: impl Into<String>) -> Self {
9071 Self {
9072 name: Identifier::new(name),
9073 if_exists: false,
9074 sync: false,
9075 }
9076 }
9077}
9078
9079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9081#[cfg_attr(feature = "bindings", derive(TS))]
9082pub struct CreateFunction {
9083 pub name: TableRef,
9084 pub parameters: Vec<FunctionParameter>,
9085 pub return_type: Option<DataType>,
9086 pub body: Option<FunctionBody>,
9087 pub or_replace: bool,
9088 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9090 pub or_alter: bool,
9091 pub if_not_exists: bool,
9092 pub temporary: bool,
9093 pub language: Option<String>,
9094 pub deterministic: Option<bool>,
9095 pub returns_null_on_null_input: Option<bool>,
9096 pub security: Option<FunctionSecurity>,
9097 #[serde(default = "default_true")]
9099 pub has_parens: bool,
9100 #[serde(default)]
9102 pub sql_data_access: Option<SqlDataAccess>,
9103 #[serde(default, skip_serializing_if = "Option::is_none")]
9105 pub returns_table_body: Option<String>,
9106 #[serde(default)]
9108 pub language_first: bool,
9109 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9111 pub set_options: Vec<FunctionSetOption>,
9112 #[serde(default)]
9114 pub strict: bool,
9115 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9117 pub options: Vec<Expression>,
9118 #[serde(default)]
9120 pub is_table_function: bool,
9121 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9123 pub property_order: Vec<FunctionPropertyKind>,
9124 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9126 pub using_resources: Vec<FunctionUsingResource>,
9127 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9129 pub environment: Vec<Expression>,
9130 #[serde(default, skip_serializing_if = "Option::is_none")]
9132 pub handler: Option<String>,
9133 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9135 pub handler_uses_eq: bool,
9136 #[serde(default, skip_serializing_if = "Option::is_none")]
9138 pub runtime_version: Option<String>,
9139 #[serde(default, skip_serializing_if = "Option::is_none")]
9141 pub packages: Option<Vec<String>>,
9142 #[serde(default, skip_serializing_if = "Option::is_none")]
9144 pub parameter_style: Option<String>,
9145}
9146
9147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9149#[cfg_attr(feature = "bindings", derive(TS))]
9150pub struct FunctionSetOption {
9151 pub name: String,
9152 pub value: FunctionSetValue,
9153}
9154
9155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9157#[cfg_attr(feature = "bindings", derive(TS))]
9158pub enum FunctionSetValue {
9159 Value { value: String, use_to: bool },
9161 FromCurrent,
9163}
9164
9165#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9167#[cfg_attr(feature = "bindings", derive(TS))]
9168pub enum SqlDataAccess {
9169 NoSql,
9171 ContainsSql,
9173 ReadsSqlData,
9175 ModifiesSqlData,
9177}
9178
9179#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9181#[cfg_attr(feature = "bindings", derive(TS))]
9182pub enum FunctionPropertyKind {
9183 Set,
9185 As,
9187 Using,
9189 Language,
9191 Determinism,
9193 NullInput,
9195 Security,
9197 SqlDataAccess,
9199 Options,
9201 Environment,
9203 Handler,
9205 RuntimeVersion,
9207 Packages,
9209 ParameterStyle,
9211}
9212
9213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9215#[cfg_attr(feature = "bindings", derive(TS))]
9216pub struct FunctionUsingResource {
9217 pub kind: String,
9218 pub uri: String,
9219}
9220
9221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9223#[cfg_attr(feature = "bindings", derive(TS))]
9224pub struct FunctionParameter {
9225 pub name: Option<Identifier>,
9226 pub data_type: DataType,
9227 pub mode: Option<ParameterMode>,
9228 pub default: Option<Expression>,
9229 #[serde(default, skip_serializing_if = "Option::is_none")]
9231 pub mode_text: Option<String>,
9232}
9233
9234#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9236#[cfg_attr(feature = "bindings", derive(TS))]
9237pub enum ParameterMode {
9238 In,
9239 Out,
9240 InOut,
9241 Variadic,
9242}
9243
9244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9246#[cfg_attr(feature = "bindings", derive(TS))]
9247pub enum FunctionBody {
9248 Block(String),
9250 StringLiteral(String),
9252 Expression(Expression),
9254 External(String),
9256 Return(Expression),
9258 Statements(Vec<Expression>),
9260 DollarQuoted {
9263 content: String,
9264 tag: Option<String>,
9265 },
9266 RawBlock(String),
9268}
9269
9270#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9272#[cfg_attr(feature = "bindings", derive(TS))]
9273pub enum FunctionSecurity {
9274 Definer,
9275 Invoker,
9276 None,
9278}
9279
9280impl CreateFunction {
9281 pub fn new(name: impl Into<String>) -> Self {
9282 Self {
9283 name: TableRef::new(name),
9284 parameters: Vec::new(),
9285 return_type: None,
9286 body: None,
9287 or_replace: false,
9288 or_alter: false,
9289 if_not_exists: false,
9290 temporary: false,
9291 language: None,
9292 deterministic: None,
9293 returns_null_on_null_input: None,
9294 security: None,
9295 has_parens: true,
9296 sql_data_access: None,
9297 returns_table_body: None,
9298 language_first: false,
9299 set_options: Vec::new(),
9300 strict: false,
9301 options: Vec::new(),
9302 is_table_function: false,
9303 property_order: Vec::new(),
9304 using_resources: Vec::new(),
9305 environment: Vec::new(),
9306 handler: None,
9307 handler_uses_eq: false,
9308 runtime_version: None,
9309 packages: None,
9310 parameter_style: None,
9311 }
9312 }
9313}
9314
9315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9317#[cfg_attr(feature = "bindings", derive(TS))]
9318pub struct DropFunction {
9319 pub name: TableRef,
9320 pub parameters: Option<Vec<DataType>>,
9321 pub if_exists: bool,
9322 pub cascade: bool,
9323}
9324
9325impl DropFunction {
9326 pub fn new(name: impl Into<String>) -> Self {
9327 Self {
9328 name: TableRef::new(name),
9329 parameters: None,
9330 if_exists: false,
9331 cascade: false,
9332 }
9333 }
9334}
9335
9336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9338#[cfg_attr(feature = "bindings", derive(TS))]
9339pub struct CreateProcedure {
9340 pub name: TableRef,
9341 pub parameters: Vec<FunctionParameter>,
9342 pub body: Option<FunctionBody>,
9343 pub or_replace: bool,
9344 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9346 pub or_alter: bool,
9347 pub if_not_exists: bool,
9348 pub language: Option<String>,
9349 pub security: Option<FunctionSecurity>,
9350 #[serde(default)]
9352 pub return_type: Option<DataType>,
9353 #[serde(default)]
9355 pub execute_as: Option<String>,
9356 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9358 pub with_options: Vec<String>,
9359 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9361 pub has_parens: bool,
9362 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9364 pub use_proc_keyword: bool,
9365}
9366
9367impl CreateProcedure {
9368 pub fn new(name: impl Into<String>) -> Self {
9369 Self {
9370 name: TableRef::new(name),
9371 parameters: Vec::new(),
9372 body: None,
9373 or_replace: false,
9374 or_alter: false,
9375 if_not_exists: false,
9376 language: None,
9377 security: None,
9378 return_type: None,
9379 execute_as: None,
9380 with_options: Vec::new(),
9381 has_parens: true,
9382 use_proc_keyword: false,
9383 }
9384 }
9385}
9386
9387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9389#[cfg_attr(feature = "bindings", derive(TS))]
9390pub struct DropProcedure {
9391 pub name: TableRef,
9392 pub parameters: Option<Vec<DataType>>,
9393 pub if_exists: bool,
9394 pub cascade: bool,
9395}
9396
9397impl DropProcedure {
9398 pub fn new(name: impl Into<String>) -> Self {
9399 Self {
9400 name: TableRef::new(name),
9401 parameters: None,
9402 if_exists: false,
9403 cascade: false,
9404 }
9405 }
9406}
9407
9408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9410#[cfg_attr(feature = "bindings", derive(TS))]
9411pub enum SeqPropKind {
9412 Start,
9413 Increment,
9414 Minvalue,
9415 Maxvalue,
9416 Cache,
9417 NoCache,
9418 Cycle,
9419 NoCycle,
9420 OwnedBy,
9421 Order,
9422 NoOrder,
9423 Comment,
9424 Sharing,
9426 Keep,
9428 NoKeep,
9430 Scale,
9432 NoScale,
9434 Shard,
9436 NoShard,
9438 Session,
9440 Global,
9442 NoCacheWord,
9444 NoCycleWord,
9446 NoMinvalueWord,
9448 NoMaxvalueWord,
9450}
9451
9452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9454#[cfg_attr(feature = "bindings", derive(TS))]
9455pub struct CreateSynonym {
9456 pub name: TableRef,
9458 pub target: TableRef,
9460}
9461
9462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9464#[cfg_attr(feature = "bindings", derive(TS))]
9465pub struct CreateSequence {
9466 pub name: TableRef,
9467 pub if_not_exists: bool,
9468 pub temporary: bool,
9469 #[serde(default)]
9470 pub or_replace: bool,
9471 #[serde(default, skip_serializing_if = "Option::is_none")]
9473 pub as_type: Option<DataType>,
9474 pub increment: Option<i64>,
9475 pub minvalue: Option<SequenceBound>,
9476 pub maxvalue: Option<SequenceBound>,
9477 pub start: Option<i64>,
9478 pub cache: Option<i64>,
9479 pub cycle: bool,
9480 pub owned_by: Option<TableRef>,
9481 #[serde(default)]
9483 pub owned_by_none: bool,
9484 #[serde(default)]
9486 pub order: Option<bool>,
9487 #[serde(default)]
9489 pub comment: Option<String>,
9490 #[serde(default, skip_serializing_if = "Option::is_none")]
9492 pub sharing: Option<String>,
9493 #[serde(default, skip_serializing_if = "Option::is_none")]
9495 pub scale_modifier: Option<String>,
9496 #[serde(default, skip_serializing_if = "Option::is_none")]
9498 pub shard_modifier: Option<String>,
9499 #[serde(default)]
9501 pub property_order: Vec<SeqPropKind>,
9502}
9503
9504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9506#[cfg_attr(feature = "bindings", derive(TS))]
9507pub enum SequenceBound {
9508 Value(i64),
9509 None,
9510}
9511
9512impl CreateSequence {
9513 pub fn new(name: impl Into<String>) -> Self {
9514 Self {
9515 name: TableRef::new(name),
9516 if_not_exists: false,
9517 temporary: false,
9518 or_replace: false,
9519 as_type: None,
9520 increment: None,
9521 minvalue: None,
9522 maxvalue: None,
9523 start: None,
9524 cache: None,
9525 cycle: false,
9526 owned_by: None,
9527 owned_by_none: false,
9528 order: None,
9529 comment: None,
9530 sharing: None,
9531 scale_modifier: None,
9532 shard_modifier: None,
9533 property_order: Vec::new(),
9534 }
9535 }
9536}
9537
9538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9540#[cfg_attr(feature = "bindings", derive(TS))]
9541pub struct DropSequence {
9542 pub name: TableRef,
9543 pub if_exists: bool,
9544 pub cascade: bool,
9545}
9546
9547impl DropSequence {
9548 pub fn new(name: impl Into<String>) -> Self {
9549 Self {
9550 name: TableRef::new(name),
9551 if_exists: false,
9552 cascade: false,
9553 }
9554 }
9555}
9556
9557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9559#[cfg_attr(feature = "bindings", derive(TS))]
9560pub struct AlterSequence {
9561 pub name: TableRef,
9562 pub if_exists: bool,
9563 pub increment: Option<i64>,
9564 pub minvalue: Option<SequenceBound>,
9565 pub maxvalue: Option<SequenceBound>,
9566 pub start: Option<i64>,
9567 pub restart: Option<Option<i64>>,
9568 pub cache: Option<i64>,
9569 pub cycle: Option<bool>,
9570 pub owned_by: Option<Option<TableRef>>,
9571}
9572
9573impl AlterSequence {
9574 pub fn new(name: impl Into<String>) -> Self {
9575 Self {
9576 name: TableRef::new(name),
9577 if_exists: false,
9578 increment: None,
9579 minvalue: None,
9580 maxvalue: None,
9581 start: None,
9582 restart: None,
9583 cache: None,
9584 cycle: None,
9585 owned_by: None,
9586 }
9587 }
9588}
9589
9590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9592#[cfg_attr(feature = "bindings", derive(TS))]
9593pub struct CreateTrigger {
9594 pub name: Identifier,
9595 pub table: TableRef,
9596 pub timing: TriggerTiming,
9597 pub events: Vec<TriggerEvent>,
9598 #[serde(default, skip_serializing_if = "Option::is_none")]
9599 pub for_each: Option<TriggerForEach>,
9600 pub when: Option<Expression>,
9601 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9603 pub when_paren: bool,
9604 pub body: TriggerBody,
9605 pub or_replace: bool,
9606 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9608 pub or_alter: bool,
9609 pub constraint: bool,
9610 pub deferrable: Option<bool>,
9611 pub initially_deferred: Option<bool>,
9612 pub referencing: Option<TriggerReferencing>,
9613}
9614
9615#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9617#[cfg_attr(feature = "bindings", derive(TS))]
9618pub enum TriggerTiming {
9619 Before,
9620 After,
9621 InsteadOf,
9622}
9623
9624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9626#[cfg_attr(feature = "bindings", derive(TS))]
9627pub enum TriggerEvent {
9628 Insert,
9629 Update(Option<Vec<Identifier>>),
9630 Delete,
9631 Truncate,
9632}
9633
9634#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9636#[cfg_attr(feature = "bindings", derive(TS))]
9637pub enum TriggerForEach {
9638 Row,
9639 Statement,
9640}
9641
9642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9644#[cfg_attr(feature = "bindings", derive(TS))]
9645pub enum TriggerBody {
9646 Execute {
9648 function: TableRef,
9649 args: Vec<Expression>,
9650 },
9651 Block(String),
9653}
9654
9655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9657#[cfg_attr(feature = "bindings", derive(TS))]
9658pub struct TriggerReferencing {
9659 pub old_table: Option<Identifier>,
9660 pub new_table: Option<Identifier>,
9661 pub old_row: Option<Identifier>,
9662 pub new_row: Option<Identifier>,
9663}
9664
9665impl CreateTrigger {
9666 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9667 Self {
9668 name: Identifier::new(name),
9669 table: TableRef::new(table),
9670 timing: TriggerTiming::Before,
9671 events: Vec::new(),
9672 for_each: Some(TriggerForEach::Row),
9673 when: None,
9674 when_paren: false,
9675 body: TriggerBody::Execute {
9676 function: TableRef::new(""),
9677 args: Vec::new(),
9678 },
9679 or_replace: false,
9680 or_alter: false,
9681 constraint: false,
9682 deferrable: None,
9683 initially_deferred: None,
9684 referencing: None,
9685 }
9686 }
9687}
9688
9689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9691#[cfg_attr(feature = "bindings", derive(TS))]
9692pub struct DropTrigger {
9693 pub name: Identifier,
9694 pub table: Option<TableRef>,
9695 pub if_exists: bool,
9696 pub cascade: bool,
9697}
9698
9699impl DropTrigger {
9700 pub fn new(name: impl Into<String>) -> Self {
9701 Self {
9702 name: Identifier::new(name),
9703 table: None,
9704 if_exists: false,
9705 cascade: false,
9706 }
9707 }
9708}
9709
9710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9712#[cfg_attr(feature = "bindings", derive(TS))]
9713pub struct CreateType {
9714 pub name: TableRef,
9715 pub definition: TypeDefinition,
9716 pub if_not_exists: bool,
9717}
9718
9719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9721#[cfg_attr(feature = "bindings", derive(TS))]
9722pub enum TypeDefinition {
9723 Enum(Vec<String>),
9725 Composite(Vec<TypeAttribute>),
9727 Range {
9729 subtype: DataType,
9730 subtype_diff: Option<String>,
9731 canonical: Option<String>,
9732 },
9733 Base {
9735 input: String,
9736 output: String,
9737 internallength: Option<i32>,
9738 },
9739 Domain {
9741 base_type: DataType,
9742 default: Option<Expression>,
9743 constraints: Vec<DomainConstraint>,
9744 },
9745}
9746
9747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9749#[cfg_attr(feature = "bindings", derive(TS))]
9750pub struct TypeAttribute {
9751 pub name: Identifier,
9752 pub data_type: DataType,
9753 pub collate: Option<Identifier>,
9754}
9755
9756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9758#[cfg_attr(feature = "bindings", derive(TS))]
9759pub struct DomainConstraint {
9760 pub name: Option<Identifier>,
9761 pub check: Expression,
9762}
9763
9764impl CreateType {
9765 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9766 Self {
9767 name: TableRef::new(name),
9768 definition: TypeDefinition::Enum(values),
9769 if_not_exists: false,
9770 }
9771 }
9772
9773 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9774 Self {
9775 name: TableRef::new(name),
9776 definition: TypeDefinition::Composite(attributes),
9777 if_not_exists: false,
9778 }
9779 }
9780}
9781
9782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9784#[cfg_attr(feature = "bindings", derive(TS))]
9785pub struct DropType {
9786 pub name: TableRef,
9787 pub if_exists: bool,
9788 pub cascade: bool,
9789}
9790
9791impl DropType {
9792 pub fn new(name: impl Into<String>) -> Self {
9793 Self {
9794 name: TableRef::new(name),
9795 if_exists: false,
9796 cascade: false,
9797 }
9798 }
9799}
9800
9801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9803#[cfg_attr(feature = "bindings", derive(TS))]
9804pub struct Describe {
9805 pub target: Expression,
9807 pub extended: bool,
9809 pub formatted: bool,
9811 #[serde(default)]
9813 pub kind: Option<String>,
9814 #[serde(default)]
9816 pub properties: Vec<(String, String)>,
9817 #[serde(default, skip_serializing_if = "Option::is_none")]
9819 pub style: Option<String>,
9820 #[serde(default)]
9822 pub partition: Option<Box<Expression>>,
9823 #[serde(default)]
9825 pub leading_comments: Vec<String>,
9826 #[serde(default)]
9828 pub as_json: bool,
9829 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9831 pub params: Vec<String>,
9832}
9833
9834impl Describe {
9835 pub fn new(target: Expression) -> Self {
9836 Self {
9837 target,
9838 extended: false,
9839 formatted: false,
9840 kind: None,
9841 properties: Vec::new(),
9842 style: None,
9843 partition: None,
9844 leading_comments: Vec::new(),
9845 as_json: false,
9846 params: Vec::new(),
9847 }
9848 }
9849}
9850
9851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9853#[cfg_attr(feature = "bindings", derive(TS))]
9854pub struct Show {
9855 pub this: String,
9857 #[serde(default)]
9859 pub terse: bool,
9860 #[serde(default)]
9862 pub history: bool,
9863 pub like: Option<Expression>,
9865 pub scope_kind: Option<String>,
9867 pub scope: Option<Expression>,
9869 pub starts_with: Option<Expression>,
9871 pub limit: Option<Box<Limit>>,
9873 pub from: Option<Expression>,
9875 #[serde(default, skip_serializing_if = "Option::is_none")]
9877 pub where_clause: Option<Expression>,
9878 #[serde(default, skip_serializing_if = "Option::is_none")]
9880 pub for_target: Option<Expression>,
9881 #[serde(default, skip_serializing_if = "Option::is_none")]
9883 pub db: Option<Expression>,
9884 #[serde(default, skip_serializing_if = "Option::is_none")]
9886 pub target: Option<Expression>,
9887 #[serde(default, skip_serializing_if = "Option::is_none")]
9889 pub mutex: Option<bool>,
9890 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9892 pub privileges: Vec<String>,
9893}
9894
9895impl Show {
9896 pub fn new(this: impl Into<String>) -> Self {
9897 Self {
9898 this: this.into(),
9899 terse: false,
9900 history: false,
9901 like: None,
9902 scope_kind: None,
9903 scope: None,
9904 starts_with: None,
9905 limit: None,
9906 from: None,
9907 where_clause: None,
9908 for_target: None,
9909 db: None,
9910 target: None,
9911 mutex: None,
9912 privileges: Vec::new(),
9913 }
9914 }
9915}
9916
9917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9922#[cfg_attr(feature = "bindings", derive(TS))]
9923pub struct Paren {
9924 pub this: Expression,
9926 #[serde(default)]
9927 pub trailing_comments: Vec<String>,
9928}
9929
9930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9932#[cfg_attr(feature = "bindings", derive(TS))]
9933pub struct Annotated {
9934 pub this: Expression,
9935 pub trailing_comments: Vec<String>,
9936}
9937
9938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9943#[cfg_attr(feature = "bindings", derive(TS))]
9944pub struct Refresh {
9945 pub this: Box<Expression>,
9946 pub kind: String,
9947}
9948
9949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9951#[cfg_attr(feature = "bindings", derive(TS))]
9952pub struct LockingStatement {
9953 pub this: Box<Expression>,
9954 pub expression: Box<Expression>,
9955}
9956
9957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9959#[cfg_attr(feature = "bindings", derive(TS))]
9960pub struct SequenceProperties {
9961 #[serde(default)]
9962 pub increment: Option<Box<Expression>>,
9963 #[serde(default)]
9964 pub minvalue: Option<Box<Expression>>,
9965 #[serde(default)]
9966 pub maxvalue: Option<Box<Expression>>,
9967 #[serde(default)]
9968 pub cache: Option<Box<Expression>>,
9969 #[serde(default)]
9970 pub start: Option<Box<Expression>>,
9971 #[serde(default)]
9972 pub owned: Option<Box<Expression>>,
9973 #[serde(default)]
9974 pub options: Vec<Expression>,
9975}
9976
9977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9979#[cfg_attr(feature = "bindings", derive(TS))]
9980pub struct TruncateTable {
9981 #[serde(default)]
9982 pub expressions: Vec<Expression>,
9983 #[serde(default)]
9984 pub is_database: Option<Box<Expression>>,
9985 #[serde(default)]
9986 pub exists: bool,
9987 #[serde(default)]
9988 pub only: Option<Box<Expression>>,
9989 #[serde(default)]
9990 pub cluster: Option<Box<Expression>>,
9991 #[serde(default)]
9992 pub identity: Option<Box<Expression>>,
9993 #[serde(default)]
9994 pub option: Option<Box<Expression>>,
9995 #[serde(default)]
9996 pub partition: Option<Box<Expression>>,
9997}
9998
9999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10001#[cfg_attr(feature = "bindings", derive(TS))]
10002pub struct Clone {
10003 pub this: Box<Expression>,
10004 #[serde(default)]
10005 pub shallow: Option<Box<Expression>>,
10006 #[serde(default)]
10007 pub copy: Option<Box<Expression>>,
10008}
10009
10010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10012#[cfg_attr(feature = "bindings", derive(TS))]
10013pub struct Attach {
10014 pub this: Box<Expression>,
10015 #[serde(default)]
10016 pub exists: bool,
10017 #[serde(default)]
10018 pub expressions: Vec<Expression>,
10019}
10020
10021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10023#[cfg_attr(feature = "bindings", derive(TS))]
10024pub struct Detach {
10025 pub this: Box<Expression>,
10026 #[serde(default)]
10027 pub exists: bool,
10028}
10029
10030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10032#[cfg_attr(feature = "bindings", derive(TS))]
10033pub struct Install {
10034 pub this: Box<Expression>,
10035 #[serde(default)]
10036 pub from_: Option<Box<Expression>>,
10037 #[serde(default)]
10038 pub force: Option<Box<Expression>>,
10039}
10040
10041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10043#[cfg_attr(feature = "bindings", derive(TS))]
10044pub struct Summarize {
10045 pub this: Box<Expression>,
10046 #[serde(default)]
10047 pub table: Option<Box<Expression>>,
10048}
10049
10050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10052#[cfg_attr(feature = "bindings", derive(TS))]
10053pub struct Declare {
10054 #[serde(default)]
10055 pub expressions: Vec<Expression>,
10056 #[serde(default)]
10057 pub replace: bool,
10058}
10059
10060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10062#[cfg_attr(feature = "bindings", derive(TS))]
10063pub struct DeclareItem {
10064 pub this: Box<Expression>,
10065 #[serde(default)]
10066 pub kind: Option<String>,
10067 #[serde(default)]
10068 pub default: Option<Box<Expression>>,
10069 #[serde(default)]
10070 pub has_as: bool,
10071 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10073 pub additional_names: Vec<Expression>,
10074}
10075
10076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10078#[cfg_attr(feature = "bindings", derive(TS))]
10079pub struct Set {
10080 #[serde(default)]
10081 pub expressions: Vec<Expression>,
10082 #[serde(default)]
10083 pub unset: Option<Box<Expression>>,
10084 #[serde(default)]
10085 pub tag: Option<Box<Expression>>,
10086}
10087
10088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10090#[cfg_attr(feature = "bindings", derive(TS))]
10091pub struct Heredoc {
10092 pub this: Box<Expression>,
10093 #[serde(default)]
10094 pub tag: Option<Box<Expression>>,
10095}
10096
10097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10099#[cfg_attr(feature = "bindings", derive(TS))]
10100pub struct QueryBand {
10101 pub this: Box<Expression>,
10102 #[serde(default)]
10103 pub scope: Option<Box<Expression>>,
10104 #[serde(default)]
10105 pub update: Option<Box<Expression>>,
10106}
10107
10108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10110#[cfg_attr(feature = "bindings", derive(TS))]
10111pub struct UserDefinedFunction {
10112 pub this: Box<Expression>,
10113 #[serde(default)]
10114 pub expressions: Vec<Expression>,
10115 #[serde(default)]
10116 pub wrapped: Option<Box<Expression>>,
10117}
10118
10119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10121#[cfg_attr(feature = "bindings", derive(TS))]
10122pub struct RecursiveWithSearch {
10123 pub kind: String,
10124 pub this: Box<Expression>,
10125 pub expression: Box<Expression>,
10126 #[serde(default)]
10127 pub using: Option<Box<Expression>>,
10128}
10129
10130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10132#[cfg_attr(feature = "bindings", derive(TS))]
10133pub struct ProjectionDef {
10134 pub this: Box<Expression>,
10135 pub expression: Box<Expression>,
10136}
10137
10138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10140#[cfg_attr(feature = "bindings", derive(TS))]
10141pub struct TableAlias {
10142 #[serde(default)]
10143 pub this: Option<Box<Expression>>,
10144 #[serde(default)]
10145 pub columns: Vec<Expression>,
10146}
10147
10148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10150#[cfg_attr(feature = "bindings", derive(TS))]
10151pub struct ByteString {
10152 pub this: Box<Expression>,
10153 #[serde(default)]
10154 pub is_bytes: Option<Box<Expression>>,
10155}
10156
10157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10160#[cfg_attr(feature = "bindings", derive(TS))]
10161pub struct HexStringExpr {
10162 pub this: Box<Expression>,
10163 #[serde(default)]
10164 pub is_integer: Option<bool>,
10165}
10166
10167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10169#[cfg_attr(feature = "bindings", derive(TS))]
10170pub struct UnicodeString {
10171 pub this: Box<Expression>,
10172 #[serde(default)]
10173 pub escape: Option<Box<Expression>>,
10174}
10175
10176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10178#[cfg_attr(feature = "bindings", derive(TS))]
10179pub struct AlterColumn {
10180 pub this: Box<Expression>,
10181 #[serde(default)]
10182 pub dtype: Option<Box<Expression>>,
10183 #[serde(default)]
10184 pub collate: Option<Box<Expression>>,
10185 #[serde(default)]
10186 pub using: Option<Box<Expression>>,
10187 #[serde(default)]
10188 pub default: Option<Box<Expression>>,
10189 #[serde(default)]
10190 pub drop: Option<Box<Expression>>,
10191 #[serde(default)]
10192 pub comment: Option<Box<Expression>>,
10193 #[serde(default)]
10194 pub allow_null: Option<Box<Expression>>,
10195 #[serde(default)]
10196 pub visible: Option<Box<Expression>>,
10197 #[serde(default)]
10198 pub rename_to: Option<Box<Expression>>,
10199}
10200
10201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10203#[cfg_attr(feature = "bindings", derive(TS))]
10204pub struct AlterSortKey {
10205 #[serde(default)]
10206 pub this: Option<Box<Expression>>,
10207 #[serde(default)]
10208 pub expressions: Vec<Expression>,
10209 #[serde(default)]
10210 pub compound: Option<Box<Expression>>,
10211}
10212
10213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10215#[cfg_attr(feature = "bindings", derive(TS))]
10216pub struct AlterSet {
10217 #[serde(default)]
10218 pub expressions: Vec<Expression>,
10219 #[serde(default)]
10220 pub option: Option<Box<Expression>>,
10221 #[serde(default)]
10222 pub tablespace: Option<Box<Expression>>,
10223 #[serde(default)]
10224 pub access_method: Option<Box<Expression>>,
10225 #[serde(default)]
10226 pub file_format: Option<Box<Expression>>,
10227 #[serde(default)]
10228 pub copy_options: Option<Box<Expression>>,
10229 #[serde(default)]
10230 pub tag: Option<Box<Expression>>,
10231 #[serde(default)]
10232 pub location: Option<Box<Expression>>,
10233 #[serde(default)]
10234 pub serde: Option<Box<Expression>>,
10235}
10236
10237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10239#[cfg_attr(feature = "bindings", derive(TS))]
10240pub struct RenameColumn {
10241 pub this: Box<Expression>,
10242 #[serde(default)]
10243 pub to: Option<Box<Expression>>,
10244 #[serde(default)]
10245 pub exists: bool,
10246}
10247
10248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10250#[cfg_attr(feature = "bindings", derive(TS))]
10251pub struct Comprehension {
10252 pub this: Box<Expression>,
10253 pub expression: Box<Expression>,
10254 #[serde(default)]
10255 pub position: Option<Box<Expression>>,
10256 #[serde(default)]
10257 pub iterator: Option<Box<Expression>>,
10258 #[serde(default)]
10259 pub condition: Option<Box<Expression>>,
10260}
10261
10262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10264#[cfg_attr(feature = "bindings", derive(TS))]
10265pub struct MergeTreeTTLAction {
10266 pub this: Box<Expression>,
10267 #[serde(default)]
10268 pub delete: Option<Box<Expression>>,
10269 #[serde(default)]
10270 pub recompress: Option<Box<Expression>>,
10271 #[serde(default)]
10272 pub to_disk: Option<Box<Expression>>,
10273 #[serde(default)]
10274 pub to_volume: Option<Box<Expression>>,
10275}
10276
10277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10279#[cfg_attr(feature = "bindings", derive(TS))]
10280pub struct MergeTreeTTL {
10281 #[serde(default)]
10282 pub expressions: Vec<Expression>,
10283 #[serde(default)]
10284 pub where_: Option<Box<Expression>>,
10285 #[serde(default)]
10286 pub group: Option<Box<Expression>>,
10287 #[serde(default)]
10288 pub aggregates: Option<Box<Expression>>,
10289}
10290
10291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10293#[cfg_attr(feature = "bindings", derive(TS))]
10294pub struct IndexConstraintOption {
10295 #[serde(default)]
10296 pub key_block_size: Option<Box<Expression>>,
10297 #[serde(default)]
10298 pub using: Option<Box<Expression>>,
10299 #[serde(default)]
10300 pub parser: Option<Box<Expression>>,
10301 #[serde(default)]
10302 pub comment: Option<Box<Expression>>,
10303 #[serde(default)]
10304 pub visible: Option<Box<Expression>>,
10305 #[serde(default)]
10306 pub engine_attr: Option<Box<Expression>>,
10307 #[serde(default)]
10308 pub secondary_engine_attr: Option<Box<Expression>>,
10309}
10310
10311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10313#[cfg_attr(feature = "bindings", derive(TS))]
10314pub struct PeriodForSystemTimeConstraint {
10315 pub this: Box<Expression>,
10316 pub expression: Box<Expression>,
10317}
10318
10319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10321#[cfg_attr(feature = "bindings", derive(TS))]
10322pub struct CaseSpecificColumnConstraint {
10323 #[serde(default)]
10324 pub not_: Option<Box<Expression>>,
10325}
10326
10327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10329#[cfg_attr(feature = "bindings", derive(TS))]
10330pub struct CharacterSetColumnConstraint {
10331 pub this: Box<Expression>,
10332}
10333
10334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10336#[cfg_attr(feature = "bindings", derive(TS))]
10337pub struct CheckColumnConstraint {
10338 pub this: Box<Expression>,
10339 #[serde(default)]
10340 pub enforced: Option<Box<Expression>>,
10341}
10342
10343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10345#[cfg_attr(feature = "bindings", derive(TS))]
10346pub struct AssumeColumnConstraint {
10347 pub this: Box<Expression>,
10348}
10349
10350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10352#[cfg_attr(feature = "bindings", derive(TS))]
10353pub struct CompressColumnConstraint {
10354 #[serde(default)]
10355 pub this: Option<Box<Expression>>,
10356}
10357
10358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10360#[cfg_attr(feature = "bindings", derive(TS))]
10361pub struct DateFormatColumnConstraint {
10362 pub this: Box<Expression>,
10363}
10364
10365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10367#[cfg_attr(feature = "bindings", derive(TS))]
10368pub struct EphemeralColumnConstraint {
10369 #[serde(default)]
10370 pub this: Option<Box<Expression>>,
10371}
10372
10373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10375#[cfg_attr(feature = "bindings", derive(TS))]
10376pub struct WithOperator {
10377 pub this: Box<Expression>,
10378 pub op: String,
10379}
10380
10381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10383#[cfg_attr(feature = "bindings", derive(TS))]
10384pub struct GeneratedAsIdentityColumnConstraint {
10385 #[serde(default)]
10386 pub this: Option<Box<Expression>>,
10387 #[serde(default)]
10388 pub expression: Option<Box<Expression>>,
10389 #[serde(default)]
10390 pub on_null: Option<Box<Expression>>,
10391 #[serde(default)]
10392 pub start: Option<Box<Expression>>,
10393 #[serde(default)]
10394 pub increment: Option<Box<Expression>>,
10395 #[serde(default)]
10396 pub minvalue: Option<Box<Expression>>,
10397 #[serde(default)]
10398 pub maxvalue: Option<Box<Expression>>,
10399 #[serde(default)]
10400 pub cycle: Option<Box<Expression>>,
10401 #[serde(default)]
10402 pub order: Option<Box<Expression>>,
10403}
10404
10405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10408#[cfg_attr(feature = "bindings", derive(TS))]
10409pub struct AutoIncrementColumnConstraint;
10410
10411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10413#[cfg_attr(feature = "bindings", derive(TS))]
10414pub struct CommentColumnConstraint;
10415
10416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10418#[cfg_attr(feature = "bindings", derive(TS))]
10419pub struct GeneratedAsRowColumnConstraint {
10420 #[serde(default)]
10421 pub start: Option<Box<Expression>>,
10422 #[serde(default)]
10423 pub hidden: Option<Box<Expression>>,
10424}
10425
10426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10428#[cfg_attr(feature = "bindings", derive(TS))]
10429pub struct IndexColumnConstraint {
10430 #[serde(default)]
10431 pub this: Option<Box<Expression>>,
10432 #[serde(default)]
10433 pub expressions: Vec<Expression>,
10434 #[serde(default)]
10435 pub kind: Option<String>,
10436 #[serde(default)]
10437 pub index_type: Option<Box<Expression>>,
10438 #[serde(default)]
10439 pub options: Vec<Expression>,
10440 #[serde(default)]
10441 pub expression: Option<Box<Expression>>,
10442 #[serde(default)]
10443 pub granularity: Option<Box<Expression>>,
10444}
10445
10446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10448#[cfg_attr(feature = "bindings", derive(TS))]
10449pub struct MaskingPolicyColumnConstraint {
10450 pub this: Box<Expression>,
10451 #[serde(default)]
10452 pub expressions: Vec<Expression>,
10453}
10454
10455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10457#[cfg_attr(feature = "bindings", derive(TS))]
10458pub struct NotNullColumnConstraint {
10459 #[serde(default)]
10460 pub allow_null: Option<Box<Expression>>,
10461}
10462
10463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10465#[cfg_attr(feature = "bindings", derive(TS))]
10466pub struct DefaultColumnConstraint {
10467 pub this: Box<Expression>,
10468 #[serde(default, skip_serializing_if = "Option::is_none")]
10470 pub for_column: Option<Identifier>,
10471}
10472
10473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10475#[cfg_attr(feature = "bindings", derive(TS))]
10476pub struct PrimaryKeyColumnConstraint {
10477 #[serde(default)]
10478 pub desc: Option<Box<Expression>>,
10479 #[serde(default)]
10480 pub options: Vec<Expression>,
10481}
10482
10483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10485#[cfg_attr(feature = "bindings", derive(TS))]
10486pub struct UniqueColumnConstraint {
10487 #[serde(default)]
10488 pub this: Option<Box<Expression>>,
10489 #[serde(default)]
10490 pub index_type: Option<Box<Expression>>,
10491 #[serde(default)]
10492 pub on_conflict: Option<Box<Expression>>,
10493 #[serde(default)]
10494 pub nulls: Option<Box<Expression>>,
10495 #[serde(default)]
10496 pub options: Vec<Expression>,
10497}
10498
10499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10501#[cfg_attr(feature = "bindings", derive(TS))]
10502pub struct WatermarkColumnConstraint {
10503 pub this: Box<Expression>,
10504 pub expression: Box<Expression>,
10505}
10506
10507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10509#[cfg_attr(feature = "bindings", derive(TS))]
10510pub struct ComputedColumnConstraint {
10511 pub this: Box<Expression>,
10512 #[serde(default)]
10513 pub persisted: Option<Box<Expression>>,
10514 #[serde(default)]
10515 pub not_null: Option<Box<Expression>>,
10516 #[serde(default)]
10517 pub data_type: Option<Box<Expression>>,
10518}
10519
10520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10522#[cfg_attr(feature = "bindings", derive(TS))]
10523pub struct InOutColumnConstraint {
10524 #[serde(default)]
10525 pub input_: Option<Box<Expression>>,
10526 #[serde(default)]
10527 pub output: Option<Box<Expression>>,
10528}
10529
10530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10532#[cfg_attr(feature = "bindings", derive(TS))]
10533pub struct PathColumnConstraint {
10534 pub this: Box<Expression>,
10535}
10536
10537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10539#[cfg_attr(feature = "bindings", derive(TS))]
10540pub struct Constraint {
10541 pub this: Box<Expression>,
10542 #[serde(default)]
10543 pub expressions: Vec<Expression>,
10544}
10545
10546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10548#[cfg_attr(feature = "bindings", derive(TS))]
10549pub struct Export {
10550 pub this: Box<Expression>,
10551 #[serde(default)]
10552 pub connection: Option<Box<Expression>>,
10553 #[serde(default)]
10554 pub options: Vec<Expression>,
10555}
10556
10557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10559#[cfg_attr(feature = "bindings", derive(TS))]
10560pub struct Filter {
10561 pub this: Box<Expression>,
10562 pub expression: Box<Expression>,
10563}
10564
10565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10567#[cfg_attr(feature = "bindings", derive(TS))]
10568pub struct Changes {
10569 #[serde(default)]
10570 pub information: Option<Box<Expression>>,
10571 #[serde(default)]
10572 pub at_before: Option<Box<Expression>>,
10573 #[serde(default)]
10574 pub end: Option<Box<Expression>>,
10575}
10576
10577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10579#[cfg_attr(feature = "bindings", derive(TS))]
10580pub struct Directory {
10581 pub this: Box<Expression>,
10582 #[serde(default)]
10583 pub local: Option<Box<Expression>>,
10584 #[serde(default)]
10585 pub row_format: Option<Box<Expression>>,
10586}
10587
10588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10590#[cfg_attr(feature = "bindings", derive(TS))]
10591pub struct ForeignKey {
10592 #[serde(default)]
10593 pub expressions: Vec<Expression>,
10594 #[serde(default)]
10595 pub reference: Option<Box<Expression>>,
10596 #[serde(default)]
10597 pub delete: Option<Box<Expression>>,
10598 #[serde(default)]
10599 pub update: Option<Box<Expression>>,
10600 #[serde(default)]
10601 pub options: Vec<Expression>,
10602}
10603
10604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10606#[cfg_attr(feature = "bindings", derive(TS))]
10607pub struct ColumnPrefix {
10608 pub this: Box<Expression>,
10609 pub expression: Box<Expression>,
10610}
10611
10612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10614#[cfg_attr(feature = "bindings", derive(TS))]
10615pub struct PrimaryKey {
10616 #[serde(default)]
10617 pub this: Option<Box<Expression>>,
10618 #[serde(default)]
10619 pub expressions: Vec<Expression>,
10620 #[serde(default)]
10621 pub options: Vec<Expression>,
10622 #[serde(default)]
10623 pub include: Option<Box<Expression>>,
10624}
10625
10626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10628#[cfg_attr(feature = "bindings", derive(TS))]
10629pub struct IntoClause {
10630 #[serde(default)]
10631 pub this: Option<Box<Expression>>,
10632 #[serde(default)]
10633 pub temporary: bool,
10634 #[serde(default)]
10635 pub unlogged: Option<Box<Expression>>,
10636 #[serde(default)]
10637 pub bulk_collect: Option<Box<Expression>>,
10638 #[serde(default)]
10639 pub expressions: Vec<Expression>,
10640}
10641
10642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10644#[cfg_attr(feature = "bindings", derive(TS))]
10645pub struct JoinHint {
10646 pub this: Box<Expression>,
10647 #[serde(default)]
10648 pub expressions: Vec<Expression>,
10649}
10650
10651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10653#[cfg_attr(feature = "bindings", derive(TS))]
10654pub struct Opclass {
10655 pub this: Box<Expression>,
10656 pub expression: Box<Expression>,
10657}
10658
10659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10661#[cfg_attr(feature = "bindings", derive(TS))]
10662pub struct Index {
10663 #[serde(default)]
10664 pub this: Option<Box<Expression>>,
10665 #[serde(default)]
10666 pub table: Option<Box<Expression>>,
10667 #[serde(default)]
10668 pub unique: bool,
10669 #[serde(default)]
10670 pub primary: Option<Box<Expression>>,
10671 #[serde(default)]
10672 pub amp: Option<Box<Expression>>,
10673 #[serde(default)]
10674 pub params: Vec<Expression>,
10675}
10676
10677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10679#[cfg_attr(feature = "bindings", derive(TS))]
10680pub struct IndexParameters {
10681 #[serde(default)]
10682 pub using: Option<Box<Expression>>,
10683 #[serde(default)]
10684 pub include: Option<Box<Expression>>,
10685 #[serde(default)]
10686 pub columns: Vec<Expression>,
10687 #[serde(default)]
10688 pub with_storage: Option<Box<Expression>>,
10689 #[serde(default)]
10690 pub partition_by: Option<Box<Expression>>,
10691 #[serde(default)]
10692 pub tablespace: Option<Box<Expression>>,
10693 #[serde(default)]
10694 pub where_: Option<Box<Expression>>,
10695 #[serde(default)]
10696 pub on: Option<Box<Expression>>,
10697}
10698
10699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10701#[cfg_attr(feature = "bindings", derive(TS))]
10702pub struct ConditionalInsert {
10703 pub this: Box<Expression>,
10704 #[serde(default)]
10705 pub expression: Option<Box<Expression>>,
10706 #[serde(default)]
10707 pub else_: Option<Box<Expression>>,
10708}
10709
10710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10712#[cfg_attr(feature = "bindings", derive(TS))]
10713pub struct MultitableInserts {
10714 #[serde(default)]
10715 pub expressions: Vec<Expression>,
10716 pub kind: String,
10717 #[serde(default)]
10718 pub source: Option<Box<Expression>>,
10719 #[serde(default)]
10721 pub leading_comments: Vec<String>,
10722 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10724 pub overwrite: bool,
10725}
10726
10727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10729#[cfg_attr(feature = "bindings", derive(TS))]
10730pub struct OnConflict {
10731 #[serde(default)]
10732 pub duplicate: Option<Box<Expression>>,
10733 #[serde(default)]
10734 pub expressions: Vec<Expression>,
10735 #[serde(default)]
10736 pub action: Option<Box<Expression>>,
10737 #[serde(default)]
10738 pub conflict_keys: Option<Box<Expression>>,
10739 #[serde(default)]
10740 pub index_predicate: Option<Box<Expression>>,
10741 #[serde(default)]
10742 pub constraint: Option<Box<Expression>>,
10743 #[serde(default)]
10744 pub where_: Option<Box<Expression>>,
10745}
10746
10747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10749#[cfg_attr(feature = "bindings", derive(TS))]
10750pub struct OnCondition {
10751 #[serde(default)]
10752 pub error: Option<Box<Expression>>,
10753 #[serde(default)]
10754 pub empty: Option<Box<Expression>>,
10755 #[serde(default)]
10756 pub null: Option<Box<Expression>>,
10757}
10758
10759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10761#[cfg_attr(feature = "bindings", derive(TS))]
10762pub struct Returning {
10763 #[serde(default)]
10764 pub expressions: Vec<Expression>,
10765 #[serde(default)]
10766 pub into: Option<Box<Expression>>,
10767}
10768
10769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10771#[cfg_attr(feature = "bindings", derive(TS))]
10772pub struct Introducer {
10773 pub this: Box<Expression>,
10774 pub expression: Box<Expression>,
10775}
10776
10777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10779#[cfg_attr(feature = "bindings", derive(TS))]
10780pub struct PartitionRange {
10781 pub this: Box<Expression>,
10782 #[serde(default)]
10783 pub expression: Option<Box<Expression>>,
10784 #[serde(default)]
10785 pub expressions: Vec<Expression>,
10786}
10787
10788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10790#[cfg_attr(feature = "bindings", derive(TS))]
10791pub struct Group {
10792 #[serde(default)]
10793 pub expressions: Vec<Expression>,
10794 #[serde(default)]
10795 pub grouping_sets: Option<Box<Expression>>,
10796 #[serde(default)]
10797 pub cube: Option<Box<Expression>>,
10798 #[serde(default)]
10799 pub rollup: Option<Box<Expression>>,
10800 #[serde(default)]
10801 pub totals: Option<Box<Expression>>,
10802 #[serde(default)]
10804 pub all: Option<bool>,
10805}
10806
10807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10809#[cfg_attr(feature = "bindings", derive(TS))]
10810pub struct Cube {
10811 #[serde(default)]
10812 pub expressions: Vec<Expression>,
10813}
10814
10815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10817#[cfg_attr(feature = "bindings", derive(TS))]
10818pub struct Rollup {
10819 #[serde(default)]
10820 pub expressions: Vec<Expression>,
10821}
10822
10823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10825#[cfg_attr(feature = "bindings", derive(TS))]
10826pub struct GroupingSets {
10827 #[serde(default)]
10828 pub expressions: Vec<Expression>,
10829}
10830
10831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10833#[cfg_attr(feature = "bindings", derive(TS))]
10834pub struct LimitOptions {
10835 #[serde(default)]
10836 pub percent: Option<Box<Expression>>,
10837 #[serde(default)]
10838 pub rows: Option<Box<Expression>>,
10839 #[serde(default)]
10840 pub with_ties: Option<Box<Expression>>,
10841}
10842
10843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10845#[cfg_attr(feature = "bindings", derive(TS))]
10846pub struct Lateral {
10847 pub this: Box<Expression>,
10848 #[serde(default)]
10849 pub view: Option<Box<Expression>>,
10850 #[serde(default)]
10851 pub outer: Option<Box<Expression>>,
10852 #[serde(default)]
10853 pub alias: Option<String>,
10854 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10856 pub alias_quoted: bool,
10857 #[serde(default)]
10858 pub cross_apply: Option<Box<Expression>>,
10859 #[serde(default)]
10860 pub ordinality: Option<Box<Expression>>,
10861 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10863 pub column_aliases: Vec<String>,
10864}
10865
10866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10868#[cfg_attr(feature = "bindings", derive(TS))]
10869pub struct TableFromRows {
10870 pub this: Box<Expression>,
10871 #[serde(default)]
10872 pub alias: Option<String>,
10873 #[serde(default)]
10874 pub joins: Vec<Expression>,
10875 #[serde(default)]
10876 pub pivots: Option<Box<Expression>>,
10877 #[serde(default)]
10878 pub sample: Option<Box<Expression>>,
10879}
10880
10881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10884#[cfg_attr(feature = "bindings", derive(TS))]
10885pub struct RowsFrom {
10886 pub expressions: Vec<Expression>,
10888 #[serde(default)]
10890 pub ordinality: bool,
10891 #[serde(default)]
10893 pub alias: Option<Box<Expression>>,
10894}
10895
10896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10898#[cfg_attr(feature = "bindings", derive(TS))]
10899pub struct WithFill {
10900 #[serde(default)]
10901 pub from_: Option<Box<Expression>>,
10902 #[serde(default)]
10903 pub to: Option<Box<Expression>>,
10904 #[serde(default)]
10905 pub step: Option<Box<Expression>>,
10906 #[serde(default)]
10907 pub staleness: Option<Box<Expression>>,
10908 #[serde(default)]
10909 pub interpolate: Option<Box<Expression>>,
10910}
10911
10912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10914#[cfg_attr(feature = "bindings", derive(TS))]
10915pub struct Property {
10916 pub this: Box<Expression>,
10917 #[serde(default)]
10918 pub value: Option<Box<Expression>>,
10919}
10920
10921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10923#[cfg_attr(feature = "bindings", derive(TS))]
10924pub struct GrantPrivilege {
10925 pub this: Box<Expression>,
10926 #[serde(default)]
10927 pub expressions: Vec<Expression>,
10928}
10929
10930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10932#[cfg_attr(feature = "bindings", derive(TS))]
10933pub struct AllowedValuesProperty {
10934 #[serde(default)]
10935 pub expressions: Vec<Expression>,
10936}
10937
10938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10940#[cfg_attr(feature = "bindings", derive(TS))]
10941pub struct AlgorithmProperty {
10942 pub this: Box<Expression>,
10943}
10944
10945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10947#[cfg_attr(feature = "bindings", derive(TS))]
10948pub struct AutoIncrementProperty {
10949 pub this: Box<Expression>,
10950}
10951
10952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10954#[cfg_attr(feature = "bindings", derive(TS))]
10955pub struct AutoRefreshProperty {
10956 pub this: Box<Expression>,
10957}
10958
10959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10961#[cfg_attr(feature = "bindings", derive(TS))]
10962pub struct BackupProperty {
10963 pub this: Box<Expression>,
10964}
10965
10966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10968#[cfg_attr(feature = "bindings", derive(TS))]
10969pub struct BuildProperty {
10970 pub this: Box<Expression>,
10971}
10972
10973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10975#[cfg_attr(feature = "bindings", derive(TS))]
10976pub struct BlockCompressionProperty {
10977 #[serde(default)]
10978 pub autotemp: Option<Box<Expression>>,
10979 #[serde(default)]
10980 pub always: Option<Box<Expression>>,
10981 #[serde(default)]
10982 pub default: Option<Box<Expression>>,
10983 #[serde(default)]
10984 pub manual: Option<Box<Expression>>,
10985 #[serde(default)]
10986 pub never: Option<Box<Expression>>,
10987}
10988
10989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10991#[cfg_attr(feature = "bindings", derive(TS))]
10992pub struct CharacterSetProperty {
10993 pub this: Box<Expression>,
10994 #[serde(default)]
10995 pub default: Option<Box<Expression>>,
10996}
10997
10998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11000#[cfg_attr(feature = "bindings", derive(TS))]
11001pub struct ChecksumProperty {
11002 #[serde(default)]
11003 pub on: Option<Box<Expression>>,
11004 #[serde(default)]
11005 pub default: Option<Box<Expression>>,
11006}
11007
11008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11010#[cfg_attr(feature = "bindings", derive(TS))]
11011pub struct CollateProperty {
11012 pub this: Box<Expression>,
11013 #[serde(default)]
11014 pub default: Option<Box<Expression>>,
11015}
11016
11017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11019#[cfg_attr(feature = "bindings", derive(TS))]
11020pub struct DataBlocksizeProperty {
11021 #[serde(default)]
11022 pub size: Option<i64>,
11023 #[serde(default)]
11024 pub units: Option<Box<Expression>>,
11025 #[serde(default)]
11026 pub minimum: Option<Box<Expression>>,
11027 #[serde(default)]
11028 pub maximum: Option<Box<Expression>>,
11029 #[serde(default)]
11030 pub default: Option<Box<Expression>>,
11031}
11032
11033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11035#[cfg_attr(feature = "bindings", derive(TS))]
11036pub struct DataDeletionProperty {
11037 pub on: Box<Expression>,
11038 #[serde(default)]
11039 pub filter_column: Option<Box<Expression>>,
11040 #[serde(default)]
11041 pub retention_period: Option<Box<Expression>>,
11042}
11043
11044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11046#[cfg_attr(feature = "bindings", derive(TS))]
11047pub struct DefinerProperty {
11048 pub this: Box<Expression>,
11049}
11050
11051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11053#[cfg_attr(feature = "bindings", derive(TS))]
11054pub struct DistKeyProperty {
11055 pub this: Box<Expression>,
11056}
11057
11058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11060#[cfg_attr(feature = "bindings", derive(TS))]
11061pub struct DistributedByProperty {
11062 #[serde(default)]
11063 pub expressions: Vec<Expression>,
11064 pub kind: String,
11065 #[serde(default)]
11066 pub buckets: Option<Box<Expression>>,
11067 #[serde(default)]
11068 pub order: Option<Box<Expression>>,
11069}
11070
11071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11073#[cfg_attr(feature = "bindings", derive(TS))]
11074pub struct DistStyleProperty {
11075 pub this: Box<Expression>,
11076}
11077
11078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11080#[cfg_attr(feature = "bindings", derive(TS))]
11081pub struct DuplicateKeyProperty {
11082 #[serde(default)]
11083 pub expressions: Vec<Expression>,
11084}
11085
11086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11088#[cfg_attr(feature = "bindings", derive(TS))]
11089pub struct EngineProperty {
11090 pub this: Box<Expression>,
11091}
11092
11093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11095#[cfg_attr(feature = "bindings", derive(TS))]
11096pub struct ToTableProperty {
11097 pub this: Box<Expression>,
11098}
11099
11100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11102#[cfg_attr(feature = "bindings", derive(TS))]
11103pub struct ExecuteAsProperty {
11104 pub this: Box<Expression>,
11105}
11106
11107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11109#[cfg_attr(feature = "bindings", derive(TS))]
11110pub struct ExternalProperty {
11111 #[serde(default)]
11112 pub this: Option<Box<Expression>>,
11113}
11114
11115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11117#[cfg_attr(feature = "bindings", derive(TS))]
11118pub struct FallbackProperty {
11119 #[serde(default)]
11120 pub no: Option<Box<Expression>>,
11121 #[serde(default)]
11122 pub protection: Option<Box<Expression>>,
11123}
11124
11125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11127#[cfg_attr(feature = "bindings", derive(TS))]
11128pub struct FileFormatProperty {
11129 #[serde(default)]
11130 pub this: Option<Box<Expression>>,
11131 #[serde(default)]
11132 pub expressions: Vec<Expression>,
11133 #[serde(default)]
11134 pub hive_format: Option<Box<Expression>>,
11135}
11136
11137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11139#[cfg_attr(feature = "bindings", derive(TS))]
11140pub struct CredentialsProperty {
11141 #[serde(default)]
11142 pub expressions: Vec<Expression>,
11143}
11144
11145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11147#[cfg_attr(feature = "bindings", derive(TS))]
11148pub struct FreespaceProperty {
11149 pub this: Box<Expression>,
11150 #[serde(default)]
11151 pub percent: Option<Box<Expression>>,
11152}
11153
11154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11156#[cfg_attr(feature = "bindings", derive(TS))]
11157pub struct InheritsProperty {
11158 #[serde(default)]
11159 pub expressions: Vec<Expression>,
11160}
11161
11162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11164#[cfg_attr(feature = "bindings", derive(TS))]
11165pub struct InputModelProperty {
11166 pub this: Box<Expression>,
11167}
11168
11169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11171#[cfg_attr(feature = "bindings", derive(TS))]
11172pub struct OutputModelProperty {
11173 pub this: Box<Expression>,
11174}
11175
11176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11178#[cfg_attr(feature = "bindings", derive(TS))]
11179pub struct IsolatedLoadingProperty {
11180 #[serde(default)]
11181 pub no: Option<Box<Expression>>,
11182 #[serde(default)]
11183 pub concurrent: Option<Box<Expression>>,
11184 #[serde(default)]
11185 pub target: Option<Box<Expression>>,
11186}
11187
11188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11190#[cfg_attr(feature = "bindings", derive(TS))]
11191pub struct JournalProperty {
11192 #[serde(default)]
11193 pub no: Option<Box<Expression>>,
11194 #[serde(default)]
11195 pub dual: Option<Box<Expression>>,
11196 #[serde(default)]
11197 pub before: Option<Box<Expression>>,
11198 #[serde(default)]
11199 pub local: Option<Box<Expression>>,
11200 #[serde(default)]
11201 pub after: Option<Box<Expression>>,
11202}
11203
11204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11206#[cfg_attr(feature = "bindings", derive(TS))]
11207pub struct LanguageProperty {
11208 pub this: Box<Expression>,
11209}
11210
11211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11213#[cfg_attr(feature = "bindings", derive(TS))]
11214pub struct EnviromentProperty {
11215 #[serde(default)]
11216 pub expressions: Vec<Expression>,
11217}
11218
11219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11221#[cfg_attr(feature = "bindings", derive(TS))]
11222pub struct ClusteredByProperty {
11223 #[serde(default)]
11224 pub expressions: Vec<Expression>,
11225 #[serde(default)]
11226 pub sorted_by: Option<Box<Expression>>,
11227 #[serde(default)]
11228 pub buckets: Option<Box<Expression>>,
11229}
11230
11231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11233#[cfg_attr(feature = "bindings", derive(TS))]
11234pub struct DictProperty {
11235 pub this: Box<Expression>,
11236 pub kind: String,
11237 #[serde(default)]
11238 pub settings: Option<Box<Expression>>,
11239}
11240
11241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11243#[cfg_attr(feature = "bindings", derive(TS))]
11244pub struct DictRange {
11245 pub this: Box<Expression>,
11246 #[serde(default)]
11247 pub min: Option<Box<Expression>>,
11248 #[serde(default)]
11249 pub max: Option<Box<Expression>>,
11250}
11251
11252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11254#[cfg_attr(feature = "bindings", derive(TS))]
11255pub struct OnCluster {
11256 pub this: Box<Expression>,
11257}
11258
11259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11261#[cfg_attr(feature = "bindings", derive(TS))]
11262pub struct LikeProperty {
11263 pub this: Box<Expression>,
11264 #[serde(default)]
11265 pub expressions: Vec<Expression>,
11266}
11267
11268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11270#[cfg_attr(feature = "bindings", derive(TS))]
11271pub struct LocationProperty {
11272 pub this: Box<Expression>,
11273}
11274
11275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11277#[cfg_attr(feature = "bindings", derive(TS))]
11278pub struct LockProperty {
11279 pub this: Box<Expression>,
11280}
11281
11282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11284#[cfg_attr(feature = "bindings", derive(TS))]
11285pub struct LockingProperty {
11286 #[serde(default)]
11287 pub this: Option<Box<Expression>>,
11288 pub kind: String,
11289 #[serde(default)]
11290 pub for_or_in: Option<Box<Expression>>,
11291 #[serde(default)]
11292 pub lock_type: Option<Box<Expression>>,
11293 #[serde(default)]
11294 pub override_: Option<Box<Expression>>,
11295}
11296
11297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11299#[cfg_attr(feature = "bindings", derive(TS))]
11300pub struct LogProperty {
11301 #[serde(default)]
11302 pub no: Option<Box<Expression>>,
11303}
11304
11305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11307#[cfg_attr(feature = "bindings", derive(TS))]
11308pub struct MaterializedProperty {
11309 #[serde(default)]
11310 pub this: Option<Box<Expression>>,
11311}
11312
11313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11315#[cfg_attr(feature = "bindings", derive(TS))]
11316pub struct MergeBlockRatioProperty {
11317 #[serde(default)]
11318 pub this: Option<Box<Expression>>,
11319 #[serde(default)]
11320 pub no: Option<Box<Expression>>,
11321 #[serde(default)]
11322 pub default: Option<Box<Expression>>,
11323 #[serde(default)]
11324 pub percent: Option<Box<Expression>>,
11325}
11326
11327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11329#[cfg_attr(feature = "bindings", derive(TS))]
11330pub struct OnProperty {
11331 pub this: Box<Expression>,
11332}
11333
11334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11336#[cfg_attr(feature = "bindings", derive(TS))]
11337pub struct OnCommitProperty {
11338 #[serde(default)]
11339 pub delete: Option<Box<Expression>>,
11340}
11341
11342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11344#[cfg_attr(feature = "bindings", derive(TS))]
11345pub struct PartitionedByProperty {
11346 pub this: Box<Expression>,
11347}
11348
11349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11351#[cfg_attr(feature = "bindings", derive(TS))]
11352pub struct PartitionByProperty {
11353 #[serde(default)]
11354 pub expressions: Vec<Expression>,
11355}
11356
11357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11359#[cfg_attr(feature = "bindings", derive(TS))]
11360pub struct PartitionedByBucket {
11361 pub this: Box<Expression>,
11362 pub expression: Box<Expression>,
11363}
11364
11365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11367#[cfg_attr(feature = "bindings", derive(TS))]
11368pub struct ClusterByColumnsProperty {
11369 #[serde(default)]
11370 pub columns: Vec<Identifier>,
11371}
11372
11373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11375#[cfg_attr(feature = "bindings", derive(TS))]
11376pub struct PartitionByTruncate {
11377 pub this: Box<Expression>,
11378 pub expression: Box<Expression>,
11379}
11380
11381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11383#[cfg_attr(feature = "bindings", derive(TS))]
11384pub struct PartitionByRangeProperty {
11385 #[serde(default)]
11386 pub partition_expressions: Option<Box<Expression>>,
11387 #[serde(default)]
11388 pub create_expressions: Option<Box<Expression>>,
11389}
11390
11391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11393#[cfg_attr(feature = "bindings", derive(TS))]
11394pub struct PartitionByRangePropertyDynamic {
11395 #[serde(default)]
11396 pub this: Option<Box<Expression>>,
11397 #[serde(default)]
11398 pub start: Option<Box<Expression>>,
11399 #[serde(default)]
11401 pub use_start_end: bool,
11402 #[serde(default)]
11403 pub end: Option<Box<Expression>>,
11404 #[serde(default)]
11405 pub every: Option<Box<Expression>>,
11406}
11407
11408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11410#[cfg_attr(feature = "bindings", derive(TS))]
11411pub struct PartitionByListProperty {
11412 #[serde(default)]
11413 pub partition_expressions: Option<Box<Expression>>,
11414 #[serde(default)]
11415 pub create_expressions: Option<Box<Expression>>,
11416}
11417
11418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11420#[cfg_attr(feature = "bindings", derive(TS))]
11421pub struct PartitionList {
11422 pub this: Box<Expression>,
11423 #[serde(default)]
11424 pub expressions: Vec<Expression>,
11425}
11426
11427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11429#[cfg_attr(feature = "bindings", derive(TS))]
11430pub struct Partition {
11431 pub expressions: Vec<Expression>,
11432 #[serde(default)]
11433 pub subpartition: bool,
11434}
11435
11436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11439#[cfg_attr(feature = "bindings", derive(TS))]
11440pub struct RefreshTriggerProperty {
11441 pub method: String,
11443 #[serde(default)]
11445 pub kind: Option<String>,
11446 #[serde(default)]
11448 pub every: Option<Box<Expression>>,
11449 #[serde(default)]
11451 pub unit: Option<String>,
11452 #[serde(default)]
11454 pub starts: Option<Box<Expression>>,
11455}
11456
11457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11459#[cfg_attr(feature = "bindings", derive(TS))]
11460pub struct UniqueKeyProperty {
11461 #[serde(default)]
11462 pub expressions: Vec<Expression>,
11463}
11464
11465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11467#[cfg_attr(feature = "bindings", derive(TS))]
11468pub struct RollupProperty {
11469 pub expressions: Vec<RollupIndex>,
11470}
11471
11472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11474#[cfg_attr(feature = "bindings", derive(TS))]
11475pub struct RollupIndex {
11476 pub name: Identifier,
11477 pub expressions: Vec<Identifier>,
11478}
11479
11480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11482#[cfg_attr(feature = "bindings", derive(TS))]
11483pub struct PartitionBoundSpec {
11484 #[serde(default)]
11485 pub this: Option<Box<Expression>>,
11486 #[serde(default)]
11487 pub expression: Option<Box<Expression>>,
11488 #[serde(default)]
11489 pub from_expressions: Option<Box<Expression>>,
11490 #[serde(default)]
11491 pub to_expressions: Option<Box<Expression>>,
11492}
11493
11494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11496#[cfg_attr(feature = "bindings", derive(TS))]
11497pub struct PartitionedOfProperty {
11498 pub this: Box<Expression>,
11499 pub expression: Box<Expression>,
11500}
11501
11502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11504#[cfg_attr(feature = "bindings", derive(TS))]
11505pub struct RemoteWithConnectionModelProperty {
11506 pub this: Box<Expression>,
11507}
11508
11509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11511#[cfg_attr(feature = "bindings", derive(TS))]
11512pub struct ReturnsProperty {
11513 #[serde(default)]
11514 pub this: Option<Box<Expression>>,
11515 #[serde(default)]
11516 pub is_table: Option<Box<Expression>>,
11517 #[serde(default)]
11518 pub table: Option<Box<Expression>>,
11519 #[serde(default)]
11520 pub null: Option<Box<Expression>>,
11521}
11522
11523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11525#[cfg_attr(feature = "bindings", derive(TS))]
11526pub struct RowFormatProperty {
11527 pub this: Box<Expression>,
11528}
11529
11530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11532#[cfg_attr(feature = "bindings", derive(TS))]
11533pub struct RowFormatDelimitedProperty {
11534 #[serde(default)]
11535 pub fields: Option<Box<Expression>>,
11536 #[serde(default)]
11537 pub escaped: Option<Box<Expression>>,
11538 #[serde(default)]
11539 pub collection_items: Option<Box<Expression>>,
11540 #[serde(default)]
11541 pub map_keys: Option<Box<Expression>>,
11542 #[serde(default)]
11543 pub lines: Option<Box<Expression>>,
11544 #[serde(default)]
11545 pub null: Option<Box<Expression>>,
11546 #[serde(default)]
11547 pub serde: Option<Box<Expression>>,
11548}
11549
11550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11552#[cfg_attr(feature = "bindings", derive(TS))]
11553pub struct RowFormatSerdeProperty {
11554 pub this: Box<Expression>,
11555 #[serde(default)]
11556 pub serde_properties: Option<Box<Expression>>,
11557}
11558
11559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11561#[cfg_attr(feature = "bindings", derive(TS))]
11562pub struct QueryTransform {
11563 #[serde(default)]
11564 pub expressions: Vec<Expression>,
11565 #[serde(default)]
11566 pub command_script: Option<Box<Expression>>,
11567 #[serde(default)]
11568 pub schema: Option<Box<Expression>>,
11569 #[serde(default)]
11570 pub row_format_before: Option<Box<Expression>>,
11571 #[serde(default)]
11572 pub record_writer: Option<Box<Expression>>,
11573 #[serde(default)]
11574 pub row_format_after: Option<Box<Expression>>,
11575 #[serde(default)]
11576 pub record_reader: Option<Box<Expression>>,
11577}
11578
11579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11581#[cfg_attr(feature = "bindings", derive(TS))]
11582pub struct SampleProperty {
11583 pub this: Box<Expression>,
11584}
11585
11586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11588#[cfg_attr(feature = "bindings", derive(TS))]
11589pub struct SecurityProperty {
11590 pub this: Box<Expression>,
11591}
11592
11593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11595#[cfg_attr(feature = "bindings", derive(TS))]
11596pub struct SchemaCommentProperty {
11597 pub this: Box<Expression>,
11598}
11599
11600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11602#[cfg_attr(feature = "bindings", derive(TS))]
11603pub struct SemanticView {
11604 pub this: Box<Expression>,
11605 #[serde(default)]
11606 pub metrics: Option<Box<Expression>>,
11607 #[serde(default)]
11608 pub dimensions: Option<Box<Expression>>,
11609 #[serde(default)]
11610 pub facts: Option<Box<Expression>>,
11611 #[serde(default)]
11612 pub where_: Option<Box<Expression>>,
11613}
11614
11615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11617#[cfg_attr(feature = "bindings", derive(TS))]
11618pub struct SerdeProperties {
11619 #[serde(default)]
11620 pub expressions: Vec<Expression>,
11621 #[serde(default)]
11622 pub with_: Option<Box<Expression>>,
11623}
11624
11625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11627#[cfg_attr(feature = "bindings", derive(TS))]
11628pub struct SetProperty {
11629 #[serde(default)]
11630 pub multi: Option<Box<Expression>>,
11631}
11632
11633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11635#[cfg_attr(feature = "bindings", derive(TS))]
11636pub struct SharingProperty {
11637 #[serde(default)]
11638 pub this: Option<Box<Expression>>,
11639}
11640
11641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11643#[cfg_attr(feature = "bindings", derive(TS))]
11644pub struct SetConfigProperty {
11645 pub this: Box<Expression>,
11646}
11647
11648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11650#[cfg_attr(feature = "bindings", derive(TS))]
11651pub struct SettingsProperty {
11652 #[serde(default)]
11653 pub expressions: Vec<Expression>,
11654}
11655
11656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11658#[cfg_attr(feature = "bindings", derive(TS))]
11659pub struct SortKeyProperty {
11660 pub this: Box<Expression>,
11661 #[serde(default)]
11662 pub compound: Option<Box<Expression>>,
11663}
11664
11665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11667#[cfg_attr(feature = "bindings", derive(TS))]
11668pub struct SqlReadWriteProperty {
11669 pub this: Box<Expression>,
11670}
11671
11672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11674#[cfg_attr(feature = "bindings", derive(TS))]
11675pub struct SqlSecurityProperty {
11676 pub this: Box<Expression>,
11677}
11678
11679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11681#[cfg_attr(feature = "bindings", derive(TS))]
11682pub struct StabilityProperty {
11683 pub this: Box<Expression>,
11684}
11685
11686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11688#[cfg_attr(feature = "bindings", derive(TS))]
11689pub struct StorageHandlerProperty {
11690 pub this: Box<Expression>,
11691}
11692
11693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11695#[cfg_attr(feature = "bindings", derive(TS))]
11696pub struct TemporaryProperty {
11697 #[serde(default)]
11698 pub this: Option<Box<Expression>>,
11699}
11700
11701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11703#[cfg_attr(feature = "bindings", derive(TS))]
11704pub struct Tags {
11705 #[serde(default)]
11706 pub expressions: Vec<Expression>,
11707}
11708
11709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11711#[cfg_attr(feature = "bindings", derive(TS))]
11712pub struct TransformModelProperty {
11713 #[serde(default)]
11714 pub expressions: Vec<Expression>,
11715}
11716
11717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11719#[cfg_attr(feature = "bindings", derive(TS))]
11720pub struct TransientProperty {
11721 #[serde(default)]
11722 pub this: Option<Box<Expression>>,
11723}
11724
11725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11727#[cfg_attr(feature = "bindings", derive(TS))]
11728pub struct UsingTemplateProperty {
11729 pub this: Box<Expression>,
11730}
11731
11732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11734#[cfg_attr(feature = "bindings", derive(TS))]
11735pub struct ViewAttributeProperty {
11736 pub this: Box<Expression>,
11737}
11738
11739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11741#[cfg_attr(feature = "bindings", derive(TS))]
11742pub struct VolatileProperty {
11743 #[serde(default)]
11744 pub this: Option<Box<Expression>>,
11745}
11746
11747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11749#[cfg_attr(feature = "bindings", derive(TS))]
11750pub struct WithDataProperty {
11751 #[serde(default)]
11752 pub no: Option<Box<Expression>>,
11753 #[serde(default)]
11754 pub statistics: Option<Box<Expression>>,
11755}
11756
11757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11759#[cfg_attr(feature = "bindings", derive(TS))]
11760pub struct WithJournalTableProperty {
11761 pub this: Box<Expression>,
11762}
11763
11764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11766#[cfg_attr(feature = "bindings", derive(TS))]
11767pub struct WithSchemaBindingProperty {
11768 pub this: Box<Expression>,
11769}
11770
11771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11773#[cfg_attr(feature = "bindings", derive(TS))]
11774pub struct WithSystemVersioningProperty {
11775 #[serde(default)]
11776 pub on: Option<Box<Expression>>,
11777 #[serde(default)]
11778 pub this: Option<Box<Expression>>,
11779 #[serde(default)]
11780 pub data_consistency: Option<Box<Expression>>,
11781 #[serde(default)]
11782 pub retention_period: Option<Box<Expression>>,
11783 #[serde(default)]
11784 pub with_: Option<Box<Expression>>,
11785}
11786
11787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11789#[cfg_attr(feature = "bindings", derive(TS))]
11790pub struct WithProcedureOptions {
11791 #[serde(default)]
11792 pub expressions: Vec<Expression>,
11793}
11794
11795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11797#[cfg_attr(feature = "bindings", derive(TS))]
11798pub struct EncodeProperty {
11799 pub this: Box<Expression>,
11800 #[serde(default)]
11801 pub properties: Vec<Expression>,
11802 #[serde(default)]
11803 pub key: Option<Box<Expression>>,
11804}
11805
11806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11808#[cfg_attr(feature = "bindings", derive(TS))]
11809pub struct IncludeProperty {
11810 pub this: Box<Expression>,
11811 #[serde(default)]
11812 pub alias: Option<String>,
11813 #[serde(default)]
11814 pub column_def: Option<Box<Expression>>,
11815}
11816
11817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11819#[cfg_attr(feature = "bindings", derive(TS))]
11820pub struct Properties {
11821 #[serde(default)]
11822 pub expressions: Vec<Expression>,
11823}
11824
11825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11827#[cfg_attr(feature = "bindings", derive(TS))]
11828pub struct OptionEntry {
11829 pub key: Identifier,
11830 pub value: Expression,
11831}
11832
11833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11835#[cfg_attr(feature = "bindings", derive(TS))]
11836pub struct OptionsProperty {
11837 #[serde(default)]
11838 pub entries: Vec<OptionEntry>,
11839}
11840
11841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11843#[cfg_attr(feature = "bindings", derive(TS))]
11844pub struct InputOutputFormat {
11845 #[serde(default)]
11846 pub input_format: Option<Box<Expression>>,
11847 #[serde(default)]
11848 pub output_format: Option<Box<Expression>>,
11849}
11850
11851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11853#[cfg_attr(feature = "bindings", derive(TS))]
11854pub struct Reference {
11855 pub this: Box<Expression>,
11856 #[serde(default)]
11857 pub expressions: Vec<Expression>,
11858 #[serde(default)]
11859 pub options: Vec<Expression>,
11860}
11861
11862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11864#[cfg_attr(feature = "bindings", derive(TS))]
11865pub struct QueryOption {
11866 pub this: Box<Expression>,
11867 #[serde(default)]
11868 pub expression: Option<Box<Expression>>,
11869}
11870
11871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11873#[cfg_attr(feature = "bindings", derive(TS))]
11874pub struct WithTableHint {
11875 #[serde(default)]
11876 pub expressions: Vec<Expression>,
11877}
11878
11879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11881#[cfg_attr(feature = "bindings", derive(TS))]
11882pub struct IndexTableHint {
11883 pub this: Box<Expression>,
11884 #[serde(default)]
11885 pub expressions: Vec<Expression>,
11886 #[serde(default)]
11887 pub target: Option<Box<Expression>>,
11888}
11889
11890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11892#[cfg_attr(feature = "bindings", derive(TS))]
11893pub struct Get {
11894 pub this: Box<Expression>,
11895 #[serde(default)]
11896 pub target: Option<Box<Expression>>,
11897 #[serde(default)]
11898 pub properties: Vec<Expression>,
11899}
11900
11901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11903#[cfg_attr(feature = "bindings", derive(TS))]
11904pub struct SetOperation {
11905 #[serde(default)]
11906 pub with_: Option<Box<Expression>>,
11907 pub this: Box<Expression>,
11908 pub expression: Box<Expression>,
11909 #[serde(default)]
11910 pub distinct: bool,
11911 #[serde(default)]
11912 pub by_name: Option<Box<Expression>>,
11913 #[serde(default)]
11914 pub side: Option<Box<Expression>>,
11915 #[serde(default)]
11916 pub kind: Option<String>,
11917 #[serde(default)]
11918 pub on: Option<Box<Expression>>,
11919}
11920
11921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11923#[cfg_attr(feature = "bindings", derive(TS))]
11924pub struct Var {
11925 pub this: String,
11926}
11927
11928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11930#[cfg_attr(feature = "bindings", derive(TS))]
11931pub struct Variadic {
11932 pub this: Box<Expression>,
11933}
11934
11935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11937#[cfg_attr(feature = "bindings", derive(TS))]
11938pub struct Version {
11939 pub this: Box<Expression>,
11940 pub kind: String,
11941 #[serde(default)]
11942 pub expression: Option<Box<Expression>>,
11943}
11944
11945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11947#[cfg_attr(feature = "bindings", derive(TS))]
11948pub struct Schema {
11949 #[serde(default)]
11950 pub this: Option<Box<Expression>>,
11951 #[serde(default)]
11952 pub expressions: Vec<Expression>,
11953}
11954
11955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11957#[cfg_attr(feature = "bindings", derive(TS))]
11958pub struct Lock {
11959 #[serde(default)]
11960 pub update: Option<Box<Expression>>,
11961 #[serde(default)]
11962 pub expressions: Vec<Expression>,
11963 #[serde(default)]
11964 pub wait: Option<Box<Expression>>,
11965 #[serde(default)]
11966 pub key: Option<Box<Expression>>,
11967}
11968
11969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11972#[cfg_attr(feature = "bindings", derive(TS))]
11973pub struct TableSample {
11974 #[serde(default, skip_serializing_if = "Option::is_none")]
11976 pub this: Option<Box<Expression>>,
11977 #[serde(default, skip_serializing_if = "Option::is_none")]
11979 pub sample: Option<Box<Sample>>,
11980 #[serde(default)]
11981 pub expressions: Vec<Expression>,
11982 #[serde(default)]
11983 pub method: Option<String>,
11984 #[serde(default)]
11985 pub bucket_numerator: Option<Box<Expression>>,
11986 #[serde(default)]
11987 pub bucket_denominator: Option<Box<Expression>>,
11988 #[serde(default)]
11989 pub bucket_field: Option<Box<Expression>>,
11990 #[serde(default)]
11991 pub percent: Option<Box<Expression>>,
11992 #[serde(default)]
11993 pub rows: Option<Box<Expression>>,
11994 #[serde(default)]
11995 pub size: Option<i64>,
11996 #[serde(default)]
11997 pub seed: Option<Box<Expression>>,
11998}
11999
12000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12002#[cfg_attr(feature = "bindings", derive(TS))]
12003pub struct Tag {
12004 #[serde(default)]
12005 pub this: Option<Box<Expression>>,
12006 #[serde(default)]
12007 pub prefix: Option<Box<Expression>>,
12008 #[serde(default)]
12009 pub postfix: Option<Box<Expression>>,
12010}
12011
12012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12014#[cfg_attr(feature = "bindings", derive(TS))]
12015pub struct UnpivotColumns {
12016 pub this: Box<Expression>,
12017 #[serde(default)]
12018 pub expressions: Vec<Expression>,
12019}
12020
12021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12023#[cfg_attr(feature = "bindings", derive(TS))]
12024pub struct SessionParameter {
12025 pub this: Box<Expression>,
12026 #[serde(default)]
12027 pub kind: Option<String>,
12028}
12029
12030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12032#[cfg_attr(feature = "bindings", derive(TS))]
12033pub struct PseudoType {
12034 pub this: Box<Expression>,
12035}
12036
12037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12039#[cfg_attr(feature = "bindings", derive(TS))]
12040pub struct ObjectIdentifier {
12041 pub this: Box<Expression>,
12042}
12043
12044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12046#[cfg_attr(feature = "bindings", derive(TS))]
12047pub struct Transaction {
12048 #[serde(default)]
12049 pub this: Option<Box<Expression>>,
12050 #[serde(default)]
12051 pub modes: Option<Box<Expression>>,
12052 #[serde(default)]
12053 pub mark: Option<Box<Expression>>,
12054}
12055
12056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12058#[cfg_attr(feature = "bindings", derive(TS))]
12059pub struct Commit {
12060 #[serde(default)]
12061 pub chain: Option<Box<Expression>>,
12062 #[serde(default)]
12063 pub this: Option<Box<Expression>>,
12064 #[serde(default)]
12065 pub durability: Option<Box<Expression>>,
12066}
12067
12068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12070#[cfg_attr(feature = "bindings", derive(TS))]
12071pub struct Rollback {
12072 #[serde(default)]
12073 pub savepoint: Option<Box<Expression>>,
12074 #[serde(default)]
12075 pub this: Option<Box<Expression>>,
12076}
12077
12078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12080#[cfg_attr(feature = "bindings", derive(TS))]
12081pub struct AlterSession {
12082 #[serde(default)]
12083 pub expressions: Vec<Expression>,
12084 #[serde(default)]
12085 pub unset: Option<Box<Expression>>,
12086}
12087
12088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12090#[cfg_attr(feature = "bindings", derive(TS))]
12091pub struct Analyze {
12092 #[serde(default)]
12093 pub kind: Option<String>,
12094 #[serde(default)]
12095 pub this: Option<Box<Expression>>,
12096 #[serde(default)]
12097 pub options: Vec<Expression>,
12098 #[serde(default)]
12099 pub mode: Option<Box<Expression>>,
12100 #[serde(default)]
12101 pub partition: Option<Box<Expression>>,
12102 #[serde(default)]
12103 pub expression: Option<Box<Expression>>,
12104 #[serde(default)]
12105 pub properties: Vec<Expression>,
12106 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12108 pub columns: Vec<String>,
12109}
12110
12111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12113#[cfg_attr(feature = "bindings", derive(TS))]
12114pub struct AnalyzeStatistics {
12115 pub kind: String,
12116 #[serde(default)]
12117 pub option: Option<Box<Expression>>,
12118 #[serde(default)]
12119 pub this: Option<Box<Expression>>,
12120 #[serde(default)]
12121 pub expressions: Vec<Expression>,
12122}
12123
12124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12126#[cfg_attr(feature = "bindings", derive(TS))]
12127pub struct AnalyzeHistogram {
12128 pub this: Box<Expression>,
12129 #[serde(default)]
12130 pub expressions: Vec<Expression>,
12131 #[serde(default)]
12132 pub expression: Option<Box<Expression>>,
12133 #[serde(default)]
12134 pub update_options: Option<Box<Expression>>,
12135}
12136
12137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12139#[cfg_attr(feature = "bindings", derive(TS))]
12140pub struct AnalyzeSample {
12141 pub kind: String,
12142 #[serde(default)]
12143 pub sample: Option<Box<Expression>>,
12144}
12145
12146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12148#[cfg_attr(feature = "bindings", derive(TS))]
12149pub struct AnalyzeListChainedRows {
12150 #[serde(default)]
12151 pub expression: Option<Box<Expression>>,
12152}
12153
12154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12156#[cfg_attr(feature = "bindings", derive(TS))]
12157pub struct AnalyzeDelete {
12158 #[serde(default)]
12159 pub kind: Option<String>,
12160}
12161
12162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12164#[cfg_attr(feature = "bindings", derive(TS))]
12165pub struct AnalyzeWith {
12166 #[serde(default)]
12167 pub expressions: Vec<Expression>,
12168}
12169
12170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12172#[cfg_attr(feature = "bindings", derive(TS))]
12173pub struct AnalyzeValidate {
12174 pub kind: String,
12175 #[serde(default)]
12176 pub this: Option<Box<Expression>>,
12177 #[serde(default)]
12178 pub expression: Option<Box<Expression>>,
12179}
12180
12181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12183#[cfg_attr(feature = "bindings", derive(TS))]
12184pub struct AddPartition {
12185 pub this: Box<Expression>,
12186 #[serde(default)]
12187 pub exists: bool,
12188 #[serde(default)]
12189 pub location: Option<Box<Expression>>,
12190}
12191
12192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12194#[cfg_attr(feature = "bindings", derive(TS))]
12195pub struct AttachOption {
12196 pub this: Box<Expression>,
12197 #[serde(default)]
12198 pub expression: Option<Box<Expression>>,
12199}
12200
12201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12203#[cfg_attr(feature = "bindings", derive(TS))]
12204pub struct DropPartition {
12205 #[serde(default)]
12206 pub expressions: Vec<Expression>,
12207 #[serde(default)]
12208 pub exists: bool,
12209}
12210
12211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12213#[cfg_attr(feature = "bindings", derive(TS))]
12214pub struct ReplacePartition {
12215 pub expression: Box<Expression>,
12216 #[serde(default)]
12217 pub source: Option<Box<Expression>>,
12218}
12219
12220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12222#[cfg_attr(feature = "bindings", derive(TS))]
12223pub struct DPipe {
12224 pub this: Box<Expression>,
12225 pub expression: Box<Expression>,
12226 #[serde(default)]
12227 pub safe: Option<Box<Expression>>,
12228}
12229
12230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12232#[cfg_attr(feature = "bindings", derive(TS))]
12233pub struct Operator {
12234 pub this: Box<Expression>,
12235 #[serde(default)]
12236 pub operator: Option<Box<Expression>>,
12237 pub expression: Box<Expression>,
12238 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12240 pub comments: Vec<String>,
12241}
12242
12243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12245#[cfg_attr(feature = "bindings", derive(TS))]
12246pub struct PivotAny {
12247 #[serde(default)]
12248 pub this: Option<Box<Expression>>,
12249}
12250
12251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12253#[cfg_attr(feature = "bindings", derive(TS))]
12254pub struct Aliases {
12255 pub this: Box<Expression>,
12256 #[serde(default)]
12257 pub expressions: Vec<Expression>,
12258}
12259
12260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12262#[cfg_attr(feature = "bindings", derive(TS))]
12263pub struct AtIndex {
12264 pub this: Box<Expression>,
12265 pub expression: Box<Expression>,
12266}
12267
12268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12270#[cfg_attr(feature = "bindings", derive(TS))]
12271pub struct FromTimeZone {
12272 pub this: Box<Expression>,
12273 #[serde(default)]
12274 pub zone: Option<Box<Expression>>,
12275}
12276
12277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12279#[cfg_attr(feature = "bindings", derive(TS))]
12280pub struct FormatPhrase {
12281 pub this: Box<Expression>,
12282 pub format: String,
12283}
12284
12285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12287#[cfg_attr(feature = "bindings", derive(TS))]
12288pub struct ForIn {
12289 pub this: Box<Expression>,
12290 pub expression: Box<Expression>,
12291}
12292
12293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12295#[cfg_attr(feature = "bindings", derive(TS))]
12296pub struct TimeUnit {
12297 #[serde(default)]
12298 pub unit: Option<String>,
12299}
12300
12301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12303#[cfg_attr(feature = "bindings", derive(TS))]
12304pub struct IntervalOp {
12305 #[serde(default)]
12306 pub unit: Option<String>,
12307 pub expression: Box<Expression>,
12308}
12309
12310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12312#[cfg_attr(feature = "bindings", derive(TS))]
12313pub struct HavingMax {
12314 pub this: Box<Expression>,
12315 pub expression: Box<Expression>,
12316 #[serde(default)]
12317 pub max: Option<Box<Expression>>,
12318}
12319
12320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12322#[cfg_attr(feature = "bindings", derive(TS))]
12323pub struct CosineDistance {
12324 pub this: Box<Expression>,
12325 pub expression: Box<Expression>,
12326}
12327
12328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12330#[cfg_attr(feature = "bindings", derive(TS))]
12331pub struct DotProduct {
12332 pub this: Box<Expression>,
12333 pub expression: Box<Expression>,
12334}
12335
12336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12338#[cfg_attr(feature = "bindings", derive(TS))]
12339pub struct EuclideanDistance {
12340 pub this: Box<Expression>,
12341 pub expression: Box<Expression>,
12342}
12343
12344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12346#[cfg_attr(feature = "bindings", derive(TS))]
12347pub struct ManhattanDistance {
12348 pub this: Box<Expression>,
12349 pub expression: Box<Expression>,
12350}
12351
12352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12354#[cfg_attr(feature = "bindings", derive(TS))]
12355pub struct JarowinklerSimilarity {
12356 pub this: Box<Expression>,
12357 pub expression: Box<Expression>,
12358}
12359
12360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12362#[cfg_attr(feature = "bindings", derive(TS))]
12363pub struct Booland {
12364 pub this: Box<Expression>,
12365 pub expression: Box<Expression>,
12366}
12367
12368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12370#[cfg_attr(feature = "bindings", derive(TS))]
12371pub struct Boolor {
12372 pub this: Box<Expression>,
12373 pub expression: Box<Expression>,
12374}
12375
12376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12378#[cfg_attr(feature = "bindings", derive(TS))]
12379pub struct ParameterizedAgg {
12380 pub this: Box<Expression>,
12381 #[serde(default)]
12382 pub expressions: Vec<Expression>,
12383 #[serde(default)]
12384 pub params: Vec<Expression>,
12385}
12386
12387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12389#[cfg_attr(feature = "bindings", derive(TS))]
12390pub struct ArgMax {
12391 pub this: Box<Expression>,
12392 pub expression: Box<Expression>,
12393 #[serde(default)]
12394 pub count: Option<Box<Expression>>,
12395}
12396
12397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12399#[cfg_attr(feature = "bindings", derive(TS))]
12400pub struct ArgMin {
12401 pub this: Box<Expression>,
12402 pub expression: Box<Expression>,
12403 #[serde(default)]
12404 pub count: Option<Box<Expression>>,
12405}
12406
12407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12409#[cfg_attr(feature = "bindings", derive(TS))]
12410pub struct ApproxTopK {
12411 pub this: Box<Expression>,
12412 #[serde(default)]
12413 pub expression: Option<Box<Expression>>,
12414 #[serde(default)]
12415 pub counters: Option<Box<Expression>>,
12416}
12417
12418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12420#[cfg_attr(feature = "bindings", derive(TS))]
12421pub struct ApproxTopKAccumulate {
12422 pub this: Box<Expression>,
12423 #[serde(default)]
12424 pub expression: Option<Box<Expression>>,
12425}
12426
12427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12429#[cfg_attr(feature = "bindings", derive(TS))]
12430pub struct ApproxTopKCombine {
12431 pub this: Box<Expression>,
12432 #[serde(default)]
12433 pub expression: Option<Box<Expression>>,
12434}
12435
12436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12438#[cfg_attr(feature = "bindings", derive(TS))]
12439pub struct ApproxTopKEstimate {
12440 pub this: Box<Expression>,
12441 #[serde(default)]
12442 pub expression: Option<Box<Expression>>,
12443}
12444
12445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12447#[cfg_attr(feature = "bindings", derive(TS))]
12448pub struct ApproxTopSum {
12449 pub this: Box<Expression>,
12450 pub expression: Box<Expression>,
12451 #[serde(default)]
12452 pub count: Option<Box<Expression>>,
12453}
12454
12455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12457#[cfg_attr(feature = "bindings", derive(TS))]
12458pub struct ApproxQuantiles {
12459 pub this: Box<Expression>,
12460 #[serde(default)]
12461 pub expression: Option<Box<Expression>>,
12462}
12463
12464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12466#[cfg_attr(feature = "bindings", derive(TS))]
12467pub struct Minhash {
12468 pub this: Box<Expression>,
12469 #[serde(default)]
12470 pub expressions: Vec<Expression>,
12471}
12472
12473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12475#[cfg_attr(feature = "bindings", derive(TS))]
12476pub struct FarmFingerprint {
12477 #[serde(default)]
12478 pub expressions: Vec<Expression>,
12479}
12480
12481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12483#[cfg_attr(feature = "bindings", derive(TS))]
12484pub struct Float64 {
12485 pub this: Box<Expression>,
12486 #[serde(default)]
12487 pub expression: Option<Box<Expression>>,
12488}
12489
12490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12492#[cfg_attr(feature = "bindings", derive(TS))]
12493pub struct Transform {
12494 pub this: Box<Expression>,
12495 pub expression: Box<Expression>,
12496}
12497
12498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12500#[cfg_attr(feature = "bindings", derive(TS))]
12501pub struct Translate {
12502 pub this: Box<Expression>,
12503 #[serde(default)]
12504 pub from_: Option<Box<Expression>>,
12505 #[serde(default)]
12506 pub to: Option<Box<Expression>>,
12507}
12508
12509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12511#[cfg_attr(feature = "bindings", derive(TS))]
12512pub struct Grouping {
12513 #[serde(default)]
12514 pub expressions: Vec<Expression>,
12515}
12516
12517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12519#[cfg_attr(feature = "bindings", derive(TS))]
12520pub struct GroupingId {
12521 #[serde(default)]
12522 pub expressions: Vec<Expression>,
12523}
12524
12525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12527#[cfg_attr(feature = "bindings", derive(TS))]
12528pub struct Anonymous {
12529 pub this: Box<Expression>,
12530 #[serde(default)]
12531 pub expressions: Vec<Expression>,
12532}
12533
12534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12536#[cfg_attr(feature = "bindings", derive(TS))]
12537pub struct AnonymousAggFunc {
12538 pub this: Box<Expression>,
12539 #[serde(default)]
12540 pub expressions: Vec<Expression>,
12541}
12542
12543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12545#[cfg_attr(feature = "bindings", derive(TS))]
12546pub struct CombinedAggFunc {
12547 pub this: Box<Expression>,
12548 #[serde(default)]
12549 pub expressions: Vec<Expression>,
12550}
12551
12552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12554#[cfg_attr(feature = "bindings", derive(TS))]
12555pub struct CombinedParameterizedAgg {
12556 pub this: Box<Expression>,
12557 #[serde(default)]
12558 pub expressions: Vec<Expression>,
12559 #[serde(default)]
12560 pub params: Vec<Expression>,
12561}
12562
12563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12565#[cfg_attr(feature = "bindings", derive(TS))]
12566pub struct HashAgg {
12567 pub this: Box<Expression>,
12568 #[serde(default)]
12569 pub expressions: Vec<Expression>,
12570}
12571
12572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12574#[cfg_attr(feature = "bindings", derive(TS))]
12575pub struct Hll {
12576 pub this: Box<Expression>,
12577 #[serde(default)]
12578 pub expressions: Vec<Expression>,
12579}
12580
12581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12583#[cfg_attr(feature = "bindings", derive(TS))]
12584pub struct Apply {
12585 pub this: Box<Expression>,
12586 pub expression: Box<Expression>,
12587}
12588
12589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12591#[cfg_attr(feature = "bindings", derive(TS))]
12592pub struct ToBoolean {
12593 pub this: Box<Expression>,
12594 #[serde(default)]
12595 pub safe: Option<Box<Expression>>,
12596}
12597
12598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12600#[cfg_attr(feature = "bindings", derive(TS))]
12601pub struct List {
12602 #[serde(default)]
12603 pub expressions: Vec<Expression>,
12604}
12605
12606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12611#[cfg_attr(feature = "bindings", derive(TS))]
12612pub struct ToMap {
12613 pub this: Box<Expression>,
12615}
12616
12617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12619#[cfg_attr(feature = "bindings", derive(TS))]
12620pub struct Pad {
12621 pub this: Box<Expression>,
12622 pub expression: Box<Expression>,
12623 #[serde(default)]
12624 pub fill_pattern: Option<Box<Expression>>,
12625 #[serde(default)]
12626 pub is_left: Option<Box<Expression>>,
12627}
12628
12629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12631#[cfg_attr(feature = "bindings", derive(TS))]
12632pub struct ToChar {
12633 pub this: Box<Expression>,
12634 #[serde(default)]
12635 pub format: Option<String>,
12636 #[serde(default)]
12637 pub nlsparam: Option<Box<Expression>>,
12638 #[serde(default)]
12639 pub is_numeric: Option<Box<Expression>>,
12640}
12641
12642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12644#[cfg_attr(feature = "bindings", derive(TS))]
12645pub struct StringFunc {
12646 pub this: Box<Expression>,
12647 #[serde(default)]
12648 pub zone: Option<Box<Expression>>,
12649}
12650
12651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12653#[cfg_attr(feature = "bindings", derive(TS))]
12654pub struct ToNumber {
12655 pub this: Box<Expression>,
12656 #[serde(default)]
12657 pub format: Option<Box<Expression>>,
12658 #[serde(default)]
12659 pub nlsparam: Option<Box<Expression>>,
12660 #[serde(default)]
12661 pub precision: Option<Box<Expression>>,
12662 #[serde(default)]
12663 pub scale: Option<Box<Expression>>,
12664 #[serde(default)]
12665 pub safe: Option<Box<Expression>>,
12666 #[serde(default)]
12667 pub safe_name: Option<Box<Expression>>,
12668}
12669
12670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12672#[cfg_attr(feature = "bindings", derive(TS))]
12673pub struct ToDouble {
12674 pub this: Box<Expression>,
12675 #[serde(default)]
12676 pub format: Option<String>,
12677 #[serde(default)]
12678 pub safe: Option<Box<Expression>>,
12679}
12680
12681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12683#[cfg_attr(feature = "bindings", derive(TS))]
12684pub struct ToDecfloat {
12685 pub this: Box<Expression>,
12686 #[serde(default)]
12687 pub format: Option<String>,
12688}
12689
12690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12692#[cfg_attr(feature = "bindings", derive(TS))]
12693pub struct TryToDecfloat {
12694 pub this: Box<Expression>,
12695 #[serde(default)]
12696 pub format: Option<String>,
12697}
12698
12699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12701#[cfg_attr(feature = "bindings", derive(TS))]
12702pub struct ToFile {
12703 pub this: Box<Expression>,
12704 #[serde(default)]
12705 pub path: Option<Box<Expression>>,
12706 #[serde(default)]
12707 pub safe: Option<Box<Expression>>,
12708}
12709
12710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12712#[cfg_attr(feature = "bindings", derive(TS))]
12713pub struct Columns {
12714 pub this: Box<Expression>,
12715 #[serde(default)]
12716 pub unpack: Option<Box<Expression>>,
12717}
12718
12719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12721#[cfg_attr(feature = "bindings", derive(TS))]
12722pub struct ConvertToCharset {
12723 pub this: Box<Expression>,
12724 #[serde(default)]
12725 pub dest: Option<Box<Expression>>,
12726 #[serde(default)]
12727 pub source: Option<Box<Expression>>,
12728}
12729
12730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12732#[cfg_attr(feature = "bindings", derive(TS))]
12733pub struct ConvertTimezone {
12734 #[serde(default)]
12735 pub source_tz: Option<Box<Expression>>,
12736 #[serde(default)]
12737 pub target_tz: Option<Box<Expression>>,
12738 #[serde(default)]
12739 pub timestamp: Option<Box<Expression>>,
12740 #[serde(default)]
12741 pub options: Vec<Expression>,
12742}
12743
12744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12746#[cfg_attr(feature = "bindings", derive(TS))]
12747pub struct GenerateSeries {
12748 #[serde(default)]
12749 pub start: Option<Box<Expression>>,
12750 #[serde(default)]
12751 pub end: Option<Box<Expression>>,
12752 #[serde(default)]
12753 pub step: Option<Box<Expression>>,
12754 #[serde(default)]
12755 pub is_end_exclusive: Option<Box<Expression>>,
12756}
12757
12758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12760#[cfg_attr(feature = "bindings", derive(TS))]
12761pub struct AIAgg {
12762 pub this: Box<Expression>,
12763 pub expression: Box<Expression>,
12764}
12765
12766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12768#[cfg_attr(feature = "bindings", derive(TS))]
12769pub struct AIClassify {
12770 pub this: Box<Expression>,
12771 #[serde(default)]
12772 pub categories: Option<Box<Expression>>,
12773 #[serde(default)]
12774 pub config: Option<Box<Expression>>,
12775}
12776
12777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12779#[cfg_attr(feature = "bindings", derive(TS))]
12780pub struct ArrayAll {
12781 pub this: Box<Expression>,
12782 pub expression: Box<Expression>,
12783}
12784
12785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12787#[cfg_attr(feature = "bindings", derive(TS))]
12788pub struct ArrayAny {
12789 pub this: Box<Expression>,
12790 pub expression: Box<Expression>,
12791}
12792
12793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12795#[cfg_attr(feature = "bindings", derive(TS))]
12796pub struct ArrayConstructCompact {
12797 #[serde(default)]
12798 pub expressions: Vec<Expression>,
12799}
12800
12801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12803#[cfg_attr(feature = "bindings", derive(TS))]
12804pub struct StPoint {
12805 pub this: Box<Expression>,
12806 pub expression: Box<Expression>,
12807 #[serde(default)]
12808 pub null: Option<Box<Expression>>,
12809}
12810
12811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12813#[cfg_attr(feature = "bindings", derive(TS))]
12814pub struct StDistance {
12815 pub this: Box<Expression>,
12816 pub expression: Box<Expression>,
12817 #[serde(default)]
12818 pub use_spheroid: Option<Box<Expression>>,
12819}
12820
12821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12823#[cfg_attr(feature = "bindings", derive(TS))]
12824pub struct StringToArray {
12825 pub this: Box<Expression>,
12826 #[serde(default)]
12827 pub expression: Option<Box<Expression>>,
12828 #[serde(default)]
12829 pub null: Option<Box<Expression>>,
12830}
12831
12832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12834#[cfg_attr(feature = "bindings", derive(TS))]
12835pub struct ArraySum {
12836 pub this: Box<Expression>,
12837 #[serde(default)]
12838 pub expression: Option<Box<Expression>>,
12839}
12840
12841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12843#[cfg_attr(feature = "bindings", derive(TS))]
12844pub struct ObjectAgg {
12845 pub this: Box<Expression>,
12846 pub expression: Box<Expression>,
12847}
12848
12849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12851#[cfg_attr(feature = "bindings", derive(TS))]
12852pub struct CastToStrType {
12853 pub this: Box<Expression>,
12854 #[serde(default)]
12855 pub to: Option<Box<Expression>>,
12856}
12857
12858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12860#[cfg_attr(feature = "bindings", derive(TS))]
12861pub struct CheckJson {
12862 pub this: Box<Expression>,
12863}
12864
12865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12867#[cfg_attr(feature = "bindings", derive(TS))]
12868pub struct CheckXml {
12869 pub this: Box<Expression>,
12870 #[serde(default)]
12871 pub disable_auto_convert: Option<Box<Expression>>,
12872}
12873
12874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12876#[cfg_attr(feature = "bindings", derive(TS))]
12877pub struct TranslateCharacters {
12878 pub this: Box<Expression>,
12879 pub expression: Box<Expression>,
12880 #[serde(default)]
12881 pub with_error: Option<Box<Expression>>,
12882}
12883
12884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12886#[cfg_attr(feature = "bindings", derive(TS))]
12887pub struct CurrentSchemas {
12888 #[serde(default)]
12889 pub this: Option<Box<Expression>>,
12890}
12891
12892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12894#[cfg_attr(feature = "bindings", derive(TS))]
12895pub struct CurrentDatetime {
12896 #[serde(default)]
12897 pub this: Option<Box<Expression>>,
12898}
12899
12900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12902#[cfg_attr(feature = "bindings", derive(TS))]
12903pub struct Localtime {
12904 #[serde(default)]
12905 pub this: Option<Box<Expression>>,
12906}
12907
12908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12910#[cfg_attr(feature = "bindings", derive(TS))]
12911pub struct Localtimestamp {
12912 #[serde(default)]
12913 pub this: Option<Box<Expression>>,
12914}
12915
12916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12918#[cfg_attr(feature = "bindings", derive(TS))]
12919pub struct Systimestamp {
12920 #[serde(default)]
12921 pub this: Option<Box<Expression>>,
12922}
12923
12924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12926#[cfg_attr(feature = "bindings", derive(TS))]
12927pub struct CurrentSchema {
12928 #[serde(default)]
12929 pub this: Option<Box<Expression>>,
12930}
12931
12932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12934#[cfg_attr(feature = "bindings", derive(TS))]
12935pub struct CurrentUser {
12936 #[serde(default)]
12937 pub this: Option<Box<Expression>>,
12938}
12939
12940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12942#[cfg_attr(feature = "bindings", derive(TS))]
12943pub struct SessionUser;
12944
12945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12947#[cfg_attr(feature = "bindings", derive(TS))]
12948pub struct JSONPathRoot;
12949
12950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12952#[cfg_attr(feature = "bindings", derive(TS))]
12953pub struct UtcTime {
12954 #[serde(default)]
12955 pub this: Option<Box<Expression>>,
12956}
12957
12958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12960#[cfg_attr(feature = "bindings", derive(TS))]
12961pub struct UtcTimestamp {
12962 #[serde(default)]
12963 pub this: Option<Box<Expression>>,
12964}
12965
12966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12968#[cfg_attr(feature = "bindings", derive(TS))]
12969pub struct TimestampFunc {
12970 #[serde(default)]
12971 pub this: Option<Box<Expression>>,
12972 #[serde(default)]
12973 pub zone: Option<Box<Expression>>,
12974 #[serde(default)]
12975 pub with_tz: Option<bool>,
12976 #[serde(default)]
12977 pub safe: Option<bool>,
12978}
12979
12980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12982#[cfg_attr(feature = "bindings", derive(TS))]
12983pub struct DateBin {
12984 pub this: Box<Expression>,
12985 pub expression: Box<Expression>,
12986 #[serde(default)]
12987 pub unit: Option<String>,
12988 #[serde(default)]
12989 pub zone: Option<Box<Expression>>,
12990 #[serde(default)]
12991 pub origin: Option<Box<Expression>>,
12992}
12993
12994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12996#[cfg_attr(feature = "bindings", derive(TS))]
12997pub struct Datetime {
12998 pub this: Box<Expression>,
12999 #[serde(default)]
13000 pub expression: Option<Box<Expression>>,
13001}
13002
13003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13005#[cfg_attr(feature = "bindings", derive(TS))]
13006pub struct DatetimeAdd {
13007 pub this: Box<Expression>,
13008 pub expression: Box<Expression>,
13009 #[serde(default)]
13010 pub unit: Option<String>,
13011}
13012
13013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13015#[cfg_attr(feature = "bindings", derive(TS))]
13016pub struct DatetimeSub {
13017 pub this: Box<Expression>,
13018 pub expression: Box<Expression>,
13019 #[serde(default)]
13020 pub unit: Option<String>,
13021}
13022
13023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13025#[cfg_attr(feature = "bindings", derive(TS))]
13026pub struct DatetimeDiff {
13027 pub this: Box<Expression>,
13028 pub expression: Box<Expression>,
13029 #[serde(default)]
13030 pub unit: Option<String>,
13031}
13032
13033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13035#[cfg_attr(feature = "bindings", derive(TS))]
13036pub struct DatetimeTrunc {
13037 pub this: Box<Expression>,
13038 pub unit: String,
13039 #[serde(default)]
13040 pub zone: Option<Box<Expression>>,
13041}
13042
13043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13045#[cfg_attr(feature = "bindings", derive(TS))]
13046pub struct Dayname {
13047 pub this: Box<Expression>,
13048 #[serde(default)]
13049 pub abbreviated: Option<Box<Expression>>,
13050}
13051
13052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13054#[cfg_attr(feature = "bindings", derive(TS))]
13055pub struct MakeInterval {
13056 #[serde(default)]
13057 pub year: Option<Box<Expression>>,
13058 #[serde(default)]
13059 pub month: Option<Box<Expression>>,
13060 #[serde(default)]
13061 pub week: Option<Box<Expression>>,
13062 #[serde(default)]
13063 pub day: Option<Box<Expression>>,
13064 #[serde(default)]
13065 pub hour: Option<Box<Expression>>,
13066 #[serde(default)]
13067 pub minute: Option<Box<Expression>>,
13068 #[serde(default)]
13069 pub second: Option<Box<Expression>>,
13070}
13071
13072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13074#[cfg_attr(feature = "bindings", derive(TS))]
13075pub struct PreviousDay {
13076 pub this: Box<Expression>,
13077 pub expression: Box<Expression>,
13078}
13079
13080#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13082#[cfg_attr(feature = "bindings", derive(TS))]
13083pub struct Elt {
13084 pub this: Box<Expression>,
13085 #[serde(default)]
13086 pub expressions: Vec<Expression>,
13087}
13088
13089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13091#[cfg_attr(feature = "bindings", derive(TS))]
13092pub struct TimestampAdd {
13093 pub this: Box<Expression>,
13094 pub expression: Box<Expression>,
13095 #[serde(default)]
13096 pub unit: Option<String>,
13097}
13098
13099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13101#[cfg_attr(feature = "bindings", derive(TS))]
13102pub struct TimestampSub {
13103 pub this: Box<Expression>,
13104 pub expression: Box<Expression>,
13105 #[serde(default)]
13106 pub unit: Option<String>,
13107}
13108
13109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13111#[cfg_attr(feature = "bindings", derive(TS))]
13112pub struct TimestampDiff {
13113 pub this: Box<Expression>,
13114 pub expression: Box<Expression>,
13115 #[serde(default)]
13116 pub unit: Option<String>,
13117}
13118
13119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13121#[cfg_attr(feature = "bindings", derive(TS))]
13122pub struct TimeSlice {
13123 pub this: Box<Expression>,
13124 pub expression: Box<Expression>,
13125 pub unit: String,
13126 #[serde(default)]
13127 pub kind: Option<String>,
13128}
13129
13130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13132#[cfg_attr(feature = "bindings", derive(TS))]
13133pub struct TimeAdd {
13134 pub this: Box<Expression>,
13135 pub expression: Box<Expression>,
13136 #[serde(default)]
13137 pub unit: Option<String>,
13138}
13139
13140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13142#[cfg_attr(feature = "bindings", derive(TS))]
13143pub struct TimeSub {
13144 pub this: Box<Expression>,
13145 pub expression: Box<Expression>,
13146 #[serde(default)]
13147 pub unit: Option<String>,
13148}
13149
13150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13152#[cfg_attr(feature = "bindings", derive(TS))]
13153pub struct TimeDiff {
13154 pub this: Box<Expression>,
13155 pub expression: Box<Expression>,
13156 #[serde(default)]
13157 pub unit: Option<String>,
13158}
13159
13160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13162#[cfg_attr(feature = "bindings", derive(TS))]
13163pub struct TimeTrunc {
13164 pub this: Box<Expression>,
13165 pub unit: String,
13166 #[serde(default)]
13167 pub zone: Option<Box<Expression>>,
13168}
13169
13170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13172#[cfg_attr(feature = "bindings", derive(TS))]
13173pub struct DateFromParts {
13174 #[serde(default)]
13175 pub year: Option<Box<Expression>>,
13176 #[serde(default)]
13177 pub month: Option<Box<Expression>>,
13178 #[serde(default)]
13179 pub day: Option<Box<Expression>>,
13180 #[serde(default)]
13181 pub allow_overflow: Option<Box<Expression>>,
13182}
13183
13184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13186#[cfg_attr(feature = "bindings", derive(TS))]
13187pub struct TimeFromParts {
13188 #[serde(default)]
13189 pub hour: Option<Box<Expression>>,
13190 #[serde(default)]
13191 pub min: Option<Box<Expression>>,
13192 #[serde(default)]
13193 pub sec: Option<Box<Expression>>,
13194 #[serde(default)]
13195 pub nano: Option<Box<Expression>>,
13196 #[serde(default)]
13197 pub fractions: Option<Box<Expression>>,
13198 #[serde(default)]
13199 pub precision: Option<i64>,
13200}
13201
13202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13204#[cfg_attr(feature = "bindings", derive(TS))]
13205pub struct DecodeCase {
13206 #[serde(default)]
13207 pub expressions: Vec<Expression>,
13208}
13209
13210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13212#[cfg_attr(feature = "bindings", derive(TS))]
13213pub struct Decrypt {
13214 pub this: Box<Expression>,
13215 #[serde(default)]
13216 pub passphrase: Option<Box<Expression>>,
13217 #[serde(default)]
13218 pub aad: Option<Box<Expression>>,
13219 #[serde(default)]
13220 pub encryption_method: Option<Box<Expression>>,
13221 #[serde(default)]
13222 pub safe: Option<Box<Expression>>,
13223}
13224
13225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13227#[cfg_attr(feature = "bindings", derive(TS))]
13228pub struct DecryptRaw {
13229 pub this: Box<Expression>,
13230 #[serde(default)]
13231 pub key: Option<Box<Expression>>,
13232 #[serde(default)]
13233 pub iv: Option<Box<Expression>>,
13234 #[serde(default)]
13235 pub aad: Option<Box<Expression>>,
13236 #[serde(default)]
13237 pub encryption_method: Option<Box<Expression>>,
13238 #[serde(default)]
13239 pub aead: Option<Box<Expression>>,
13240 #[serde(default)]
13241 pub safe: Option<Box<Expression>>,
13242}
13243
13244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13246#[cfg_attr(feature = "bindings", derive(TS))]
13247pub struct Encode {
13248 pub this: Box<Expression>,
13249 #[serde(default)]
13250 pub charset: Option<Box<Expression>>,
13251}
13252
13253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13255#[cfg_attr(feature = "bindings", derive(TS))]
13256pub struct Encrypt {
13257 pub this: Box<Expression>,
13258 #[serde(default)]
13259 pub passphrase: Option<Box<Expression>>,
13260 #[serde(default)]
13261 pub aad: Option<Box<Expression>>,
13262 #[serde(default)]
13263 pub encryption_method: Option<Box<Expression>>,
13264}
13265
13266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13268#[cfg_attr(feature = "bindings", derive(TS))]
13269pub struct EncryptRaw {
13270 pub this: Box<Expression>,
13271 #[serde(default)]
13272 pub key: Option<Box<Expression>>,
13273 #[serde(default)]
13274 pub iv: Option<Box<Expression>>,
13275 #[serde(default)]
13276 pub aad: Option<Box<Expression>>,
13277 #[serde(default)]
13278 pub encryption_method: Option<Box<Expression>>,
13279}
13280
13281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13283#[cfg_attr(feature = "bindings", derive(TS))]
13284pub struct EqualNull {
13285 pub this: Box<Expression>,
13286 pub expression: Box<Expression>,
13287}
13288
13289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13291#[cfg_attr(feature = "bindings", derive(TS))]
13292pub struct ToBinary {
13293 pub this: Box<Expression>,
13294 #[serde(default)]
13295 pub format: Option<String>,
13296 #[serde(default)]
13297 pub safe: Option<Box<Expression>>,
13298}
13299
13300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13302#[cfg_attr(feature = "bindings", derive(TS))]
13303pub struct Base64DecodeBinary {
13304 pub this: Box<Expression>,
13305 #[serde(default)]
13306 pub alphabet: Option<Box<Expression>>,
13307}
13308
13309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13311#[cfg_attr(feature = "bindings", derive(TS))]
13312pub struct Base64DecodeString {
13313 pub this: Box<Expression>,
13314 #[serde(default)]
13315 pub alphabet: Option<Box<Expression>>,
13316}
13317
13318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13320#[cfg_attr(feature = "bindings", derive(TS))]
13321pub struct Base64Encode {
13322 pub this: Box<Expression>,
13323 #[serde(default)]
13324 pub max_line_length: Option<Box<Expression>>,
13325 #[serde(default)]
13326 pub alphabet: Option<Box<Expression>>,
13327}
13328
13329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13331#[cfg_attr(feature = "bindings", derive(TS))]
13332pub struct TryBase64DecodeBinary {
13333 pub this: Box<Expression>,
13334 #[serde(default)]
13335 pub alphabet: Option<Box<Expression>>,
13336}
13337
13338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13340#[cfg_attr(feature = "bindings", derive(TS))]
13341pub struct TryBase64DecodeString {
13342 pub this: Box<Expression>,
13343 #[serde(default)]
13344 pub alphabet: Option<Box<Expression>>,
13345}
13346
13347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13349#[cfg_attr(feature = "bindings", derive(TS))]
13350pub struct GapFill {
13351 pub this: Box<Expression>,
13352 #[serde(default)]
13353 pub ts_column: Option<Box<Expression>>,
13354 #[serde(default)]
13355 pub bucket_width: Option<Box<Expression>>,
13356 #[serde(default)]
13357 pub partitioning_columns: Option<Box<Expression>>,
13358 #[serde(default)]
13359 pub value_columns: Option<Box<Expression>>,
13360 #[serde(default)]
13361 pub origin: Option<Box<Expression>>,
13362 #[serde(default)]
13363 pub ignore_nulls: Option<Box<Expression>>,
13364}
13365
13366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13368#[cfg_attr(feature = "bindings", derive(TS))]
13369pub struct GenerateDateArray {
13370 #[serde(default)]
13371 pub start: Option<Box<Expression>>,
13372 #[serde(default)]
13373 pub end: Option<Box<Expression>>,
13374 #[serde(default)]
13375 pub step: Option<Box<Expression>>,
13376}
13377
13378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13380#[cfg_attr(feature = "bindings", derive(TS))]
13381pub struct GenerateTimestampArray {
13382 #[serde(default)]
13383 pub start: Option<Box<Expression>>,
13384 #[serde(default)]
13385 pub end: Option<Box<Expression>>,
13386 #[serde(default)]
13387 pub step: Option<Box<Expression>>,
13388}
13389
13390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13392#[cfg_attr(feature = "bindings", derive(TS))]
13393pub struct GetExtract {
13394 pub this: Box<Expression>,
13395 pub expression: Box<Expression>,
13396}
13397
13398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13400#[cfg_attr(feature = "bindings", derive(TS))]
13401pub struct Getbit {
13402 pub this: Box<Expression>,
13403 pub expression: Box<Expression>,
13404 #[serde(default)]
13405 pub zero_is_msb: Option<Box<Expression>>,
13406}
13407
13408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13410#[cfg_attr(feature = "bindings", derive(TS))]
13411pub struct OverflowTruncateBehavior {
13412 #[serde(default)]
13413 pub this: Option<Box<Expression>>,
13414 #[serde(default)]
13415 pub with_count: Option<Box<Expression>>,
13416}
13417
13418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13420#[cfg_attr(feature = "bindings", derive(TS))]
13421pub struct HexEncode {
13422 pub this: Box<Expression>,
13423 #[serde(default)]
13424 pub case: Option<Box<Expression>>,
13425}
13426
13427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13429#[cfg_attr(feature = "bindings", derive(TS))]
13430pub struct Compress {
13431 pub this: Box<Expression>,
13432 #[serde(default)]
13433 pub method: Option<String>,
13434}
13435
13436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13438#[cfg_attr(feature = "bindings", derive(TS))]
13439pub struct DecompressBinary {
13440 pub this: Box<Expression>,
13441 pub method: String,
13442}
13443
13444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13446#[cfg_attr(feature = "bindings", derive(TS))]
13447pub struct DecompressString {
13448 pub this: Box<Expression>,
13449 pub method: String,
13450}
13451
13452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13454#[cfg_attr(feature = "bindings", derive(TS))]
13455pub struct Xor {
13456 #[serde(default)]
13457 pub this: Option<Box<Expression>>,
13458 #[serde(default)]
13459 pub expression: Option<Box<Expression>>,
13460 #[serde(default)]
13461 pub expressions: Vec<Expression>,
13462}
13463
13464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13466#[cfg_attr(feature = "bindings", derive(TS))]
13467pub struct Nullif {
13468 pub this: Box<Expression>,
13469 pub expression: Box<Expression>,
13470}
13471
13472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13474#[cfg_attr(feature = "bindings", derive(TS))]
13475pub struct JSON {
13476 #[serde(default)]
13477 pub this: Option<Box<Expression>>,
13478 #[serde(default)]
13479 pub with_: Option<Box<Expression>>,
13480 #[serde(default)]
13481 pub unique: bool,
13482}
13483
13484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13486#[cfg_attr(feature = "bindings", derive(TS))]
13487pub struct JSONPath {
13488 #[serde(default)]
13489 pub expressions: Vec<Expression>,
13490 #[serde(default)]
13491 pub escape: Option<Box<Expression>>,
13492}
13493
13494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13496#[cfg_attr(feature = "bindings", derive(TS))]
13497pub struct JSONPathFilter {
13498 pub this: Box<Expression>,
13499}
13500
13501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13503#[cfg_attr(feature = "bindings", derive(TS))]
13504pub struct JSONPathKey {
13505 pub this: Box<Expression>,
13506}
13507
13508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13510#[cfg_attr(feature = "bindings", derive(TS))]
13511pub struct JSONPathRecursive {
13512 #[serde(default)]
13513 pub this: Option<Box<Expression>>,
13514}
13515
13516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13518#[cfg_attr(feature = "bindings", derive(TS))]
13519pub struct JSONPathScript {
13520 pub this: Box<Expression>,
13521}
13522
13523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13525#[cfg_attr(feature = "bindings", derive(TS))]
13526pub struct JSONPathSlice {
13527 #[serde(default)]
13528 pub start: Option<Box<Expression>>,
13529 #[serde(default)]
13530 pub end: Option<Box<Expression>>,
13531 #[serde(default)]
13532 pub step: Option<Box<Expression>>,
13533}
13534
13535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13537#[cfg_attr(feature = "bindings", derive(TS))]
13538pub struct JSONPathSelector {
13539 pub this: Box<Expression>,
13540}
13541
13542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13544#[cfg_attr(feature = "bindings", derive(TS))]
13545pub struct JSONPathSubscript {
13546 pub this: Box<Expression>,
13547}
13548
13549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13551#[cfg_attr(feature = "bindings", derive(TS))]
13552pub struct JSONPathUnion {
13553 #[serde(default)]
13554 pub expressions: Vec<Expression>,
13555}
13556
13557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13559#[cfg_attr(feature = "bindings", derive(TS))]
13560pub struct Format {
13561 pub this: Box<Expression>,
13562 #[serde(default)]
13563 pub expressions: Vec<Expression>,
13564}
13565
13566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13568#[cfg_attr(feature = "bindings", derive(TS))]
13569pub struct JSONKeys {
13570 pub this: Box<Expression>,
13571 #[serde(default)]
13572 pub expression: Option<Box<Expression>>,
13573 #[serde(default)]
13574 pub expressions: Vec<Expression>,
13575}
13576
13577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13579#[cfg_attr(feature = "bindings", derive(TS))]
13580pub struct JSONKeyValue {
13581 pub this: Box<Expression>,
13582 pub expression: Box<Expression>,
13583}
13584
13585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13587#[cfg_attr(feature = "bindings", derive(TS))]
13588pub struct JSONKeysAtDepth {
13589 pub this: Box<Expression>,
13590 #[serde(default)]
13591 pub expression: Option<Box<Expression>>,
13592 #[serde(default)]
13593 pub mode: Option<Box<Expression>>,
13594}
13595
13596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13598#[cfg_attr(feature = "bindings", derive(TS))]
13599pub struct JSONObject {
13600 #[serde(default)]
13601 pub expressions: Vec<Expression>,
13602 #[serde(default)]
13603 pub null_handling: Option<Box<Expression>>,
13604 #[serde(default)]
13605 pub unique_keys: Option<Box<Expression>>,
13606 #[serde(default)]
13607 pub return_type: Option<Box<Expression>>,
13608 #[serde(default)]
13609 pub encoding: Option<Box<Expression>>,
13610}
13611
13612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13614#[cfg_attr(feature = "bindings", derive(TS))]
13615pub struct JSONObjectAgg {
13616 #[serde(default)]
13617 pub expressions: Vec<Expression>,
13618 #[serde(default)]
13619 pub null_handling: Option<Box<Expression>>,
13620 #[serde(default)]
13621 pub unique_keys: Option<Box<Expression>>,
13622 #[serde(default)]
13623 pub return_type: Option<Box<Expression>>,
13624 #[serde(default)]
13625 pub encoding: Option<Box<Expression>>,
13626}
13627
13628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13630#[cfg_attr(feature = "bindings", derive(TS))]
13631pub struct JSONBObjectAgg {
13632 pub this: Box<Expression>,
13633 pub expression: Box<Expression>,
13634}
13635
13636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13638#[cfg_attr(feature = "bindings", derive(TS))]
13639pub struct JSONArray {
13640 #[serde(default)]
13641 pub expressions: Vec<Expression>,
13642 #[serde(default)]
13643 pub null_handling: Option<Box<Expression>>,
13644 #[serde(default)]
13645 pub return_type: Option<Box<Expression>>,
13646 #[serde(default)]
13647 pub strict: Option<Box<Expression>>,
13648}
13649
13650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13652#[cfg_attr(feature = "bindings", derive(TS))]
13653pub struct JSONArrayAgg {
13654 pub this: Box<Expression>,
13655 #[serde(default)]
13656 pub order: Option<Box<Expression>>,
13657 #[serde(default)]
13658 pub null_handling: Option<Box<Expression>>,
13659 #[serde(default)]
13660 pub return_type: Option<Box<Expression>>,
13661 #[serde(default)]
13662 pub strict: Option<Box<Expression>>,
13663}
13664
13665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13667#[cfg_attr(feature = "bindings", derive(TS))]
13668pub struct JSONExists {
13669 pub this: Box<Expression>,
13670 #[serde(default)]
13671 pub path: Option<Box<Expression>>,
13672 #[serde(default)]
13673 pub passing: Option<Box<Expression>>,
13674 #[serde(default)]
13675 pub on_condition: Option<Box<Expression>>,
13676 #[serde(default)]
13677 pub from_dcolonqmark: Option<Box<Expression>>,
13678}
13679
13680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13682#[cfg_attr(feature = "bindings", derive(TS))]
13683pub struct JSONColumnDef {
13684 #[serde(default)]
13685 pub this: Option<Box<Expression>>,
13686 #[serde(default)]
13687 pub kind: Option<String>,
13688 #[serde(default)]
13689 pub format_json: bool,
13690 #[serde(default)]
13691 pub path: Option<Box<Expression>>,
13692 #[serde(default)]
13693 pub nested_schema: Option<Box<Expression>>,
13694 #[serde(default)]
13695 pub ordinality: Option<Box<Expression>>,
13696}
13697
13698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13700#[cfg_attr(feature = "bindings", derive(TS))]
13701pub struct JSONSchema {
13702 #[serde(default)]
13703 pub expressions: Vec<Expression>,
13704}
13705
13706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13708#[cfg_attr(feature = "bindings", derive(TS))]
13709pub struct JSONSet {
13710 pub this: Box<Expression>,
13711 #[serde(default)]
13712 pub expressions: Vec<Expression>,
13713}
13714
13715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13717#[cfg_attr(feature = "bindings", derive(TS))]
13718pub struct JSONStripNulls {
13719 pub this: Box<Expression>,
13720 #[serde(default)]
13721 pub expression: Option<Box<Expression>>,
13722 #[serde(default)]
13723 pub include_arrays: Option<Box<Expression>>,
13724 #[serde(default)]
13725 pub remove_empty: Option<Box<Expression>>,
13726}
13727
13728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13730#[cfg_attr(feature = "bindings", derive(TS))]
13731pub struct JSONValue {
13732 pub this: Box<Expression>,
13733 #[serde(default)]
13734 pub path: Option<Box<Expression>>,
13735 #[serde(default)]
13736 pub returning: Option<Box<Expression>>,
13737 #[serde(default)]
13738 pub on_condition: Option<Box<Expression>>,
13739}
13740
13741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13743#[cfg_attr(feature = "bindings", derive(TS))]
13744pub struct JSONValueArray {
13745 pub this: Box<Expression>,
13746 #[serde(default)]
13747 pub expression: Option<Box<Expression>>,
13748}
13749
13750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13752#[cfg_attr(feature = "bindings", derive(TS))]
13753pub struct JSONRemove {
13754 pub this: Box<Expression>,
13755 #[serde(default)]
13756 pub expressions: Vec<Expression>,
13757}
13758
13759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13761#[cfg_attr(feature = "bindings", derive(TS))]
13762pub struct JSONTable {
13763 pub this: Box<Expression>,
13764 #[serde(default)]
13765 pub schema: Option<Box<Expression>>,
13766 #[serde(default)]
13767 pub path: Option<Box<Expression>>,
13768 #[serde(default)]
13769 pub error_handling: Option<Box<Expression>>,
13770 #[serde(default)]
13771 pub empty_handling: Option<Box<Expression>>,
13772}
13773
13774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13776#[cfg_attr(feature = "bindings", derive(TS))]
13777pub struct JSONType {
13778 pub this: Box<Expression>,
13779 #[serde(default)]
13780 pub expression: Option<Box<Expression>>,
13781}
13782
13783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13785#[cfg_attr(feature = "bindings", derive(TS))]
13786pub struct ObjectInsert {
13787 pub this: Box<Expression>,
13788 #[serde(default)]
13789 pub key: Option<Box<Expression>>,
13790 #[serde(default)]
13791 pub value: Option<Box<Expression>>,
13792 #[serde(default)]
13793 pub update_flag: Option<Box<Expression>>,
13794}
13795
13796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13798#[cfg_attr(feature = "bindings", derive(TS))]
13799pub struct OpenJSONColumnDef {
13800 pub this: Box<Expression>,
13801 pub kind: String,
13802 #[serde(default)]
13803 pub path: Option<Box<Expression>>,
13804 #[serde(default)]
13805 pub as_json: Option<Box<Expression>>,
13806 #[serde(default, skip_serializing_if = "Option::is_none")]
13808 pub data_type: Option<DataType>,
13809}
13810
13811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13813#[cfg_attr(feature = "bindings", derive(TS))]
13814pub struct OpenJSON {
13815 pub this: Box<Expression>,
13816 #[serde(default)]
13817 pub path: Option<Box<Expression>>,
13818 #[serde(default)]
13819 pub expressions: Vec<Expression>,
13820}
13821
13822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13824#[cfg_attr(feature = "bindings", derive(TS))]
13825pub struct JSONBExists {
13826 pub this: Box<Expression>,
13827 #[serde(default)]
13828 pub path: Option<Box<Expression>>,
13829}
13830
13831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13833#[cfg_attr(feature = "bindings", derive(TS))]
13834pub struct JSONCast {
13835 pub this: Box<Expression>,
13836 pub to: DataType,
13837}
13838
13839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13841#[cfg_attr(feature = "bindings", derive(TS))]
13842pub struct JSONExtract {
13843 pub this: Box<Expression>,
13844 pub expression: Box<Expression>,
13845 #[serde(default)]
13846 pub only_json_types: Option<Box<Expression>>,
13847 #[serde(default)]
13848 pub expressions: Vec<Expression>,
13849 #[serde(default)]
13850 pub variant_extract: Option<Box<Expression>>,
13851 #[serde(default)]
13852 pub json_query: Option<Box<Expression>>,
13853 #[serde(default)]
13854 pub option: Option<Box<Expression>>,
13855 #[serde(default)]
13856 pub quote: Option<Box<Expression>>,
13857 #[serde(default)]
13858 pub on_condition: Option<Box<Expression>>,
13859 #[serde(default)]
13860 pub requires_json: Option<Box<Expression>>,
13861}
13862
13863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13865#[cfg_attr(feature = "bindings", derive(TS))]
13866pub struct JSONExtractQuote {
13867 #[serde(default)]
13868 pub option: Option<Box<Expression>>,
13869 #[serde(default)]
13870 pub scalar: Option<Box<Expression>>,
13871}
13872
13873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13875#[cfg_attr(feature = "bindings", derive(TS))]
13876pub struct JSONExtractArray {
13877 pub this: Box<Expression>,
13878 #[serde(default)]
13879 pub expression: Option<Box<Expression>>,
13880}
13881
13882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13884#[cfg_attr(feature = "bindings", derive(TS))]
13885pub struct JSONExtractScalar {
13886 pub this: Box<Expression>,
13887 pub expression: Box<Expression>,
13888 #[serde(default)]
13889 pub only_json_types: Option<Box<Expression>>,
13890 #[serde(default)]
13891 pub expressions: Vec<Expression>,
13892 #[serde(default)]
13893 pub json_type: Option<Box<Expression>>,
13894 #[serde(default)]
13895 pub scalar_only: Option<Box<Expression>>,
13896}
13897
13898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13900#[cfg_attr(feature = "bindings", derive(TS))]
13901pub struct JSONBExtractScalar {
13902 pub this: Box<Expression>,
13903 pub expression: Box<Expression>,
13904 #[serde(default)]
13905 pub json_type: Option<Box<Expression>>,
13906}
13907
13908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13910#[cfg_attr(feature = "bindings", derive(TS))]
13911pub struct JSONFormat {
13912 #[serde(default)]
13913 pub this: Option<Box<Expression>>,
13914 #[serde(default)]
13915 pub options: Vec<Expression>,
13916 #[serde(default)]
13917 pub is_json: Option<Box<Expression>>,
13918 #[serde(default)]
13919 pub to_json: Option<Box<Expression>>,
13920}
13921
13922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13924#[cfg_attr(feature = "bindings", derive(TS))]
13925pub struct JSONArrayAppend {
13926 pub this: Box<Expression>,
13927 #[serde(default)]
13928 pub expressions: Vec<Expression>,
13929}
13930
13931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13933#[cfg_attr(feature = "bindings", derive(TS))]
13934pub struct JSONArrayContains {
13935 pub this: Box<Expression>,
13936 pub expression: Box<Expression>,
13937 #[serde(default)]
13938 pub json_type: Option<Box<Expression>>,
13939}
13940
13941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13943#[cfg_attr(feature = "bindings", derive(TS))]
13944pub struct JSONArrayInsert {
13945 pub this: Box<Expression>,
13946 #[serde(default)]
13947 pub expressions: Vec<Expression>,
13948}
13949
13950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13952#[cfg_attr(feature = "bindings", derive(TS))]
13953pub struct ParseJSON {
13954 pub this: Box<Expression>,
13955 #[serde(default)]
13956 pub expression: Option<Box<Expression>>,
13957 #[serde(default)]
13958 pub safe: Option<Box<Expression>>,
13959}
13960
13961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13963#[cfg_attr(feature = "bindings", derive(TS))]
13964pub struct ParseUrl {
13965 pub this: Box<Expression>,
13966 #[serde(default)]
13967 pub part_to_extract: Option<Box<Expression>>,
13968 #[serde(default)]
13969 pub key: Option<Box<Expression>>,
13970 #[serde(default)]
13971 pub permissive: Option<Box<Expression>>,
13972}
13973
13974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13976#[cfg_attr(feature = "bindings", derive(TS))]
13977pub struct ParseIp {
13978 pub this: Box<Expression>,
13979 #[serde(default)]
13980 pub type_: Option<Box<Expression>>,
13981 #[serde(default)]
13982 pub permissive: Option<Box<Expression>>,
13983}
13984
13985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13987#[cfg_attr(feature = "bindings", derive(TS))]
13988pub struct ParseTime {
13989 pub this: Box<Expression>,
13990 pub format: String,
13991}
13992
13993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13995#[cfg_attr(feature = "bindings", derive(TS))]
13996pub struct ParseDatetime {
13997 pub this: Box<Expression>,
13998 #[serde(default)]
13999 pub format: Option<String>,
14000 #[serde(default)]
14001 pub zone: Option<Box<Expression>>,
14002}
14003
14004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14006#[cfg_attr(feature = "bindings", derive(TS))]
14007pub struct Map {
14008 #[serde(default)]
14009 pub keys: Vec<Expression>,
14010 #[serde(default)]
14011 pub values: Vec<Expression>,
14012}
14013
14014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14016#[cfg_attr(feature = "bindings", derive(TS))]
14017pub struct MapCat {
14018 pub this: Box<Expression>,
14019 pub expression: Box<Expression>,
14020}
14021
14022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14024#[cfg_attr(feature = "bindings", derive(TS))]
14025pub struct MapDelete {
14026 pub this: Box<Expression>,
14027 #[serde(default)]
14028 pub expressions: Vec<Expression>,
14029}
14030
14031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14033#[cfg_attr(feature = "bindings", derive(TS))]
14034pub struct MapInsert {
14035 pub this: Box<Expression>,
14036 #[serde(default)]
14037 pub key: Option<Box<Expression>>,
14038 #[serde(default)]
14039 pub value: Option<Box<Expression>>,
14040 #[serde(default)]
14041 pub update_flag: Option<Box<Expression>>,
14042}
14043
14044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14046#[cfg_attr(feature = "bindings", derive(TS))]
14047pub struct MapPick {
14048 pub this: Box<Expression>,
14049 #[serde(default)]
14050 pub expressions: Vec<Expression>,
14051}
14052
14053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14055#[cfg_attr(feature = "bindings", derive(TS))]
14056pub struct ScopeResolution {
14057 #[serde(default)]
14058 pub this: Option<Box<Expression>>,
14059 pub expression: Box<Expression>,
14060}
14061
14062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14064#[cfg_attr(feature = "bindings", derive(TS))]
14065pub struct Slice {
14066 #[serde(default)]
14067 pub this: Option<Box<Expression>>,
14068 #[serde(default)]
14069 pub expression: Option<Box<Expression>>,
14070 #[serde(default)]
14071 pub step: Option<Box<Expression>>,
14072}
14073
14074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14076#[cfg_attr(feature = "bindings", derive(TS))]
14077pub struct VarMap {
14078 #[serde(default)]
14079 pub keys: Vec<Expression>,
14080 #[serde(default)]
14081 pub values: Vec<Expression>,
14082}
14083
14084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14086#[cfg_attr(feature = "bindings", derive(TS))]
14087pub struct MatchAgainst {
14088 pub this: Box<Expression>,
14089 #[serde(default)]
14090 pub expressions: Vec<Expression>,
14091 #[serde(default)]
14092 pub modifier: Option<Box<Expression>>,
14093}
14094
14095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14097#[cfg_attr(feature = "bindings", derive(TS))]
14098pub struct MD5Digest {
14099 pub this: Box<Expression>,
14100 #[serde(default)]
14101 pub expressions: Vec<Expression>,
14102}
14103
14104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14106#[cfg_attr(feature = "bindings", derive(TS))]
14107pub struct Monthname {
14108 pub this: Box<Expression>,
14109 #[serde(default)]
14110 pub abbreviated: Option<Box<Expression>>,
14111}
14112
14113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14115#[cfg_attr(feature = "bindings", derive(TS))]
14116pub struct Ntile {
14117 #[serde(default)]
14118 pub this: Option<Box<Expression>>,
14119}
14120
14121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14123#[cfg_attr(feature = "bindings", derive(TS))]
14124pub struct Normalize {
14125 pub this: Box<Expression>,
14126 #[serde(default)]
14127 pub form: Option<Box<Expression>>,
14128 #[serde(default)]
14129 pub is_casefold: Option<Box<Expression>>,
14130}
14131
14132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14134#[cfg_attr(feature = "bindings", derive(TS))]
14135pub struct Normal {
14136 pub this: Box<Expression>,
14137 #[serde(default)]
14138 pub stddev: Option<Box<Expression>>,
14139 #[serde(default)]
14140 pub gen: Option<Box<Expression>>,
14141}
14142
14143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14145#[cfg_attr(feature = "bindings", derive(TS))]
14146pub struct Predict {
14147 pub this: Box<Expression>,
14148 pub expression: Box<Expression>,
14149 #[serde(default)]
14150 pub params_struct: Option<Box<Expression>>,
14151}
14152
14153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14155#[cfg_attr(feature = "bindings", derive(TS))]
14156pub struct MLTranslate {
14157 pub this: Box<Expression>,
14158 pub expression: Box<Expression>,
14159 #[serde(default)]
14160 pub params_struct: Option<Box<Expression>>,
14161}
14162
14163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14165#[cfg_attr(feature = "bindings", derive(TS))]
14166pub struct FeaturesAtTime {
14167 pub this: Box<Expression>,
14168 #[serde(default)]
14169 pub time: Option<Box<Expression>>,
14170 #[serde(default)]
14171 pub num_rows: Option<Box<Expression>>,
14172 #[serde(default)]
14173 pub ignore_feature_nulls: Option<Box<Expression>>,
14174}
14175
14176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14178#[cfg_attr(feature = "bindings", derive(TS))]
14179pub struct GenerateEmbedding {
14180 pub this: Box<Expression>,
14181 pub expression: Box<Expression>,
14182 #[serde(default)]
14183 pub params_struct: Option<Box<Expression>>,
14184 #[serde(default)]
14185 pub is_text: Option<Box<Expression>>,
14186}
14187
14188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14190#[cfg_attr(feature = "bindings", derive(TS))]
14191pub struct MLForecast {
14192 pub this: Box<Expression>,
14193 #[serde(default)]
14194 pub expression: Option<Box<Expression>>,
14195 #[serde(default)]
14196 pub params_struct: Option<Box<Expression>>,
14197}
14198
14199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14201#[cfg_attr(feature = "bindings", derive(TS))]
14202pub struct ModelAttribute {
14203 pub this: Box<Expression>,
14204 pub expression: Box<Expression>,
14205}
14206
14207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14209#[cfg_attr(feature = "bindings", derive(TS))]
14210pub struct VectorSearch {
14211 pub this: Box<Expression>,
14212 #[serde(default)]
14213 pub column_to_search: Option<Box<Expression>>,
14214 #[serde(default)]
14215 pub query_table: Option<Box<Expression>>,
14216 #[serde(default)]
14217 pub query_column_to_search: Option<Box<Expression>>,
14218 #[serde(default)]
14219 pub top_k: Option<Box<Expression>>,
14220 #[serde(default)]
14221 pub distance_type: Option<Box<Expression>>,
14222 #[serde(default)]
14223 pub options: Vec<Expression>,
14224}
14225
14226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14228#[cfg_attr(feature = "bindings", derive(TS))]
14229pub struct Quantile {
14230 pub this: Box<Expression>,
14231 #[serde(default)]
14232 pub quantile: Option<Box<Expression>>,
14233}
14234
14235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14237#[cfg_attr(feature = "bindings", derive(TS))]
14238pub struct ApproxQuantile {
14239 pub this: Box<Expression>,
14240 #[serde(default)]
14241 pub quantile: Option<Box<Expression>>,
14242 #[serde(default)]
14243 pub accuracy: Option<Box<Expression>>,
14244 #[serde(default)]
14245 pub weight: Option<Box<Expression>>,
14246 #[serde(default)]
14247 pub error_tolerance: Option<Box<Expression>>,
14248}
14249
14250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14252#[cfg_attr(feature = "bindings", derive(TS))]
14253pub struct ApproxPercentileEstimate {
14254 pub this: Box<Expression>,
14255 #[serde(default)]
14256 pub percentile: Option<Box<Expression>>,
14257}
14258
14259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14261#[cfg_attr(feature = "bindings", derive(TS))]
14262pub struct Randn {
14263 #[serde(default)]
14264 pub this: Option<Box<Expression>>,
14265}
14266
14267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14269#[cfg_attr(feature = "bindings", derive(TS))]
14270pub struct Randstr {
14271 pub this: Box<Expression>,
14272 #[serde(default)]
14273 pub generator: Option<Box<Expression>>,
14274}
14275
14276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14278#[cfg_attr(feature = "bindings", derive(TS))]
14279pub struct RangeN {
14280 pub this: Box<Expression>,
14281 #[serde(default)]
14282 pub expressions: Vec<Expression>,
14283 #[serde(default)]
14284 pub each: Option<Box<Expression>>,
14285}
14286
14287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14289#[cfg_attr(feature = "bindings", derive(TS))]
14290pub struct RangeBucket {
14291 pub this: Box<Expression>,
14292 pub expression: Box<Expression>,
14293}
14294
14295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14297#[cfg_attr(feature = "bindings", derive(TS))]
14298pub struct ReadCSV {
14299 pub this: Box<Expression>,
14300 #[serde(default)]
14301 pub expressions: Vec<Expression>,
14302}
14303
14304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14306#[cfg_attr(feature = "bindings", derive(TS))]
14307pub struct ReadParquet {
14308 #[serde(default)]
14309 pub expressions: Vec<Expression>,
14310}
14311
14312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14314#[cfg_attr(feature = "bindings", derive(TS))]
14315pub struct Reduce {
14316 pub this: Box<Expression>,
14317 #[serde(default)]
14318 pub initial: Option<Box<Expression>>,
14319 #[serde(default)]
14320 pub merge: Option<Box<Expression>>,
14321 #[serde(default)]
14322 pub finish: Option<Box<Expression>>,
14323}
14324
14325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14327#[cfg_attr(feature = "bindings", derive(TS))]
14328pub struct RegexpExtractAll {
14329 pub this: Box<Expression>,
14330 pub expression: Box<Expression>,
14331 #[serde(default)]
14332 pub group: Option<Box<Expression>>,
14333 #[serde(default)]
14334 pub parameters: Option<Box<Expression>>,
14335 #[serde(default)]
14336 pub position: Option<Box<Expression>>,
14337 #[serde(default)]
14338 pub occurrence: Option<Box<Expression>>,
14339}
14340
14341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14343#[cfg_attr(feature = "bindings", derive(TS))]
14344pub struct RegexpILike {
14345 pub this: Box<Expression>,
14346 pub expression: Box<Expression>,
14347 #[serde(default)]
14348 pub flag: Option<Box<Expression>>,
14349}
14350
14351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14353#[cfg_attr(feature = "bindings", derive(TS))]
14354pub struct RegexpFullMatch {
14355 pub this: Box<Expression>,
14356 pub expression: Box<Expression>,
14357 #[serde(default)]
14358 pub options: Vec<Expression>,
14359}
14360
14361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14363#[cfg_attr(feature = "bindings", derive(TS))]
14364pub struct RegexpInstr {
14365 pub this: Box<Expression>,
14366 pub expression: Box<Expression>,
14367 #[serde(default)]
14368 pub position: Option<Box<Expression>>,
14369 #[serde(default)]
14370 pub occurrence: Option<Box<Expression>>,
14371 #[serde(default)]
14372 pub option: Option<Box<Expression>>,
14373 #[serde(default)]
14374 pub parameters: Option<Box<Expression>>,
14375 #[serde(default)]
14376 pub group: Option<Box<Expression>>,
14377}
14378
14379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14381#[cfg_attr(feature = "bindings", derive(TS))]
14382pub struct RegexpSplit {
14383 pub this: Box<Expression>,
14384 pub expression: Box<Expression>,
14385 #[serde(default)]
14386 pub limit: Option<Box<Expression>>,
14387}
14388
14389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14391#[cfg_attr(feature = "bindings", derive(TS))]
14392pub struct RegexpCount {
14393 pub this: Box<Expression>,
14394 pub expression: Box<Expression>,
14395 #[serde(default)]
14396 pub position: Option<Box<Expression>>,
14397 #[serde(default)]
14398 pub parameters: Option<Box<Expression>>,
14399}
14400
14401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14403#[cfg_attr(feature = "bindings", derive(TS))]
14404pub struct RegrValx {
14405 pub this: Box<Expression>,
14406 pub expression: Box<Expression>,
14407}
14408
14409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14411#[cfg_attr(feature = "bindings", derive(TS))]
14412pub struct RegrValy {
14413 pub this: Box<Expression>,
14414 pub expression: Box<Expression>,
14415}
14416
14417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14419#[cfg_attr(feature = "bindings", derive(TS))]
14420pub struct RegrAvgy {
14421 pub this: Box<Expression>,
14422 pub expression: Box<Expression>,
14423}
14424
14425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14427#[cfg_attr(feature = "bindings", derive(TS))]
14428pub struct RegrAvgx {
14429 pub this: Box<Expression>,
14430 pub expression: Box<Expression>,
14431}
14432
14433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14435#[cfg_attr(feature = "bindings", derive(TS))]
14436pub struct RegrCount {
14437 pub this: Box<Expression>,
14438 pub expression: Box<Expression>,
14439}
14440
14441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14443#[cfg_attr(feature = "bindings", derive(TS))]
14444pub struct RegrIntercept {
14445 pub this: Box<Expression>,
14446 pub expression: Box<Expression>,
14447}
14448
14449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14451#[cfg_attr(feature = "bindings", derive(TS))]
14452pub struct RegrR2 {
14453 pub this: Box<Expression>,
14454 pub expression: Box<Expression>,
14455}
14456
14457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14459#[cfg_attr(feature = "bindings", derive(TS))]
14460pub struct RegrSxx {
14461 pub this: Box<Expression>,
14462 pub expression: Box<Expression>,
14463}
14464
14465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14467#[cfg_attr(feature = "bindings", derive(TS))]
14468pub struct RegrSxy {
14469 pub this: Box<Expression>,
14470 pub expression: Box<Expression>,
14471}
14472
14473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14475#[cfg_attr(feature = "bindings", derive(TS))]
14476pub struct RegrSyy {
14477 pub this: Box<Expression>,
14478 pub expression: Box<Expression>,
14479}
14480
14481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14483#[cfg_attr(feature = "bindings", derive(TS))]
14484pub struct RegrSlope {
14485 pub this: Box<Expression>,
14486 pub expression: Box<Expression>,
14487}
14488
14489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14491#[cfg_attr(feature = "bindings", derive(TS))]
14492pub struct SafeAdd {
14493 pub this: Box<Expression>,
14494 pub expression: Box<Expression>,
14495}
14496
14497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14499#[cfg_attr(feature = "bindings", derive(TS))]
14500pub struct SafeDivide {
14501 pub this: Box<Expression>,
14502 pub expression: Box<Expression>,
14503}
14504
14505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14507#[cfg_attr(feature = "bindings", derive(TS))]
14508pub struct SafeMultiply {
14509 pub this: Box<Expression>,
14510 pub expression: Box<Expression>,
14511}
14512
14513#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14515#[cfg_attr(feature = "bindings", derive(TS))]
14516pub struct SafeSubtract {
14517 pub this: Box<Expression>,
14518 pub expression: Box<Expression>,
14519}
14520
14521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14523#[cfg_attr(feature = "bindings", derive(TS))]
14524pub struct SHA2 {
14525 pub this: Box<Expression>,
14526 #[serde(default)]
14527 pub length: Option<i64>,
14528}
14529
14530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14532#[cfg_attr(feature = "bindings", derive(TS))]
14533pub struct SHA2Digest {
14534 pub this: Box<Expression>,
14535 #[serde(default)]
14536 pub length: Option<i64>,
14537}
14538
14539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14541#[cfg_attr(feature = "bindings", derive(TS))]
14542pub struct SortArray {
14543 pub this: Box<Expression>,
14544 #[serde(default)]
14545 pub asc: Option<Box<Expression>>,
14546 #[serde(default)]
14547 pub nulls_first: Option<Box<Expression>>,
14548}
14549
14550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14552#[cfg_attr(feature = "bindings", derive(TS))]
14553pub struct SplitPart {
14554 pub this: Box<Expression>,
14555 #[serde(default)]
14556 pub delimiter: Option<Box<Expression>>,
14557 #[serde(default)]
14558 pub part_index: Option<Box<Expression>>,
14559}
14560
14561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14563#[cfg_attr(feature = "bindings", derive(TS))]
14564pub struct SubstringIndex {
14565 pub this: Box<Expression>,
14566 #[serde(default)]
14567 pub delimiter: Option<Box<Expression>>,
14568 #[serde(default)]
14569 pub count: Option<Box<Expression>>,
14570}
14571
14572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14574#[cfg_attr(feature = "bindings", derive(TS))]
14575pub struct StandardHash {
14576 pub this: Box<Expression>,
14577 #[serde(default)]
14578 pub expression: Option<Box<Expression>>,
14579}
14580
14581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14583#[cfg_attr(feature = "bindings", derive(TS))]
14584pub struct StrPosition {
14585 pub this: Box<Expression>,
14586 #[serde(default)]
14587 pub substr: Option<Box<Expression>>,
14588 #[serde(default)]
14589 pub position: Option<Box<Expression>>,
14590 #[serde(default)]
14591 pub occurrence: Option<Box<Expression>>,
14592}
14593
14594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14596#[cfg_attr(feature = "bindings", derive(TS))]
14597pub struct Search {
14598 pub this: Box<Expression>,
14599 pub expression: Box<Expression>,
14600 #[serde(default)]
14601 pub json_scope: Option<Box<Expression>>,
14602 #[serde(default)]
14603 pub analyzer: Option<Box<Expression>>,
14604 #[serde(default)]
14605 pub analyzer_options: Option<Box<Expression>>,
14606 #[serde(default)]
14607 pub search_mode: Option<Box<Expression>>,
14608}
14609
14610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14612#[cfg_attr(feature = "bindings", derive(TS))]
14613pub struct SearchIp {
14614 pub this: Box<Expression>,
14615 pub expression: Box<Expression>,
14616}
14617
14618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14620#[cfg_attr(feature = "bindings", derive(TS))]
14621pub struct StrToDate {
14622 pub this: Box<Expression>,
14623 #[serde(default)]
14624 pub format: Option<String>,
14625 #[serde(default)]
14626 pub safe: Option<Box<Expression>>,
14627}
14628
14629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14631#[cfg_attr(feature = "bindings", derive(TS))]
14632pub struct StrToTime {
14633 pub this: Box<Expression>,
14634 pub format: String,
14635 #[serde(default)]
14636 pub zone: Option<Box<Expression>>,
14637 #[serde(default)]
14638 pub safe: Option<Box<Expression>>,
14639 #[serde(default)]
14640 pub target_type: Option<Box<Expression>>,
14641}
14642
14643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14645#[cfg_attr(feature = "bindings", derive(TS))]
14646pub struct StrToUnix {
14647 #[serde(default)]
14648 pub this: Option<Box<Expression>>,
14649 #[serde(default)]
14650 pub format: Option<String>,
14651}
14652
14653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14655#[cfg_attr(feature = "bindings", derive(TS))]
14656pub struct StrToMap {
14657 pub this: Box<Expression>,
14658 #[serde(default)]
14659 pub pair_delim: Option<Box<Expression>>,
14660 #[serde(default)]
14661 pub key_value_delim: Option<Box<Expression>>,
14662 #[serde(default)]
14663 pub duplicate_resolution_callback: Option<Box<Expression>>,
14664}
14665
14666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14668#[cfg_attr(feature = "bindings", derive(TS))]
14669pub struct NumberToStr {
14670 pub this: Box<Expression>,
14671 pub format: String,
14672 #[serde(default)]
14673 pub culture: Option<Box<Expression>>,
14674}
14675
14676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14678#[cfg_attr(feature = "bindings", derive(TS))]
14679pub struct FromBase {
14680 pub this: Box<Expression>,
14681 pub expression: Box<Expression>,
14682}
14683
14684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14686#[cfg_attr(feature = "bindings", derive(TS))]
14687pub struct Stuff {
14688 pub this: Box<Expression>,
14689 #[serde(default)]
14690 pub start: Option<Box<Expression>>,
14691 #[serde(default)]
14692 pub length: Option<i64>,
14693 pub expression: Box<Expression>,
14694}
14695
14696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14698#[cfg_attr(feature = "bindings", derive(TS))]
14699pub struct TimeToStr {
14700 pub this: Box<Expression>,
14701 pub format: String,
14702 #[serde(default)]
14703 pub culture: Option<Box<Expression>>,
14704 #[serde(default)]
14705 pub zone: Option<Box<Expression>>,
14706}
14707
14708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14710#[cfg_attr(feature = "bindings", derive(TS))]
14711pub struct TimeStrToTime {
14712 pub this: Box<Expression>,
14713 #[serde(default)]
14714 pub zone: Option<Box<Expression>>,
14715}
14716
14717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14719#[cfg_attr(feature = "bindings", derive(TS))]
14720pub struct TsOrDsAdd {
14721 pub this: Box<Expression>,
14722 pub expression: Box<Expression>,
14723 #[serde(default)]
14724 pub unit: Option<String>,
14725 #[serde(default)]
14726 pub return_type: Option<Box<Expression>>,
14727}
14728
14729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14731#[cfg_attr(feature = "bindings", derive(TS))]
14732pub struct TsOrDsDiff {
14733 pub this: Box<Expression>,
14734 pub expression: Box<Expression>,
14735 #[serde(default)]
14736 pub unit: Option<String>,
14737}
14738
14739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14741#[cfg_attr(feature = "bindings", derive(TS))]
14742pub struct TsOrDsToDate {
14743 pub this: Box<Expression>,
14744 #[serde(default)]
14745 pub format: Option<String>,
14746 #[serde(default)]
14747 pub safe: Option<Box<Expression>>,
14748}
14749
14750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14752#[cfg_attr(feature = "bindings", derive(TS))]
14753pub struct TsOrDsToTime {
14754 pub this: Box<Expression>,
14755 #[serde(default)]
14756 pub format: Option<String>,
14757 #[serde(default)]
14758 pub safe: Option<Box<Expression>>,
14759}
14760
14761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14763#[cfg_attr(feature = "bindings", derive(TS))]
14764pub struct Unhex {
14765 pub this: Box<Expression>,
14766 #[serde(default)]
14767 pub expression: Option<Box<Expression>>,
14768}
14769
14770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14772#[cfg_attr(feature = "bindings", derive(TS))]
14773pub struct Uniform {
14774 pub this: Box<Expression>,
14775 pub expression: Box<Expression>,
14776 #[serde(default)]
14777 pub gen: Option<Box<Expression>>,
14778 #[serde(default)]
14779 pub seed: Option<Box<Expression>>,
14780}
14781
14782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14784#[cfg_attr(feature = "bindings", derive(TS))]
14785pub struct UnixToStr {
14786 pub this: Box<Expression>,
14787 #[serde(default)]
14788 pub format: Option<String>,
14789}
14790
14791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14793#[cfg_attr(feature = "bindings", derive(TS))]
14794pub struct UnixToTime {
14795 pub this: Box<Expression>,
14796 #[serde(default)]
14797 pub scale: Option<i64>,
14798 #[serde(default)]
14799 pub zone: Option<Box<Expression>>,
14800 #[serde(default)]
14801 pub hours: Option<Box<Expression>>,
14802 #[serde(default)]
14803 pub minutes: Option<Box<Expression>>,
14804 #[serde(default)]
14805 pub format: Option<String>,
14806 #[serde(default)]
14807 pub target_type: Option<Box<Expression>>,
14808}
14809
14810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14812#[cfg_attr(feature = "bindings", derive(TS))]
14813pub struct Uuid {
14814 #[serde(default)]
14815 pub this: Option<Box<Expression>>,
14816 #[serde(default)]
14817 pub name: Option<String>,
14818 #[serde(default)]
14819 pub is_string: Option<Box<Expression>>,
14820}
14821
14822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14824#[cfg_attr(feature = "bindings", derive(TS))]
14825pub struct TimestampFromParts {
14826 #[serde(default)]
14827 pub zone: Option<Box<Expression>>,
14828 #[serde(default)]
14829 pub milli: Option<Box<Expression>>,
14830 #[serde(default)]
14831 pub this: Option<Box<Expression>>,
14832 #[serde(default)]
14833 pub expression: Option<Box<Expression>>,
14834}
14835
14836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14838#[cfg_attr(feature = "bindings", derive(TS))]
14839pub struct TimestampTzFromParts {
14840 #[serde(default)]
14841 pub zone: Option<Box<Expression>>,
14842}
14843
14844#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14846#[cfg_attr(feature = "bindings", derive(TS))]
14847pub struct Corr {
14848 pub this: Box<Expression>,
14849 pub expression: Box<Expression>,
14850 #[serde(default)]
14851 pub null_on_zero_variance: Option<Box<Expression>>,
14852}
14853
14854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14856#[cfg_attr(feature = "bindings", derive(TS))]
14857pub struct WidthBucket {
14858 pub this: Box<Expression>,
14859 #[serde(default)]
14860 pub min_value: Option<Box<Expression>>,
14861 #[serde(default)]
14862 pub max_value: Option<Box<Expression>>,
14863 #[serde(default)]
14864 pub num_buckets: Option<Box<Expression>>,
14865 #[serde(default)]
14866 pub threshold: Option<Box<Expression>>,
14867}
14868
14869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14871#[cfg_attr(feature = "bindings", derive(TS))]
14872pub struct CovarSamp {
14873 pub this: Box<Expression>,
14874 pub expression: Box<Expression>,
14875}
14876
14877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14879#[cfg_attr(feature = "bindings", derive(TS))]
14880pub struct CovarPop {
14881 pub this: Box<Expression>,
14882 pub expression: Box<Expression>,
14883}
14884
14885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14887#[cfg_attr(feature = "bindings", derive(TS))]
14888pub struct Week {
14889 pub this: Box<Expression>,
14890 #[serde(default)]
14891 pub mode: Option<Box<Expression>>,
14892}
14893
14894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14896#[cfg_attr(feature = "bindings", derive(TS))]
14897pub struct XMLElement {
14898 pub this: Box<Expression>,
14899 #[serde(default)]
14900 pub expressions: Vec<Expression>,
14901 #[serde(default)]
14902 pub evalname: Option<Box<Expression>>,
14903}
14904
14905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14907#[cfg_attr(feature = "bindings", derive(TS))]
14908pub struct XMLGet {
14909 pub this: Box<Expression>,
14910 pub expression: Box<Expression>,
14911 #[serde(default)]
14912 pub instance: Option<Box<Expression>>,
14913}
14914
14915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14917#[cfg_attr(feature = "bindings", derive(TS))]
14918pub struct XMLTable {
14919 pub this: Box<Expression>,
14920 #[serde(default)]
14921 pub namespaces: Option<Box<Expression>>,
14922 #[serde(default)]
14923 pub passing: Option<Box<Expression>>,
14924 #[serde(default)]
14925 pub columns: Vec<Expression>,
14926 #[serde(default)]
14927 pub by_ref: Option<Box<Expression>>,
14928}
14929
14930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14932#[cfg_attr(feature = "bindings", derive(TS))]
14933pub struct XMLKeyValueOption {
14934 pub this: Box<Expression>,
14935 #[serde(default)]
14936 pub expression: Option<Box<Expression>>,
14937}
14938
14939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14941#[cfg_attr(feature = "bindings", derive(TS))]
14942pub struct Zipf {
14943 pub this: Box<Expression>,
14944 #[serde(default)]
14945 pub elementcount: Option<Box<Expression>>,
14946 #[serde(default)]
14947 pub gen: Option<Box<Expression>>,
14948}
14949
14950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14952#[cfg_attr(feature = "bindings", derive(TS))]
14953pub struct Merge {
14954 pub this: Box<Expression>,
14955 pub using: Box<Expression>,
14956 #[serde(default)]
14957 pub on: Option<Box<Expression>>,
14958 #[serde(default)]
14959 pub using_cond: Option<Box<Expression>>,
14960 #[serde(default)]
14961 pub whens: Option<Box<Expression>>,
14962 #[serde(default)]
14963 pub with_: Option<Box<Expression>>,
14964 #[serde(default)]
14965 pub returning: Option<Box<Expression>>,
14966}
14967
14968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14970#[cfg_attr(feature = "bindings", derive(TS))]
14971pub struct When {
14972 #[serde(default)]
14973 pub matched: Option<Box<Expression>>,
14974 #[serde(default)]
14975 pub source: Option<Box<Expression>>,
14976 #[serde(default)]
14977 pub condition: Option<Box<Expression>>,
14978 pub then: Box<Expression>,
14979}
14980
14981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14983#[cfg_attr(feature = "bindings", derive(TS))]
14984pub struct Whens {
14985 #[serde(default)]
14986 pub expressions: Vec<Expression>,
14987}
14988
14989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14991#[cfg_attr(feature = "bindings", derive(TS))]
14992pub struct NextValueFor {
14993 pub this: Box<Expression>,
14994 #[serde(default)]
14995 pub order: Option<Box<Expression>>,
14996}
14997
14998#[cfg(test)]
14999mod tests {
15000 use super::*;
15001
15002 #[test]
15003 #[cfg(feature = "bindings")]
15004 fn export_typescript_types() {
15005 Expression::export_all(&ts_rs::Config::default())
15008 .expect("Failed to export Expression types");
15009 }
15010
15011 #[test]
15012 fn test_simple_select_builder() {
15013 let select = Select::new()
15014 .column(Expression::star())
15015 .from(Expression::Table(Box::new(TableRef::new("users"))));
15016
15017 assert_eq!(select.expressions.len(), 1);
15018 assert!(select.from.is_some());
15019 }
15020
15021 #[test]
15022 fn test_expression_alias() {
15023 let expr = Expression::column("id").alias("user_id");
15024
15025 match expr {
15026 Expression::Alias(a) => {
15027 assert_eq!(a.alias.name, "user_id");
15028 }
15029 _ => panic!("Expected Alias"),
15030 }
15031 }
15032
15033 #[test]
15034 fn test_literal_creation() {
15035 let num = Expression::number(42);
15036 let str = Expression::string("hello");
15037
15038 match num {
15039 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
15040 let Literal::Number(n) = lit.as_ref() else {
15041 unreachable!()
15042 };
15043 assert_eq!(n, "42")
15044 }
15045 _ => panic!("Expected Number"),
15046 }
15047
15048 match str {
15049 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
15050 let Literal::String(s) = lit.as_ref() else {
15051 unreachable!()
15052 };
15053 assert_eq!(s, "hello")
15054 }
15055 _ => panic!("Expected String"),
15056 }
15057 }
15058
15059 #[test]
15060 fn test_expression_sql() {
15061 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
15062 assert_eq!(expr.sql(), "SELECT 1 + 2");
15063 }
15064
15065 #[test]
15066 fn test_expression_sql_for() {
15067 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
15068 let sql = expr.sql_for(crate::DialectType::Generic);
15069 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15071 }
15072}