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 Execute(Box<ExecuteStatement>),
592
593 CreateTask(Box<CreateTask>),
595
596 Raw(Raw),
598
599 Paren(Box<Paren>),
601
602 Annotated(Box<Annotated>),
604
605 Refresh(Box<Refresh>),
608 LockingStatement(Box<LockingStatement>),
609 SequenceProperties(Box<SequenceProperties>),
610 TruncateTable(Box<TruncateTable>),
611 Clone(Box<Clone>),
612 Attach(Box<Attach>),
613 Detach(Box<Detach>),
614 Install(Box<Install>),
615 Summarize(Box<Summarize>),
616 Declare(Box<Declare>),
617 DeclareItem(Box<DeclareItem>),
618 Set(Box<Set>),
619 Heredoc(Box<Heredoc>),
620 SetItem(Box<SetItem>),
621 QueryBand(Box<QueryBand>),
622 UserDefinedFunction(Box<UserDefinedFunction>),
623 RecursiveWithSearch(Box<RecursiveWithSearch>),
624 ProjectionDef(Box<ProjectionDef>),
625 TableAlias(Box<TableAlias>),
626 ByteString(Box<ByteString>),
627 HexStringExpr(Box<HexStringExpr>),
628 UnicodeString(Box<UnicodeString>),
629 ColumnPosition(Box<ColumnPosition>),
630 ColumnDef(Box<ColumnDef>),
631 AlterColumn(Box<AlterColumn>),
632 AlterSortKey(Box<AlterSortKey>),
633 AlterSet(Box<AlterSet>),
634 RenameColumn(Box<RenameColumn>),
635 Comprehension(Box<Comprehension>),
636 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
637 MergeTreeTTL(Box<MergeTreeTTL>),
638 IndexConstraintOption(Box<IndexConstraintOption>),
639 ColumnConstraint(Box<ColumnConstraint>),
640 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
641 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
642 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
643 CheckColumnConstraint(Box<CheckColumnConstraint>),
644 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
645 CompressColumnConstraint(Box<CompressColumnConstraint>),
646 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
647 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
648 WithOperator(Box<WithOperator>),
649 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
650 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
651 CommentColumnConstraint(CommentColumnConstraint),
652 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
653 IndexColumnConstraint(Box<IndexColumnConstraint>),
654 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
655 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
656 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
657 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
658 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
659 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
660 InOutColumnConstraint(Box<InOutColumnConstraint>),
661 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
662 PathColumnConstraint(Box<PathColumnConstraint>),
663 Constraint(Box<Constraint>),
664 Export(Box<Export>),
665 Filter(Box<Filter>),
666 Changes(Box<Changes>),
667 CopyParameter(Box<CopyParameter>),
668 Credentials(Box<Credentials>),
669 Directory(Box<Directory>),
670 ForeignKey(Box<ForeignKey>),
671 ColumnPrefix(Box<ColumnPrefix>),
672 PrimaryKey(Box<PrimaryKey>),
673 IntoClause(Box<IntoClause>),
674 JoinHint(Box<JoinHint>),
675 Opclass(Box<Opclass>),
676 Index(Box<Index>),
677 IndexParameters(Box<IndexParameters>),
678 ConditionalInsert(Box<ConditionalInsert>),
679 MultitableInserts(Box<MultitableInserts>),
680 OnConflict(Box<OnConflict>),
681 OnCondition(Box<OnCondition>),
682 Returning(Box<Returning>),
683 Introducer(Box<Introducer>),
684 PartitionRange(Box<PartitionRange>),
685 Fetch(Box<Fetch>),
686 Group(Box<Group>),
687 Cube(Box<Cube>),
688 Rollup(Box<Rollup>),
689 GroupingSets(Box<GroupingSets>),
690 LimitOptions(Box<LimitOptions>),
691 Lateral(Box<Lateral>),
692 TableFromRows(Box<TableFromRows>),
693 RowsFrom(Box<RowsFrom>),
694 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
695 WithFill(Box<WithFill>),
696 Property(Box<Property>),
697 GrantPrivilege(Box<GrantPrivilege>),
698 GrantPrincipal(Box<GrantPrincipal>),
699 AllowedValuesProperty(Box<AllowedValuesProperty>),
700 AlgorithmProperty(Box<AlgorithmProperty>),
701 AutoIncrementProperty(Box<AutoIncrementProperty>),
702 AutoRefreshProperty(Box<AutoRefreshProperty>),
703 BackupProperty(Box<BackupProperty>),
704 BuildProperty(Box<BuildProperty>),
705 BlockCompressionProperty(Box<BlockCompressionProperty>),
706 CharacterSetProperty(Box<CharacterSetProperty>),
707 ChecksumProperty(Box<ChecksumProperty>),
708 CollateProperty(Box<CollateProperty>),
709 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
710 DataDeletionProperty(Box<DataDeletionProperty>),
711 DefinerProperty(Box<DefinerProperty>),
712 DistKeyProperty(Box<DistKeyProperty>),
713 DistributedByProperty(Box<DistributedByProperty>),
714 DistStyleProperty(Box<DistStyleProperty>),
715 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
716 EngineProperty(Box<EngineProperty>),
717 ToTableProperty(Box<ToTableProperty>),
718 ExecuteAsProperty(Box<ExecuteAsProperty>),
719 ExternalProperty(Box<ExternalProperty>),
720 FallbackProperty(Box<FallbackProperty>),
721 FileFormatProperty(Box<FileFormatProperty>),
722 CredentialsProperty(Box<CredentialsProperty>),
723 FreespaceProperty(Box<FreespaceProperty>),
724 InheritsProperty(Box<InheritsProperty>),
725 InputModelProperty(Box<InputModelProperty>),
726 OutputModelProperty(Box<OutputModelProperty>),
727 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
728 JournalProperty(Box<JournalProperty>),
729 LanguageProperty(Box<LanguageProperty>),
730 EnviromentProperty(Box<EnviromentProperty>),
731 ClusteredByProperty(Box<ClusteredByProperty>),
732 DictProperty(Box<DictProperty>),
733 DictRange(Box<DictRange>),
734 OnCluster(Box<OnCluster>),
735 LikeProperty(Box<LikeProperty>),
736 LocationProperty(Box<LocationProperty>),
737 LockProperty(Box<LockProperty>),
738 LockingProperty(Box<LockingProperty>),
739 LogProperty(Box<LogProperty>),
740 MaterializedProperty(Box<MaterializedProperty>),
741 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
742 OnProperty(Box<OnProperty>),
743 OnCommitProperty(Box<OnCommitProperty>),
744 PartitionedByProperty(Box<PartitionedByProperty>),
745 PartitionByProperty(Box<PartitionByProperty>),
746 PartitionedByBucket(Box<PartitionedByBucket>),
747 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
748 PartitionByTruncate(Box<PartitionByTruncate>),
749 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
750 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
751 PartitionByListProperty(Box<PartitionByListProperty>),
752 PartitionList(Box<PartitionList>),
753 Partition(Box<Partition>),
754 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
755 UniqueKeyProperty(Box<UniqueKeyProperty>),
756 RollupProperty(Box<RollupProperty>),
757 PartitionBoundSpec(Box<PartitionBoundSpec>),
758 PartitionedOfProperty(Box<PartitionedOfProperty>),
759 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
760 ReturnsProperty(Box<ReturnsProperty>),
761 RowFormatProperty(Box<RowFormatProperty>),
762 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
763 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
764 QueryTransform(Box<QueryTransform>),
765 SampleProperty(Box<SampleProperty>),
766 SecurityProperty(Box<SecurityProperty>),
767 SchemaCommentProperty(Box<SchemaCommentProperty>),
768 SemanticView(Box<SemanticView>),
769 SerdeProperties(Box<SerdeProperties>),
770 SetProperty(Box<SetProperty>),
771 SharingProperty(Box<SharingProperty>),
772 SetConfigProperty(Box<SetConfigProperty>),
773 SettingsProperty(Box<SettingsProperty>),
774 SortKeyProperty(Box<SortKeyProperty>),
775 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
776 SqlSecurityProperty(Box<SqlSecurityProperty>),
777 StabilityProperty(Box<StabilityProperty>),
778 StorageHandlerProperty(Box<StorageHandlerProperty>),
779 TemporaryProperty(Box<TemporaryProperty>),
780 Tags(Box<Tags>),
781 TransformModelProperty(Box<TransformModelProperty>),
782 TransientProperty(Box<TransientProperty>),
783 UsingTemplateProperty(Box<UsingTemplateProperty>),
784 ViewAttributeProperty(Box<ViewAttributeProperty>),
785 VolatileProperty(Box<VolatileProperty>),
786 WithDataProperty(Box<WithDataProperty>),
787 WithJournalTableProperty(Box<WithJournalTableProperty>),
788 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
789 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
790 WithProcedureOptions(Box<WithProcedureOptions>),
791 EncodeProperty(Box<EncodeProperty>),
792 IncludeProperty(Box<IncludeProperty>),
793 Properties(Box<Properties>),
794 OptionsProperty(Box<OptionsProperty>),
795 InputOutputFormat(Box<InputOutputFormat>),
796 Reference(Box<Reference>),
797 QueryOption(Box<QueryOption>),
798 WithTableHint(Box<WithTableHint>),
799 IndexTableHint(Box<IndexTableHint>),
800 HistoricalData(Box<HistoricalData>),
801 Get(Box<Get>),
802 SetOperation(Box<SetOperation>),
803 Var(Box<Var>),
804 Variadic(Box<Variadic>),
805 Version(Box<Version>),
806 Schema(Box<Schema>),
807 Lock(Box<Lock>),
808 TableSample(Box<TableSample>),
809 Tag(Box<Tag>),
810 UnpivotColumns(Box<UnpivotColumns>),
811 WindowSpec(Box<WindowSpec>),
812 SessionParameter(Box<SessionParameter>),
813 PseudoType(Box<PseudoType>),
814 ObjectIdentifier(Box<ObjectIdentifier>),
815 Transaction(Box<Transaction>),
816 Commit(Box<Commit>),
817 Rollback(Box<Rollback>),
818 AlterSession(Box<AlterSession>),
819 Analyze(Box<Analyze>),
820 AnalyzeStatistics(Box<AnalyzeStatistics>),
821 AnalyzeHistogram(Box<AnalyzeHistogram>),
822 AnalyzeSample(Box<AnalyzeSample>),
823 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
824 AnalyzeDelete(Box<AnalyzeDelete>),
825 AnalyzeWith(Box<AnalyzeWith>),
826 AnalyzeValidate(Box<AnalyzeValidate>),
827 AddPartition(Box<AddPartition>),
828 AttachOption(Box<AttachOption>),
829 DropPartition(Box<DropPartition>),
830 ReplacePartition(Box<ReplacePartition>),
831 DPipe(Box<DPipe>),
832 Operator(Box<Operator>),
833 PivotAny(Box<PivotAny>),
834 Aliases(Box<Aliases>),
835 AtIndex(Box<AtIndex>),
836 FromTimeZone(Box<FromTimeZone>),
837 FormatPhrase(Box<FormatPhrase>),
838 ForIn(Box<ForIn>),
839 TimeUnit(Box<TimeUnit>),
840 IntervalOp(Box<IntervalOp>),
841 IntervalSpan(Box<IntervalSpan>),
842 HavingMax(Box<HavingMax>),
843 CosineDistance(Box<CosineDistance>),
844 DotProduct(Box<DotProduct>),
845 EuclideanDistance(Box<EuclideanDistance>),
846 ManhattanDistance(Box<ManhattanDistance>),
847 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
848 Booland(Box<Booland>),
849 Boolor(Box<Boolor>),
850 ParameterizedAgg(Box<ParameterizedAgg>),
851 ArgMax(Box<ArgMax>),
852 ArgMin(Box<ArgMin>),
853 ApproxTopK(Box<ApproxTopK>),
854 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
855 ApproxTopKCombine(Box<ApproxTopKCombine>),
856 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
857 ApproxTopSum(Box<ApproxTopSum>),
858 ApproxQuantiles(Box<ApproxQuantiles>),
859 Minhash(Box<Minhash>),
860 FarmFingerprint(Box<FarmFingerprint>),
861 Float64(Box<Float64>),
862 Transform(Box<Transform>),
863 Translate(Box<Translate>),
864 Grouping(Box<Grouping>),
865 GroupingId(Box<GroupingId>),
866 Anonymous(Box<Anonymous>),
867 AnonymousAggFunc(Box<AnonymousAggFunc>),
868 CombinedAggFunc(Box<CombinedAggFunc>),
869 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
870 HashAgg(Box<HashAgg>),
871 Hll(Box<Hll>),
872 Apply(Box<Apply>),
873 ToBoolean(Box<ToBoolean>),
874 List(Box<List>),
875 ToMap(Box<ToMap>),
876 Pad(Box<Pad>),
877 ToChar(Box<ToChar>),
878 ToNumber(Box<ToNumber>),
879 ToDouble(Box<ToDouble>),
880 Int64(Box<UnaryFunc>),
881 StringFunc(Box<StringFunc>),
882 ToDecfloat(Box<ToDecfloat>),
883 TryToDecfloat(Box<TryToDecfloat>),
884 ToFile(Box<ToFile>),
885 Columns(Box<Columns>),
886 ConvertToCharset(Box<ConvertToCharset>),
887 ConvertTimezone(Box<ConvertTimezone>),
888 GenerateSeries(Box<GenerateSeries>),
889 AIAgg(Box<AIAgg>),
890 AIClassify(Box<AIClassify>),
891 ArrayAll(Box<ArrayAll>),
892 ArrayAny(Box<ArrayAny>),
893 ArrayConstructCompact(Box<ArrayConstructCompact>),
894 StPoint(Box<StPoint>),
895 StDistance(Box<StDistance>),
896 StringToArray(Box<StringToArray>),
897 ArraySum(Box<ArraySum>),
898 ObjectAgg(Box<ObjectAgg>),
899 CastToStrType(Box<CastToStrType>),
900 CheckJson(Box<CheckJson>),
901 CheckXml(Box<CheckXml>),
902 TranslateCharacters(Box<TranslateCharacters>),
903 CurrentSchemas(Box<CurrentSchemas>),
904 CurrentDatetime(Box<CurrentDatetime>),
905 Localtime(Box<Localtime>),
906 Localtimestamp(Box<Localtimestamp>),
907 Systimestamp(Box<Systimestamp>),
908 CurrentSchema(Box<CurrentSchema>),
909 CurrentUser(Box<CurrentUser>),
910 UtcTime(Box<UtcTime>),
911 UtcTimestamp(Box<UtcTimestamp>),
912 Timestamp(Box<TimestampFunc>),
913 DateBin(Box<DateBin>),
914 Datetime(Box<Datetime>),
915 DatetimeAdd(Box<DatetimeAdd>),
916 DatetimeSub(Box<DatetimeSub>),
917 DatetimeDiff(Box<DatetimeDiff>),
918 DatetimeTrunc(Box<DatetimeTrunc>),
919 Dayname(Box<Dayname>),
920 MakeInterval(Box<MakeInterval>),
921 PreviousDay(Box<PreviousDay>),
922 Elt(Box<Elt>),
923 TimestampAdd(Box<TimestampAdd>),
924 TimestampSub(Box<TimestampSub>),
925 TimestampDiff(Box<TimestampDiff>),
926 TimeSlice(Box<TimeSlice>),
927 TimeAdd(Box<TimeAdd>),
928 TimeSub(Box<TimeSub>),
929 TimeDiff(Box<TimeDiff>),
930 TimeTrunc(Box<TimeTrunc>),
931 DateFromParts(Box<DateFromParts>),
932 TimeFromParts(Box<TimeFromParts>),
933 DecodeCase(Box<DecodeCase>),
934 Decrypt(Box<Decrypt>),
935 DecryptRaw(Box<DecryptRaw>),
936 Encode(Box<Encode>),
937 Encrypt(Box<Encrypt>),
938 EncryptRaw(Box<EncryptRaw>),
939 EqualNull(Box<EqualNull>),
940 ToBinary(Box<ToBinary>),
941 Base64DecodeBinary(Box<Base64DecodeBinary>),
942 Base64DecodeString(Box<Base64DecodeString>),
943 Base64Encode(Box<Base64Encode>),
944 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
945 TryBase64DecodeString(Box<TryBase64DecodeString>),
946 GapFill(Box<GapFill>),
947 GenerateDateArray(Box<GenerateDateArray>),
948 GenerateTimestampArray(Box<GenerateTimestampArray>),
949 GetExtract(Box<GetExtract>),
950 Getbit(Box<Getbit>),
951 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
952 HexEncode(Box<HexEncode>),
953 Compress(Box<Compress>),
954 DecompressBinary(Box<DecompressBinary>),
955 DecompressString(Box<DecompressString>),
956 Xor(Box<Xor>),
957 Nullif(Box<Nullif>),
958 JSON(Box<JSON>),
959 JSONPath(Box<JSONPath>),
960 JSONPathFilter(Box<JSONPathFilter>),
961 JSONPathKey(Box<JSONPathKey>),
962 JSONPathRecursive(Box<JSONPathRecursive>),
963 JSONPathScript(Box<JSONPathScript>),
964 JSONPathSlice(Box<JSONPathSlice>),
965 JSONPathSelector(Box<JSONPathSelector>),
966 JSONPathSubscript(Box<JSONPathSubscript>),
967 JSONPathUnion(Box<JSONPathUnion>),
968 Format(Box<Format>),
969 JSONKeys(Box<JSONKeys>),
970 JSONKeyValue(Box<JSONKeyValue>),
971 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
972 JSONObject(Box<JSONObject>),
973 JSONObjectAgg(Box<JSONObjectAgg>),
974 JSONBObjectAgg(Box<JSONBObjectAgg>),
975 JSONArray(Box<JSONArray>),
976 JSONArrayAgg(Box<JSONArrayAgg>),
977 JSONExists(Box<JSONExists>),
978 JSONColumnDef(Box<JSONColumnDef>),
979 JSONSchema(Box<JSONSchema>),
980 JSONSet(Box<JSONSet>),
981 JSONStripNulls(Box<JSONStripNulls>),
982 JSONValue(Box<JSONValue>),
983 JSONValueArray(Box<JSONValueArray>),
984 JSONRemove(Box<JSONRemove>),
985 JSONTable(Box<JSONTable>),
986 JSONType(Box<JSONType>),
987 ObjectInsert(Box<ObjectInsert>),
988 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
989 OpenJSON(Box<OpenJSON>),
990 JSONBExists(Box<JSONBExists>),
991 JSONBContains(Box<BinaryFunc>),
992 JSONBExtract(Box<BinaryFunc>),
993 JSONCast(Box<JSONCast>),
994 JSONExtract(Box<JSONExtract>),
995 JSONExtractQuote(Box<JSONExtractQuote>),
996 JSONExtractArray(Box<JSONExtractArray>),
997 JSONExtractScalar(Box<JSONExtractScalar>),
998 JSONBExtractScalar(Box<JSONBExtractScalar>),
999 JSONFormat(Box<JSONFormat>),
1000 JSONBool(Box<UnaryFunc>),
1001 JSONPathRoot(JSONPathRoot),
1002 JSONArrayAppend(Box<JSONArrayAppend>),
1003 JSONArrayContains(Box<JSONArrayContains>),
1004 JSONArrayInsert(Box<JSONArrayInsert>),
1005 ParseJSON(Box<ParseJSON>),
1006 ParseUrl(Box<ParseUrl>),
1007 ParseIp(Box<ParseIp>),
1008 ParseTime(Box<ParseTime>),
1009 ParseDatetime(Box<ParseDatetime>),
1010 Map(Box<Map>),
1011 MapCat(Box<MapCat>),
1012 MapDelete(Box<MapDelete>),
1013 MapInsert(Box<MapInsert>),
1014 MapPick(Box<MapPick>),
1015 ScopeResolution(Box<ScopeResolution>),
1016 Slice(Box<Slice>),
1017 VarMap(Box<VarMap>),
1018 MatchAgainst(Box<MatchAgainst>),
1019 MD5Digest(Box<MD5Digest>),
1020 MD5NumberLower64(Box<UnaryFunc>),
1021 MD5NumberUpper64(Box<UnaryFunc>),
1022 Monthname(Box<Monthname>),
1023 Ntile(Box<Ntile>),
1024 Normalize(Box<Normalize>),
1025 Normal(Box<Normal>),
1026 Predict(Box<Predict>),
1027 MLTranslate(Box<MLTranslate>),
1028 FeaturesAtTime(Box<FeaturesAtTime>),
1029 GenerateEmbedding(Box<GenerateEmbedding>),
1030 MLForecast(Box<MLForecast>),
1031 ModelAttribute(Box<ModelAttribute>),
1032 VectorSearch(Box<VectorSearch>),
1033 Quantile(Box<Quantile>),
1034 ApproxQuantile(Box<ApproxQuantile>),
1035 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1036 Randn(Box<Randn>),
1037 Randstr(Box<Randstr>),
1038 RangeN(Box<RangeN>),
1039 RangeBucket(Box<RangeBucket>),
1040 ReadCSV(Box<ReadCSV>),
1041 ReadParquet(Box<ReadParquet>),
1042 Reduce(Box<Reduce>),
1043 RegexpExtractAll(Box<RegexpExtractAll>),
1044 RegexpILike(Box<RegexpILike>),
1045 RegexpFullMatch(Box<RegexpFullMatch>),
1046 RegexpInstr(Box<RegexpInstr>),
1047 RegexpSplit(Box<RegexpSplit>),
1048 RegexpCount(Box<RegexpCount>),
1049 RegrValx(Box<RegrValx>),
1050 RegrValy(Box<RegrValy>),
1051 RegrAvgy(Box<RegrAvgy>),
1052 RegrAvgx(Box<RegrAvgx>),
1053 RegrCount(Box<RegrCount>),
1054 RegrIntercept(Box<RegrIntercept>),
1055 RegrR2(Box<RegrR2>),
1056 RegrSxx(Box<RegrSxx>),
1057 RegrSxy(Box<RegrSxy>),
1058 RegrSyy(Box<RegrSyy>),
1059 RegrSlope(Box<RegrSlope>),
1060 SafeAdd(Box<SafeAdd>),
1061 SafeDivide(Box<SafeDivide>),
1062 SafeMultiply(Box<SafeMultiply>),
1063 SafeSubtract(Box<SafeSubtract>),
1064 SHA2(Box<SHA2>),
1065 SHA2Digest(Box<SHA2Digest>),
1066 SortArray(Box<SortArray>),
1067 SplitPart(Box<SplitPart>),
1068 SubstringIndex(Box<SubstringIndex>),
1069 StandardHash(Box<StandardHash>),
1070 StrPosition(Box<StrPosition>),
1071 Search(Box<Search>),
1072 SearchIp(Box<SearchIp>),
1073 StrToDate(Box<StrToDate>),
1074 DateStrToDate(Box<UnaryFunc>),
1075 DateToDateStr(Box<UnaryFunc>),
1076 StrToTime(Box<StrToTime>),
1077 StrToUnix(Box<StrToUnix>),
1078 StrToMap(Box<StrToMap>),
1079 NumberToStr(Box<NumberToStr>),
1080 FromBase(Box<FromBase>),
1081 Stuff(Box<Stuff>),
1082 TimeToStr(Box<TimeToStr>),
1083 TimeStrToTime(Box<TimeStrToTime>),
1084 TsOrDsAdd(Box<TsOrDsAdd>),
1085 TsOrDsDiff(Box<TsOrDsDiff>),
1086 TsOrDsToDate(Box<TsOrDsToDate>),
1087 TsOrDsToTime(Box<TsOrDsToTime>),
1088 Unhex(Box<Unhex>),
1089 Uniform(Box<Uniform>),
1090 UnixToStr(Box<UnixToStr>),
1091 UnixToTime(Box<UnixToTime>),
1092 Uuid(Box<Uuid>),
1093 TimestampFromParts(Box<TimestampFromParts>),
1094 TimestampTzFromParts(Box<TimestampTzFromParts>),
1095 Corr(Box<Corr>),
1096 WidthBucket(Box<WidthBucket>),
1097 CovarSamp(Box<CovarSamp>),
1098 CovarPop(Box<CovarPop>),
1099 Week(Box<Week>),
1100 XMLElement(Box<XMLElement>),
1101 XMLGet(Box<XMLGet>),
1102 XMLTable(Box<XMLTable>),
1103 XMLKeyValueOption(Box<XMLKeyValueOption>),
1104 Zipf(Box<Zipf>),
1105 Merge(Box<Merge>),
1106 When(Box<When>),
1107 Whens(Box<Whens>),
1108 NextValueFor(Box<NextValueFor>),
1109 ReturnStmt(Box<Expression>),
1111}
1112
1113impl Expression {
1114 #[inline]
1116 pub fn boxed_column(col: Column) -> Self {
1117 Expression::Column(Box::new(col))
1118 }
1119
1120 #[inline]
1122 pub fn boxed_table(t: TableRef) -> Self {
1123 Expression::Table(Box::new(t))
1124 }
1125
1126 pub fn is_statement(&self) -> bool {
1133 match self {
1134 Expression::Select(_)
1136 | Expression::Union(_)
1137 | Expression::Intersect(_)
1138 | Expression::Except(_)
1139 | Expression::Subquery(_)
1140 | Expression::Values(_)
1141 | Expression::PipeOperator(_)
1142
1143 | Expression::Insert(_)
1145 | Expression::Update(_)
1146 | Expression::Delete(_)
1147 | Expression::Copy(_)
1148 | Expression::Put(_)
1149 | Expression::Merge(_)
1150 | Expression::TryCatch(_)
1151
1152 | Expression::CreateTable(_)
1154 | Expression::DropTable(_)
1155 | Expression::Undrop(_)
1156 | Expression::AlterTable(_)
1157 | Expression::CreateIndex(_)
1158 | Expression::DropIndex(_)
1159 | Expression::CreateView(_)
1160 | Expression::DropView(_)
1161 | Expression::AlterView(_)
1162 | Expression::AlterIndex(_)
1163 | Expression::Truncate(_)
1164 | Expression::TruncateTable(_)
1165 | Expression::CreateSchema(_)
1166 | Expression::DropSchema(_)
1167 | Expression::DropNamespace(_)
1168 | Expression::CreateDatabase(_)
1169 | Expression::DropDatabase(_)
1170 | Expression::CreateFunction(_)
1171 | Expression::DropFunction(_)
1172 | Expression::CreateProcedure(_)
1173 | Expression::DropProcedure(_)
1174 | Expression::CreateSequence(_)
1175 | Expression::CreateSynonym(_)
1176 | Expression::DropSequence(_)
1177 | Expression::AlterSequence(_)
1178 | Expression::CreateTrigger(_)
1179 | Expression::DropTrigger(_)
1180 | Expression::CreateType(_)
1181 | Expression::DropType(_)
1182 | Expression::Comment(_)
1183
1184 | Expression::Use(_)
1186 | Expression::Set(_)
1187 | Expression::SetStatement(_)
1188 | Expression::Transaction(_)
1189 | Expression::Commit(_)
1190 | Expression::Rollback(_)
1191 | Expression::Grant(_)
1192 | Expression::Revoke(_)
1193 | Expression::Cache(_)
1194 | Expression::Uncache(_)
1195 | Expression::LoadData(_)
1196 | Expression::Pragma(_)
1197 | Expression::Describe(_)
1198 | Expression::Show(_)
1199 | Expression::Kill(_)
1200 | Expression::Execute(_)
1201 | Expression::Declare(_)
1202 | Expression::Refresh(_)
1203 | Expression::AlterSession(_)
1204 | Expression::LockingStatement(_)
1205
1206 | Expression::Analyze(_)
1208 | Expression::AnalyzeStatistics(_)
1209 | Expression::AnalyzeHistogram(_)
1210 | Expression::AnalyzeSample(_)
1211 | Expression::AnalyzeListChainedRows(_)
1212 | Expression::AnalyzeDelete(_)
1213
1214 | Expression::Attach(_)
1216 | Expression::Detach(_)
1217 | Expression::Install(_)
1218 | Expression::Summarize(_)
1219
1220 | Expression::Pivot(_)
1222 | Expression::Unpivot(_)
1223
1224 | Expression::Command(_)
1226 | Expression::Raw(_)
1227 | Expression::CreateTask(_)
1228
1229 | Expression::ReturnStmt(_) => true,
1231
1232 Expression::Annotated(a) => a.this.is_statement(),
1234
1235 Expression::Alias(a) => a.this.is_statement(),
1237
1238 _ => false,
1240 }
1241 }
1242
1243 pub fn number(n: i64) -> Self {
1245 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1246 }
1247
1248 pub fn string(s: impl Into<String>) -> Self {
1250 Expression::Literal(Box::new(Literal::String(s.into())))
1251 }
1252
1253 pub fn float(f: f64) -> Self {
1255 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1256 }
1257
1258 pub fn inferred_type(&self) -> Option<&DataType> {
1264 match self {
1265 Expression::And(op)
1267 | Expression::Or(op)
1268 | Expression::Add(op)
1269 | Expression::Sub(op)
1270 | Expression::Mul(op)
1271 | Expression::Div(op)
1272 | Expression::Mod(op)
1273 | Expression::Eq(op)
1274 | Expression::Neq(op)
1275 | Expression::Lt(op)
1276 | Expression::Lte(op)
1277 | Expression::Gt(op)
1278 | Expression::Gte(op)
1279 | Expression::Concat(op)
1280 | Expression::BitwiseAnd(op)
1281 | Expression::BitwiseOr(op)
1282 | Expression::BitwiseXor(op)
1283 | Expression::Adjacent(op)
1284 | Expression::TsMatch(op)
1285 | Expression::PropertyEQ(op)
1286 | Expression::ArrayContainsAll(op)
1287 | Expression::ArrayContainedBy(op)
1288 | Expression::ArrayOverlaps(op)
1289 | Expression::JSONBContainsAllTopKeys(op)
1290 | Expression::JSONBContainsAnyTopKeys(op)
1291 | Expression::JSONBDeleteAtPath(op)
1292 | Expression::ExtendsLeft(op)
1293 | Expression::ExtendsRight(op)
1294 | Expression::Is(op)
1295 | Expression::MemberOf(op)
1296 | Expression::Match(op)
1297 | Expression::NullSafeEq(op)
1298 | Expression::NullSafeNeq(op)
1299 | Expression::Glob(op)
1300 | Expression::BitwiseLeftShift(op)
1301 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1302
1303 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1304 op.inferred_type.as_ref()
1305 }
1306
1307 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1308
1309 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1310 c.inferred_type.as_ref()
1311 }
1312
1313 Expression::Column(c) => c.inferred_type.as_ref(),
1314 Expression::Function(f) => f.inferred_type.as_ref(),
1315 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1316 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1317 Expression::Case(c) => c.inferred_type.as_ref(),
1318 Expression::Subquery(s) => s.inferred_type.as_ref(),
1319 Expression::Alias(a) => a.inferred_type.as_ref(),
1320 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1321 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1322 Expression::Count(f) => f.inferred_type.as_ref(),
1323 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1324 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1325 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1326 Expression::SumIf(f) => f.inferred_type.as_ref(),
1327
1328 Expression::Upper(f)
1330 | Expression::Lower(f)
1331 | Expression::Length(f)
1332 | Expression::LTrim(f)
1333 | Expression::RTrim(f)
1334 | Expression::Reverse(f)
1335 | Expression::Abs(f)
1336 | Expression::Sqrt(f)
1337 | Expression::Cbrt(f)
1338 | Expression::Ln(f)
1339 | Expression::Exp(f)
1340 | Expression::Sign(f)
1341 | Expression::Date(f)
1342 | Expression::Time(f)
1343 | Expression::Initcap(f)
1344 | Expression::Ascii(f)
1345 | Expression::Chr(f)
1346 | Expression::Soundex(f)
1347 | Expression::ByteLength(f)
1348 | Expression::Hex(f)
1349 | Expression::LowerHex(f)
1350 | Expression::Unicode(f)
1351 | Expression::Typeof(f)
1352 | Expression::Explode(f)
1353 | Expression::ExplodeOuter(f)
1354 | Expression::MapFromEntries(f)
1355 | Expression::MapKeys(f)
1356 | Expression::MapValues(f)
1357 | Expression::ArrayLength(f)
1358 | Expression::ArraySize(f)
1359 | Expression::Cardinality(f)
1360 | Expression::ArrayReverse(f)
1361 | Expression::ArrayDistinct(f)
1362 | Expression::ArrayFlatten(f)
1363 | Expression::ArrayCompact(f)
1364 | Expression::ToArray(f)
1365 | Expression::JsonArrayLength(f)
1366 | Expression::JsonKeys(f)
1367 | Expression::JsonType(f)
1368 | Expression::ParseJson(f)
1369 | Expression::ToJson(f)
1370 | Expression::Radians(f)
1371 | Expression::Degrees(f)
1372 | Expression::Sin(f)
1373 | Expression::Cos(f)
1374 | Expression::Tan(f)
1375 | Expression::Asin(f)
1376 | Expression::Acos(f)
1377 | Expression::Atan(f)
1378 | Expression::IsNan(f)
1379 | Expression::IsInf(f)
1380 | Expression::Year(f)
1381 | Expression::Month(f)
1382 | Expression::Day(f)
1383 | Expression::Hour(f)
1384 | Expression::Minute(f)
1385 | Expression::Second(f)
1386 | Expression::DayOfWeek(f)
1387 | Expression::DayOfWeekIso(f)
1388 | Expression::DayOfMonth(f)
1389 | Expression::DayOfYear(f)
1390 | Expression::WeekOfYear(f)
1391 | Expression::Quarter(f)
1392 | Expression::Epoch(f)
1393 | Expression::EpochMs(f)
1394 | Expression::BitwiseCount(f)
1395 | Expression::DateFromUnixDate(f)
1396 | Expression::UnixDate(f)
1397 | Expression::UnixSeconds(f)
1398 | Expression::UnixMillis(f)
1399 | Expression::UnixMicros(f)
1400 | Expression::TimeStrToDate(f)
1401 | Expression::DateToDi(f)
1402 | Expression::DiToDate(f)
1403 | Expression::TsOrDiToDi(f)
1404 | Expression::TsOrDsToDatetime(f)
1405 | Expression::TsOrDsToTimestamp(f)
1406 | Expression::YearOfWeek(f)
1407 | Expression::YearOfWeekIso(f)
1408 | Expression::SHA(f)
1409 | Expression::SHA1Digest(f)
1410 | Expression::TimeToUnix(f)
1411 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1412
1413 Expression::Power(f)
1415 | Expression::NullIf(f)
1416 | Expression::IfNull(f)
1417 | Expression::Nvl(f)
1418 | Expression::Contains(f)
1419 | Expression::StartsWith(f)
1420 | Expression::EndsWith(f)
1421 | Expression::Levenshtein(f)
1422 | Expression::ModFunc(f)
1423 | Expression::IntDiv(f)
1424 | Expression::Atan2(f)
1425 | Expression::AddMonths(f)
1426 | Expression::MonthsBetween(f)
1427 | Expression::NextDay(f)
1428 | Expression::UnixToTimeStr(f)
1429 | Expression::ArrayContains(f)
1430 | Expression::ArrayPosition(f)
1431 | Expression::ArrayAppend(f)
1432 | Expression::ArrayPrepend(f)
1433 | Expression::ArrayUnion(f)
1434 | Expression::ArrayExcept(f)
1435 | Expression::ArrayRemove(f)
1436 | Expression::StarMap(f)
1437 | Expression::MapFromArrays(f)
1438 | Expression::MapContainsKey(f)
1439 | Expression::ElementAt(f)
1440 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1441
1442 Expression::Coalesce(f)
1444 | Expression::Greatest(f)
1445 | Expression::Least(f)
1446 | Expression::ArrayConcat(f)
1447 | Expression::ArrayIntersect(f)
1448 | Expression::ArrayZip(f)
1449 | Expression::MapConcat(f)
1450 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1451
1452 Expression::Sum(f)
1454 | Expression::Avg(f)
1455 | Expression::Min(f)
1456 | Expression::Max(f)
1457 | Expression::ArrayAgg(f)
1458 | Expression::CountIf(f)
1459 | Expression::Stddev(f)
1460 | Expression::StddevPop(f)
1461 | Expression::StddevSamp(f)
1462 | Expression::Variance(f)
1463 | Expression::VarPop(f)
1464 | Expression::VarSamp(f)
1465 | Expression::Median(f)
1466 | Expression::Mode(f)
1467 | Expression::First(f)
1468 | Expression::Last(f)
1469 | Expression::AnyValue(f)
1470 | Expression::ApproxDistinct(f)
1471 | Expression::ApproxCountDistinct(f)
1472 | Expression::LogicalAnd(f)
1473 | Expression::LogicalOr(f)
1474 | Expression::Skewness(f)
1475 | Expression::ArrayConcatAgg(f)
1476 | Expression::ArrayUniqueAgg(f)
1477 | Expression::BoolXorAgg(f)
1478 | Expression::BitwiseAndAgg(f)
1479 | Expression::BitwiseOrAgg(f)
1480 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1481
1482 _ => None,
1484 }
1485 }
1486
1487 pub fn set_inferred_type(&mut self, dt: DataType) {
1492 match self {
1493 Expression::And(op)
1494 | Expression::Or(op)
1495 | Expression::Add(op)
1496 | Expression::Sub(op)
1497 | Expression::Mul(op)
1498 | Expression::Div(op)
1499 | Expression::Mod(op)
1500 | Expression::Eq(op)
1501 | Expression::Neq(op)
1502 | Expression::Lt(op)
1503 | Expression::Lte(op)
1504 | Expression::Gt(op)
1505 | Expression::Gte(op)
1506 | Expression::Concat(op)
1507 | Expression::BitwiseAnd(op)
1508 | Expression::BitwiseOr(op)
1509 | Expression::BitwiseXor(op)
1510 | Expression::Adjacent(op)
1511 | Expression::TsMatch(op)
1512 | Expression::PropertyEQ(op)
1513 | Expression::ArrayContainsAll(op)
1514 | Expression::ArrayContainedBy(op)
1515 | Expression::ArrayOverlaps(op)
1516 | Expression::JSONBContainsAllTopKeys(op)
1517 | Expression::JSONBContainsAnyTopKeys(op)
1518 | Expression::JSONBDeleteAtPath(op)
1519 | Expression::ExtendsLeft(op)
1520 | Expression::ExtendsRight(op)
1521 | Expression::Is(op)
1522 | Expression::MemberOf(op)
1523 | Expression::Match(op)
1524 | Expression::NullSafeEq(op)
1525 | Expression::NullSafeNeq(op)
1526 | Expression::Glob(op)
1527 | Expression::BitwiseLeftShift(op)
1528 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1529
1530 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1531 op.inferred_type = Some(dt)
1532 }
1533
1534 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1535
1536 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1537 c.inferred_type = Some(dt)
1538 }
1539
1540 Expression::Column(c) => c.inferred_type = Some(dt),
1541 Expression::Function(f) => f.inferred_type = Some(dt),
1542 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1543 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1544 Expression::Case(c) => c.inferred_type = Some(dt),
1545 Expression::Subquery(s) => s.inferred_type = Some(dt),
1546 Expression::Alias(a) => a.inferred_type = Some(dt),
1547 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1548 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1549 Expression::Count(f) => f.inferred_type = Some(dt),
1550 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1551 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1552 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1553 Expression::SumIf(f) => f.inferred_type = Some(dt),
1554
1555 Expression::Upper(f)
1557 | Expression::Lower(f)
1558 | Expression::Length(f)
1559 | Expression::LTrim(f)
1560 | Expression::RTrim(f)
1561 | Expression::Reverse(f)
1562 | Expression::Abs(f)
1563 | Expression::Sqrt(f)
1564 | Expression::Cbrt(f)
1565 | Expression::Ln(f)
1566 | Expression::Exp(f)
1567 | Expression::Sign(f)
1568 | Expression::Date(f)
1569 | Expression::Time(f)
1570 | Expression::Initcap(f)
1571 | Expression::Ascii(f)
1572 | Expression::Chr(f)
1573 | Expression::Soundex(f)
1574 | Expression::ByteLength(f)
1575 | Expression::Hex(f)
1576 | Expression::LowerHex(f)
1577 | Expression::Unicode(f)
1578 | Expression::Typeof(f)
1579 | Expression::Explode(f)
1580 | Expression::ExplodeOuter(f)
1581 | Expression::MapFromEntries(f)
1582 | Expression::MapKeys(f)
1583 | Expression::MapValues(f)
1584 | Expression::ArrayLength(f)
1585 | Expression::ArraySize(f)
1586 | Expression::Cardinality(f)
1587 | Expression::ArrayReverse(f)
1588 | Expression::ArrayDistinct(f)
1589 | Expression::ArrayFlatten(f)
1590 | Expression::ArrayCompact(f)
1591 | Expression::ToArray(f)
1592 | Expression::JsonArrayLength(f)
1593 | Expression::JsonKeys(f)
1594 | Expression::JsonType(f)
1595 | Expression::ParseJson(f)
1596 | Expression::ToJson(f)
1597 | Expression::Radians(f)
1598 | Expression::Degrees(f)
1599 | Expression::Sin(f)
1600 | Expression::Cos(f)
1601 | Expression::Tan(f)
1602 | Expression::Asin(f)
1603 | Expression::Acos(f)
1604 | Expression::Atan(f)
1605 | Expression::IsNan(f)
1606 | Expression::IsInf(f)
1607 | Expression::Year(f)
1608 | Expression::Month(f)
1609 | Expression::Day(f)
1610 | Expression::Hour(f)
1611 | Expression::Minute(f)
1612 | Expression::Second(f)
1613 | Expression::DayOfWeek(f)
1614 | Expression::DayOfWeekIso(f)
1615 | Expression::DayOfMonth(f)
1616 | Expression::DayOfYear(f)
1617 | Expression::WeekOfYear(f)
1618 | Expression::Quarter(f)
1619 | Expression::Epoch(f)
1620 | Expression::EpochMs(f)
1621 | Expression::BitwiseCount(f)
1622 | Expression::DateFromUnixDate(f)
1623 | Expression::UnixDate(f)
1624 | Expression::UnixSeconds(f)
1625 | Expression::UnixMillis(f)
1626 | Expression::UnixMicros(f)
1627 | Expression::TimeStrToDate(f)
1628 | Expression::DateToDi(f)
1629 | Expression::DiToDate(f)
1630 | Expression::TsOrDiToDi(f)
1631 | Expression::TsOrDsToDatetime(f)
1632 | Expression::TsOrDsToTimestamp(f)
1633 | Expression::YearOfWeek(f)
1634 | Expression::YearOfWeekIso(f)
1635 | Expression::SHA(f)
1636 | Expression::SHA1Digest(f)
1637 | Expression::TimeToUnix(f)
1638 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1639
1640 Expression::Power(f)
1642 | Expression::NullIf(f)
1643 | Expression::IfNull(f)
1644 | Expression::Nvl(f)
1645 | Expression::Contains(f)
1646 | Expression::StartsWith(f)
1647 | Expression::EndsWith(f)
1648 | Expression::Levenshtein(f)
1649 | Expression::ModFunc(f)
1650 | Expression::IntDiv(f)
1651 | Expression::Atan2(f)
1652 | Expression::AddMonths(f)
1653 | Expression::MonthsBetween(f)
1654 | Expression::NextDay(f)
1655 | Expression::UnixToTimeStr(f)
1656 | Expression::ArrayContains(f)
1657 | Expression::ArrayPosition(f)
1658 | Expression::ArrayAppend(f)
1659 | Expression::ArrayPrepend(f)
1660 | Expression::ArrayUnion(f)
1661 | Expression::ArrayExcept(f)
1662 | Expression::ArrayRemove(f)
1663 | Expression::StarMap(f)
1664 | Expression::MapFromArrays(f)
1665 | Expression::MapContainsKey(f)
1666 | Expression::ElementAt(f)
1667 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1668
1669 Expression::Coalesce(f)
1671 | Expression::Greatest(f)
1672 | Expression::Least(f)
1673 | Expression::ArrayConcat(f)
1674 | Expression::ArrayIntersect(f)
1675 | Expression::ArrayZip(f)
1676 | Expression::MapConcat(f)
1677 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1678
1679 Expression::Sum(f)
1681 | Expression::Avg(f)
1682 | Expression::Min(f)
1683 | Expression::Max(f)
1684 | Expression::ArrayAgg(f)
1685 | Expression::CountIf(f)
1686 | Expression::Stddev(f)
1687 | Expression::StddevPop(f)
1688 | Expression::StddevSamp(f)
1689 | Expression::Variance(f)
1690 | Expression::VarPop(f)
1691 | Expression::VarSamp(f)
1692 | Expression::Median(f)
1693 | Expression::Mode(f)
1694 | Expression::First(f)
1695 | Expression::Last(f)
1696 | Expression::AnyValue(f)
1697 | Expression::ApproxDistinct(f)
1698 | Expression::ApproxCountDistinct(f)
1699 | Expression::LogicalAnd(f)
1700 | Expression::LogicalOr(f)
1701 | Expression::Skewness(f)
1702 | Expression::ArrayConcatAgg(f)
1703 | Expression::ArrayUniqueAgg(f)
1704 | Expression::BoolXorAgg(f)
1705 | Expression::BitwiseAndAgg(f)
1706 | Expression::BitwiseOrAgg(f)
1707 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1708
1709 _ => {}
1711 }
1712 }
1713
1714 pub fn column(name: impl Into<String>) -> Self {
1716 Expression::Column(Box::new(Column {
1717 name: Identifier::new(name),
1718 table: None,
1719 join_mark: false,
1720 trailing_comments: Vec::new(),
1721 span: None,
1722 inferred_type: None,
1723 }))
1724 }
1725
1726 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1728 Expression::Column(Box::new(Column {
1729 name: Identifier::new(column),
1730 table: Some(Identifier::new(table)),
1731 join_mark: false,
1732 trailing_comments: Vec::new(),
1733 span: None,
1734 inferred_type: None,
1735 }))
1736 }
1737
1738 pub fn identifier(name: impl Into<String>) -> Self {
1740 Expression::Identifier(Identifier::new(name))
1741 }
1742
1743 pub fn null() -> Self {
1745 Expression::Null(Null)
1746 }
1747
1748 pub fn true_() -> Self {
1750 Expression::Boolean(BooleanLiteral { value: true })
1751 }
1752
1753 pub fn false_() -> Self {
1755 Expression::Boolean(BooleanLiteral { value: false })
1756 }
1757
1758 pub fn star() -> Self {
1760 Expression::Star(Star {
1761 table: None,
1762 except: None,
1763 replace: None,
1764 rename: None,
1765 trailing_comments: Vec::new(),
1766 span: None,
1767 })
1768 }
1769
1770 pub fn alias(self, name: impl Into<String>) -> Self {
1772 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1773 }
1774
1775 pub fn is_select(&self) -> bool {
1777 matches!(self, Expression::Select(_))
1778 }
1779
1780 pub fn as_select(&self) -> Option<&Select> {
1782 match self {
1783 Expression::Select(s) => Some(s),
1784 _ => None,
1785 }
1786 }
1787
1788 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1790 match self {
1791 Expression::Select(s) => Some(s),
1792 _ => None,
1793 }
1794 }
1795
1796 pub fn sql(&self) -> String {
1801 crate::generator::Generator::sql(self).unwrap_or_default()
1802 }
1803
1804 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1810 crate::generate(self, dialect).unwrap_or_default()
1811 }
1812}
1813
1814impl Expression {
1817 pub fn variant_name(&self) -> &'static str {
1820 match self {
1821 Expression::Literal(_) => "literal",
1822 Expression::Boolean(_) => "boolean",
1823 Expression::Null(_) => "null",
1824 Expression::Identifier(_) => "identifier",
1825 Expression::Column(_) => "column",
1826 Expression::Table(_) => "table",
1827 Expression::Star(_) => "star",
1828 Expression::BracedWildcard(_) => "braced_wildcard",
1829 Expression::Select(_) => "select",
1830 Expression::Union(_) => "union",
1831 Expression::Intersect(_) => "intersect",
1832 Expression::Except(_) => "except",
1833 Expression::Subquery(_) => "subquery",
1834 Expression::PipeOperator(_) => "pipe_operator",
1835 Expression::Pivot(_) => "pivot",
1836 Expression::PivotAlias(_) => "pivot_alias",
1837 Expression::Unpivot(_) => "unpivot",
1838 Expression::Values(_) => "values",
1839 Expression::PreWhere(_) => "pre_where",
1840 Expression::Stream(_) => "stream",
1841 Expression::UsingData(_) => "using_data",
1842 Expression::XmlNamespace(_) => "xml_namespace",
1843 Expression::Insert(_) => "insert",
1844 Expression::Update(_) => "update",
1845 Expression::Delete(_) => "delete",
1846 Expression::Copy(_) => "copy",
1847 Expression::Put(_) => "put",
1848 Expression::StageReference(_) => "stage_reference",
1849 Expression::Alias(_) => "alias",
1850 Expression::Cast(_) => "cast",
1851 Expression::Collation(_) => "collation",
1852 Expression::Case(_) => "case",
1853 Expression::And(_) => "and",
1854 Expression::Or(_) => "or",
1855 Expression::Add(_) => "add",
1856 Expression::Sub(_) => "sub",
1857 Expression::Mul(_) => "mul",
1858 Expression::Div(_) => "div",
1859 Expression::Mod(_) => "mod",
1860 Expression::Eq(_) => "eq",
1861 Expression::Neq(_) => "neq",
1862 Expression::Lt(_) => "lt",
1863 Expression::Lte(_) => "lte",
1864 Expression::Gt(_) => "gt",
1865 Expression::Gte(_) => "gte",
1866 Expression::Like(_) => "like",
1867 Expression::ILike(_) => "i_like",
1868 Expression::Match(_) => "match",
1869 Expression::BitwiseAnd(_) => "bitwise_and",
1870 Expression::BitwiseOr(_) => "bitwise_or",
1871 Expression::BitwiseXor(_) => "bitwise_xor",
1872 Expression::Concat(_) => "concat",
1873 Expression::Adjacent(_) => "adjacent",
1874 Expression::TsMatch(_) => "ts_match",
1875 Expression::PropertyEQ(_) => "property_e_q",
1876 Expression::ArrayContainsAll(_) => "array_contains_all",
1877 Expression::ArrayContainedBy(_) => "array_contained_by",
1878 Expression::ArrayOverlaps(_) => "array_overlaps",
1879 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1880 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1881 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1882 Expression::ExtendsLeft(_) => "extends_left",
1883 Expression::ExtendsRight(_) => "extends_right",
1884 Expression::Not(_) => "not",
1885 Expression::Neg(_) => "neg",
1886 Expression::BitwiseNot(_) => "bitwise_not",
1887 Expression::In(_) => "in",
1888 Expression::Between(_) => "between",
1889 Expression::IsNull(_) => "is_null",
1890 Expression::IsTrue(_) => "is_true",
1891 Expression::IsFalse(_) => "is_false",
1892 Expression::IsJson(_) => "is_json",
1893 Expression::Is(_) => "is",
1894 Expression::Exists(_) => "exists",
1895 Expression::MemberOf(_) => "member_of",
1896 Expression::Function(_) => "function",
1897 Expression::AggregateFunction(_) => "aggregate_function",
1898 Expression::WindowFunction(_) => "window_function",
1899 Expression::From(_) => "from",
1900 Expression::Join(_) => "join",
1901 Expression::JoinedTable(_) => "joined_table",
1902 Expression::Where(_) => "where",
1903 Expression::GroupBy(_) => "group_by",
1904 Expression::Having(_) => "having",
1905 Expression::OrderBy(_) => "order_by",
1906 Expression::Limit(_) => "limit",
1907 Expression::Offset(_) => "offset",
1908 Expression::Qualify(_) => "qualify",
1909 Expression::With(_) => "with",
1910 Expression::Cte(_) => "cte",
1911 Expression::DistributeBy(_) => "distribute_by",
1912 Expression::ClusterBy(_) => "cluster_by",
1913 Expression::SortBy(_) => "sort_by",
1914 Expression::LateralView(_) => "lateral_view",
1915 Expression::Hint(_) => "hint",
1916 Expression::Pseudocolumn(_) => "pseudocolumn",
1917 Expression::Connect(_) => "connect",
1918 Expression::Prior(_) => "prior",
1919 Expression::ConnectByRoot(_) => "connect_by_root",
1920 Expression::MatchRecognize(_) => "match_recognize",
1921 Expression::Ordered(_) => "ordered",
1922 Expression::Window(_) => "window",
1923 Expression::Over(_) => "over",
1924 Expression::WithinGroup(_) => "within_group",
1925 Expression::DataType(_) => "data_type",
1926 Expression::Array(_) => "array",
1927 Expression::Struct(_) => "struct",
1928 Expression::Tuple(_) => "tuple",
1929 Expression::Interval(_) => "interval",
1930 Expression::ConcatWs(_) => "concat_ws",
1931 Expression::Substring(_) => "substring",
1932 Expression::Upper(_) => "upper",
1933 Expression::Lower(_) => "lower",
1934 Expression::Length(_) => "length",
1935 Expression::Trim(_) => "trim",
1936 Expression::LTrim(_) => "l_trim",
1937 Expression::RTrim(_) => "r_trim",
1938 Expression::Replace(_) => "replace",
1939 Expression::Reverse(_) => "reverse",
1940 Expression::Left(_) => "left",
1941 Expression::Right(_) => "right",
1942 Expression::Repeat(_) => "repeat",
1943 Expression::Lpad(_) => "lpad",
1944 Expression::Rpad(_) => "rpad",
1945 Expression::Split(_) => "split",
1946 Expression::RegexpLike(_) => "regexp_like",
1947 Expression::RegexpReplace(_) => "regexp_replace",
1948 Expression::RegexpExtract(_) => "regexp_extract",
1949 Expression::Overlay(_) => "overlay",
1950 Expression::Abs(_) => "abs",
1951 Expression::Round(_) => "round",
1952 Expression::Floor(_) => "floor",
1953 Expression::Ceil(_) => "ceil",
1954 Expression::Power(_) => "power",
1955 Expression::Sqrt(_) => "sqrt",
1956 Expression::Cbrt(_) => "cbrt",
1957 Expression::Ln(_) => "ln",
1958 Expression::Log(_) => "log",
1959 Expression::Exp(_) => "exp",
1960 Expression::Sign(_) => "sign",
1961 Expression::Greatest(_) => "greatest",
1962 Expression::Least(_) => "least",
1963 Expression::CurrentDate(_) => "current_date",
1964 Expression::CurrentTime(_) => "current_time",
1965 Expression::CurrentTimestamp(_) => "current_timestamp",
1966 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1967 Expression::AtTimeZone(_) => "at_time_zone",
1968 Expression::DateAdd(_) => "date_add",
1969 Expression::DateSub(_) => "date_sub",
1970 Expression::DateDiff(_) => "date_diff",
1971 Expression::DateTrunc(_) => "date_trunc",
1972 Expression::Extract(_) => "extract",
1973 Expression::ToDate(_) => "to_date",
1974 Expression::ToTimestamp(_) => "to_timestamp",
1975 Expression::Date(_) => "date",
1976 Expression::Time(_) => "time",
1977 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1978 Expression::UnixDate(_) => "unix_date",
1979 Expression::UnixSeconds(_) => "unix_seconds",
1980 Expression::UnixMillis(_) => "unix_millis",
1981 Expression::UnixMicros(_) => "unix_micros",
1982 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1983 Expression::TimeStrToDate(_) => "time_str_to_date",
1984 Expression::DateToDi(_) => "date_to_di",
1985 Expression::DiToDate(_) => "di_to_date",
1986 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1987 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1988 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1989 Expression::YearOfWeek(_) => "year_of_week",
1990 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1991 Expression::Coalesce(_) => "coalesce",
1992 Expression::NullIf(_) => "null_if",
1993 Expression::IfFunc(_) => "if_func",
1994 Expression::IfNull(_) => "if_null",
1995 Expression::Nvl(_) => "nvl",
1996 Expression::Nvl2(_) => "nvl2",
1997 Expression::TryCast(_) => "try_cast",
1998 Expression::SafeCast(_) => "safe_cast",
1999 Expression::Count(_) => "count",
2000 Expression::Sum(_) => "sum",
2001 Expression::Avg(_) => "avg",
2002 Expression::Min(_) => "min",
2003 Expression::Max(_) => "max",
2004 Expression::GroupConcat(_) => "group_concat",
2005 Expression::StringAgg(_) => "string_agg",
2006 Expression::ListAgg(_) => "list_agg",
2007 Expression::ArrayAgg(_) => "array_agg",
2008 Expression::CountIf(_) => "count_if",
2009 Expression::SumIf(_) => "sum_if",
2010 Expression::Stddev(_) => "stddev",
2011 Expression::StddevPop(_) => "stddev_pop",
2012 Expression::StddevSamp(_) => "stddev_samp",
2013 Expression::Variance(_) => "variance",
2014 Expression::VarPop(_) => "var_pop",
2015 Expression::VarSamp(_) => "var_samp",
2016 Expression::Median(_) => "median",
2017 Expression::Mode(_) => "mode",
2018 Expression::First(_) => "first",
2019 Expression::Last(_) => "last",
2020 Expression::AnyValue(_) => "any_value",
2021 Expression::ApproxDistinct(_) => "approx_distinct",
2022 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2023 Expression::ApproxPercentile(_) => "approx_percentile",
2024 Expression::Percentile(_) => "percentile",
2025 Expression::LogicalAnd(_) => "logical_and",
2026 Expression::LogicalOr(_) => "logical_or",
2027 Expression::Skewness(_) => "skewness",
2028 Expression::BitwiseCount(_) => "bitwise_count",
2029 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2030 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2031 Expression::BoolXorAgg(_) => "bool_xor_agg",
2032 Expression::RowNumber(_) => "row_number",
2033 Expression::Rank(_) => "rank",
2034 Expression::DenseRank(_) => "dense_rank",
2035 Expression::NTile(_) => "n_tile",
2036 Expression::Lead(_) => "lead",
2037 Expression::Lag(_) => "lag",
2038 Expression::FirstValue(_) => "first_value",
2039 Expression::LastValue(_) => "last_value",
2040 Expression::NthValue(_) => "nth_value",
2041 Expression::PercentRank(_) => "percent_rank",
2042 Expression::CumeDist(_) => "cume_dist",
2043 Expression::PercentileCont(_) => "percentile_cont",
2044 Expression::PercentileDisc(_) => "percentile_disc",
2045 Expression::Contains(_) => "contains",
2046 Expression::StartsWith(_) => "starts_with",
2047 Expression::EndsWith(_) => "ends_with",
2048 Expression::Position(_) => "position",
2049 Expression::Initcap(_) => "initcap",
2050 Expression::Ascii(_) => "ascii",
2051 Expression::Chr(_) => "chr",
2052 Expression::CharFunc(_) => "char_func",
2053 Expression::Soundex(_) => "soundex",
2054 Expression::Levenshtein(_) => "levenshtein",
2055 Expression::ByteLength(_) => "byte_length",
2056 Expression::Hex(_) => "hex",
2057 Expression::LowerHex(_) => "lower_hex",
2058 Expression::Unicode(_) => "unicode",
2059 Expression::ModFunc(_) => "mod_func",
2060 Expression::Random(_) => "random",
2061 Expression::Rand(_) => "rand",
2062 Expression::TruncFunc(_) => "trunc_func",
2063 Expression::Pi(_) => "pi",
2064 Expression::Radians(_) => "radians",
2065 Expression::Degrees(_) => "degrees",
2066 Expression::Sin(_) => "sin",
2067 Expression::Cos(_) => "cos",
2068 Expression::Tan(_) => "tan",
2069 Expression::Asin(_) => "asin",
2070 Expression::Acos(_) => "acos",
2071 Expression::Atan(_) => "atan",
2072 Expression::Atan2(_) => "atan2",
2073 Expression::IsNan(_) => "is_nan",
2074 Expression::IsInf(_) => "is_inf",
2075 Expression::IntDiv(_) => "int_div",
2076 Expression::Decode(_) => "decode",
2077 Expression::DateFormat(_) => "date_format",
2078 Expression::FormatDate(_) => "format_date",
2079 Expression::Year(_) => "year",
2080 Expression::Month(_) => "month",
2081 Expression::Day(_) => "day",
2082 Expression::Hour(_) => "hour",
2083 Expression::Minute(_) => "minute",
2084 Expression::Second(_) => "second",
2085 Expression::DayOfWeek(_) => "day_of_week",
2086 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2087 Expression::DayOfMonth(_) => "day_of_month",
2088 Expression::DayOfYear(_) => "day_of_year",
2089 Expression::WeekOfYear(_) => "week_of_year",
2090 Expression::Quarter(_) => "quarter",
2091 Expression::AddMonths(_) => "add_months",
2092 Expression::MonthsBetween(_) => "months_between",
2093 Expression::LastDay(_) => "last_day",
2094 Expression::NextDay(_) => "next_day",
2095 Expression::Epoch(_) => "epoch",
2096 Expression::EpochMs(_) => "epoch_ms",
2097 Expression::FromUnixtime(_) => "from_unixtime",
2098 Expression::UnixTimestamp(_) => "unix_timestamp",
2099 Expression::MakeDate(_) => "make_date",
2100 Expression::MakeTimestamp(_) => "make_timestamp",
2101 Expression::TimestampTrunc(_) => "timestamp_trunc",
2102 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2103 Expression::SessionUser(_) => "session_user",
2104 Expression::SHA(_) => "s_h_a",
2105 Expression::SHA1Digest(_) => "s_h_a1_digest",
2106 Expression::TimeToUnix(_) => "time_to_unix",
2107 Expression::ArrayFunc(_) => "array_func",
2108 Expression::ArrayLength(_) => "array_length",
2109 Expression::ArraySize(_) => "array_size",
2110 Expression::Cardinality(_) => "cardinality",
2111 Expression::ArrayContains(_) => "array_contains",
2112 Expression::ArrayPosition(_) => "array_position",
2113 Expression::ArrayAppend(_) => "array_append",
2114 Expression::ArrayPrepend(_) => "array_prepend",
2115 Expression::ArrayConcat(_) => "array_concat",
2116 Expression::ArraySort(_) => "array_sort",
2117 Expression::ArrayReverse(_) => "array_reverse",
2118 Expression::ArrayDistinct(_) => "array_distinct",
2119 Expression::ArrayJoin(_) => "array_join",
2120 Expression::ArrayToString(_) => "array_to_string",
2121 Expression::Unnest(_) => "unnest",
2122 Expression::Explode(_) => "explode",
2123 Expression::ExplodeOuter(_) => "explode_outer",
2124 Expression::ArrayFilter(_) => "array_filter",
2125 Expression::ArrayTransform(_) => "array_transform",
2126 Expression::ArrayFlatten(_) => "array_flatten",
2127 Expression::ArrayCompact(_) => "array_compact",
2128 Expression::ArrayIntersect(_) => "array_intersect",
2129 Expression::ArrayUnion(_) => "array_union",
2130 Expression::ArrayExcept(_) => "array_except",
2131 Expression::ArrayRemove(_) => "array_remove",
2132 Expression::ArrayZip(_) => "array_zip",
2133 Expression::Sequence(_) => "sequence",
2134 Expression::Generate(_) => "generate",
2135 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2136 Expression::ToArray(_) => "to_array",
2137 Expression::StarMap(_) => "star_map",
2138 Expression::StructFunc(_) => "struct_func",
2139 Expression::StructExtract(_) => "struct_extract",
2140 Expression::NamedStruct(_) => "named_struct",
2141 Expression::MapFunc(_) => "map_func",
2142 Expression::MapFromEntries(_) => "map_from_entries",
2143 Expression::MapFromArrays(_) => "map_from_arrays",
2144 Expression::MapKeys(_) => "map_keys",
2145 Expression::MapValues(_) => "map_values",
2146 Expression::MapContainsKey(_) => "map_contains_key",
2147 Expression::MapConcat(_) => "map_concat",
2148 Expression::ElementAt(_) => "element_at",
2149 Expression::TransformKeys(_) => "transform_keys",
2150 Expression::TransformValues(_) => "transform_values",
2151 Expression::FunctionEmits(_) => "function_emits",
2152 Expression::JsonExtract(_) => "json_extract",
2153 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2154 Expression::JsonExtractPath(_) => "json_extract_path",
2155 Expression::JsonArray(_) => "json_array",
2156 Expression::JsonObject(_) => "json_object",
2157 Expression::JsonQuery(_) => "json_query",
2158 Expression::JsonValue(_) => "json_value",
2159 Expression::JsonArrayLength(_) => "json_array_length",
2160 Expression::JsonKeys(_) => "json_keys",
2161 Expression::JsonType(_) => "json_type",
2162 Expression::ParseJson(_) => "parse_json",
2163 Expression::ToJson(_) => "to_json",
2164 Expression::JsonSet(_) => "json_set",
2165 Expression::JsonInsert(_) => "json_insert",
2166 Expression::JsonRemove(_) => "json_remove",
2167 Expression::JsonMergePatch(_) => "json_merge_patch",
2168 Expression::JsonArrayAgg(_) => "json_array_agg",
2169 Expression::JsonObjectAgg(_) => "json_object_agg",
2170 Expression::Convert(_) => "convert",
2171 Expression::Typeof(_) => "typeof",
2172 Expression::Lambda(_) => "lambda",
2173 Expression::Parameter(_) => "parameter",
2174 Expression::Placeholder(_) => "placeholder",
2175 Expression::NamedArgument(_) => "named_argument",
2176 Expression::TableArgument(_) => "table_argument",
2177 Expression::SqlComment(_) => "sql_comment",
2178 Expression::NullSafeEq(_) => "null_safe_eq",
2179 Expression::NullSafeNeq(_) => "null_safe_neq",
2180 Expression::Glob(_) => "glob",
2181 Expression::SimilarTo(_) => "similar_to",
2182 Expression::Any(_) => "any",
2183 Expression::All(_) => "all",
2184 Expression::Overlaps(_) => "overlaps",
2185 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2186 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2187 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2188 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2189 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2190 Expression::Subscript(_) => "subscript",
2191 Expression::Dot(_) => "dot",
2192 Expression::MethodCall(_) => "method_call",
2193 Expression::ArraySlice(_) => "array_slice",
2194 Expression::CreateTable(_) => "create_table",
2195 Expression::DropTable(_) => "drop_table",
2196 Expression::Undrop(_) => "undrop",
2197 Expression::AlterTable(_) => "alter_table",
2198 Expression::CreateIndex(_) => "create_index",
2199 Expression::DropIndex(_) => "drop_index",
2200 Expression::CreateView(_) => "create_view",
2201 Expression::DropView(_) => "drop_view",
2202 Expression::AlterView(_) => "alter_view",
2203 Expression::AlterIndex(_) => "alter_index",
2204 Expression::Truncate(_) => "truncate",
2205 Expression::Use(_) => "use",
2206 Expression::Cache(_) => "cache",
2207 Expression::Uncache(_) => "uncache",
2208 Expression::LoadData(_) => "load_data",
2209 Expression::Pragma(_) => "pragma",
2210 Expression::Grant(_) => "grant",
2211 Expression::Revoke(_) => "revoke",
2212 Expression::Comment(_) => "comment",
2213 Expression::SetStatement(_) => "set_statement",
2214 Expression::CreateSchema(_) => "create_schema",
2215 Expression::DropSchema(_) => "drop_schema",
2216 Expression::DropNamespace(_) => "drop_namespace",
2217 Expression::CreateDatabase(_) => "create_database",
2218 Expression::DropDatabase(_) => "drop_database",
2219 Expression::CreateFunction(_) => "create_function",
2220 Expression::DropFunction(_) => "drop_function",
2221 Expression::CreateProcedure(_) => "create_procedure",
2222 Expression::DropProcedure(_) => "drop_procedure",
2223 Expression::CreateSequence(_) => "create_sequence",
2224 Expression::CreateSynonym(_) => "create_synonym",
2225 Expression::DropSequence(_) => "drop_sequence",
2226 Expression::AlterSequence(_) => "alter_sequence",
2227 Expression::CreateTrigger(_) => "create_trigger",
2228 Expression::DropTrigger(_) => "drop_trigger",
2229 Expression::CreateType(_) => "create_type",
2230 Expression::DropType(_) => "drop_type",
2231 Expression::Describe(_) => "describe",
2232 Expression::Show(_) => "show",
2233 Expression::Command(_) => "command",
2234 Expression::TryCatch(_) => "try_catch",
2235 Expression::Kill(_) => "kill",
2236 Expression::Execute(_) => "execute",
2237 Expression::Raw(_) => "raw",
2238 Expression::CreateTask(_) => "create_task",
2239 Expression::Paren(_) => "paren",
2240 Expression::Annotated(_) => "annotated",
2241 Expression::Refresh(_) => "refresh",
2242 Expression::LockingStatement(_) => "locking_statement",
2243 Expression::SequenceProperties(_) => "sequence_properties",
2244 Expression::TruncateTable(_) => "truncate_table",
2245 Expression::Clone(_) => "clone",
2246 Expression::Attach(_) => "attach",
2247 Expression::Detach(_) => "detach",
2248 Expression::Install(_) => "install",
2249 Expression::Summarize(_) => "summarize",
2250 Expression::Declare(_) => "declare",
2251 Expression::DeclareItem(_) => "declare_item",
2252 Expression::Set(_) => "set",
2253 Expression::Heredoc(_) => "heredoc",
2254 Expression::SetItem(_) => "set_item",
2255 Expression::QueryBand(_) => "query_band",
2256 Expression::UserDefinedFunction(_) => "user_defined_function",
2257 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2258 Expression::ProjectionDef(_) => "projection_def",
2259 Expression::TableAlias(_) => "table_alias",
2260 Expression::ByteString(_) => "byte_string",
2261 Expression::HexStringExpr(_) => "hex_string_expr",
2262 Expression::UnicodeString(_) => "unicode_string",
2263 Expression::ColumnPosition(_) => "column_position",
2264 Expression::ColumnDef(_) => "column_def",
2265 Expression::AlterColumn(_) => "alter_column",
2266 Expression::AlterSortKey(_) => "alter_sort_key",
2267 Expression::AlterSet(_) => "alter_set",
2268 Expression::RenameColumn(_) => "rename_column",
2269 Expression::Comprehension(_) => "comprehension",
2270 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2271 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2272 Expression::IndexConstraintOption(_) => "index_constraint_option",
2273 Expression::ColumnConstraint(_) => "column_constraint",
2274 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2275 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2276 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2277 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2278 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2279 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2280 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2281 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2282 Expression::WithOperator(_) => "with_operator",
2283 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2284 "generated_as_identity_column_constraint"
2285 }
2286 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2287 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2288 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2289 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2290 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2291 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2292 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2293 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2294 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2295 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2296 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2297 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2298 Expression::PathColumnConstraint(_) => "path_column_constraint",
2299 Expression::Constraint(_) => "constraint",
2300 Expression::Export(_) => "export",
2301 Expression::Filter(_) => "filter",
2302 Expression::Changes(_) => "changes",
2303 Expression::CopyParameter(_) => "copy_parameter",
2304 Expression::Credentials(_) => "credentials",
2305 Expression::Directory(_) => "directory",
2306 Expression::ForeignKey(_) => "foreign_key",
2307 Expression::ColumnPrefix(_) => "column_prefix",
2308 Expression::PrimaryKey(_) => "primary_key",
2309 Expression::IntoClause(_) => "into_clause",
2310 Expression::JoinHint(_) => "join_hint",
2311 Expression::Opclass(_) => "opclass",
2312 Expression::Index(_) => "index",
2313 Expression::IndexParameters(_) => "index_parameters",
2314 Expression::ConditionalInsert(_) => "conditional_insert",
2315 Expression::MultitableInserts(_) => "multitable_inserts",
2316 Expression::OnConflict(_) => "on_conflict",
2317 Expression::OnCondition(_) => "on_condition",
2318 Expression::Returning(_) => "returning",
2319 Expression::Introducer(_) => "introducer",
2320 Expression::PartitionRange(_) => "partition_range",
2321 Expression::Fetch(_) => "fetch",
2322 Expression::Group(_) => "group",
2323 Expression::Cube(_) => "cube",
2324 Expression::Rollup(_) => "rollup",
2325 Expression::GroupingSets(_) => "grouping_sets",
2326 Expression::LimitOptions(_) => "limit_options",
2327 Expression::Lateral(_) => "lateral",
2328 Expression::TableFromRows(_) => "table_from_rows",
2329 Expression::RowsFrom(_) => "rows_from",
2330 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2331 Expression::WithFill(_) => "with_fill",
2332 Expression::Property(_) => "property",
2333 Expression::GrantPrivilege(_) => "grant_privilege",
2334 Expression::GrantPrincipal(_) => "grant_principal",
2335 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2336 Expression::AlgorithmProperty(_) => "algorithm_property",
2337 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2338 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2339 Expression::BackupProperty(_) => "backup_property",
2340 Expression::BuildProperty(_) => "build_property",
2341 Expression::BlockCompressionProperty(_) => "block_compression_property",
2342 Expression::CharacterSetProperty(_) => "character_set_property",
2343 Expression::ChecksumProperty(_) => "checksum_property",
2344 Expression::CollateProperty(_) => "collate_property",
2345 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2346 Expression::DataDeletionProperty(_) => "data_deletion_property",
2347 Expression::DefinerProperty(_) => "definer_property",
2348 Expression::DistKeyProperty(_) => "dist_key_property",
2349 Expression::DistributedByProperty(_) => "distributed_by_property",
2350 Expression::DistStyleProperty(_) => "dist_style_property",
2351 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2352 Expression::EngineProperty(_) => "engine_property",
2353 Expression::ToTableProperty(_) => "to_table_property",
2354 Expression::ExecuteAsProperty(_) => "execute_as_property",
2355 Expression::ExternalProperty(_) => "external_property",
2356 Expression::FallbackProperty(_) => "fallback_property",
2357 Expression::FileFormatProperty(_) => "file_format_property",
2358 Expression::CredentialsProperty(_) => "credentials_property",
2359 Expression::FreespaceProperty(_) => "freespace_property",
2360 Expression::InheritsProperty(_) => "inherits_property",
2361 Expression::InputModelProperty(_) => "input_model_property",
2362 Expression::OutputModelProperty(_) => "output_model_property",
2363 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2364 Expression::JournalProperty(_) => "journal_property",
2365 Expression::LanguageProperty(_) => "language_property",
2366 Expression::EnviromentProperty(_) => "enviroment_property",
2367 Expression::ClusteredByProperty(_) => "clustered_by_property",
2368 Expression::DictProperty(_) => "dict_property",
2369 Expression::DictRange(_) => "dict_range",
2370 Expression::OnCluster(_) => "on_cluster",
2371 Expression::LikeProperty(_) => "like_property",
2372 Expression::LocationProperty(_) => "location_property",
2373 Expression::LockProperty(_) => "lock_property",
2374 Expression::LockingProperty(_) => "locking_property",
2375 Expression::LogProperty(_) => "log_property",
2376 Expression::MaterializedProperty(_) => "materialized_property",
2377 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2378 Expression::OnProperty(_) => "on_property",
2379 Expression::OnCommitProperty(_) => "on_commit_property",
2380 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2381 Expression::PartitionByProperty(_) => "partition_by_property",
2382 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2383 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2384 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2385 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2386 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2387 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2388 Expression::PartitionList(_) => "partition_list",
2389 Expression::Partition(_) => "partition",
2390 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2391 Expression::UniqueKeyProperty(_) => "unique_key_property",
2392 Expression::RollupProperty(_) => "rollup_property",
2393 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2394 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2395 Expression::RemoteWithConnectionModelProperty(_) => {
2396 "remote_with_connection_model_property"
2397 }
2398 Expression::ReturnsProperty(_) => "returns_property",
2399 Expression::RowFormatProperty(_) => "row_format_property",
2400 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2401 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2402 Expression::QueryTransform(_) => "query_transform",
2403 Expression::SampleProperty(_) => "sample_property",
2404 Expression::SecurityProperty(_) => "security_property",
2405 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2406 Expression::SemanticView(_) => "semantic_view",
2407 Expression::SerdeProperties(_) => "serde_properties",
2408 Expression::SetProperty(_) => "set_property",
2409 Expression::SharingProperty(_) => "sharing_property",
2410 Expression::SetConfigProperty(_) => "set_config_property",
2411 Expression::SettingsProperty(_) => "settings_property",
2412 Expression::SortKeyProperty(_) => "sort_key_property",
2413 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2414 Expression::SqlSecurityProperty(_) => "sql_security_property",
2415 Expression::StabilityProperty(_) => "stability_property",
2416 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2417 Expression::TemporaryProperty(_) => "temporary_property",
2418 Expression::Tags(_) => "tags",
2419 Expression::TransformModelProperty(_) => "transform_model_property",
2420 Expression::TransientProperty(_) => "transient_property",
2421 Expression::UsingTemplateProperty(_) => "using_template_property",
2422 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2423 Expression::VolatileProperty(_) => "volatile_property",
2424 Expression::WithDataProperty(_) => "with_data_property",
2425 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2426 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2427 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2428 Expression::WithProcedureOptions(_) => "with_procedure_options",
2429 Expression::EncodeProperty(_) => "encode_property",
2430 Expression::IncludeProperty(_) => "include_property",
2431 Expression::Properties(_) => "properties",
2432 Expression::OptionsProperty(_) => "options_property",
2433 Expression::InputOutputFormat(_) => "input_output_format",
2434 Expression::Reference(_) => "reference",
2435 Expression::QueryOption(_) => "query_option",
2436 Expression::WithTableHint(_) => "with_table_hint",
2437 Expression::IndexTableHint(_) => "index_table_hint",
2438 Expression::HistoricalData(_) => "historical_data",
2439 Expression::Get(_) => "get",
2440 Expression::SetOperation(_) => "set_operation",
2441 Expression::Var(_) => "var",
2442 Expression::Variadic(_) => "variadic",
2443 Expression::Version(_) => "version",
2444 Expression::Schema(_) => "schema",
2445 Expression::Lock(_) => "lock",
2446 Expression::TableSample(_) => "table_sample",
2447 Expression::Tag(_) => "tag",
2448 Expression::UnpivotColumns(_) => "unpivot_columns",
2449 Expression::WindowSpec(_) => "window_spec",
2450 Expression::SessionParameter(_) => "session_parameter",
2451 Expression::PseudoType(_) => "pseudo_type",
2452 Expression::ObjectIdentifier(_) => "object_identifier",
2453 Expression::Transaction(_) => "transaction",
2454 Expression::Commit(_) => "commit",
2455 Expression::Rollback(_) => "rollback",
2456 Expression::AlterSession(_) => "alter_session",
2457 Expression::Analyze(_) => "analyze",
2458 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2459 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2460 Expression::AnalyzeSample(_) => "analyze_sample",
2461 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2462 Expression::AnalyzeDelete(_) => "analyze_delete",
2463 Expression::AnalyzeWith(_) => "analyze_with",
2464 Expression::AnalyzeValidate(_) => "analyze_validate",
2465 Expression::AddPartition(_) => "add_partition",
2466 Expression::AttachOption(_) => "attach_option",
2467 Expression::DropPartition(_) => "drop_partition",
2468 Expression::ReplacePartition(_) => "replace_partition",
2469 Expression::DPipe(_) => "d_pipe",
2470 Expression::Operator(_) => "operator",
2471 Expression::PivotAny(_) => "pivot_any",
2472 Expression::Aliases(_) => "aliases",
2473 Expression::AtIndex(_) => "at_index",
2474 Expression::FromTimeZone(_) => "from_time_zone",
2475 Expression::FormatPhrase(_) => "format_phrase",
2476 Expression::ForIn(_) => "for_in",
2477 Expression::TimeUnit(_) => "time_unit",
2478 Expression::IntervalOp(_) => "interval_op",
2479 Expression::IntervalSpan(_) => "interval_span",
2480 Expression::HavingMax(_) => "having_max",
2481 Expression::CosineDistance(_) => "cosine_distance",
2482 Expression::DotProduct(_) => "dot_product",
2483 Expression::EuclideanDistance(_) => "euclidean_distance",
2484 Expression::ManhattanDistance(_) => "manhattan_distance",
2485 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2486 Expression::Booland(_) => "booland",
2487 Expression::Boolor(_) => "boolor",
2488 Expression::ParameterizedAgg(_) => "parameterized_agg",
2489 Expression::ArgMax(_) => "arg_max",
2490 Expression::ArgMin(_) => "arg_min",
2491 Expression::ApproxTopK(_) => "approx_top_k",
2492 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2493 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2494 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2495 Expression::ApproxTopSum(_) => "approx_top_sum",
2496 Expression::ApproxQuantiles(_) => "approx_quantiles",
2497 Expression::Minhash(_) => "minhash",
2498 Expression::FarmFingerprint(_) => "farm_fingerprint",
2499 Expression::Float64(_) => "float64",
2500 Expression::Transform(_) => "transform",
2501 Expression::Translate(_) => "translate",
2502 Expression::Grouping(_) => "grouping",
2503 Expression::GroupingId(_) => "grouping_id",
2504 Expression::Anonymous(_) => "anonymous",
2505 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2506 Expression::CombinedAggFunc(_) => "combined_agg_func",
2507 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2508 Expression::HashAgg(_) => "hash_agg",
2509 Expression::Hll(_) => "hll",
2510 Expression::Apply(_) => "apply",
2511 Expression::ToBoolean(_) => "to_boolean",
2512 Expression::List(_) => "list",
2513 Expression::ToMap(_) => "to_map",
2514 Expression::Pad(_) => "pad",
2515 Expression::ToChar(_) => "to_char",
2516 Expression::ToNumber(_) => "to_number",
2517 Expression::ToDouble(_) => "to_double",
2518 Expression::Int64(_) => "int64",
2519 Expression::StringFunc(_) => "string_func",
2520 Expression::ToDecfloat(_) => "to_decfloat",
2521 Expression::TryToDecfloat(_) => "try_to_decfloat",
2522 Expression::ToFile(_) => "to_file",
2523 Expression::Columns(_) => "columns",
2524 Expression::ConvertToCharset(_) => "convert_to_charset",
2525 Expression::ConvertTimezone(_) => "convert_timezone",
2526 Expression::GenerateSeries(_) => "generate_series",
2527 Expression::AIAgg(_) => "a_i_agg",
2528 Expression::AIClassify(_) => "a_i_classify",
2529 Expression::ArrayAll(_) => "array_all",
2530 Expression::ArrayAny(_) => "array_any",
2531 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2532 Expression::StPoint(_) => "st_point",
2533 Expression::StDistance(_) => "st_distance",
2534 Expression::StringToArray(_) => "string_to_array",
2535 Expression::ArraySum(_) => "array_sum",
2536 Expression::ObjectAgg(_) => "object_agg",
2537 Expression::CastToStrType(_) => "cast_to_str_type",
2538 Expression::CheckJson(_) => "check_json",
2539 Expression::CheckXml(_) => "check_xml",
2540 Expression::TranslateCharacters(_) => "translate_characters",
2541 Expression::CurrentSchemas(_) => "current_schemas",
2542 Expression::CurrentDatetime(_) => "current_datetime",
2543 Expression::Localtime(_) => "localtime",
2544 Expression::Localtimestamp(_) => "localtimestamp",
2545 Expression::Systimestamp(_) => "systimestamp",
2546 Expression::CurrentSchema(_) => "current_schema",
2547 Expression::CurrentUser(_) => "current_user",
2548 Expression::UtcTime(_) => "utc_time",
2549 Expression::UtcTimestamp(_) => "utc_timestamp",
2550 Expression::Timestamp(_) => "timestamp",
2551 Expression::DateBin(_) => "date_bin",
2552 Expression::Datetime(_) => "datetime",
2553 Expression::DatetimeAdd(_) => "datetime_add",
2554 Expression::DatetimeSub(_) => "datetime_sub",
2555 Expression::DatetimeDiff(_) => "datetime_diff",
2556 Expression::DatetimeTrunc(_) => "datetime_trunc",
2557 Expression::Dayname(_) => "dayname",
2558 Expression::MakeInterval(_) => "make_interval",
2559 Expression::PreviousDay(_) => "previous_day",
2560 Expression::Elt(_) => "elt",
2561 Expression::TimestampAdd(_) => "timestamp_add",
2562 Expression::TimestampSub(_) => "timestamp_sub",
2563 Expression::TimestampDiff(_) => "timestamp_diff",
2564 Expression::TimeSlice(_) => "time_slice",
2565 Expression::TimeAdd(_) => "time_add",
2566 Expression::TimeSub(_) => "time_sub",
2567 Expression::TimeDiff(_) => "time_diff",
2568 Expression::TimeTrunc(_) => "time_trunc",
2569 Expression::DateFromParts(_) => "date_from_parts",
2570 Expression::TimeFromParts(_) => "time_from_parts",
2571 Expression::DecodeCase(_) => "decode_case",
2572 Expression::Decrypt(_) => "decrypt",
2573 Expression::DecryptRaw(_) => "decrypt_raw",
2574 Expression::Encode(_) => "encode",
2575 Expression::Encrypt(_) => "encrypt",
2576 Expression::EncryptRaw(_) => "encrypt_raw",
2577 Expression::EqualNull(_) => "equal_null",
2578 Expression::ToBinary(_) => "to_binary",
2579 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2580 Expression::Base64DecodeString(_) => "base64_decode_string",
2581 Expression::Base64Encode(_) => "base64_encode",
2582 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2583 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2584 Expression::GapFill(_) => "gap_fill",
2585 Expression::GenerateDateArray(_) => "generate_date_array",
2586 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2587 Expression::GetExtract(_) => "get_extract",
2588 Expression::Getbit(_) => "getbit",
2589 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2590 Expression::HexEncode(_) => "hex_encode",
2591 Expression::Compress(_) => "compress",
2592 Expression::DecompressBinary(_) => "decompress_binary",
2593 Expression::DecompressString(_) => "decompress_string",
2594 Expression::Xor(_) => "xor",
2595 Expression::Nullif(_) => "nullif",
2596 Expression::JSON(_) => "j_s_o_n",
2597 Expression::JSONPath(_) => "j_s_o_n_path",
2598 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2599 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2600 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2601 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2602 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2603 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2604 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2605 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2606 Expression::Format(_) => "format",
2607 Expression::JSONKeys(_) => "j_s_o_n_keys",
2608 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2609 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2610 Expression::JSONObject(_) => "j_s_o_n_object",
2611 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2612 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2613 Expression::JSONArray(_) => "j_s_o_n_array",
2614 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2615 Expression::JSONExists(_) => "j_s_o_n_exists",
2616 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2617 Expression::JSONSchema(_) => "j_s_o_n_schema",
2618 Expression::JSONSet(_) => "j_s_o_n_set",
2619 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2620 Expression::JSONValue(_) => "j_s_o_n_value",
2621 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2622 Expression::JSONRemove(_) => "j_s_o_n_remove",
2623 Expression::JSONTable(_) => "j_s_o_n_table",
2624 Expression::JSONType(_) => "j_s_o_n_type",
2625 Expression::ObjectInsert(_) => "object_insert",
2626 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2627 Expression::OpenJSON(_) => "open_j_s_o_n",
2628 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2629 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2630 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2631 Expression::JSONCast(_) => "j_s_o_n_cast",
2632 Expression::JSONExtract(_) => "j_s_o_n_extract",
2633 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2634 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2635 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2636 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2637 Expression::JSONFormat(_) => "j_s_o_n_format",
2638 Expression::JSONBool(_) => "j_s_o_n_bool",
2639 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2640 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2641 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2642 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2643 Expression::ParseJSON(_) => "parse_j_s_o_n",
2644 Expression::ParseUrl(_) => "parse_url",
2645 Expression::ParseIp(_) => "parse_ip",
2646 Expression::ParseTime(_) => "parse_time",
2647 Expression::ParseDatetime(_) => "parse_datetime",
2648 Expression::Map(_) => "map",
2649 Expression::MapCat(_) => "map_cat",
2650 Expression::MapDelete(_) => "map_delete",
2651 Expression::MapInsert(_) => "map_insert",
2652 Expression::MapPick(_) => "map_pick",
2653 Expression::ScopeResolution(_) => "scope_resolution",
2654 Expression::Slice(_) => "slice",
2655 Expression::VarMap(_) => "var_map",
2656 Expression::MatchAgainst(_) => "match_against",
2657 Expression::MD5Digest(_) => "m_d5_digest",
2658 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2659 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2660 Expression::Monthname(_) => "monthname",
2661 Expression::Ntile(_) => "ntile",
2662 Expression::Normalize(_) => "normalize",
2663 Expression::Normal(_) => "normal",
2664 Expression::Predict(_) => "predict",
2665 Expression::MLTranslate(_) => "m_l_translate",
2666 Expression::FeaturesAtTime(_) => "features_at_time",
2667 Expression::GenerateEmbedding(_) => "generate_embedding",
2668 Expression::MLForecast(_) => "m_l_forecast",
2669 Expression::ModelAttribute(_) => "model_attribute",
2670 Expression::VectorSearch(_) => "vector_search",
2671 Expression::Quantile(_) => "quantile",
2672 Expression::ApproxQuantile(_) => "approx_quantile",
2673 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2674 Expression::Randn(_) => "randn",
2675 Expression::Randstr(_) => "randstr",
2676 Expression::RangeN(_) => "range_n",
2677 Expression::RangeBucket(_) => "range_bucket",
2678 Expression::ReadCSV(_) => "read_c_s_v",
2679 Expression::ReadParquet(_) => "read_parquet",
2680 Expression::Reduce(_) => "reduce",
2681 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2682 Expression::RegexpILike(_) => "regexp_i_like",
2683 Expression::RegexpFullMatch(_) => "regexp_full_match",
2684 Expression::RegexpInstr(_) => "regexp_instr",
2685 Expression::RegexpSplit(_) => "regexp_split",
2686 Expression::RegexpCount(_) => "regexp_count",
2687 Expression::RegrValx(_) => "regr_valx",
2688 Expression::RegrValy(_) => "regr_valy",
2689 Expression::RegrAvgy(_) => "regr_avgy",
2690 Expression::RegrAvgx(_) => "regr_avgx",
2691 Expression::RegrCount(_) => "regr_count",
2692 Expression::RegrIntercept(_) => "regr_intercept",
2693 Expression::RegrR2(_) => "regr_r2",
2694 Expression::RegrSxx(_) => "regr_sxx",
2695 Expression::RegrSxy(_) => "regr_sxy",
2696 Expression::RegrSyy(_) => "regr_syy",
2697 Expression::RegrSlope(_) => "regr_slope",
2698 Expression::SafeAdd(_) => "safe_add",
2699 Expression::SafeDivide(_) => "safe_divide",
2700 Expression::SafeMultiply(_) => "safe_multiply",
2701 Expression::SafeSubtract(_) => "safe_subtract",
2702 Expression::SHA2(_) => "s_h_a2",
2703 Expression::SHA2Digest(_) => "s_h_a2_digest",
2704 Expression::SortArray(_) => "sort_array",
2705 Expression::SplitPart(_) => "split_part",
2706 Expression::SubstringIndex(_) => "substring_index",
2707 Expression::StandardHash(_) => "standard_hash",
2708 Expression::StrPosition(_) => "str_position",
2709 Expression::Search(_) => "search",
2710 Expression::SearchIp(_) => "search_ip",
2711 Expression::StrToDate(_) => "str_to_date",
2712 Expression::DateStrToDate(_) => "date_str_to_date",
2713 Expression::DateToDateStr(_) => "date_to_date_str",
2714 Expression::StrToTime(_) => "str_to_time",
2715 Expression::StrToUnix(_) => "str_to_unix",
2716 Expression::StrToMap(_) => "str_to_map",
2717 Expression::NumberToStr(_) => "number_to_str",
2718 Expression::FromBase(_) => "from_base",
2719 Expression::Stuff(_) => "stuff",
2720 Expression::TimeToStr(_) => "time_to_str",
2721 Expression::TimeStrToTime(_) => "time_str_to_time",
2722 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2723 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2724 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2725 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2726 Expression::Unhex(_) => "unhex",
2727 Expression::Uniform(_) => "uniform",
2728 Expression::UnixToStr(_) => "unix_to_str",
2729 Expression::UnixToTime(_) => "unix_to_time",
2730 Expression::Uuid(_) => "uuid",
2731 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2732 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2733 Expression::Corr(_) => "corr",
2734 Expression::WidthBucket(_) => "width_bucket",
2735 Expression::CovarSamp(_) => "covar_samp",
2736 Expression::CovarPop(_) => "covar_pop",
2737 Expression::Week(_) => "week",
2738 Expression::XMLElement(_) => "x_m_l_element",
2739 Expression::XMLGet(_) => "x_m_l_get",
2740 Expression::XMLTable(_) => "x_m_l_table",
2741 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2742 Expression::Zipf(_) => "zipf",
2743 Expression::Merge(_) => "merge",
2744 Expression::When(_) => "when",
2745 Expression::Whens(_) => "whens",
2746 Expression::NextValueFor(_) => "next_value_for",
2747 Expression::ReturnStmt(_) => "return_stmt",
2748 }
2749 }
2750
2751 pub fn get_this(&self) -> Option<&Expression> {
2753 match self {
2754 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2756 Expression::Upper(f)
2758 | Expression::Lower(f)
2759 | Expression::Length(f)
2760 | Expression::LTrim(f)
2761 | Expression::RTrim(f)
2762 | Expression::Reverse(f)
2763 | Expression::Abs(f)
2764 | Expression::Sqrt(f)
2765 | Expression::Cbrt(f)
2766 | Expression::Ln(f)
2767 | Expression::Exp(f)
2768 | Expression::Sign(f)
2769 | Expression::Date(f)
2770 | Expression::Time(f)
2771 | Expression::Initcap(f)
2772 | Expression::Ascii(f)
2773 | Expression::Chr(f)
2774 | Expression::Soundex(f)
2775 | Expression::ByteLength(f)
2776 | Expression::Hex(f)
2777 | Expression::LowerHex(f)
2778 | Expression::Unicode(f)
2779 | Expression::Typeof(f)
2780 | Expression::Explode(f)
2781 | Expression::ExplodeOuter(f)
2782 | Expression::MapFromEntries(f)
2783 | Expression::MapKeys(f)
2784 | Expression::MapValues(f)
2785 | Expression::ArrayLength(f)
2786 | Expression::ArraySize(f)
2787 | Expression::Cardinality(f)
2788 | Expression::ArrayReverse(f)
2789 | Expression::ArrayDistinct(f)
2790 | Expression::ArrayFlatten(f)
2791 | Expression::ArrayCompact(f)
2792 | Expression::ToArray(f)
2793 | Expression::JsonArrayLength(f)
2794 | Expression::JsonKeys(f)
2795 | Expression::JsonType(f)
2796 | Expression::ParseJson(f)
2797 | Expression::ToJson(f)
2798 | Expression::Radians(f)
2799 | Expression::Degrees(f)
2800 | Expression::Sin(f)
2801 | Expression::Cos(f)
2802 | Expression::Tan(f)
2803 | Expression::Asin(f)
2804 | Expression::Acos(f)
2805 | Expression::Atan(f)
2806 | Expression::IsNan(f)
2807 | Expression::IsInf(f)
2808 | Expression::Year(f)
2809 | Expression::Month(f)
2810 | Expression::Day(f)
2811 | Expression::Hour(f)
2812 | Expression::Minute(f)
2813 | Expression::Second(f)
2814 | Expression::DayOfWeek(f)
2815 | Expression::DayOfWeekIso(f)
2816 | Expression::DayOfMonth(f)
2817 | Expression::DayOfYear(f)
2818 | Expression::WeekOfYear(f)
2819 | Expression::Quarter(f)
2820 | Expression::Epoch(f)
2821 | Expression::EpochMs(f)
2822 | Expression::BitwiseCount(f)
2823 | Expression::DateFromUnixDate(f)
2824 | Expression::UnixDate(f)
2825 | Expression::UnixSeconds(f)
2826 | Expression::UnixMillis(f)
2827 | Expression::UnixMicros(f)
2828 | Expression::TimeStrToDate(f)
2829 | Expression::DateToDi(f)
2830 | Expression::DiToDate(f)
2831 | Expression::TsOrDiToDi(f)
2832 | Expression::TsOrDsToDatetime(f)
2833 | Expression::TsOrDsToTimestamp(f)
2834 | Expression::YearOfWeek(f)
2835 | Expression::YearOfWeekIso(f)
2836 | Expression::SHA(f)
2837 | Expression::SHA1Digest(f)
2838 | Expression::TimeToUnix(f)
2839 | Expression::TimeStrToUnix(f)
2840 | Expression::Int64(f)
2841 | Expression::JSONBool(f)
2842 | Expression::MD5NumberLower64(f)
2843 | Expression::MD5NumberUpper64(f)
2844 | Expression::DateStrToDate(f)
2845 | Expression::DateToDateStr(f) => Some(&f.this),
2846 Expression::Power(f)
2848 | Expression::NullIf(f)
2849 | Expression::IfNull(f)
2850 | Expression::Nvl(f)
2851 | Expression::Contains(f)
2852 | Expression::StartsWith(f)
2853 | Expression::EndsWith(f)
2854 | Expression::Levenshtein(f)
2855 | Expression::ModFunc(f)
2856 | Expression::IntDiv(f)
2857 | Expression::Atan2(f)
2858 | Expression::AddMonths(f)
2859 | Expression::MonthsBetween(f)
2860 | Expression::NextDay(f)
2861 | Expression::UnixToTimeStr(f)
2862 | Expression::ArrayContains(f)
2863 | Expression::ArrayPosition(f)
2864 | Expression::ArrayAppend(f)
2865 | Expression::ArrayPrepend(f)
2866 | Expression::ArrayUnion(f)
2867 | Expression::ArrayExcept(f)
2868 | Expression::ArrayRemove(f)
2869 | Expression::StarMap(f)
2870 | Expression::MapFromArrays(f)
2871 | Expression::MapContainsKey(f)
2872 | Expression::ElementAt(f)
2873 | Expression::JsonMergePatch(f)
2874 | Expression::JSONBContains(f)
2875 | Expression::JSONBExtract(f) => Some(&f.this),
2876 Expression::Sum(af)
2878 | Expression::Avg(af)
2879 | Expression::Min(af)
2880 | Expression::Max(af)
2881 | Expression::ArrayAgg(af)
2882 | Expression::CountIf(af)
2883 | Expression::Stddev(af)
2884 | Expression::StddevPop(af)
2885 | Expression::StddevSamp(af)
2886 | Expression::Variance(af)
2887 | Expression::VarPop(af)
2888 | Expression::VarSamp(af)
2889 | Expression::Median(af)
2890 | Expression::Mode(af)
2891 | Expression::First(af)
2892 | Expression::Last(af)
2893 | Expression::AnyValue(af)
2894 | Expression::ApproxDistinct(af)
2895 | Expression::ApproxCountDistinct(af)
2896 | Expression::LogicalAnd(af)
2897 | Expression::LogicalOr(af)
2898 | Expression::Skewness(af)
2899 | Expression::ArrayConcatAgg(af)
2900 | Expression::ArrayUniqueAgg(af)
2901 | Expression::BoolXorAgg(af)
2902 | Expression::BitwiseAndAgg(af)
2903 | Expression::BitwiseOrAgg(af)
2904 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2905 Expression::And(op)
2907 | Expression::Or(op)
2908 | Expression::Add(op)
2909 | Expression::Sub(op)
2910 | Expression::Mul(op)
2911 | Expression::Div(op)
2912 | Expression::Mod(op)
2913 | Expression::Eq(op)
2914 | Expression::Neq(op)
2915 | Expression::Lt(op)
2916 | Expression::Lte(op)
2917 | Expression::Gt(op)
2918 | Expression::Gte(op)
2919 | Expression::BitwiseAnd(op)
2920 | Expression::BitwiseOr(op)
2921 | Expression::BitwiseXor(op)
2922 | Expression::Concat(op)
2923 | Expression::Adjacent(op)
2924 | Expression::TsMatch(op)
2925 | Expression::PropertyEQ(op)
2926 | Expression::ArrayContainsAll(op)
2927 | Expression::ArrayContainedBy(op)
2928 | Expression::ArrayOverlaps(op)
2929 | Expression::JSONBContainsAllTopKeys(op)
2930 | Expression::JSONBContainsAnyTopKeys(op)
2931 | Expression::JSONBDeleteAtPath(op)
2932 | Expression::ExtendsLeft(op)
2933 | Expression::ExtendsRight(op)
2934 | Expression::Is(op)
2935 | Expression::MemberOf(op)
2936 | Expression::Match(op)
2937 | Expression::NullSafeEq(op)
2938 | Expression::NullSafeNeq(op)
2939 | Expression::Glob(op)
2940 | Expression::BitwiseLeftShift(op)
2941 | Expression::BitwiseRightShift(op) => Some(&op.left),
2942 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2944 Expression::Alias(a) => Some(&a.this),
2946 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2947 Expression::Paren(p) => Some(&p.this),
2948 Expression::Annotated(a) => Some(&a.this),
2949 Expression::Subquery(s) => Some(&s.this),
2950 Expression::Where(w) => Some(&w.this),
2951 Expression::Having(h) => Some(&h.this),
2952 Expression::Qualify(q) => Some(&q.this),
2953 Expression::IsNull(i) => Some(&i.this),
2954 Expression::Exists(e) => Some(&e.this),
2955 Expression::Ordered(o) => Some(&o.this),
2956 Expression::WindowFunction(wf) => Some(&wf.this),
2957 Expression::Cte(cte) => Some(&cte.this),
2958 Expression::Between(b) => Some(&b.this),
2959 Expression::In(i) => Some(&i.this),
2960 Expression::ReturnStmt(e) => Some(e),
2961 _ => None,
2962 }
2963 }
2964
2965 pub fn get_expression(&self) -> Option<&Expression> {
2967 match self {
2968 Expression::And(op)
2970 | Expression::Or(op)
2971 | Expression::Add(op)
2972 | Expression::Sub(op)
2973 | Expression::Mul(op)
2974 | Expression::Div(op)
2975 | Expression::Mod(op)
2976 | Expression::Eq(op)
2977 | Expression::Neq(op)
2978 | Expression::Lt(op)
2979 | Expression::Lte(op)
2980 | Expression::Gt(op)
2981 | Expression::Gte(op)
2982 | Expression::BitwiseAnd(op)
2983 | Expression::BitwiseOr(op)
2984 | Expression::BitwiseXor(op)
2985 | Expression::Concat(op)
2986 | Expression::Adjacent(op)
2987 | Expression::TsMatch(op)
2988 | Expression::PropertyEQ(op)
2989 | Expression::ArrayContainsAll(op)
2990 | Expression::ArrayContainedBy(op)
2991 | Expression::ArrayOverlaps(op)
2992 | Expression::JSONBContainsAllTopKeys(op)
2993 | Expression::JSONBContainsAnyTopKeys(op)
2994 | Expression::JSONBDeleteAtPath(op)
2995 | Expression::ExtendsLeft(op)
2996 | Expression::ExtendsRight(op)
2997 | Expression::Is(op)
2998 | Expression::MemberOf(op)
2999 | Expression::Match(op)
3000 | Expression::NullSafeEq(op)
3001 | Expression::NullSafeNeq(op)
3002 | Expression::Glob(op)
3003 | Expression::BitwiseLeftShift(op)
3004 | Expression::BitwiseRightShift(op) => Some(&op.right),
3005 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3007 Expression::Power(f)
3009 | Expression::NullIf(f)
3010 | Expression::IfNull(f)
3011 | Expression::Nvl(f)
3012 | Expression::Contains(f)
3013 | Expression::StartsWith(f)
3014 | Expression::EndsWith(f)
3015 | Expression::Levenshtein(f)
3016 | Expression::ModFunc(f)
3017 | Expression::IntDiv(f)
3018 | Expression::Atan2(f)
3019 | Expression::AddMonths(f)
3020 | Expression::MonthsBetween(f)
3021 | Expression::NextDay(f)
3022 | Expression::UnixToTimeStr(f)
3023 | Expression::ArrayContains(f)
3024 | Expression::ArrayPosition(f)
3025 | Expression::ArrayAppend(f)
3026 | Expression::ArrayPrepend(f)
3027 | Expression::ArrayUnion(f)
3028 | Expression::ArrayExcept(f)
3029 | Expression::ArrayRemove(f)
3030 | Expression::StarMap(f)
3031 | Expression::MapFromArrays(f)
3032 | Expression::MapContainsKey(f)
3033 | Expression::ElementAt(f)
3034 | Expression::JsonMergePatch(f)
3035 | Expression::JSONBContains(f)
3036 | Expression::JSONBExtract(f) => Some(&f.expression),
3037 _ => None,
3038 }
3039 }
3040
3041 pub fn get_expressions(&self) -> &[Expression] {
3043 match self {
3044 Expression::Select(s) => &s.expressions,
3045 Expression::Function(f) => &f.args,
3046 Expression::AggregateFunction(f) => &f.args,
3047 Expression::From(f) => &f.expressions,
3048 Expression::GroupBy(g) => &g.expressions,
3049 Expression::In(i) => &i.expressions,
3050 Expression::Array(a) => &a.expressions,
3051 Expression::Tuple(t) => &t.expressions,
3052 Expression::Coalesce(f)
3053 | Expression::Greatest(f)
3054 | Expression::Least(f)
3055 | Expression::ArrayConcat(f)
3056 | Expression::ArrayIntersect(f)
3057 | Expression::ArrayZip(f)
3058 | Expression::MapConcat(f)
3059 | Expression::JsonArray(f) => &f.expressions,
3060 _ => &[],
3061 }
3062 }
3063
3064 pub fn get_name(&self) -> &str {
3066 match self {
3067 Expression::Identifier(id) => &id.name,
3068 Expression::Column(col) => &col.name.name,
3069 Expression::Table(t) => &t.name.name,
3070 Expression::Literal(lit) => lit.value_str(),
3071 Expression::Star(_) => "*",
3072 Expression::Function(f) => &f.name,
3073 Expression::AggregateFunction(f) => &f.name,
3074 Expression::Alias(a) => a.this.get_name(),
3075 Expression::Boolean(b) => {
3076 if b.value {
3077 "TRUE"
3078 } else {
3079 "FALSE"
3080 }
3081 }
3082 Expression::Null(_) => "NULL",
3083 _ => "",
3084 }
3085 }
3086
3087 pub fn get_alias(&self) -> &str {
3089 match self {
3090 Expression::Alias(a) => &a.alias.name,
3091 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3092 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3093 _ => "",
3094 }
3095 }
3096
3097 pub fn get_output_name(&self) -> &str {
3099 match self {
3100 Expression::Alias(a) => &a.alias.name,
3101 Expression::Column(c) => &c.name.name,
3102 Expression::Identifier(id) => &id.name,
3103 Expression::Literal(lit) => lit.value_str(),
3104 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3105 Expression::Star(_) => "*",
3106 _ => "",
3107 }
3108 }
3109
3110 pub fn get_comments(&self) -> Vec<&str> {
3112 match self {
3113 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3114 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3115 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3116 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3117 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3118 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3119 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3120 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3121 }
3122 Expression::And(op)
3123 | Expression::Or(op)
3124 | Expression::Add(op)
3125 | Expression::Sub(op)
3126 | Expression::Mul(op)
3127 | Expression::Div(op)
3128 | Expression::Mod(op)
3129 | Expression::Eq(op)
3130 | Expression::Neq(op)
3131 | Expression::Lt(op)
3132 | Expression::Lte(op)
3133 | Expression::Gt(op)
3134 | Expression::Gte(op)
3135 | Expression::Concat(op)
3136 | Expression::BitwiseAnd(op)
3137 | Expression::BitwiseOr(op)
3138 | Expression::BitwiseXor(op) => {
3139 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3140 }
3141 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3142 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3143 _ => Vec::new(),
3144 }
3145 }
3146}
3147
3148impl fmt::Display for Expression {
3149 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3150 match self {
3152 Expression::Literal(lit) => write!(f, "{}", lit),
3153 Expression::Identifier(id) => write!(f, "{}", id),
3154 Expression::Column(col) => write!(f, "{}", col),
3155 Expression::Star(_) => write!(f, "*"),
3156 Expression::Null(_) => write!(f, "NULL"),
3157 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3158 Expression::Select(_) => write!(f, "SELECT ..."),
3159 _ => write!(f, "{:?}", self),
3160 }
3161 }
3162}
3163
3164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3174#[cfg_attr(feature = "bindings", derive(TS))]
3175#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3176pub enum Literal {
3177 String(String),
3179 Number(String),
3181 HexString(String),
3183 HexNumber(String),
3185 BitString(String),
3186 ByteString(String),
3188 NationalString(String),
3190 Date(String),
3192 Time(String),
3194 Timestamp(String),
3196 Datetime(String),
3198 TripleQuotedString(String, char),
3201 EscapeString(String),
3203 DollarString(String),
3205 RawString(String),
3209}
3210
3211impl Literal {
3212 pub fn value_str(&self) -> &str {
3214 match self {
3215 Literal::String(s)
3216 | Literal::Number(s)
3217 | Literal::HexString(s)
3218 | Literal::HexNumber(s)
3219 | Literal::BitString(s)
3220 | Literal::ByteString(s)
3221 | Literal::NationalString(s)
3222 | Literal::Date(s)
3223 | Literal::Time(s)
3224 | Literal::Timestamp(s)
3225 | Literal::Datetime(s)
3226 | Literal::EscapeString(s)
3227 | Literal::DollarString(s)
3228 | Literal::RawString(s) => s.as_str(),
3229 Literal::TripleQuotedString(s, _) => s.as_str(),
3230 }
3231 }
3232
3233 pub fn is_string(&self) -> bool {
3235 matches!(
3236 self,
3237 Literal::String(_)
3238 | Literal::NationalString(_)
3239 | Literal::EscapeString(_)
3240 | Literal::DollarString(_)
3241 | Literal::RawString(_)
3242 | Literal::TripleQuotedString(_, _)
3243 )
3244 }
3245
3246 pub fn is_number(&self) -> bool {
3248 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3249 }
3250}
3251
3252impl fmt::Display for Literal {
3253 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3254 match self {
3255 Literal::String(s) => write!(f, "'{}'", s),
3256 Literal::Number(n) => write!(f, "{}", n),
3257 Literal::HexString(h) => write!(f, "X'{}'", h),
3258 Literal::HexNumber(h) => write!(f, "0x{}", h),
3259 Literal::BitString(b) => write!(f, "B'{}'", b),
3260 Literal::ByteString(b) => write!(f, "b'{}'", b),
3261 Literal::NationalString(s) => write!(f, "N'{}'", s),
3262 Literal::Date(d) => write!(f, "DATE '{}'", d),
3263 Literal::Time(t) => write!(f, "TIME '{}'", t),
3264 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3265 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3266 Literal::TripleQuotedString(s, q) => {
3267 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3268 }
3269 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3270 Literal::DollarString(s) => write!(f, "$${}$$", s),
3271 Literal::RawString(s) => write!(f, "r'{}'", s),
3272 }
3273 }
3274}
3275
3276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3278#[cfg_attr(feature = "bindings", derive(TS))]
3279pub struct BooleanLiteral {
3280 pub value: bool,
3281}
3282
3283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3285#[cfg_attr(feature = "bindings", derive(TS))]
3286pub struct Null;
3287
3288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3295#[cfg_attr(feature = "bindings", derive(TS))]
3296pub struct Identifier {
3297 pub name: String,
3299 pub quoted: bool,
3301 #[serde(default)]
3302 pub trailing_comments: Vec<String>,
3303 #[serde(default, skip_serializing_if = "Option::is_none")]
3305 pub span: Option<Span>,
3306}
3307
3308impl Identifier {
3309 pub fn new(name: impl Into<String>) -> Self {
3310 Self {
3311 name: name.into(),
3312 quoted: false,
3313 trailing_comments: Vec::new(),
3314 span: None,
3315 }
3316 }
3317
3318 pub fn quoted(name: impl Into<String>) -> Self {
3319 Self {
3320 name: name.into(),
3321 quoted: true,
3322 trailing_comments: Vec::new(),
3323 span: None,
3324 }
3325 }
3326
3327 pub fn empty() -> Self {
3328 Self {
3329 name: String::new(),
3330 quoted: false,
3331 trailing_comments: Vec::new(),
3332 span: None,
3333 }
3334 }
3335
3336 pub fn is_empty(&self) -> bool {
3337 self.name.is_empty()
3338 }
3339
3340 pub fn with_span(mut self, span: Span) -> Self {
3342 self.span = Some(span);
3343 self
3344 }
3345}
3346
3347impl fmt::Display for Identifier {
3348 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3349 if self.quoted {
3350 write!(f, "\"{}\"", self.name)
3351 } else {
3352 write!(f, "{}", self.name)
3353 }
3354 }
3355}
3356
3357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3363#[cfg_attr(feature = "bindings", derive(TS))]
3364pub struct Column {
3365 pub name: Identifier,
3367 pub table: Option<Identifier>,
3369 #[serde(default)]
3371 pub join_mark: bool,
3372 #[serde(default)]
3374 pub trailing_comments: Vec<String>,
3375 #[serde(default, skip_serializing_if = "Option::is_none")]
3377 pub span: Option<Span>,
3378 #[serde(default, skip_serializing_if = "Option::is_none")]
3380 pub inferred_type: Option<DataType>,
3381}
3382
3383impl fmt::Display for Column {
3384 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3385 if let Some(table) = &self.table {
3386 write!(f, "{}.{}", table, self.name)
3387 } else {
3388 write!(f, "{}", self.name)
3389 }
3390 }
3391}
3392
3393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3400#[cfg_attr(feature = "bindings", derive(TS))]
3401pub struct TableRef {
3402 pub name: Identifier,
3404 pub schema: Option<Identifier>,
3406 pub catalog: Option<Identifier>,
3408 pub alias: Option<Identifier>,
3410 #[serde(default)]
3412 pub alias_explicit_as: bool,
3413 #[serde(default)]
3415 pub column_aliases: Vec<Identifier>,
3416 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3418 pub leading_comments: Vec<String>,
3419 #[serde(default)]
3421 pub trailing_comments: Vec<String>,
3422 #[serde(default)]
3424 pub when: Option<Box<HistoricalData>>,
3425 #[serde(default)]
3427 pub only: bool,
3428 #[serde(default)]
3430 pub final_: bool,
3431 #[serde(default, skip_serializing_if = "Option::is_none")]
3433 pub table_sample: Option<Box<Sample>>,
3434 #[serde(default)]
3436 pub hints: Vec<Expression>,
3437 #[serde(default, skip_serializing_if = "Option::is_none")]
3440 pub system_time: Option<String>,
3441 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3443 pub partitions: Vec<Identifier>,
3444 #[serde(default, skip_serializing_if = "Option::is_none")]
3447 pub identifier_func: Option<Box<Expression>>,
3448 #[serde(default, skip_serializing_if = "Option::is_none")]
3450 pub changes: Option<Box<Changes>>,
3451 #[serde(default, skip_serializing_if = "Option::is_none")]
3453 pub version: Option<Box<Version>>,
3454 #[serde(default, skip_serializing_if = "Option::is_none")]
3456 pub span: Option<Span>,
3457}
3458
3459impl TableRef {
3460 pub fn new(name: impl Into<String>) -> Self {
3461 Self {
3462 name: Identifier::new(name),
3463 schema: None,
3464 catalog: None,
3465 alias: None,
3466 alias_explicit_as: false,
3467 column_aliases: Vec::new(),
3468 leading_comments: Vec::new(),
3469 trailing_comments: Vec::new(),
3470 when: None,
3471 only: false,
3472 final_: false,
3473 table_sample: None,
3474 hints: Vec::new(),
3475 system_time: None,
3476 partitions: Vec::new(),
3477 identifier_func: None,
3478 changes: None,
3479 version: None,
3480 span: None,
3481 }
3482 }
3483
3484 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3486 let mut t = Self::new(name);
3487 t.schema = Some(Identifier::new(schema));
3488 t
3489 }
3490
3491 pub fn new_with_catalog(
3493 name: impl Into<String>,
3494 schema: impl Into<String>,
3495 catalog: impl Into<String>,
3496 ) -> Self {
3497 let mut t = Self::new(name);
3498 t.schema = Some(Identifier::new(schema));
3499 t.catalog = Some(Identifier::new(catalog));
3500 t
3501 }
3502
3503 pub fn from_identifier(name: Identifier) -> Self {
3505 Self {
3506 name,
3507 schema: None,
3508 catalog: None,
3509 alias: None,
3510 alias_explicit_as: false,
3511 column_aliases: Vec::new(),
3512 leading_comments: Vec::new(),
3513 trailing_comments: Vec::new(),
3514 when: None,
3515 only: false,
3516 final_: false,
3517 table_sample: None,
3518 hints: Vec::new(),
3519 system_time: None,
3520 partitions: Vec::new(),
3521 identifier_func: None,
3522 changes: None,
3523 version: None,
3524 span: None,
3525 }
3526 }
3527
3528 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3529 self.alias = Some(Identifier::new(alias));
3530 self
3531 }
3532
3533 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3534 self.schema = Some(Identifier::new(schema));
3535 self
3536 }
3537}
3538
3539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3544#[cfg_attr(feature = "bindings", derive(TS))]
3545pub struct Star {
3546 pub table: Option<Identifier>,
3548 pub except: Option<Vec<Identifier>>,
3550 pub replace: Option<Vec<Alias>>,
3552 pub rename: Option<Vec<(Identifier, Identifier)>>,
3554 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3556 pub trailing_comments: Vec<String>,
3557 #[serde(default, skip_serializing_if = "Option::is_none")]
3559 pub span: Option<Span>,
3560}
3561
3562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3586#[cfg_attr(feature = "bindings", derive(TS))]
3587pub struct Select {
3588 pub expressions: Vec<Expression>,
3590 pub from: Option<From>,
3592 pub joins: Vec<Join>,
3594 pub lateral_views: Vec<LateralView>,
3595 #[serde(default, skip_serializing_if = "Option::is_none")]
3597 pub prewhere: Option<Expression>,
3598 pub where_clause: Option<Where>,
3599 pub group_by: Option<GroupBy>,
3600 pub having: Option<Having>,
3601 pub qualify: Option<Qualify>,
3602 pub order_by: Option<OrderBy>,
3603 pub distribute_by: Option<DistributeBy>,
3604 pub cluster_by: Option<ClusterBy>,
3605 pub sort_by: Option<SortBy>,
3606 pub limit: Option<Limit>,
3607 pub offset: Option<Offset>,
3608 #[serde(default, skip_serializing_if = "Option::is_none")]
3610 pub limit_by: Option<Vec<Expression>>,
3611 pub fetch: Option<Fetch>,
3612 pub distinct: bool,
3613 pub distinct_on: Option<Vec<Expression>>,
3614 pub top: Option<Top>,
3615 pub with: Option<With>,
3616 pub sample: Option<Sample>,
3617 #[serde(default, skip_serializing_if = "Option::is_none")]
3619 pub settings: Option<Vec<Expression>>,
3620 #[serde(default, skip_serializing_if = "Option::is_none")]
3622 pub format: Option<Expression>,
3623 pub windows: Option<Vec<NamedWindow>>,
3624 pub hint: Option<Hint>,
3625 pub connect: Option<Connect>,
3627 pub into: Option<SelectInto>,
3629 #[serde(default)]
3631 pub locks: Vec<Lock>,
3632 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub for_xml: Vec<Expression>,
3635 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3637 pub for_json: Vec<Expression>,
3638 #[serde(default)]
3640 pub leading_comments: Vec<String>,
3641 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3644 pub post_select_comments: Vec<String>,
3645 #[serde(default, skip_serializing_if = "Option::is_none")]
3647 pub kind: Option<String>,
3648 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3650 pub operation_modifiers: Vec<String>,
3651 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3653 pub qualify_after_window: bool,
3654 #[serde(default, skip_serializing_if = "Option::is_none")]
3656 pub option: Option<String>,
3657 #[serde(default, skip_serializing_if = "Option::is_none")]
3660 pub exclude: Option<Vec<Expression>>,
3661}
3662
3663impl Select {
3664 pub fn new() -> Self {
3665 Self {
3666 expressions: Vec::new(),
3667 from: None,
3668 joins: Vec::new(),
3669 lateral_views: Vec::new(),
3670 prewhere: None,
3671 where_clause: None,
3672 group_by: None,
3673 having: None,
3674 qualify: None,
3675 order_by: None,
3676 distribute_by: None,
3677 cluster_by: None,
3678 sort_by: None,
3679 limit: None,
3680 offset: None,
3681 limit_by: None,
3682 fetch: None,
3683 distinct: false,
3684 distinct_on: None,
3685 top: None,
3686 with: None,
3687 sample: None,
3688 settings: None,
3689 format: None,
3690 windows: None,
3691 hint: None,
3692 connect: None,
3693 into: None,
3694 locks: Vec::new(),
3695 for_xml: Vec::new(),
3696 for_json: Vec::new(),
3697 leading_comments: Vec::new(),
3698 post_select_comments: Vec::new(),
3699 kind: None,
3700 operation_modifiers: Vec::new(),
3701 qualify_after_window: false,
3702 option: None,
3703 exclude: None,
3704 }
3705 }
3706
3707 pub fn column(mut self, expr: Expression) -> Self {
3709 self.expressions.push(expr);
3710 self
3711 }
3712
3713 pub fn from(mut self, table: Expression) -> Self {
3715 self.from = Some(From {
3716 expressions: vec![table],
3717 });
3718 self
3719 }
3720
3721 pub fn where_(mut self, condition: Expression) -> Self {
3723 self.where_clause = Some(Where { this: condition });
3724 self
3725 }
3726
3727 pub fn distinct(mut self) -> Self {
3729 self.distinct = true;
3730 self
3731 }
3732
3733 pub fn join(mut self, join: Join) -> Self {
3735 self.joins.push(join);
3736 self
3737 }
3738
3739 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3741 self.order_by = Some(OrderBy {
3742 expressions,
3743 siblings: false,
3744 comments: Vec::new(),
3745 });
3746 self
3747 }
3748
3749 pub fn limit(mut self, n: Expression) -> Self {
3751 self.limit = Some(Limit {
3752 this: n,
3753 percent: false,
3754 comments: Vec::new(),
3755 });
3756 self
3757 }
3758
3759 pub fn offset(mut self, n: Expression) -> Self {
3761 self.offset = Some(Offset {
3762 this: n,
3763 rows: None,
3764 });
3765 self
3766 }
3767}
3768
3769impl Default for Select {
3770 fn default() -> Self {
3771 Self::new()
3772 }
3773}
3774
3775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3781#[cfg_attr(feature = "bindings", derive(TS))]
3782pub struct Union {
3783 pub left: Expression,
3785 pub right: Expression,
3787 pub all: bool,
3789 #[serde(default)]
3791 pub distinct: bool,
3792 pub with: Option<With>,
3794 pub order_by: Option<OrderBy>,
3796 pub limit: Option<Box<Expression>>,
3798 pub offset: Option<Box<Expression>>,
3800 #[serde(default, skip_serializing_if = "Option::is_none")]
3802 pub distribute_by: Option<DistributeBy>,
3803 #[serde(default, skip_serializing_if = "Option::is_none")]
3805 pub sort_by: Option<SortBy>,
3806 #[serde(default, skip_serializing_if = "Option::is_none")]
3808 pub cluster_by: Option<ClusterBy>,
3809 #[serde(default)]
3811 pub by_name: bool,
3812 #[serde(default, skip_serializing_if = "Option::is_none")]
3814 pub side: Option<String>,
3815 #[serde(default, skip_serializing_if = "Option::is_none")]
3817 pub kind: Option<String>,
3818 #[serde(default)]
3820 pub corresponding: bool,
3821 #[serde(default)]
3823 pub strict: bool,
3824 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3826 pub on_columns: Vec<Expression>,
3827}
3828
3829impl Drop for Union {
3832 fn drop(&mut self) {
3833 loop {
3834 if let Expression::Union(ref mut inner) = self.left {
3835 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3836 let old_left = std::mem::replace(&mut self.left, next_left);
3837 drop(old_left);
3838 } else {
3839 break;
3840 }
3841 }
3842 }
3843}
3844
3845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3850#[cfg_attr(feature = "bindings", derive(TS))]
3851pub struct Intersect {
3852 pub left: Expression,
3854 pub right: Expression,
3856 pub all: bool,
3858 #[serde(default)]
3860 pub distinct: bool,
3861 pub with: Option<With>,
3863 pub order_by: Option<OrderBy>,
3865 pub limit: Option<Box<Expression>>,
3867 pub offset: Option<Box<Expression>>,
3869 #[serde(default, skip_serializing_if = "Option::is_none")]
3871 pub distribute_by: Option<DistributeBy>,
3872 #[serde(default, skip_serializing_if = "Option::is_none")]
3874 pub sort_by: Option<SortBy>,
3875 #[serde(default, skip_serializing_if = "Option::is_none")]
3877 pub cluster_by: Option<ClusterBy>,
3878 #[serde(default)]
3880 pub by_name: bool,
3881 #[serde(default, skip_serializing_if = "Option::is_none")]
3883 pub side: Option<String>,
3884 #[serde(default, skip_serializing_if = "Option::is_none")]
3886 pub kind: Option<String>,
3887 #[serde(default)]
3889 pub corresponding: bool,
3890 #[serde(default)]
3892 pub strict: bool,
3893 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3895 pub on_columns: Vec<Expression>,
3896}
3897
3898impl Drop for Intersect {
3899 fn drop(&mut self) {
3900 loop {
3901 if let Expression::Intersect(ref mut inner) = self.left {
3902 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3903 let old_left = std::mem::replace(&mut self.left, next_left);
3904 drop(old_left);
3905 } else {
3906 break;
3907 }
3908 }
3909 }
3910}
3911
3912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3917#[cfg_attr(feature = "bindings", derive(TS))]
3918pub struct Except {
3919 pub left: Expression,
3921 pub right: Expression,
3923 pub all: bool,
3925 #[serde(default)]
3927 pub distinct: bool,
3928 pub with: Option<With>,
3930 pub order_by: Option<OrderBy>,
3932 pub limit: Option<Box<Expression>>,
3934 pub offset: Option<Box<Expression>>,
3936 #[serde(default, skip_serializing_if = "Option::is_none")]
3938 pub distribute_by: Option<DistributeBy>,
3939 #[serde(default, skip_serializing_if = "Option::is_none")]
3941 pub sort_by: Option<SortBy>,
3942 #[serde(default, skip_serializing_if = "Option::is_none")]
3944 pub cluster_by: Option<ClusterBy>,
3945 #[serde(default)]
3947 pub by_name: bool,
3948 #[serde(default, skip_serializing_if = "Option::is_none")]
3950 pub side: Option<String>,
3951 #[serde(default, skip_serializing_if = "Option::is_none")]
3953 pub kind: Option<String>,
3954 #[serde(default)]
3956 pub corresponding: bool,
3957 #[serde(default)]
3959 pub strict: bool,
3960 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3962 pub on_columns: Vec<Expression>,
3963}
3964
3965impl Drop for Except {
3966 fn drop(&mut self) {
3967 loop {
3968 if let Expression::Except(ref mut inner) = self.left {
3969 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3970 let old_left = std::mem::replace(&mut self.left, next_left);
3971 drop(old_left);
3972 } else {
3973 break;
3974 }
3975 }
3976 }
3977}
3978
3979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3981#[cfg_attr(feature = "bindings", derive(TS))]
3982pub struct SelectInto {
3983 pub this: Expression,
3985 #[serde(default)]
3987 pub temporary: bool,
3988 #[serde(default)]
3990 pub unlogged: bool,
3991 #[serde(default)]
3993 pub bulk_collect: bool,
3994 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3996 pub expressions: Vec<Expression>,
3997}
3998
3999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4009#[cfg_attr(feature = "bindings", derive(TS))]
4010pub struct Subquery {
4011 pub this: Expression,
4013 pub alias: Option<Identifier>,
4015 pub column_aliases: Vec<Identifier>,
4017 #[serde(default)]
4019 pub alias_explicit_as: bool,
4020 #[serde(skip_serializing_if = "Option::is_none", default)]
4022 pub alias_keyword: Option<String>,
4023 pub order_by: Option<OrderBy>,
4025 pub limit: Option<Limit>,
4027 pub offset: Option<Offset>,
4029 #[serde(default, skip_serializing_if = "Option::is_none")]
4031 pub distribute_by: Option<DistributeBy>,
4032 #[serde(default, skip_serializing_if = "Option::is_none")]
4034 pub sort_by: Option<SortBy>,
4035 #[serde(default, skip_serializing_if = "Option::is_none")]
4037 pub cluster_by: Option<ClusterBy>,
4038 #[serde(default)]
4040 pub lateral: bool,
4041 #[serde(default)]
4045 pub modifiers_inside: bool,
4046 #[serde(default)]
4048 pub trailing_comments: Vec<String>,
4049 #[serde(default, skip_serializing_if = "Option::is_none")]
4051 pub inferred_type: Option<DataType>,
4052}
4053
4054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4059#[cfg_attr(feature = "bindings", derive(TS))]
4060pub struct PipeOperator {
4061 pub this: Expression,
4063 pub expression: Expression,
4065}
4066
4067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4069#[cfg_attr(feature = "bindings", derive(TS))]
4070pub struct Values {
4071 pub expressions: Vec<Tuple>,
4073 pub alias: Option<Identifier>,
4075 pub column_aliases: Vec<Identifier>,
4077}
4078
4079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4089#[cfg_attr(feature = "bindings", derive(TS))]
4090pub struct Pivot {
4091 pub this: Expression,
4093 #[serde(default)]
4096 pub expressions: Vec<Expression>,
4097 #[serde(default)]
4099 pub fields: Vec<Expression>,
4100 #[serde(default)]
4102 pub using: Vec<Expression>,
4103 #[serde(default)]
4105 pub group: Option<Box<Expression>>,
4106 #[serde(default)]
4108 pub unpivot: bool,
4109 #[serde(default)]
4111 pub into: Option<Box<Expression>>,
4112 #[serde(default)]
4114 pub alias: Option<Identifier>,
4115 #[serde(default)]
4117 pub include_nulls: Option<bool>,
4118 #[serde(default)]
4120 pub default_on_null: Option<Box<Expression>>,
4121 #[serde(default, skip_serializing_if = "Option::is_none")]
4123 pub with: Option<With>,
4124}
4125
4126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4128#[cfg_attr(feature = "bindings", derive(TS))]
4129pub struct Unpivot {
4130 pub this: Expression,
4131 pub value_column: Identifier,
4132 pub name_column: Identifier,
4133 pub columns: Vec<Expression>,
4134 pub alias: Option<Identifier>,
4135 #[serde(default)]
4137 pub value_column_parenthesized: bool,
4138 #[serde(default)]
4140 pub include_nulls: Option<bool>,
4141 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4143 pub extra_value_columns: Vec<Identifier>,
4144}
4145
4146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4149#[cfg_attr(feature = "bindings", derive(TS))]
4150pub struct PivotAlias {
4151 pub this: Expression,
4152 pub alias: Expression,
4153}
4154
4155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4157#[cfg_attr(feature = "bindings", derive(TS))]
4158pub struct PreWhere {
4159 pub this: Expression,
4160}
4161
4162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4164#[cfg_attr(feature = "bindings", derive(TS))]
4165pub struct Stream {
4166 pub this: Expression,
4167 #[serde(skip_serializing_if = "Option::is_none")]
4168 pub on: Option<Expression>,
4169 #[serde(skip_serializing_if = "Option::is_none")]
4170 pub show_initial_rows: Option<bool>,
4171}
4172
4173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4175#[cfg_attr(feature = "bindings", derive(TS))]
4176pub struct UsingData {
4177 pub this: Expression,
4178}
4179
4180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4182#[cfg_attr(feature = "bindings", derive(TS))]
4183pub struct XmlNamespace {
4184 pub this: Expression,
4185 #[serde(skip_serializing_if = "Option::is_none")]
4186 pub alias: Option<Identifier>,
4187}
4188
4189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4191#[cfg_attr(feature = "bindings", derive(TS))]
4192pub struct RowFormat {
4193 pub delimited: bool,
4194 pub fields_terminated_by: Option<String>,
4195 pub collection_items_terminated_by: Option<String>,
4196 pub map_keys_terminated_by: Option<String>,
4197 pub lines_terminated_by: Option<String>,
4198 pub null_defined_as: Option<String>,
4199}
4200
4201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4203#[cfg_attr(feature = "bindings", derive(TS))]
4204pub struct DirectoryInsert {
4205 pub local: bool,
4206 pub path: String,
4207 pub row_format: Option<RowFormat>,
4208 #[serde(default)]
4210 pub stored_as: Option<String>,
4211}
4212
4213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4215#[cfg_attr(feature = "bindings", derive(TS))]
4216pub struct Insert {
4217 pub table: TableRef,
4218 pub columns: Vec<Identifier>,
4219 pub values: Vec<Vec<Expression>>,
4220 pub query: Option<Expression>,
4221 pub overwrite: bool,
4223 pub partition: Vec<(Identifier, Option<Expression>)>,
4225 #[serde(default)]
4227 pub directory: Option<DirectoryInsert>,
4228 #[serde(default)]
4230 pub returning: Vec<Expression>,
4231 #[serde(default)]
4233 pub output: Option<OutputClause>,
4234 #[serde(default)]
4236 pub on_conflict: Option<Box<Expression>>,
4237 #[serde(default)]
4239 pub leading_comments: Vec<String>,
4240 #[serde(default)]
4242 pub if_exists: bool,
4243 #[serde(default)]
4245 pub with: Option<With>,
4246 #[serde(default)]
4248 pub ignore: bool,
4249 #[serde(default)]
4251 pub source_alias: Option<Identifier>,
4252 #[serde(default)]
4254 pub alias: Option<Identifier>,
4255 #[serde(default)]
4257 pub alias_explicit_as: bool,
4258 #[serde(default)]
4260 pub default_values: bool,
4261 #[serde(default)]
4263 pub by_name: bool,
4264 #[serde(default, skip_serializing_if = "Option::is_none")]
4266 pub conflict_action: Option<String>,
4267 #[serde(default)]
4269 pub is_replace: bool,
4270 #[serde(default, skip_serializing_if = "Option::is_none")]
4272 pub hint: Option<Hint>,
4273 #[serde(default)]
4275 pub replace_where: Option<Box<Expression>>,
4276 #[serde(default)]
4278 pub source: Option<Box<Expression>>,
4279 #[serde(default, skip_serializing_if = "Option::is_none")]
4281 pub function_target: Option<Box<Expression>>,
4282 #[serde(default, skip_serializing_if = "Option::is_none")]
4284 pub partition_by: Option<Box<Expression>>,
4285 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4287 pub settings: Vec<Expression>,
4288}
4289
4290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4292#[cfg_attr(feature = "bindings", derive(TS))]
4293pub struct OutputClause {
4294 pub columns: Vec<Expression>,
4296 #[serde(default)]
4298 pub into_table: Option<Expression>,
4299}
4300
4301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4303#[cfg_attr(feature = "bindings", derive(TS))]
4304pub struct Update {
4305 pub table: TableRef,
4306 #[serde(default)]
4307 pub hint: Option<Hint>,
4308 #[serde(default)]
4310 pub extra_tables: Vec<TableRef>,
4311 #[serde(default)]
4313 pub table_joins: Vec<Join>,
4314 pub set: Vec<(Identifier, Expression)>,
4315 pub from_clause: Option<From>,
4316 #[serde(default)]
4318 pub from_joins: Vec<Join>,
4319 pub where_clause: Option<Where>,
4320 #[serde(default)]
4322 pub returning: Vec<Expression>,
4323 #[serde(default)]
4325 pub output: Option<OutputClause>,
4326 #[serde(default)]
4328 pub with: Option<With>,
4329 #[serde(default)]
4331 pub leading_comments: Vec<String>,
4332 #[serde(default)]
4334 pub limit: Option<Expression>,
4335 #[serde(default)]
4337 pub order_by: Option<OrderBy>,
4338 #[serde(default)]
4340 pub from_before_set: bool,
4341}
4342
4343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4345#[cfg_attr(feature = "bindings", derive(TS))]
4346pub struct Delete {
4347 pub table: TableRef,
4348 #[serde(default)]
4349 pub hint: Option<Hint>,
4350 #[serde(default, skip_serializing_if = "Option::is_none")]
4352 pub on_cluster: Option<OnCluster>,
4353 pub alias: Option<Identifier>,
4355 #[serde(default)]
4357 pub alias_explicit_as: bool,
4358 pub using: Vec<TableRef>,
4360 pub where_clause: Option<Where>,
4361 #[serde(default)]
4363 pub output: Option<OutputClause>,
4364 #[serde(default)]
4366 pub leading_comments: Vec<String>,
4367 #[serde(default)]
4369 pub with: Option<With>,
4370 #[serde(default)]
4372 pub limit: Option<Expression>,
4373 #[serde(default)]
4375 pub order_by: Option<OrderBy>,
4376 #[serde(default)]
4378 pub returning: Vec<Expression>,
4379 #[serde(default)]
4382 pub tables: Vec<TableRef>,
4383 #[serde(default)]
4386 pub tables_from_using: bool,
4387 #[serde(default)]
4389 pub joins: Vec<Join>,
4390 #[serde(default)]
4392 pub force_index: Option<String>,
4393 #[serde(default)]
4395 pub no_from: bool,
4396}
4397
4398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4400#[cfg_attr(feature = "bindings", derive(TS))]
4401pub struct CopyStmt {
4402 pub this: Expression,
4404 pub kind: bool,
4406 pub files: Vec<Expression>,
4408 #[serde(default)]
4410 pub params: Vec<CopyParameter>,
4411 #[serde(default)]
4413 pub credentials: Option<Box<Credentials>>,
4414 #[serde(default)]
4416 pub is_into: bool,
4417 #[serde(default)]
4419 pub with_wrapped: bool,
4420}
4421
4422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4424#[cfg_attr(feature = "bindings", derive(TS))]
4425pub struct CopyParameter {
4426 pub name: String,
4427 pub value: Option<Expression>,
4428 pub values: Vec<Expression>,
4429 #[serde(default)]
4431 pub eq: bool,
4432}
4433
4434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4436#[cfg_attr(feature = "bindings", derive(TS))]
4437pub struct Credentials {
4438 pub credentials: Vec<(String, String)>,
4439 pub encryption: Option<String>,
4440 pub storage: Option<String>,
4441}
4442
4443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4445#[cfg_attr(feature = "bindings", derive(TS))]
4446pub struct PutStmt {
4447 pub source: String,
4449 #[serde(default)]
4451 pub source_quoted: bool,
4452 pub target: Expression,
4454 #[serde(default)]
4456 pub params: Vec<CopyParameter>,
4457}
4458
4459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4461#[cfg_attr(feature = "bindings", derive(TS))]
4462pub struct StageReference {
4463 pub name: String,
4465 #[serde(default)]
4467 pub path: Option<String>,
4468 #[serde(default)]
4470 pub file_format: Option<Expression>,
4471 #[serde(default)]
4473 pub pattern: Option<String>,
4474 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4476 pub quoted: bool,
4477}
4478
4479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4481#[cfg_attr(feature = "bindings", derive(TS))]
4482pub struct HistoricalData {
4483 pub this: Box<Expression>,
4485 pub kind: String,
4487 pub expression: Box<Expression>,
4489}
4490
4491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4496#[cfg_attr(feature = "bindings", derive(TS))]
4497pub struct Alias {
4498 pub this: Expression,
4500 pub alias: Identifier,
4502 #[serde(default)]
4504 pub column_aliases: Vec<Identifier>,
4505 #[serde(default)]
4507 pub alias_explicit_as: bool,
4508 #[serde(skip_serializing_if = "Option::is_none", default)]
4510 pub alias_keyword: Option<String>,
4511 #[serde(default)]
4513 pub pre_alias_comments: Vec<String>,
4514 #[serde(default)]
4516 pub trailing_comments: Vec<String>,
4517 #[serde(default, skip_serializing_if = "Option::is_none")]
4519 pub inferred_type: Option<DataType>,
4520}
4521
4522impl Alias {
4523 pub fn new(this: Expression, alias: Identifier) -> Self {
4525 Self {
4526 this,
4527 alias,
4528 column_aliases: Vec::new(),
4529 alias_explicit_as: false,
4530 alias_keyword: None,
4531 pre_alias_comments: Vec::new(),
4532 trailing_comments: Vec::new(),
4533 inferred_type: None,
4534 }
4535 }
4536
4537 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4539 Self {
4540 this,
4541 alias: Identifier::empty(),
4542 column_aliases,
4543 alias_explicit_as: false,
4544 alias_keyword: None,
4545 pre_alias_comments: Vec::new(),
4546 trailing_comments: Vec::new(),
4547 inferred_type: None,
4548 }
4549 }
4550}
4551
4552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4559#[cfg_attr(feature = "bindings", derive(TS))]
4560pub struct Cast {
4561 pub this: Expression,
4563 pub to: DataType,
4565 #[serde(default)]
4566 pub trailing_comments: Vec<String>,
4567 #[serde(default)]
4569 pub double_colon_syntax: bool,
4570 #[serde(skip_serializing_if = "Option::is_none", default)]
4572 pub format: Option<Box<Expression>>,
4573 #[serde(skip_serializing_if = "Option::is_none", default)]
4575 pub default: Option<Box<Expression>>,
4576 #[serde(default, skip_serializing_if = "Option::is_none")]
4578 pub inferred_type: Option<DataType>,
4579}
4580
4581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4583#[cfg_attr(feature = "bindings", derive(TS))]
4584pub struct CollationExpr {
4585 pub this: Expression,
4586 pub collation: String,
4587 #[serde(default)]
4589 pub quoted: bool,
4590 #[serde(default)]
4592 pub double_quoted: bool,
4593}
4594
4595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4601#[cfg_attr(feature = "bindings", derive(TS))]
4602pub struct Case {
4603 pub operand: Option<Expression>,
4605 pub whens: Vec<(Expression, Expression)>,
4607 pub else_: Option<Expression>,
4609 #[serde(default)]
4611 #[serde(skip_serializing_if = "Vec::is_empty")]
4612 pub comments: Vec<String>,
4613 #[serde(default, skip_serializing_if = "Option::is_none")]
4615 pub inferred_type: Option<DataType>,
4616}
4617
4618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4626#[cfg_attr(feature = "bindings", derive(TS))]
4627pub struct BinaryOp {
4628 pub left: Expression,
4629 pub right: Expression,
4630 #[serde(default)]
4632 pub left_comments: Vec<String>,
4633 #[serde(default)]
4635 pub operator_comments: Vec<String>,
4636 #[serde(default)]
4638 pub trailing_comments: Vec<String>,
4639 #[serde(default, skip_serializing_if = "Option::is_none")]
4641 pub inferred_type: Option<DataType>,
4642}
4643
4644impl BinaryOp {
4645 pub fn new(left: Expression, right: Expression) -> Self {
4646 Self {
4647 left,
4648 right,
4649 left_comments: Vec::new(),
4650 operator_comments: Vec::new(),
4651 trailing_comments: Vec::new(),
4652 inferred_type: None,
4653 }
4654 }
4655}
4656
4657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4659#[cfg_attr(feature = "bindings", derive(TS))]
4660pub struct LikeOp {
4661 pub left: Expression,
4662 pub right: Expression,
4663 #[serde(default)]
4665 pub escape: Option<Expression>,
4666 #[serde(default)]
4668 pub quantifier: Option<String>,
4669 #[serde(default, skip_serializing_if = "Option::is_none")]
4671 pub inferred_type: Option<DataType>,
4672}
4673
4674impl LikeOp {
4675 pub fn new(left: Expression, right: Expression) -> Self {
4676 Self {
4677 left,
4678 right,
4679 escape: None,
4680 quantifier: None,
4681 inferred_type: None,
4682 }
4683 }
4684
4685 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4686 Self {
4687 left,
4688 right,
4689 escape: Some(escape),
4690 quantifier: None,
4691 inferred_type: None,
4692 }
4693 }
4694}
4695
4696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4700#[cfg_attr(feature = "bindings", derive(TS))]
4701pub struct UnaryOp {
4702 pub this: Expression,
4704 #[serde(default, skip_serializing_if = "Option::is_none")]
4706 pub inferred_type: Option<DataType>,
4707}
4708
4709impl UnaryOp {
4710 pub fn new(this: Expression) -> Self {
4711 Self {
4712 this,
4713 inferred_type: None,
4714 }
4715 }
4716}
4717
4718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4723#[cfg_attr(feature = "bindings", derive(TS))]
4724pub struct In {
4725 pub this: Expression,
4727 pub expressions: Vec<Expression>,
4729 pub query: Option<Expression>,
4731 pub not: bool,
4733 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4734 pub global: bool,
4735 #[serde(default, skip_serializing_if = "Option::is_none")]
4737 pub unnest: Option<Box<Expression>>,
4738 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4742 pub is_field: bool,
4743}
4744
4745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4747#[cfg_attr(feature = "bindings", derive(TS))]
4748pub struct Between {
4749 pub this: Expression,
4751 pub low: Expression,
4753 pub high: Expression,
4755 pub not: bool,
4757 #[serde(default)]
4759 pub symmetric: Option<bool>,
4760}
4761
4762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4764#[cfg_attr(feature = "bindings", derive(TS))]
4765pub struct IsNull {
4766 pub this: Expression,
4767 pub not: bool,
4768 #[serde(default)]
4770 pub postfix_form: bool,
4771}
4772
4773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4775#[cfg_attr(feature = "bindings", derive(TS))]
4776pub struct IsTrueFalse {
4777 pub this: Expression,
4778 pub not: bool,
4779}
4780
4781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4784#[cfg_attr(feature = "bindings", derive(TS))]
4785pub struct IsJson {
4786 pub this: Expression,
4787 pub json_type: Option<String>,
4789 pub unique_keys: Option<JsonUniqueKeys>,
4791 pub negated: bool,
4793}
4794
4795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4797#[cfg_attr(feature = "bindings", derive(TS))]
4798pub enum JsonUniqueKeys {
4799 With,
4801 Without,
4803 Shorthand,
4805}
4806
4807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4809#[cfg_attr(feature = "bindings", derive(TS))]
4810pub struct Exists {
4811 pub this: Expression,
4813 pub not: bool,
4815}
4816
4817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4824#[cfg_attr(feature = "bindings", derive(TS))]
4825pub struct Function {
4826 pub name: String,
4828 pub args: Vec<Expression>,
4830 pub distinct: bool,
4832 #[serde(default)]
4833 pub trailing_comments: Vec<String>,
4834 #[serde(default)]
4836 pub use_bracket_syntax: bool,
4837 #[serde(default)]
4839 pub no_parens: bool,
4840 #[serde(default)]
4842 pub quoted: bool,
4843 #[serde(default, skip_serializing_if = "Option::is_none")]
4845 pub span: Option<Span>,
4846 #[serde(default, skip_serializing_if = "Option::is_none")]
4848 pub inferred_type: Option<DataType>,
4849}
4850
4851impl Default for Function {
4852 fn default() -> Self {
4853 Self {
4854 name: String::new(),
4855 args: Vec::new(),
4856 distinct: false,
4857 trailing_comments: Vec::new(),
4858 use_bracket_syntax: false,
4859 no_parens: false,
4860 quoted: false,
4861 span: None,
4862 inferred_type: None,
4863 }
4864 }
4865}
4866
4867impl Function {
4868 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4869 Self {
4870 name: name.into(),
4871 args,
4872 distinct: false,
4873 trailing_comments: Vec::new(),
4874 use_bracket_syntax: false,
4875 no_parens: false,
4876 quoted: false,
4877 span: None,
4878 inferred_type: None,
4879 }
4880 }
4881}
4882
4883#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4890#[cfg_attr(feature = "bindings", derive(TS))]
4891pub struct AggregateFunction {
4892 pub name: String,
4894 pub args: Vec<Expression>,
4896 pub distinct: bool,
4898 pub filter: Option<Expression>,
4900 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4902 pub order_by: Vec<Ordered>,
4903 #[serde(default, skip_serializing_if = "Option::is_none")]
4905 pub limit: Option<Box<Expression>>,
4906 #[serde(default, skip_serializing_if = "Option::is_none")]
4908 pub ignore_nulls: Option<bool>,
4909 #[serde(default, skip_serializing_if = "Option::is_none")]
4911 pub inferred_type: Option<DataType>,
4912}
4913
4914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4921#[cfg_attr(feature = "bindings", derive(TS))]
4922pub struct WindowFunction {
4923 pub this: Expression,
4925 pub over: Over,
4927 #[serde(default, skip_serializing_if = "Option::is_none")]
4929 pub keep: Option<Keep>,
4930 #[serde(default, skip_serializing_if = "Option::is_none")]
4932 pub inferred_type: Option<DataType>,
4933}
4934
4935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4938#[cfg_attr(feature = "bindings", derive(TS))]
4939pub struct Keep {
4940 pub first: bool,
4942 pub order_by: Vec<Ordered>,
4944}
4945
4946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4948#[cfg_attr(feature = "bindings", derive(TS))]
4949pub struct WithinGroup {
4950 pub this: Expression,
4952 pub order_by: Vec<Ordered>,
4954}
4955
4956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4961#[cfg_attr(feature = "bindings", derive(TS))]
4962pub struct From {
4963 pub expressions: Vec<Expression>,
4965}
4966
4967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4973#[cfg_attr(feature = "bindings", derive(TS))]
4974pub struct Join {
4975 pub this: Expression,
4977 pub on: Option<Expression>,
4979 pub using: Vec<Identifier>,
4981 pub kind: JoinKind,
4983 pub use_inner_keyword: bool,
4985 pub use_outer_keyword: bool,
4987 pub deferred_condition: bool,
4989 #[serde(default, skip_serializing_if = "Option::is_none")]
4991 pub join_hint: Option<String>,
4992 #[serde(default, skip_serializing_if = "Option::is_none")]
4994 pub match_condition: Option<Expression>,
4995 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4997 pub pivots: Vec<Expression>,
4998 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5000 pub comments: Vec<String>,
5001 #[serde(default)]
5005 pub nesting_group: usize,
5006 #[serde(default)]
5008 pub directed: bool,
5009}
5010
5011#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5018#[cfg_attr(feature = "bindings", derive(TS))]
5019pub enum JoinKind {
5020 Inner,
5021 Left,
5022 Right,
5023 Full,
5024 Outer, Cross,
5026 Natural,
5027 NaturalLeft,
5028 NaturalRight,
5029 NaturalFull,
5030 Semi,
5031 Anti,
5032 LeftSemi,
5034 LeftAnti,
5035 RightSemi,
5036 RightAnti,
5037 CrossApply,
5039 OuterApply,
5040 AsOf,
5042 AsOfLeft,
5043 AsOfRight,
5044 Lateral,
5046 LeftLateral,
5047 Straight,
5049 Implicit,
5051 Array,
5053 LeftArray,
5054 Paste,
5056 Positional,
5058}
5059
5060impl Default for JoinKind {
5061 fn default() -> Self {
5062 JoinKind::Inner
5063 }
5064}
5065
5066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5069#[cfg_attr(feature = "bindings", derive(TS))]
5070pub struct JoinedTable {
5071 pub left: Expression,
5073 pub joins: Vec<Join>,
5075 pub lateral_views: Vec<LateralView>,
5077 pub alias: Option<Identifier>,
5079}
5080
5081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5083#[cfg_attr(feature = "bindings", derive(TS))]
5084pub struct Where {
5085 pub this: Expression,
5087}
5088
5089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5094#[cfg_attr(feature = "bindings", derive(TS))]
5095pub struct GroupBy {
5096 pub expressions: Vec<Expression>,
5098 #[serde(default)]
5100 pub all: Option<bool>,
5101 #[serde(default)]
5103 pub totals: bool,
5104 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5106 pub comments: Vec<String>,
5107}
5108
5109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5111#[cfg_attr(feature = "bindings", derive(TS))]
5112pub struct Having {
5113 pub this: Expression,
5115 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5117 pub comments: Vec<String>,
5118}
5119
5120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5122#[cfg_attr(feature = "bindings", derive(TS))]
5123pub struct OrderBy {
5124 pub expressions: Vec<Ordered>,
5126 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5128 pub siblings: bool,
5129 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5131 pub comments: Vec<String>,
5132}
5133
5134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5141#[cfg_attr(feature = "bindings", derive(TS))]
5142pub struct Ordered {
5143 pub this: Expression,
5145 pub desc: bool,
5147 pub nulls_first: Option<bool>,
5149 #[serde(default)]
5151 pub explicit_asc: bool,
5152 #[serde(default, skip_serializing_if = "Option::is_none")]
5154 pub with_fill: Option<Box<WithFill>>,
5155}
5156
5157impl Ordered {
5158 pub fn asc(expr: Expression) -> Self {
5159 Self {
5160 this: expr,
5161 desc: false,
5162 nulls_first: None,
5163 explicit_asc: false,
5164 with_fill: None,
5165 }
5166 }
5167
5168 pub fn desc(expr: Expression) -> Self {
5169 Self {
5170 this: expr,
5171 desc: true,
5172 nulls_first: None,
5173 explicit_asc: false,
5174 with_fill: None,
5175 }
5176 }
5177}
5178
5179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5182#[cfg_attr(feature = "bindings", derive(TS))]
5183#[cfg_attr(feature = "bindings", ts(export))]
5184pub struct DistributeBy {
5185 pub expressions: Vec<Expression>,
5186}
5187
5188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5191#[cfg_attr(feature = "bindings", derive(TS))]
5192#[cfg_attr(feature = "bindings", ts(export))]
5193pub struct ClusterBy {
5194 pub expressions: Vec<Ordered>,
5195}
5196
5197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5200#[cfg_attr(feature = "bindings", derive(TS))]
5201#[cfg_attr(feature = "bindings", ts(export))]
5202pub struct SortBy {
5203 pub expressions: Vec<Ordered>,
5204}
5205
5206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5209#[cfg_attr(feature = "bindings", derive(TS))]
5210#[cfg_attr(feature = "bindings", ts(export))]
5211pub struct LateralView {
5212 pub this: Expression,
5214 pub table_alias: Option<Identifier>,
5216 pub column_aliases: Vec<Identifier>,
5218 pub outer: bool,
5220}
5221
5222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5224#[cfg_attr(feature = "bindings", derive(TS))]
5225#[cfg_attr(feature = "bindings", ts(export))]
5226pub struct Hint {
5227 pub expressions: Vec<HintExpression>,
5228}
5229
5230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5232#[cfg_attr(feature = "bindings", derive(TS))]
5233#[cfg_attr(feature = "bindings", ts(export))]
5234pub enum HintExpression {
5235 Function { name: String, args: Vec<Expression> },
5237 Identifier(String),
5239 Raw(String),
5241}
5242
5243#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5245#[cfg_attr(feature = "bindings", derive(TS))]
5246#[cfg_attr(feature = "bindings", ts(export))]
5247pub enum PseudocolumnType {
5248 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5255
5256impl PseudocolumnType {
5257 pub fn as_str(&self) -> &'static str {
5258 match self {
5259 PseudocolumnType::Rownum => "ROWNUM",
5260 PseudocolumnType::Rowid => "ROWID",
5261 PseudocolumnType::Level => "LEVEL",
5262 PseudocolumnType::Sysdate => "SYSDATE",
5263 PseudocolumnType::ObjectId => "OBJECT_ID",
5264 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5265 }
5266 }
5267
5268 pub fn from_str(s: &str) -> Option<Self> {
5269 match s.to_uppercase().as_str() {
5270 "ROWNUM" => Some(PseudocolumnType::Rownum),
5271 "ROWID" => Some(PseudocolumnType::Rowid),
5272 "LEVEL" => Some(PseudocolumnType::Level),
5273 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5274 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5275 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5276 _ => None,
5277 }
5278 }
5279}
5280
5281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5284#[cfg_attr(feature = "bindings", derive(TS))]
5285#[cfg_attr(feature = "bindings", ts(export))]
5286pub struct Pseudocolumn {
5287 pub kind: PseudocolumnType,
5288}
5289
5290impl Pseudocolumn {
5291 pub fn rownum() -> Self {
5292 Self {
5293 kind: PseudocolumnType::Rownum,
5294 }
5295 }
5296
5297 pub fn rowid() -> Self {
5298 Self {
5299 kind: PseudocolumnType::Rowid,
5300 }
5301 }
5302
5303 pub fn level() -> Self {
5304 Self {
5305 kind: PseudocolumnType::Level,
5306 }
5307 }
5308}
5309
5310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5312#[cfg_attr(feature = "bindings", derive(TS))]
5313#[cfg_attr(feature = "bindings", ts(export))]
5314pub struct Connect {
5315 pub start: Option<Expression>,
5317 pub connect: Expression,
5319 pub nocycle: bool,
5321}
5322
5323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5325#[cfg_attr(feature = "bindings", derive(TS))]
5326#[cfg_attr(feature = "bindings", ts(export))]
5327pub struct Prior {
5328 pub this: Expression,
5329}
5330
5331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5333#[cfg_attr(feature = "bindings", derive(TS))]
5334#[cfg_attr(feature = "bindings", ts(export))]
5335pub struct ConnectByRoot {
5336 pub this: Expression,
5337}
5338
5339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5341#[cfg_attr(feature = "bindings", derive(TS))]
5342#[cfg_attr(feature = "bindings", ts(export))]
5343pub struct MatchRecognize {
5344 pub this: Option<Box<Expression>>,
5346 pub partition_by: Option<Vec<Expression>>,
5348 pub order_by: Option<Vec<Ordered>>,
5350 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5352 pub rows: Option<MatchRecognizeRows>,
5354 pub after: Option<MatchRecognizeAfter>,
5356 pub pattern: Option<String>,
5358 pub define: Option<Vec<(Identifier, Expression)>>,
5360 pub alias: Option<Identifier>,
5362 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5364 pub alias_explicit_as: bool,
5365}
5366
5367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5369#[cfg_attr(feature = "bindings", derive(TS))]
5370#[cfg_attr(feature = "bindings", ts(export))]
5371pub struct MatchRecognizeMeasure {
5372 pub this: Expression,
5374 pub window_frame: Option<MatchRecognizeSemantics>,
5376}
5377
5378#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5380#[cfg_attr(feature = "bindings", derive(TS))]
5381#[cfg_attr(feature = "bindings", ts(export))]
5382pub enum MatchRecognizeSemantics {
5383 Running,
5384 Final,
5385}
5386
5387#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5389#[cfg_attr(feature = "bindings", derive(TS))]
5390#[cfg_attr(feature = "bindings", ts(export))]
5391pub enum MatchRecognizeRows {
5392 OneRowPerMatch,
5393 AllRowsPerMatch,
5394 AllRowsPerMatchShowEmptyMatches,
5395 AllRowsPerMatchOmitEmptyMatches,
5396 AllRowsPerMatchWithUnmatchedRows,
5397}
5398
5399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5401#[cfg_attr(feature = "bindings", derive(TS))]
5402#[cfg_attr(feature = "bindings", ts(export))]
5403pub enum MatchRecognizeAfter {
5404 PastLastRow,
5405 ToNextRow,
5406 ToFirst(Identifier),
5407 ToLast(Identifier),
5408}
5409
5410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5412#[cfg_attr(feature = "bindings", derive(TS))]
5413pub struct Limit {
5414 pub this: Expression,
5416 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5418 pub percent: bool,
5419 #[serde(default)]
5421 #[serde(skip_serializing_if = "Vec::is_empty")]
5422 pub comments: Vec<String>,
5423}
5424
5425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5427#[cfg_attr(feature = "bindings", derive(TS))]
5428pub struct Offset {
5429 pub this: Expression,
5430 #[serde(skip_serializing_if = "Option::is_none", default)]
5432 pub rows: Option<bool>,
5433}
5434
5435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5437#[cfg_attr(feature = "bindings", derive(TS))]
5438pub struct Top {
5439 pub this: Expression,
5440 pub percent: bool,
5441 pub with_ties: bool,
5442 #[serde(default)]
5444 pub parenthesized: bool,
5445}
5446
5447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5449#[cfg_attr(feature = "bindings", derive(TS))]
5450pub struct Fetch {
5451 pub direction: String,
5453 pub count: Option<Expression>,
5455 pub percent: bool,
5457 pub rows: bool,
5459 pub with_ties: bool,
5461}
5462
5463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5469#[cfg_attr(feature = "bindings", derive(TS))]
5470pub struct Qualify {
5471 pub this: Expression,
5473}
5474
5475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5477#[cfg_attr(feature = "bindings", derive(TS))]
5478pub struct Sample {
5479 pub method: SampleMethod,
5480 pub size: Expression,
5481 pub seed: Option<Expression>,
5482 #[serde(default)]
5484 pub offset: Option<Expression>,
5485 pub unit_after_size: bool,
5487 #[serde(default)]
5489 pub use_sample_keyword: bool,
5490 #[serde(default)]
5492 pub explicit_method: bool,
5493 #[serde(default)]
5495 pub method_before_size: bool,
5496 #[serde(default)]
5498 pub use_seed_keyword: bool,
5499 pub bucket_numerator: Option<Box<Expression>>,
5501 pub bucket_denominator: Option<Box<Expression>>,
5503 pub bucket_field: Option<Box<Expression>>,
5505 #[serde(default)]
5507 pub is_using_sample: bool,
5508 #[serde(default)]
5510 pub is_percent: bool,
5511 #[serde(default)]
5513 pub suppress_method_output: bool,
5514}
5515
5516#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5518#[cfg_attr(feature = "bindings", derive(TS))]
5519pub enum SampleMethod {
5520 Bernoulli,
5521 System,
5522 Block,
5523 Row,
5524 Percent,
5525 Bucket,
5527 Reservoir,
5529}
5530
5531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5533#[cfg_attr(feature = "bindings", derive(TS))]
5534pub struct NamedWindow {
5535 pub name: Identifier,
5536 pub spec: Over,
5537}
5538
5539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5545#[cfg_attr(feature = "bindings", derive(TS))]
5546pub struct With {
5547 pub ctes: Vec<Cte>,
5549 pub recursive: bool,
5551 #[serde(default)]
5553 pub leading_comments: Vec<String>,
5554 #[serde(default, skip_serializing_if = "Option::is_none")]
5556 pub search: Option<Box<Expression>>,
5557}
5558
5559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5566#[cfg_attr(feature = "bindings", derive(TS))]
5567pub struct Cte {
5568 pub alias: Identifier,
5570 pub this: Expression,
5572 pub columns: Vec<Identifier>,
5574 pub materialized: Option<bool>,
5576 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5578 pub key_expressions: Vec<Identifier>,
5579 #[serde(default)]
5581 pub alias_first: bool,
5582 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5584 pub comments: Vec<String>,
5585}
5586
5587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5589#[cfg_attr(feature = "bindings", derive(TS))]
5590pub struct WindowSpec {
5591 pub partition_by: Vec<Expression>,
5592 pub order_by: Vec<Ordered>,
5593 pub frame: Option<WindowFrame>,
5594}
5595
5596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5598#[cfg_attr(feature = "bindings", derive(TS))]
5599pub struct Over {
5600 pub window_name: Option<Identifier>,
5602 pub partition_by: Vec<Expression>,
5603 pub order_by: Vec<Ordered>,
5604 pub frame: Option<WindowFrame>,
5605 pub alias: Option<Identifier>,
5606}
5607
5608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5610#[cfg_attr(feature = "bindings", derive(TS))]
5611pub struct WindowFrame {
5612 pub kind: WindowFrameKind,
5613 pub start: WindowFrameBound,
5614 pub end: Option<WindowFrameBound>,
5615 pub exclude: Option<WindowFrameExclude>,
5616 #[serde(default, skip_serializing_if = "Option::is_none")]
5618 pub kind_text: Option<String>,
5619 #[serde(default, skip_serializing_if = "Option::is_none")]
5621 pub start_side_text: Option<String>,
5622 #[serde(default, skip_serializing_if = "Option::is_none")]
5624 pub end_side_text: Option<String>,
5625}
5626
5627#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5628#[cfg_attr(feature = "bindings", derive(TS))]
5629pub enum WindowFrameKind {
5630 Rows,
5631 Range,
5632 Groups,
5633}
5634
5635#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5637#[cfg_attr(feature = "bindings", derive(TS))]
5638pub enum WindowFrameExclude {
5639 CurrentRow,
5640 Group,
5641 Ties,
5642 NoOthers,
5643}
5644
5645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5646#[cfg_attr(feature = "bindings", derive(TS))]
5647pub enum WindowFrameBound {
5648 CurrentRow,
5649 UnboundedPreceding,
5650 UnboundedFollowing,
5651 Preceding(Box<Expression>),
5652 Following(Box<Expression>),
5653 BarePreceding,
5655 BareFollowing,
5657 Value(Box<Expression>),
5659}
5660
5661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5663#[cfg_attr(feature = "bindings", derive(TS))]
5664pub struct StructField {
5665 pub name: String,
5666 pub data_type: DataType,
5667 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5668 pub options: Vec<Expression>,
5669 #[serde(default, skip_serializing_if = "Option::is_none")]
5670 pub comment: Option<String>,
5671}
5672
5673impl StructField {
5674 pub fn new(name: String, data_type: DataType) -> Self {
5676 Self {
5677 name,
5678 data_type,
5679 options: Vec::new(),
5680 comment: None,
5681 }
5682 }
5683
5684 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5686 Self {
5687 name,
5688 data_type,
5689 options,
5690 comment: None,
5691 }
5692 }
5693
5694 pub fn with_options_and_comment(
5696 name: String,
5697 data_type: DataType,
5698 options: Vec<Expression>,
5699 comment: Option<String>,
5700 ) -> Self {
5701 Self {
5702 name,
5703 data_type,
5704 options,
5705 comment,
5706 }
5707 }
5708}
5709
5710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5722#[cfg_attr(feature = "bindings", derive(TS))]
5723#[serde(tag = "data_type", rename_all = "snake_case")]
5724pub enum DataType {
5725 Boolean,
5727 TinyInt {
5728 length: Option<u32>,
5729 },
5730 SmallInt {
5731 length: Option<u32>,
5732 },
5733 Int {
5737 length: Option<u32>,
5738 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5739 integer_spelling: bool,
5740 },
5741 BigInt {
5742 length: Option<u32>,
5743 },
5744 Float {
5748 precision: Option<u32>,
5749 scale: Option<u32>,
5750 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5751 real_spelling: bool,
5752 },
5753 Double {
5754 precision: Option<u32>,
5755 scale: Option<u32>,
5756 },
5757 Decimal {
5758 precision: Option<u32>,
5759 scale: Option<u32>,
5760 },
5761
5762 Char {
5764 length: Option<u32>,
5765 },
5766 VarChar {
5769 length: Option<u32>,
5770 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5771 parenthesized_length: bool,
5772 },
5773 String {
5775 length: Option<u32>,
5776 },
5777 Text,
5778 TextWithLength {
5780 length: u32,
5781 },
5782
5783 Binary {
5785 length: Option<u32>,
5786 },
5787 VarBinary {
5788 length: Option<u32>,
5789 },
5790 Blob,
5791
5792 Bit {
5794 length: Option<u32>,
5795 },
5796 VarBit {
5797 length: Option<u32>,
5798 },
5799
5800 Date,
5802 Time {
5803 precision: Option<u32>,
5804 #[serde(default)]
5805 timezone: bool,
5806 },
5807 Timestamp {
5808 precision: Option<u32>,
5809 timezone: bool,
5810 },
5811 Interval {
5812 unit: Option<String>,
5813 #[serde(default, skip_serializing_if = "Option::is_none")]
5815 to: Option<String>,
5816 },
5817
5818 Json,
5820 JsonB,
5821
5822 Uuid,
5824
5825 Array {
5827 element_type: Box<DataType>,
5828 #[serde(default, skip_serializing_if = "Option::is_none")]
5830 dimension: Option<u32>,
5831 },
5832
5833 List {
5836 element_type: Box<DataType>,
5837 },
5838
5839 Struct {
5843 fields: Vec<StructField>,
5844 nested: bool,
5845 },
5846 Map {
5847 key_type: Box<DataType>,
5848 value_type: Box<DataType>,
5849 },
5850
5851 Enum {
5853 values: Vec<String>,
5854 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5855 assignments: Vec<Option<String>>,
5856 },
5857
5858 Set {
5860 values: Vec<String>,
5861 },
5862
5863 Union {
5865 fields: Vec<(String, DataType)>,
5866 },
5867
5868 Vector {
5870 #[serde(default)]
5871 element_type: Option<Box<DataType>>,
5872 dimension: Option<u32>,
5873 },
5874
5875 Object {
5878 fields: Vec<(String, DataType, bool)>,
5879 modifier: Option<String>,
5880 },
5881
5882 Nullable {
5884 inner: Box<DataType>,
5885 },
5886
5887 Custom {
5889 name: String,
5890 },
5891
5892 Geometry {
5894 subtype: Option<String>,
5895 srid: Option<u32>,
5896 },
5897 Geography {
5898 subtype: Option<String>,
5899 srid: Option<u32>,
5900 },
5901
5902 CharacterSet {
5905 name: String,
5906 },
5907
5908 Unknown,
5910}
5911
5912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5914#[cfg_attr(feature = "bindings", derive(TS))]
5915#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5916pub struct Array {
5917 pub expressions: Vec<Expression>,
5918}
5919
5920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5922#[cfg_attr(feature = "bindings", derive(TS))]
5923pub struct Struct {
5924 pub fields: Vec<(Option<String>, Expression)>,
5925}
5926
5927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5929#[cfg_attr(feature = "bindings", derive(TS))]
5930pub struct Tuple {
5931 pub expressions: Vec<Expression>,
5932}
5933
5934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5936#[cfg_attr(feature = "bindings", derive(TS))]
5937pub struct Interval {
5938 pub this: Option<Expression>,
5940 pub unit: Option<IntervalUnitSpec>,
5942}
5943
5944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5946#[cfg_attr(feature = "bindings", derive(TS))]
5947#[serde(tag = "type", rename_all = "snake_case")]
5948pub enum IntervalUnitSpec {
5949 Simple {
5951 unit: IntervalUnit,
5952 use_plural: bool,
5954 },
5955 Span(IntervalSpan),
5957 ExprSpan(IntervalSpanExpr),
5960 Expr(Box<Expression>),
5962}
5963
5964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5966#[cfg_attr(feature = "bindings", derive(TS))]
5967pub struct IntervalSpan {
5968 pub this: IntervalUnit,
5970 pub expression: IntervalUnit,
5972}
5973
5974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5977#[cfg_attr(feature = "bindings", derive(TS))]
5978pub struct IntervalSpanExpr {
5979 pub this: Box<Expression>,
5981 pub expression: Box<Expression>,
5983}
5984
5985#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5986#[cfg_attr(feature = "bindings", derive(TS))]
5987pub enum IntervalUnit {
5988 Year,
5989 Quarter,
5990 Month,
5991 Week,
5992 Day,
5993 Hour,
5994 Minute,
5995 Second,
5996 Millisecond,
5997 Microsecond,
5998 Nanosecond,
5999}
6000
6001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6003#[cfg_attr(feature = "bindings", derive(TS))]
6004pub struct Command {
6005 pub this: String,
6007}
6008
6009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6011#[cfg_attr(feature = "bindings", derive(TS))]
6012pub struct TryCatch {
6013 #[serde(default)]
6015 pub try_body: Vec<Expression>,
6016 #[serde(default, skip_serializing_if = "Option::is_none")]
6018 pub catch_body: Option<Vec<Expression>>,
6019}
6020
6021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6024#[cfg_attr(feature = "bindings", derive(TS))]
6025pub struct ExecuteStatement {
6026 pub this: Expression,
6028 #[serde(default)]
6030 pub parameters: Vec<ExecuteParameter>,
6031 #[serde(default, skip_serializing_if = "Option::is_none")]
6033 pub suffix: Option<String>,
6034}
6035
6036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6038#[cfg_attr(feature = "bindings", derive(TS))]
6039pub struct ExecuteParameter {
6040 pub name: String,
6042 pub value: Expression,
6044 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6046 pub positional: bool,
6047 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6049 pub output: bool,
6050}
6051
6052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6055#[cfg_attr(feature = "bindings", derive(TS))]
6056pub struct Kill {
6057 pub this: Expression,
6059 pub kind: Option<String>,
6061}
6062
6063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6065#[cfg_attr(feature = "bindings", derive(TS))]
6066pub struct CreateTask {
6067 pub or_replace: bool,
6068 pub if_not_exists: bool,
6069 pub name: String,
6071 pub properties: String,
6073 pub body: Expression,
6075}
6076
6077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6079#[cfg_attr(feature = "bindings", derive(TS))]
6080pub struct Raw {
6081 pub sql: String,
6082}
6083
6084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6090#[cfg_attr(feature = "bindings", derive(TS))]
6091pub struct UnaryFunc {
6092 pub this: Expression,
6093 #[serde(skip_serializing_if = "Option::is_none", default)]
6095 pub original_name: Option<String>,
6096 #[serde(default, skip_serializing_if = "Option::is_none")]
6098 pub inferred_type: Option<DataType>,
6099}
6100
6101impl UnaryFunc {
6102 pub fn new(this: Expression) -> Self {
6104 Self {
6105 this,
6106 original_name: None,
6107 inferred_type: None,
6108 }
6109 }
6110
6111 pub fn with_name(this: Expression, name: String) -> Self {
6113 Self {
6114 this,
6115 original_name: Some(name),
6116 inferred_type: None,
6117 }
6118 }
6119}
6120
6121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6125#[cfg_attr(feature = "bindings", derive(TS))]
6126pub struct CharFunc {
6127 pub args: Vec<Expression>,
6128 #[serde(skip_serializing_if = "Option::is_none", default)]
6129 pub charset: Option<String>,
6130 #[serde(skip_serializing_if = "Option::is_none", default)]
6132 pub name: Option<String>,
6133}
6134
6135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6137#[cfg_attr(feature = "bindings", derive(TS))]
6138pub struct BinaryFunc {
6139 pub this: Expression,
6140 pub expression: Expression,
6141 #[serde(skip_serializing_if = "Option::is_none", default)]
6143 pub original_name: Option<String>,
6144 #[serde(default, skip_serializing_if = "Option::is_none")]
6146 pub inferred_type: Option<DataType>,
6147}
6148
6149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6151#[cfg_attr(feature = "bindings", derive(TS))]
6152pub struct VarArgFunc {
6153 pub expressions: Vec<Expression>,
6154 #[serde(skip_serializing_if = "Option::is_none", default)]
6156 pub original_name: Option<String>,
6157 #[serde(default, skip_serializing_if = "Option::is_none")]
6159 pub inferred_type: Option<DataType>,
6160}
6161
6162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6164#[cfg_attr(feature = "bindings", derive(TS))]
6165pub struct ConcatWs {
6166 pub separator: Expression,
6167 pub expressions: Vec<Expression>,
6168}
6169
6170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6172#[cfg_attr(feature = "bindings", derive(TS))]
6173pub struct SubstringFunc {
6174 pub this: Expression,
6175 pub start: Expression,
6176 pub length: Option<Expression>,
6177 #[serde(default)]
6179 pub from_for_syntax: bool,
6180}
6181
6182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6184#[cfg_attr(feature = "bindings", derive(TS))]
6185pub struct OverlayFunc {
6186 pub this: Expression,
6187 pub replacement: Expression,
6188 pub from: Expression,
6189 pub length: Option<Expression>,
6190}
6191
6192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6194#[cfg_attr(feature = "bindings", derive(TS))]
6195pub struct TrimFunc {
6196 pub this: Expression,
6197 pub characters: Option<Expression>,
6198 pub position: TrimPosition,
6199 #[serde(default)]
6201 pub sql_standard_syntax: bool,
6202 #[serde(default)]
6204 pub position_explicit: bool,
6205}
6206
6207#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6208#[cfg_attr(feature = "bindings", derive(TS))]
6209pub enum TrimPosition {
6210 Both,
6211 Leading,
6212 Trailing,
6213}
6214
6215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6217#[cfg_attr(feature = "bindings", derive(TS))]
6218pub struct ReplaceFunc {
6219 pub this: Expression,
6220 pub old: Expression,
6221 pub new: Expression,
6222}
6223
6224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6226#[cfg_attr(feature = "bindings", derive(TS))]
6227pub struct LeftRightFunc {
6228 pub this: Expression,
6229 pub length: Expression,
6230}
6231
6232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6234#[cfg_attr(feature = "bindings", derive(TS))]
6235pub struct RepeatFunc {
6236 pub this: Expression,
6237 pub times: Expression,
6238}
6239
6240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6242#[cfg_attr(feature = "bindings", derive(TS))]
6243pub struct PadFunc {
6244 pub this: Expression,
6245 pub length: Expression,
6246 pub fill: Option<Expression>,
6247}
6248
6249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6251#[cfg_attr(feature = "bindings", derive(TS))]
6252pub struct SplitFunc {
6253 pub this: Expression,
6254 pub delimiter: Expression,
6255}
6256
6257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6259#[cfg_attr(feature = "bindings", derive(TS))]
6260pub struct RegexpFunc {
6261 pub this: Expression,
6262 pub pattern: Expression,
6263 pub flags: Option<Expression>,
6264}
6265
6266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6268#[cfg_attr(feature = "bindings", derive(TS))]
6269pub struct RegexpReplaceFunc {
6270 pub this: Expression,
6271 pub pattern: Expression,
6272 pub replacement: Expression,
6273 pub flags: Option<Expression>,
6274}
6275
6276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6278#[cfg_attr(feature = "bindings", derive(TS))]
6279pub struct RegexpExtractFunc {
6280 pub this: Expression,
6281 pub pattern: Expression,
6282 pub group: Option<Expression>,
6283}
6284
6285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6287#[cfg_attr(feature = "bindings", derive(TS))]
6288pub struct RoundFunc {
6289 pub this: Expression,
6290 pub decimals: Option<Expression>,
6291}
6292
6293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6295#[cfg_attr(feature = "bindings", derive(TS))]
6296pub struct FloorFunc {
6297 pub this: Expression,
6298 pub scale: Option<Expression>,
6299 #[serde(skip_serializing_if = "Option::is_none", default)]
6301 pub to: Option<Expression>,
6302}
6303
6304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6306#[cfg_attr(feature = "bindings", derive(TS))]
6307pub struct CeilFunc {
6308 pub this: Expression,
6309 #[serde(skip_serializing_if = "Option::is_none", default)]
6310 pub decimals: Option<Expression>,
6311 #[serde(skip_serializing_if = "Option::is_none", default)]
6313 pub to: Option<Expression>,
6314}
6315
6316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6318#[cfg_attr(feature = "bindings", derive(TS))]
6319pub struct LogFunc {
6320 pub this: Expression,
6321 pub base: Option<Expression>,
6322}
6323
6324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6326#[cfg_attr(feature = "bindings", derive(TS))]
6327pub struct CurrentDate;
6328
6329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6331#[cfg_attr(feature = "bindings", derive(TS))]
6332pub struct CurrentTime {
6333 pub precision: Option<u32>,
6334}
6335
6336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6338#[cfg_attr(feature = "bindings", derive(TS))]
6339pub struct CurrentTimestamp {
6340 pub precision: Option<u32>,
6341 #[serde(default)]
6343 pub sysdate: bool,
6344}
6345
6346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6348#[cfg_attr(feature = "bindings", derive(TS))]
6349pub struct CurrentTimestampLTZ {
6350 pub precision: Option<u32>,
6351}
6352
6353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6355#[cfg_attr(feature = "bindings", derive(TS))]
6356pub struct AtTimeZone {
6357 pub this: Expression,
6359 pub zone: Expression,
6361}
6362
6363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6365#[cfg_attr(feature = "bindings", derive(TS))]
6366pub struct DateAddFunc {
6367 pub this: Expression,
6368 pub interval: Expression,
6369 pub unit: IntervalUnit,
6370}
6371
6372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6374#[cfg_attr(feature = "bindings", derive(TS))]
6375pub struct DateDiffFunc {
6376 pub this: Expression,
6377 pub expression: Expression,
6378 pub unit: Option<IntervalUnit>,
6379}
6380
6381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6383#[cfg_attr(feature = "bindings", derive(TS))]
6384pub struct DateTruncFunc {
6385 pub this: Expression,
6386 pub unit: DateTimeField,
6387}
6388
6389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6391#[cfg_attr(feature = "bindings", derive(TS))]
6392pub struct ExtractFunc {
6393 pub this: Expression,
6394 pub field: DateTimeField,
6395}
6396
6397#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6398#[cfg_attr(feature = "bindings", derive(TS))]
6399pub enum DateTimeField {
6400 Year,
6401 Month,
6402 Day,
6403 Hour,
6404 Minute,
6405 Second,
6406 Millisecond,
6407 Microsecond,
6408 DayOfWeek,
6409 DayOfYear,
6410 Week,
6411 WeekWithModifier(String),
6413 Quarter,
6414 Epoch,
6415 Timezone,
6416 TimezoneHour,
6417 TimezoneMinute,
6418 Date,
6419 Time,
6420 Custom(String),
6422}
6423
6424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6426#[cfg_attr(feature = "bindings", derive(TS))]
6427pub struct ToDateFunc {
6428 pub this: Expression,
6429 pub format: Option<Expression>,
6430}
6431
6432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6434#[cfg_attr(feature = "bindings", derive(TS))]
6435pub struct ToTimestampFunc {
6436 pub this: Expression,
6437 pub format: Option<Expression>,
6438}
6439
6440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6442#[cfg_attr(feature = "bindings", derive(TS))]
6443pub struct IfFunc {
6444 pub condition: Expression,
6445 pub true_value: Expression,
6446 pub false_value: Option<Expression>,
6447 #[serde(skip_serializing_if = "Option::is_none", default)]
6449 pub original_name: Option<String>,
6450 #[serde(default, skip_serializing_if = "Option::is_none")]
6452 pub inferred_type: Option<DataType>,
6453}
6454
6455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6457#[cfg_attr(feature = "bindings", derive(TS))]
6458pub struct Nvl2Func {
6459 pub this: Expression,
6460 pub true_value: Expression,
6461 pub false_value: Expression,
6462 #[serde(default, skip_serializing_if = "Option::is_none")]
6464 pub inferred_type: Option<DataType>,
6465}
6466
6467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6473#[cfg_attr(feature = "bindings", derive(TS))]
6474pub struct AggFunc {
6475 pub this: Expression,
6476 pub distinct: bool,
6477 pub filter: Option<Expression>,
6478 pub order_by: Vec<Ordered>,
6479 #[serde(skip_serializing_if = "Option::is_none", default)]
6481 pub name: Option<String>,
6482 #[serde(skip_serializing_if = "Option::is_none", default)]
6484 pub ignore_nulls: Option<bool>,
6485 #[serde(skip_serializing_if = "Option::is_none", default)]
6488 pub having_max: Option<(Box<Expression>, bool)>,
6489 #[serde(skip_serializing_if = "Option::is_none", default)]
6491 pub limit: Option<Box<Expression>>,
6492 #[serde(default, skip_serializing_if = "Option::is_none")]
6494 pub inferred_type: Option<DataType>,
6495}
6496
6497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6499#[cfg_attr(feature = "bindings", derive(TS))]
6500pub struct CountFunc {
6501 pub this: Option<Expression>,
6502 pub star: bool,
6503 pub distinct: bool,
6504 pub filter: Option<Expression>,
6505 #[serde(default, skip_serializing_if = "Option::is_none")]
6507 pub ignore_nulls: Option<bool>,
6508 #[serde(default, skip_serializing_if = "Option::is_none")]
6510 pub original_name: Option<String>,
6511 #[serde(default, skip_serializing_if = "Option::is_none")]
6513 pub inferred_type: Option<DataType>,
6514}
6515
6516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6518#[cfg_attr(feature = "bindings", derive(TS))]
6519pub struct GroupConcatFunc {
6520 pub this: Expression,
6521 pub separator: Option<Expression>,
6522 pub order_by: Option<Vec<Ordered>>,
6523 pub distinct: bool,
6524 pub filter: Option<Expression>,
6525 #[serde(default, skip_serializing_if = "Option::is_none")]
6527 pub limit: Option<Box<Expression>>,
6528 #[serde(default, skip_serializing_if = "Option::is_none")]
6530 pub inferred_type: Option<DataType>,
6531}
6532
6533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6535#[cfg_attr(feature = "bindings", derive(TS))]
6536pub struct StringAggFunc {
6537 pub this: Expression,
6538 #[serde(default)]
6539 pub separator: Option<Expression>,
6540 #[serde(default)]
6541 pub order_by: Option<Vec<Ordered>>,
6542 #[serde(default)]
6543 pub distinct: bool,
6544 #[serde(default)]
6545 pub filter: Option<Expression>,
6546 #[serde(default, skip_serializing_if = "Option::is_none")]
6548 pub limit: Option<Box<Expression>>,
6549 #[serde(default, skip_serializing_if = "Option::is_none")]
6551 pub inferred_type: Option<DataType>,
6552}
6553
6554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6556#[cfg_attr(feature = "bindings", derive(TS))]
6557pub struct ListAggFunc {
6558 pub this: Expression,
6559 pub separator: Option<Expression>,
6560 pub on_overflow: Option<ListAggOverflow>,
6561 pub order_by: Option<Vec<Ordered>>,
6562 pub distinct: bool,
6563 pub filter: Option<Expression>,
6564 #[serde(default, skip_serializing_if = "Option::is_none")]
6566 pub inferred_type: Option<DataType>,
6567}
6568
6569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6571#[cfg_attr(feature = "bindings", derive(TS))]
6572pub enum ListAggOverflow {
6573 Error,
6574 Truncate {
6575 filler: Option<Expression>,
6576 with_count: bool,
6577 },
6578}
6579
6580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6582#[cfg_attr(feature = "bindings", derive(TS))]
6583pub struct SumIfFunc {
6584 pub this: Expression,
6585 pub condition: Expression,
6586 pub filter: Option<Expression>,
6587 #[serde(default, skip_serializing_if = "Option::is_none")]
6589 pub inferred_type: Option<DataType>,
6590}
6591
6592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6594#[cfg_attr(feature = "bindings", derive(TS))]
6595pub struct ApproxPercentileFunc {
6596 pub this: Expression,
6597 pub percentile: Expression,
6598 pub accuracy: Option<Expression>,
6599 pub filter: Option<Expression>,
6600}
6601
6602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6604#[cfg_attr(feature = "bindings", derive(TS))]
6605pub struct PercentileFunc {
6606 pub this: Expression,
6607 pub percentile: Expression,
6608 pub order_by: Option<Vec<Ordered>>,
6609 pub filter: Option<Expression>,
6610}
6611
6612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6618#[cfg_attr(feature = "bindings", derive(TS))]
6619pub struct RowNumber;
6620
6621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6623#[cfg_attr(feature = "bindings", derive(TS))]
6624pub struct Rank {
6625 #[serde(default, skip_serializing_if = "Option::is_none")]
6627 pub order_by: Option<Vec<Ordered>>,
6628 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6630 pub args: Vec<Expression>,
6631}
6632
6633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6635#[cfg_attr(feature = "bindings", derive(TS))]
6636pub struct DenseRank {
6637 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6639 pub args: Vec<Expression>,
6640}
6641
6642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6644#[cfg_attr(feature = "bindings", derive(TS))]
6645pub struct NTileFunc {
6646 #[serde(default, skip_serializing_if = "Option::is_none")]
6648 pub num_buckets: Option<Expression>,
6649 #[serde(default, skip_serializing_if = "Option::is_none")]
6651 pub order_by: Option<Vec<Ordered>>,
6652}
6653
6654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6656#[cfg_attr(feature = "bindings", derive(TS))]
6657pub struct LeadLagFunc {
6658 pub this: Expression,
6659 pub offset: Option<Expression>,
6660 pub default: Option<Expression>,
6661 #[serde(default, skip_serializing_if = "Option::is_none")]
6663 pub ignore_nulls: Option<bool>,
6664}
6665
6666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6668#[cfg_attr(feature = "bindings", derive(TS))]
6669pub struct ValueFunc {
6670 pub this: Expression,
6671 #[serde(default, skip_serializing_if = "Option::is_none")]
6673 pub ignore_nulls: Option<bool>,
6674 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6676 pub order_by: Vec<Ordered>,
6677}
6678
6679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6681#[cfg_attr(feature = "bindings", derive(TS))]
6682pub struct NthValueFunc {
6683 pub this: Expression,
6684 pub offset: Expression,
6685 #[serde(default, skip_serializing_if = "Option::is_none")]
6687 pub ignore_nulls: Option<bool>,
6688 #[serde(default, skip_serializing_if = "Option::is_none")]
6691 pub from_first: Option<bool>,
6692}
6693
6694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6696#[cfg_attr(feature = "bindings", derive(TS))]
6697pub struct PercentRank {
6698 #[serde(default, skip_serializing_if = "Option::is_none")]
6700 pub order_by: Option<Vec<Ordered>>,
6701 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6703 pub args: Vec<Expression>,
6704}
6705
6706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6708#[cfg_attr(feature = "bindings", derive(TS))]
6709pub struct CumeDist {
6710 #[serde(default, skip_serializing_if = "Option::is_none")]
6712 pub order_by: Option<Vec<Ordered>>,
6713 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6715 pub args: Vec<Expression>,
6716}
6717
6718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6724#[cfg_attr(feature = "bindings", derive(TS))]
6725pub struct PositionFunc {
6726 pub substring: Expression,
6727 pub string: Expression,
6728 pub start: Option<Expression>,
6729}
6730
6731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6737#[cfg_attr(feature = "bindings", derive(TS))]
6738pub struct Random;
6739
6740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6742#[cfg_attr(feature = "bindings", derive(TS))]
6743pub struct Rand {
6744 pub seed: Option<Box<Expression>>,
6745 #[serde(default)]
6747 pub lower: Option<Box<Expression>>,
6748 #[serde(default)]
6750 pub upper: Option<Box<Expression>>,
6751}
6752
6753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6755#[cfg_attr(feature = "bindings", derive(TS))]
6756pub struct TruncateFunc {
6757 pub this: Expression,
6758 pub decimals: Option<Expression>,
6759}
6760
6761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6763#[cfg_attr(feature = "bindings", derive(TS))]
6764pub struct Pi;
6765
6766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6772#[cfg_attr(feature = "bindings", derive(TS))]
6773pub struct DecodeFunc {
6774 pub this: Expression,
6775 pub search_results: Vec<(Expression, Expression)>,
6776 pub default: Option<Expression>,
6777}
6778
6779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6785#[cfg_attr(feature = "bindings", derive(TS))]
6786pub struct DateFormatFunc {
6787 pub this: Expression,
6788 pub format: Expression,
6789}
6790
6791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6793#[cfg_attr(feature = "bindings", derive(TS))]
6794pub struct FromUnixtimeFunc {
6795 pub this: Expression,
6796 pub format: Option<Expression>,
6797}
6798
6799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6801#[cfg_attr(feature = "bindings", derive(TS))]
6802pub struct UnixTimestampFunc {
6803 pub this: Option<Expression>,
6804 pub format: Option<Expression>,
6805}
6806
6807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6809#[cfg_attr(feature = "bindings", derive(TS))]
6810pub struct MakeDateFunc {
6811 pub year: Expression,
6812 pub month: Expression,
6813 pub day: Expression,
6814}
6815
6816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6818#[cfg_attr(feature = "bindings", derive(TS))]
6819pub struct MakeTimestampFunc {
6820 pub year: Expression,
6821 pub month: Expression,
6822 pub day: Expression,
6823 pub hour: Expression,
6824 pub minute: Expression,
6825 pub second: Expression,
6826 pub timezone: Option<Expression>,
6827}
6828
6829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6831#[cfg_attr(feature = "bindings", derive(TS))]
6832pub struct LastDayFunc {
6833 pub this: Expression,
6834 #[serde(skip_serializing_if = "Option::is_none", default)]
6836 pub unit: Option<DateTimeField>,
6837}
6838
6839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6845#[cfg_attr(feature = "bindings", derive(TS))]
6846pub struct ArrayConstructor {
6847 pub expressions: Vec<Expression>,
6848 pub bracket_notation: bool,
6849 pub use_list_keyword: bool,
6851}
6852
6853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6855#[cfg_attr(feature = "bindings", derive(TS))]
6856pub struct ArraySortFunc {
6857 pub this: Expression,
6858 pub comparator: Option<Expression>,
6859 pub desc: bool,
6860 pub nulls_first: Option<bool>,
6861}
6862
6863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6865#[cfg_attr(feature = "bindings", derive(TS))]
6866pub struct ArrayJoinFunc {
6867 pub this: Expression,
6868 pub separator: Expression,
6869 pub null_replacement: Option<Expression>,
6870}
6871
6872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6874#[cfg_attr(feature = "bindings", derive(TS))]
6875pub struct UnnestFunc {
6876 pub this: Expression,
6877 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6879 pub expressions: Vec<Expression>,
6880 pub with_ordinality: bool,
6881 pub alias: Option<Identifier>,
6882 #[serde(default, skip_serializing_if = "Option::is_none")]
6884 pub offset_alias: Option<Identifier>,
6885}
6886
6887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6889#[cfg_attr(feature = "bindings", derive(TS))]
6890pub struct ArrayFilterFunc {
6891 pub this: Expression,
6892 pub filter: Expression,
6893}
6894
6895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6897#[cfg_attr(feature = "bindings", derive(TS))]
6898pub struct ArrayTransformFunc {
6899 pub this: Expression,
6900 pub transform: Expression,
6901}
6902
6903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6905#[cfg_attr(feature = "bindings", derive(TS))]
6906pub struct SequenceFunc {
6907 pub start: Expression,
6908 pub stop: Expression,
6909 pub step: Option<Expression>,
6910}
6911
6912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6918#[cfg_attr(feature = "bindings", derive(TS))]
6919pub struct StructConstructor {
6920 pub fields: Vec<(Option<Identifier>, Expression)>,
6921}
6922
6923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6925#[cfg_attr(feature = "bindings", derive(TS))]
6926pub struct StructExtractFunc {
6927 pub this: Expression,
6928 pub field: Identifier,
6929}
6930
6931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6933#[cfg_attr(feature = "bindings", derive(TS))]
6934pub struct NamedStructFunc {
6935 pub pairs: Vec<(Expression, Expression)>,
6936}
6937
6938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6944#[cfg_attr(feature = "bindings", derive(TS))]
6945pub struct MapConstructor {
6946 pub keys: Vec<Expression>,
6947 pub values: Vec<Expression>,
6948 #[serde(default)]
6950 pub curly_brace_syntax: bool,
6951 #[serde(default)]
6953 pub with_map_keyword: bool,
6954}
6955
6956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6958#[cfg_attr(feature = "bindings", derive(TS))]
6959pub struct TransformFunc {
6960 pub this: Expression,
6961 pub transform: Expression,
6962}
6963
6964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6967#[cfg_attr(feature = "bindings", derive(TS))]
6968pub struct FunctionEmits {
6969 pub this: Expression,
6971 pub emits: Expression,
6973}
6974
6975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6981#[cfg_attr(feature = "bindings", derive(TS))]
6982pub struct JsonExtractFunc {
6983 pub this: Expression,
6984 pub path: Expression,
6985 pub returning: Option<DataType>,
6986 #[serde(default)]
6988 pub arrow_syntax: bool,
6989 #[serde(default)]
6991 pub hash_arrow_syntax: bool,
6992 #[serde(default)]
6994 pub wrapper_option: Option<String>,
6995 #[serde(default)]
6997 pub quotes_option: Option<String>,
6998 #[serde(default)]
7000 pub on_scalar_string: bool,
7001 #[serde(default)]
7003 pub on_error: Option<String>,
7004}
7005
7006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7008#[cfg_attr(feature = "bindings", derive(TS))]
7009pub struct JsonPathFunc {
7010 pub this: Expression,
7011 pub paths: Vec<Expression>,
7012}
7013
7014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7016#[cfg_attr(feature = "bindings", derive(TS))]
7017pub struct JsonObjectFunc {
7018 pub pairs: Vec<(Expression, Expression)>,
7019 pub null_handling: Option<JsonNullHandling>,
7020 #[serde(default)]
7021 pub with_unique_keys: bool,
7022 #[serde(default)]
7023 pub returning_type: Option<DataType>,
7024 #[serde(default)]
7025 pub format_json: bool,
7026 #[serde(default)]
7027 pub encoding: Option<String>,
7028 #[serde(default)]
7030 pub star: bool,
7031}
7032
7033#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7035#[cfg_attr(feature = "bindings", derive(TS))]
7036pub enum JsonNullHandling {
7037 NullOnNull,
7038 AbsentOnNull,
7039}
7040
7041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7043#[cfg_attr(feature = "bindings", derive(TS))]
7044pub struct JsonModifyFunc {
7045 pub this: Expression,
7046 pub path_values: Vec<(Expression, Expression)>,
7047}
7048
7049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7051#[cfg_attr(feature = "bindings", derive(TS))]
7052pub struct JsonArrayAggFunc {
7053 pub this: Expression,
7054 pub order_by: Option<Vec<Ordered>>,
7055 pub null_handling: Option<JsonNullHandling>,
7056 pub filter: Option<Expression>,
7057}
7058
7059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7061#[cfg_attr(feature = "bindings", derive(TS))]
7062pub struct JsonObjectAggFunc {
7063 pub key: Expression,
7064 pub value: Expression,
7065 pub null_handling: Option<JsonNullHandling>,
7066 pub filter: Option<Expression>,
7067}
7068
7069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7075#[cfg_attr(feature = "bindings", derive(TS))]
7076pub struct ConvertFunc {
7077 pub this: Expression,
7078 pub to: DataType,
7079 pub style: Option<Expression>,
7080}
7081
7082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7088#[cfg_attr(feature = "bindings", derive(TS))]
7089pub struct LambdaExpr {
7090 pub parameters: Vec<Identifier>,
7091 pub body: Expression,
7092 #[serde(default)]
7094 pub colon: bool,
7095 #[serde(default)]
7098 pub parameter_types: Vec<Option<DataType>>,
7099}
7100
7101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7103#[cfg_attr(feature = "bindings", derive(TS))]
7104pub struct Parameter {
7105 pub name: Option<String>,
7106 pub index: Option<u32>,
7107 pub style: ParameterStyle,
7108 #[serde(default)]
7110 pub quoted: bool,
7111 #[serde(default)]
7113 pub string_quoted: bool,
7114 #[serde(default)]
7116 pub expression: Option<String>,
7117}
7118
7119#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7121#[cfg_attr(feature = "bindings", derive(TS))]
7122pub enum ParameterStyle {
7123 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7133
7134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7136#[cfg_attr(feature = "bindings", derive(TS))]
7137pub struct Placeholder {
7138 pub index: Option<u32>,
7139}
7140
7141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7143#[cfg_attr(feature = "bindings", derive(TS))]
7144pub struct NamedArgument {
7145 pub name: Identifier,
7146 pub value: Expression,
7147 pub separator: NamedArgSeparator,
7149}
7150
7151#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7153#[cfg_attr(feature = "bindings", derive(TS))]
7154pub enum NamedArgSeparator {
7155 DArrow,
7157 ColonEq,
7159 Eq,
7161}
7162
7163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7166#[cfg_attr(feature = "bindings", derive(TS))]
7167pub struct TableArgument {
7168 pub prefix: String,
7170 pub this: Expression,
7172}
7173
7174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7176#[cfg_attr(feature = "bindings", derive(TS))]
7177pub struct SqlComment {
7178 pub text: String,
7179 pub is_block: bool,
7180}
7181
7182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7188#[cfg_attr(feature = "bindings", derive(TS))]
7189pub struct SimilarToExpr {
7190 pub this: Expression,
7191 pub pattern: Expression,
7192 pub escape: Option<Expression>,
7193 pub not: bool,
7194}
7195
7196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7198#[cfg_attr(feature = "bindings", derive(TS))]
7199pub struct QuantifiedExpr {
7200 pub this: Expression,
7201 pub subquery: Expression,
7202 pub op: Option<QuantifiedOp>,
7203}
7204
7205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7207#[cfg_attr(feature = "bindings", derive(TS))]
7208pub enum QuantifiedOp {
7209 Eq,
7210 Neq,
7211 Lt,
7212 Lte,
7213 Gt,
7214 Gte,
7215}
7216
7217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7222#[cfg_attr(feature = "bindings", derive(TS))]
7223pub struct OverlapsExpr {
7224 #[serde(skip_serializing_if = "Option::is_none")]
7226 pub this: Option<Expression>,
7227 #[serde(skip_serializing_if = "Option::is_none")]
7229 pub expression: Option<Expression>,
7230 #[serde(skip_serializing_if = "Option::is_none")]
7232 pub left_start: Option<Expression>,
7233 #[serde(skip_serializing_if = "Option::is_none")]
7235 pub left_end: Option<Expression>,
7236 #[serde(skip_serializing_if = "Option::is_none")]
7238 pub right_start: Option<Expression>,
7239 #[serde(skip_serializing_if = "Option::is_none")]
7241 pub right_end: Option<Expression>,
7242}
7243
7244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7250#[cfg_attr(feature = "bindings", derive(TS))]
7251pub struct Subscript {
7252 pub this: Expression,
7253 pub index: Expression,
7254}
7255
7256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7258#[cfg_attr(feature = "bindings", derive(TS))]
7259pub struct DotAccess {
7260 pub this: Expression,
7261 pub field: Identifier,
7262}
7263
7264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7266#[cfg_attr(feature = "bindings", derive(TS))]
7267pub struct MethodCall {
7268 pub this: Expression,
7269 pub method: Identifier,
7270 pub args: Vec<Expression>,
7271}
7272
7273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7275#[cfg_attr(feature = "bindings", derive(TS))]
7276pub struct ArraySlice {
7277 pub this: Expression,
7278 pub start: Option<Expression>,
7279 pub end: Option<Expression>,
7280}
7281
7282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7288#[cfg_attr(feature = "bindings", derive(TS))]
7289pub enum OnCommit {
7290 PreserveRows,
7292 DeleteRows,
7294}
7295
7296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7298#[cfg_attr(feature = "bindings", derive(TS))]
7299pub struct CreateTable {
7300 pub name: TableRef,
7301 #[serde(default, skip_serializing_if = "Option::is_none")]
7303 pub on_cluster: Option<OnCluster>,
7304 pub columns: Vec<ColumnDef>,
7305 pub constraints: Vec<TableConstraint>,
7306 pub if_not_exists: bool,
7307 pub temporary: bool,
7308 pub or_replace: bool,
7309 #[serde(default, skip_serializing_if = "Option::is_none")]
7311 pub table_modifier: Option<String>,
7312 pub as_select: Option<Expression>,
7313 #[serde(default)]
7315 pub as_select_parenthesized: bool,
7316 #[serde(default)]
7318 pub on_commit: Option<OnCommit>,
7319 #[serde(default)]
7321 pub clone_source: Option<TableRef>,
7322 #[serde(default, skip_serializing_if = "Option::is_none")]
7324 pub clone_at_clause: Option<Expression>,
7325 #[serde(default)]
7327 pub is_copy: bool,
7328 #[serde(default)]
7330 pub shallow_clone: bool,
7331 #[serde(default)]
7333 pub deep_clone: bool,
7334 #[serde(default)]
7336 pub leading_comments: Vec<String>,
7337 #[serde(default)]
7339 pub with_properties: Vec<(String, String)>,
7340 #[serde(default)]
7342 pub teradata_post_name_options: Vec<String>,
7343 #[serde(default)]
7345 pub with_data: Option<bool>,
7346 #[serde(default)]
7348 pub with_statistics: Option<bool>,
7349 #[serde(default)]
7351 pub teradata_indexes: Vec<TeradataIndex>,
7352 #[serde(default)]
7354 pub with_cte: Option<With>,
7355 #[serde(default)]
7357 pub properties: Vec<Expression>,
7358 #[serde(default, skip_serializing_if = "Option::is_none")]
7360 pub partition_of: Option<Expression>,
7361 #[serde(default)]
7363 pub post_table_properties: Vec<Expression>,
7364 #[serde(default)]
7366 pub mysql_table_options: Vec<(String, String)>,
7367 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7369 pub inherits: Vec<TableRef>,
7370 #[serde(default, skip_serializing_if = "Option::is_none")]
7372 pub on_property: Option<OnProperty>,
7373 #[serde(default)]
7375 pub copy_grants: bool,
7376 #[serde(default, skip_serializing_if = "Option::is_none")]
7378 pub using_template: Option<Box<Expression>>,
7379 #[serde(default, skip_serializing_if = "Option::is_none")]
7381 pub rollup: Option<RollupProperty>,
7382 #[serde(default, skip_serializing_if = "Option::is_none")]
7384 pub uuid: Option<String>,
7385 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7389 pub with_partition_columns: Vec<ColumnDef>,
7390 #[serde(default, skip_serializing_if = "Option::is_none")]
7393 pub with_connection: Option<TableRef>,
7394}
7395
7396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7398#[cfg_attr(feature = "bindings", derive(TS))]
7399pub struct TeradataIndex {
7400 pub kind: TeradataIndexKind,
7402 pub name: Option<String>,
7404 pub columns: Vec<String>,
7406}
7407
7408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7410#[cfg_attr(feature = "bindings", derive(TS))]
7411pub enum TeradataIndexKind {
7412 NoPrimary,
7414 Primary,
7416 PrimaryAmp,
7418 Unique,
7420 UniquePrimary,
7422 Secondary,
7424}
7425
7426impl CreateTable {
7427 pub fn new(name: impl Into<String>) -> Self {
7428 Self {
7429 name: TableRef::new(name),
7430 on_cluster: None,
7431 columns: Vec::new(),
7432 constraints: Vec::new(),
7433 if_not_exists: false,
7434 temporary: false,
7435 or_replace: false,
7436 table_modifier: None,
7437 as_select: None,
7438 as_select_parenthesized: false,
7439 on_commit: None,
7440 clone_source: None,
7441 clone_at_clause: None,
7442 shallow_clone: false,
7443 deep_clone: false,
7444 is_copy: false,
7445 leading_comments: Vec::new(),
7446 with_properties: Vec::new(),
7447 teradata_post_name_options: Vec::new(),
7448 with_data: None,
7449 with_statistics: None,
7450 teradata_indexes: Vec::new(),
7451 with_cte: None,
7452 properties: Vec::new(),
7453 partition_of: None,
7454 post_table_properties: Vec::new(),
7455 mysql_table_options: Vec::new(),
7456 inherits: Vec::new(),
7457 on_property: None,
7458 copy_grants: false,
7459 using_template: None,
7460 rollup: None,
7461 uuid: None,
7462 with_partition_columns: Vec::new(),
7463 with_connection: None,
7464 }
7465 }
7466}
7467
7468#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7470#[cfg_attr(feature = "bindings", derive(TS))]
7471pub enum SortOrder {
7472 Asc,
7473 Desc,
7474}
7475
7476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7478#[cfg_attr(feature = "bindings", derive(TS))]
7479pub enum ConstraintType {
7480 NotNull,
7481 Null,
7482 PrimaryKey,
7483 Unique,
7484 Default,
7485 AutoIncrement,
7486 Collate,
7487 Comment,
7488 References,
7489 Check,
7490 GeneratedAsIdentity,
7491 Tags,
7493 ComputedColumn,
7495 GeneratedAsRow,
7497 OnUpdate,
7499 Path,
7501 Encode,
7503}
7504
7505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7507#[cfg_attr(feature = "bindings", derive(TS))]
7508pub struct ColumnDef {
7509 pub name: Identifier,
7510 pub data_type: DataType,
7511 pub nullable: Option<bool>,
7512 pub default: Option<Expression>,
7513 pub primary_key: bool,
7514 #[serde(default)]
7516 pub primary_key_order: Option<SortOrder>,
7517 pub unique: bool,
7518 #[serde(default)]
7520 pub unique_nulls_not_distinct: bool,
7521 pub auto_increment: bool,
7522 pub comment: Option<String>,
7523 pub constraints: Vec<ColumnConstraint>,
7524 #[serde(default)]
7526 pub constraint_order: Vec<ConstraintType>,
7527 #[serde(default)]
7529 pub format: Option<String>,
7530 #[serde(default)]
7532 pub title: Option<String>,
7533 #[serde(default)]
7535 pub inline_length: Option<u64>,
7536 #[serde(default)]
7538 pub compress: Option<Vec<Expression>>,
7539 #[serde(default)]
7541 pub character_set: Option<String>,
7542 #[serde(default)]
7544 pub uppercase: bool,
7545 #[serde(default)]
7547 pub casespecific: Option<bool>,
7548 #[serde(default)]
7550 pub auto_increment_start: Option<Box<Expression>>,
7551 #[serde(default)]
7553 pub auto_increment_increment: Option<Box<Expression>>,
7554 #[serde(default)]
7556 pub auto_increment_order: Option<bool>,
7557 #[serde(default)]
7559 pub unsigned: bool,
7560 #[serde(default)]
7562 pub zerofill: bool,
7563 #[serde(default, skip_serializing_if = "Option::is_none")]
7565 pub on_update: Option<Expression>,
7566 #[serde(default, skip_serializing_if = "Option::is_none")]
7568 pub visible: Option<bool>,
7569 #[serde(default, skip_serializing_if = "Option::is_none")]
7571 pub unique_constraint_name: Option<String>,
7572 #[serde(default, skip_serializing_if = "Option::is_none")]
7574 pub not_null_constraint_name: Option<String>,
7575 #[serde(default, skip_serializing_if = "Option::is_none")]
7577 pub primary_key_constraint_name: Option<String>,
7578 #[serde(default, skip_serializing_if = "Option::is_none")]
7580 pub check_constraint_name: Option<String>,
7581 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7583 pub options: Vec<Expression>,
7584 #[serde(default)]
7586 pub no_type: bool,
7587 #[serde(default, skip_serializing_if = "Option::is_none")]
7589 pub encoding: Option<String>,
7590 #[serde(default, skip_serializing_if = "Option::is_none")]
7592 pub codec: Option<String>,
7593 #[serde(default, skip_serializing_if = "Option::is_none")]
7595 pub ephemeral: Option<Option<Box<Expression>>>,
7596 #[serde(default, skip_serializing_if = "Option::is_none")]
7598 pub materialized_expr: Option<Box<Expression>>,
7599 #[serde(default, skip_serializing_if = "Option::is_none")]
7601 pub alias_expr: Option<Box<Expression>>,
7602 #[serde(default, skip_serializing_if = "Option::is_none")]
7604 pub ttl_expr: Option<Box<Expression>>,
7605 #[serde(default)]
7607 pub not_for_replication: bool,
7608}
7609
7610impl ColumnDef {
7611 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7612 Self {
7613 name: Identifier::new(name),
7614 data_type,
7615 nullable: None,
7616 default: None,
7617 primary_key: false,
7618 primary_key_order: None,
7619 unique: false,
7620 unique_nulls_not_distinct: false,
7621 auto_increment: false,
7622 comment: None,
7623 constraints: Vec::new(),
7624 constraint_order: Vec::new(),
7625 format: None,
7626 title: None,
7627 inline_length: None,
7628 compress: None,
7629 character_set: None,
7630 uppercase: false,
7631 casespecific: None,
7632 auto_increment_start: None,
7633 auto_increment_increment: None,
7634 auto_increment_order: None,
7635 unsigned: false,
7636 zerofill: false,
7637 on_update: None,
7638 visible: None,
7639 unique_constraint_name: None,
7640 not_null_constraint_name: None,
7641 primary_key_constraint_name: None,
7642 check_constraint_name: None,
7643 options: Vec::new(),
7644 no_type: false,
7645 encoding: None,
7646 codec: None,
7647 ephemeral: None,
7648 materialized_expr: None,
7649 alias_expr: None,
7650 ttl_expr: None,
7651 not_for_replication: false,
7652 }
7653 }
7654}
7655
7656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7658#[cfg_attr(feature = "bindings", derive(TS))]
7659pub enum ColumnConstraint {
7660 NotNull,
7661 Null,
7662 Unique,
7663 PrimaryKey,
7664 Default(Expression),
7665 Check(Expression),
7666 References(ForeignKeyRef),
7667 GeneratedAsIdentity(GeneratedAsIdentity),
7668 Collate(Identifier),
7669 Comment(String),
7670 Tags(Tags),
7672 ComputedColumn(ComputedColumn),
7675 GeneratedAsRow(GeneratedAsRow),
7677 Path(Expression),
7679}
7680
7681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7683#[cfg_attr(feature = "bindings", derive(TS))]
7684pub struct ComputedColumn {
7685 pub expression: Box<Expression>,
7687 #[serde(default)]
7689 pub persisted: bool,
7690 #[serde(default)]
7692 pub not_null: bool,
7693 #[serde(default)]
7696 pub persistence_kind: Option<String>,
7697 #[serde(default, skip_serializing_if = "Option::is_none")]
7699 pub data_type: Option<DataType>,
7700}
7701
7702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7704#[cfg_attr(feature = "bindings", derive(TS))]
7705pub struct GeneratedAsRow {
7706 pub start: bool,
7708 #[serde(default)]
7710 pub hidden: bool,
7711}
7712
7713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7715#[cfg_attr(feature = "bindings", derive(TS))]
7716pub struct GeneratedAsIdentity {
7717 pub always: bool,
7719 pub on_null: bool,
7721 pub start: Option<Box<Expression>>,
7723 pub increment: Option<Box<Expression>>,
7725 pub minvalue: Option<Box<Expression>>,
7727 pub maxvalue: Option<Box<Expression>>,
7729 pub cycle: Option<bool>,
7731}
7732
7733#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7735#[cfg_attr(feature = "bindings", derive(TS))]
7736pub struct ConstraintModifiers {
7737 pub enforced: Option<bool>,
7739 pub deferrable: Option<bool>,
7741 pub initially_deferred: Option<bool>,
7743 pub norely: bool,
7745 pub rely: bool,
7747 #[serde(default)]
7749 pub using: Option<String>,
7750 #[serde(default)]
7752 pub using_before_columns: bool,
7753 #[serde(default, skip_serializing_if = "Option::is_none")]
7755 pub comment: Option<String>,
7756 #[serde(default, skip_serializing_if = "Option::is_none")]
7758 pub visible: Option<bool>,
7759 #[serde(default, skip_serializing_if = "Option::is_none")]
7761 pub engine_attribute: Option<String>,
7762 #[serde(default, skip_serializing_if = "Option::is_none")]
7764 pub with_parser: Option<String>,
7765 #[serde(default)]
7767 pub not_valid: bool,
7768 #[serde(default, skip_serializing_if = "Option::is_none")]
7770 pub clustered: Option<String>,
7771 #[serde(default, skip_serializing_if = "Option::is_none")]
7773 pub on_conflict: Option<String>,
7774 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7776 pub with_options: Vec<(String, String)>,
7777 #[serde(default, skip_serializing_if = "Option::is_none")]
7779 pub on_filegroup: Option<Identifier>,
7780}
7781
7782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7784#[cfg_attr(feature = "bindings", derive(TS))]
7785pub enum TableConstraint {
7786 PrimaryKey {
7787 name: Option<Identifier>,
7788 columns: Vec<Identifier>,
7789 #[serde(default)]
7791 include_columns: Vec<Identifier>,
7792 #[serde(default)]
7793 modifiers: ConstraintModifiers,
7794 #[serde(default)]
7796 has_constraint_keyword: bool,
7797 },
7798 Unique {
7799 name: Option<Identifier>,
7800 columns: Vec<Identifier>,
7801 #[serde(default)]
7803 columns_parenthesized: bool,
7804 #[serde(default)]
7805 modifiers: ConstraintModifiers,
7806 #[serde(default)]
7808 has_constraint_keyword: bool,
7809 #[serde(default)]
7811 nulls_not_distinct: bool,
7812 },
7813 ForeignKey {
7814 name: Option<Identifier>,
7815 columns: Vec<Identifier>,
7816 #[serde(default)]
7817 references: Option<ForeignKeyRef>,
7818 #[serde(default)]
7820 on_delete: Option<ReferentialAction>,
7821 #[serde(default)]
7823 on_update: Option<ReferentialAction>,
7824 #[serde(default)]
7825 modifiers: ConstraintModifiers,
7826 },
7827 Check {
7828 name: Option<Identifier>,
7829 expression: Expression,
7830 #[serde(default)]
7831 modifiers: ConstraintModifiers,
7832 },
7833 Assume {
7835 name: Option<Identifier>,
7836 expression: Expression,
7837 },
7838 Default {
7840 name: Option<Identifier>,
7841 expression: Expression,
7842 column: Identifier,
7843 },
7844 Index {
7846 name: Option<Identifier>,
7847 columns: Vec<Identifier>,
7848 #[serde(default)]
7850 kind: Option<String>,
7851 #[serde(default)]
7852 modifiers: ConstraintModifiers,
7853 #[serde(default)]
7855 use_key_keyword: bool,
7856 #[serde(default, skip_serializing_if = "Option::is_none")]
7858 expression: Option<Box<Expression>>,
7859 #[serde(default, skip_serializing_if = "Option::is_none")]
7861 index_type: Option<Box<Expression>>,
7862 #[serde(default, skip_serializing_if = "Option::is_none")]
7864 granularity: Option<Box<Expression>>,
7865 },
7866 Projection {
7868 name: Identifier,
7869 expression: Expression,
7870 },
7871 Like {
7873 source: TableRef,
7874 options: Vec<(LikeOptionAction, String)>,
7876 },
7877 PeriodForSystemTime {
7879 start_col: Identifier,
7880 end_col: Identifier,
7881 },
7882 Exclude {
7885 name: Option<Identifier>,
7886 #[serde(default)]
7888 using: Option<String>,
7889 elements: Vec<ExcludeElement>,
7891 #[serde(default)]
7893 include_columns: Vec<Identifier>,
7894 #[serde(default)]
7896 where_clause: Option<Box<Expression>>,
7897 #[serde(default)]
7899 with_params: Vec<(String, String)>,
7900 #[serde(default)]
7902 using_index_tablespace: Option<String>,
7903 #[serde(default)]
7904 modifiers: ConstraintModifiers,
7905 },
7906 Tags(Tags),
7908 InitiallyDeferred {
7912 deferred: bool,
7914 },
7915}
7916
7917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7919#[cfg_attr(feature = "bindings", derive(TS))]
7920pub struct ExcludeElement {
7921 pub expression: String,
7923 pub operator: String,
7925}
7926
7927#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7929#[cfg_attr(feature = "bindings", derive(TS))]
7930pub enum LikeOptionAction {
7931 Including,
7932 Excluding,
7933}
7934
7935#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7937#[cfg_attr(feature = "bindings", derive(TS))]
7938pub enum MatchType {
7939 Full,
7940 Partial,
7941 Simple,
7942}
7943
7944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7946#[cfg_attr(feature = "bindings", derive(TS))]
7947pub struct ForeignKeyRef {
7948 pub table: TableRef,
7949 pub columns: Vec<Identifier>,
7950 pub on_delete: Option<ReferentialAction>,
7951 pub on_update: Option<ReferentialAction>,
7952 #[serde(default)]
7954 pub on_update_first: bool,
7955 #[serde(default)]
7957 pub match_type: Option<MatchType>,
7958 #[serde(default)]
7960 pub match_after_actions: bool,
7961 #[serde(default)]
7963 pub constraint_name: Option<String>,
7964 #[serde(default)]
7966 pub deferrable: Option<bool>,
7967 #[serde(default)]
7969 pub has_foreign_key_keywords: bool,
7970}
7971
7972#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7974#[cfg_attr(feature = "bindings", derive(TS))]
7975pub enum ReferentialAction {
7976 Cascade,
7977 SetNull,
7978 SetDefault,
7979 Restrict,
7980 NoAction,
7981}
7982
7983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7985#[cfg_attr(feature = "bindings", derive(TS))]
7986pub struct DropTable {
7987 pub names: Vec<TableRef>,
7988 pub if_exists: bool,
7989 pub cascade: bool,
7990 #[serde(default)]
7992 pub cascade_constraints: bool,
7993 #[serde(default)]
7995 pub purge: bool,
7996 #[serde(default)]
7998 pub leading_comments: Vec<String>,
7999 #[serde(default, skip_serializing_if = "Option::is_none")]
8002 pub object_id_args: Option<String>,
8003 #[serde(default)]
8005 pub sync: bool,
8006 #[serde(default)]
8008 pub iceberg: bool,
8009 #[serde(default)]
8011 pub restrict: bool,
8012}
8013
8014impl DropTable {
8015 pub fn new(name: impl Into<String>) -> Self {
8016 Self {
8017 names: vec![TableRef::new(name)],
8018 if_exists: false,
8019 cascade: false,
8020 cascade_constraints: false,
8021 purge: false,
8022 leading_comments: Vec::new(),
8023 object_id_args: None,
8024 sync: false,
8025 iceberg: false,
8026 restrict: false,
8027 }
8028 }
8029}
8030
8031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8033#[cfg_attr(feature = "bindings", derive(TS))]
8034pub struct Undrop {
8035 pub kind: String,
8037 pub name: TableRef,
8039 #[serde(default)]
8041 pub if_exists: bool,
8042}
8043
8044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8046#[cfg_attr(feature = "bindings", derive(TS))]
8047pub struct AlterTable {
8048 pub name: TableRef,
8049 pub actions: Vec<AlterTableAction>,
8050 #[serde(default)]
8052 pub if_exists: bool,
8053 #[serde(default, skip_serializing_if = "Option::is_none")]
8055 pub algorithm: Option<String>,
8056 #[serde(default, skip_serializing_if = "Option::is_none")]
8058 pub lock: Option<String>,
8059 #[serde(default, skip_serializing_if = "Option::is_none")]
8061 pub with_check: Option<String>,
8062 #[serde(default, skip_serializing_if = "Option::is_none")]
8064 pub partition: Option<Vec<(Identifier, Expression)>>,
8065 #[serde(default, skip_serializing_if = "Option::is_none")]
8067 pub on_cluster: Option<OnCluster>,
8068 #[serde(default, skip_serializing_if = "Option::is_none")]
8070 pub table_modifier: Option<String>,
8071}
8072
8073impl AlterTable {
8074 pub fn new(name: impl Into<String>) -> Self {
8075 Self {
8076 name: TableRef::new(name),
8077 actions: Vec::new(),
8078 if_exists: false,
8079 algorithm: None,
8080 lock: None,
8081 with_check: None,
8082 partition: None,
8083 on_cluster: None,
8084 table_modifier: None,
8085 }
8086 }
8087}
8088
8089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8091#[cfg_attr(feature = "bindings", derive(TS))]
8092pub enum ColumnPosition {
8093 First,
8094 After(Identifier),
8095}
8096
8097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8099#[cfg_attr(feature = "bindings", derive(TS))]
8100pub enum AlterTableAction {
8101 AddColumn {
8102 column: ColumnDef,
8103 if_not_exists: bool,
8104 position: Option<ColumnPosition>,
8105 },
8106 DropColumn {
8107 name: Identifier,
8108 if_exists: bool,
8109 cascade: bool,
8110 },
8111 RenameColumn {
8112 old_name: Identifier,
8113 new_name: Identifier,
8114 if_exists: bool,
8115 },
8116 AlterColumn {
8117 name: Identifier,
8118 action: AlterColumnAction,
8119 #[serde(default)]
8121 use_modify_keyword: bool,
8122 },
8123 RenameTable(TableRef),
8124 AddConstraint(TableConstraint),
8125 DropConstraint {
8126 name: Identifier,
8127 if_exists: bool,
8128 },
8129 DropForeignKey {
8131 name: Identifier,
8132 },
8133 DropPartition {
8135 partitions: Vec<Vec<(Identifier, Expression)>>,
8137 if_exists: bool,
8138 },
8139 AddPartition {
8141 partition: Expression,
8143 if_not_exists: bool,
8144 location: Option<Expression>,
8145 },
8146 Delete {
8148 where_clause: Expression,
8149 },
8150 SwapWith(TableRef),
8152 SetProperty {
8154 properties: Vec<(String, Expression)>,
8155 },
8156 UnsetProperty {
8158 properties: Vec<String>,
8159 },
8160 ClusterBy {
8162 expressions: Vec<Expression>,
8163 },
8164 SetTag {
8166 expressions: Vec<(String, Expression)>,
8167 },
8168 UnsetTag {
8170 names: Vec<String>,
8171 },
8172 SetOptions {
8174 expressions: Vec<Expression>,
8175 },
8176 AlterIndex {
8178 name: Identifier,
8179 visible: bool,
8180 },
8181 SetAttribute {
8183 attribute: String,
8184 },
8185 SetStageFileFormat {
8187 options: Option<Expression>,
8188 },
8189 SetStageCopyOptions {
8191 options: Option<Expression>,
8192 },
8193 AddColumns {
8195 columns: Vec<ColumnDef>,
8196 cascade: bool,
8197 },
8198 DropColumns {
8200 names: Vec<Identifier>,
8201 },
8202 ChangeColumn {
8205 old_name: Identifier,
8206 new_name: Identifier,
8207 #[serde(default, skip_serializing_if = "Option::is_none")]
8208 data_type: Option<DataType>,
8209 comment: Option<String>,
8210 #[serde(default)]
8211 cascade: bool,
8212 },
8213 AlterSortKey {
8216 this: Option<String>,
8218 expressions: Vec<Expression>,
8220 compound: bool,
8222 },
8223 AlterDistStyle {
8227 style: String,
8229 distkey: Option<Identifier>,
8231 },
8232 SetTableProperties {
8234 properties: Vec<(Expression, Expression)>,
8235 },
8236 SetLocation {
8238 location: String,
8239 },
8240 SetFileFormat {
8242 format: String,
8243 },
8244 ReplacePartition {
8246 partition: Expression,
8247 source: Option<Box<Expression>>,
8248 },
8249 Raw {
8251 sql: String,
8252 },
8253}
8254
8255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8257#[cfg_attr(feature = "bindings", derive(TS))]
8258pub enum AlterColumnAction {
8259 SetDataType {
8260 data_type: DataType,
8261 using: Option<Expression>,
8263 #[serde(default, skip_serializing_if = "Option::is_none")]
8265 collate: Option<String>,
8266 },
8267 SetDefault(Expression),
8268 DropDefault,
8269 SetNotNull,
8270 DropNotNull,
8271 Comment(String),
8273 SetVisible,
8275 SetInvisible,
8277}
8278
8279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8281#[cfg_attr(feature = "bindings", derive(TS))]
8282pub struct CreateIndex {
8283 pub name: Identifier,
8284 pub table: TableRef,
8285 pub columns: Vec<IndexColumn>,
8286 pub unique: bool,
8287 pub if_not_exists: bool,
8288 pub using: Option<String>,
8289 #[serde(default)]
8291 pub clustered: Option<String>,
8292 #[serde(default)]
8294 pub concurrently: bool,
8295 #[serde(default)]
8297 pub where_clause: Option<Box<Expression>>,
8298 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8300 pub include_columns: Vec<Identifier>,
8301 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8303 pub with_options: Vec<(String, String)>,
8304 #[serde(default)]
8306 pub on_filegroup: Option<String>,
8307}
8308
8309impl CreateIndex {
8310 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8311 Self {
8312 name: Identifier::new(name),
8313 table: TableRef::new(table),
8314 columns: Vec::new(),
8315 unique: false,
8316 if_not_exists: false,
8317 using: None,
8318 clustered: None,
8319 concurrently: false,
8320 where_clause: None,
8321 include_columns: Vec::new(),
8322 with_options: Vec::new(),
8323 on_filegroup: None,
8324 }
8325 }
8326}
8327
8328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8330#[cfg_attr(feature = "bindings", derive(TS))]
8331pub struct IndexColumn {
8332 pub column: Identifier,
8333 pub desc: bool,
8334 #[serde(default)]
8336 pub asc: bool,
8337 pub nulls_first: Option<bool>,
8338 #[serde(default, skip_serializing_if = "Option::is_none")]
8340 pub opclass: Option<String>,
8341}
8342
8343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8345#[cfg_attr(feature = "bindings", derive(TS))]
8346pub struct DropIndex {
8347 pub name: Identifier,
8348 pub table: Option<TableRef>,
8349 pub if_exists: bool,
8350 #[serde(default)]
8352 pub concurrently: bool,
8353}
8354
8355impl DropIndex {
8356 pub fn new(name: impl Into<String>) -> Self {
8357 Self {
8358 name: Identifier::new(name),
8359 table: None,
8360 if_exists: false,
8361 concurrently: false,
8362 }
8363 }
8364}
8365
8366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8368#[cfg_attr(feature = "bindings", derive(TS))]
8369pub struct ViewColumn {
8370 pub name: Identifier,
8371 pub comment: Option<String>,
8372 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8374 pub options: Vec<Expression>,
8375}
8376
8377impl ViewColumn {
8378 pub fn new(name: impl Into<String>) -> Self {
8379 Self {
8380 name: Identifier::new(name),
8381 comment: None,
8382 options: Vec::new(),
8383 }
8384 }
8385
8386 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8387 Self {
8388 name: Identifier::new(name),
8389 comment: Some(comment.into()),
8390 options: Vec::new(),
8391 }
8392 }
8393}
8394
8395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8397#[cfg_attr(feature = "bindings", derive(TS))]
8398pub struct CreateView {
8399 pub name: TableRef,
8400 pub columns: Vec<ViewColumn>,
8401 pub query: Expression,
8402 pub or_replace: bool,
8403 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8405 pub or_alter: bool,
8406 pub if_not_exists: bool,
8407 pub materialized: bool,
8408 pub temporary: bool,
8409 #[serde(default)]
8411 pub secure: bool,
8412 #[serde(skip_serializing_if = "Option::is_none")]
8414 pub algorithm: Option<String>,
8415 #[serde(skip_serializing_if = "Option::is_none")]
8417 pub definer: Option<String>,
8418 #[serde(skip_serializing_if = "Option::is_none")]
8420 pub security: Option<FunctionSecurity>,
8421 #[serde(default = "default_true")]
8423 pub security_sql_style: bool,
8424 #[serde(default)]
8426 pub security_after_name: bool,
8427 #[serde(default)]
8429 pub query_parenthesized: bool,
8430 #[serde(skip_serializing_if = "Option::is_none")]
8432 pub locking_mode: Option<String>,
8433 #[serde(skip_serializing_if = "Option::is_none")]
8435 pub locking_access: Option<String>,
8436 #[serde(default)]
8438 pub copy_grants: bool,
8439 #[serde(skip_serializing_if = "Option::is_none", default)]
8441 pub comment: Option<String>,
8442 #[serde(skip_serializing_if = "Option::is_none", default)]
8444 pub row_access_policy: Option<String>,
8445 #[serde(default)]
8447 pub tags: Vec<(String, String)>,
8448 #[serde(default)]
8450 pub options: Vec<Expression>,
8451 #[serde(skip_serializing_if = "Option::is_none", default)]
8453 pub build: Option<String>,
8454 #[serde(skip_serializing_if = "Option::is_none", default)]
8456 pub refresh: Option<Box<RefreshTriggerProperty>>,
8457 #[serde(skip_serializing_if = "Option::is_none", default)]
8460 pub schema: Option<Box<Schema>>,
8461 #[serde(skip_serializing_if = "Option::is_none", default)]
8463 pub unique_key: Option<Box<UniqueKeyProperty>>,
8464 #[serde(default)]
8466 pub no_schema_binding: bool,
8467 #[serde(skip_serializing_if = "Option::is_none", default)]
8469 pub auto_refresh: Option<bool>,
8470 #[serde(skip_serializing_if = "Option::is_none", default)]
8472 pub clickhouse_population: Option<String>,
8473 #[serde(default, skip_serializing_if = "Option::is_none")]
8475 pub on_cluster: Option<OnCluster>,
8476 #[serde(default, skip_serializing_if = "Option::is_none")]
8478 pub to_table: Option<TableRef>,
8479 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8481 pub table_properties: Vec<Expression>,
8482}
8483
8484impl CreateView {
8485 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8486 Self {
8487 name: TableRef::new(name),
8488 columns: Vec::new(),
8489 query,
8490 or_replace: false,
8491 or_alter: false,
8492 if_not_exists: false,
8493 materialized: false,
8494 temporary: false,
8495 secure: false,
8496 algorithm: None,
8497 definer: None,
8498 security: None,
8499 security_sql_style: true,
8500 security_after_name: false,
8501 query_parenthesized: false,
8502 locking_mode: None,
8503 locking_access: None,
8504 copy_grants: false,
8505 comment: None,
8506 row_access_policy: None,
8507 tags: Vec::new(),
8508 options: Vec::new(),
8509 build: None,
8510 refresh: None,
8511 schema: None,
8512 unique_key: None,
8513 no_schema_binding: false,
8514 auto_refresh: None,
8515 clickhouse_population: None,
8516 on_cluster: None,
8517 to_table: None,
8518 table_properties: Vec::new(),
8519 }
8520 }
8521}
8522
8523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8525#[cfg_attr(feature = "bindings", derive(TS))]
8526pub struct DropView {
8527 pub name: TableRef,
8528 pub if_exists: bool,
8529 pub materialized: bool,
8530}
8531
8532impl DropView {
8533 pub fn new(name: impl Into<String>) -> Self {
8534 Self {
8535 name: TableRef::new(name),
8536 if_exists: false,
8537 materialized: false,
8538 }
8539 }
8540}
8541
8542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8544#[cfg_attr(feature = "bindings", derive(TS))]
8545pub struct Truncate {
8546 #[serde(default)]
8548 pub target: TruncateTarget,
8549 #[serde(default)]
8551 pub if_exists: bool,
8552 pub table: TableRef,
8553 #[serde(default, skip_serializing_if = "Option::is_none")]
8555 pub on_cluster: Option<OnCluster>,
8556 pub cascade: bool,
8557 #[serde(default)]
8559 pub extra_tables: Vec<TruncateTableEntry>,
8560 #[serde(default)]
8562 pub identity: Option<TruncateIdentity>,
8563 #[serde(default)]
8565 pub restrict: bool,
8566 #[serde(default, skip_serializing_if = "Option::is_none")]
8568 pub partition: Option<Box<Expression>>,
8569}
8570
8571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8573#[cfg_attr(feature = "bindings", derive(TS))]
8574pub struct TruncateTableEntry {
8575 pub table: TableRef,
8576 #[serde(default)]
8578 pub star: bool,
8579}
8580
8581#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8583#[cfg_attr(feature = "bindings", derive(TS))]
8584pub enum TruncateTarget {
8585 Table,
8586 Database,
8587}
8588
8589impl Default for TruncateTarget {
8590 fn default() -> Self {
8591 TruncateTarget::Table
8592 }
8593}
8594
8595#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8597#[cfg_attr(feature = "bindings", derive(TS))]
8598pub enum TruncateIdentity {
8599 Restart,
8600 Continue,
8601}
8602
8603impl Truncate {
8604 pub fn new(table: impl Into<String>) -> Self {
8605 Self {
8606 target: TruncateTarget::Table,
8607 if_exists: false,
8608 table: TableRef::new(table),
8609 on_cluster: None,
8610 cascade: false,
8611 extra_tables: Vec::new(),
8612 identity: None,
8613 restrict: false,
8614 partition: None,
8615 }
8616 }
8617}
8618
8619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8621#[cfg_attr(feature = "bindings", derive(TS))]
8622pub struct Use {
8623 pub kind: Option<UseKind>,
8625 pub this: Identifier,
8627}
8628
8629#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8631#[cfg_attr(feature = "bindings", derive(TS))]
8632pub enum UseKind {
8633 Database,
8634 Schema,
8635 Role,
8636 Warehouse,
8637 Catalog,
8638 SecondaryRoles,
8640}
8641
8642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8644#[cfg_attr(feature = "bindings", derive(TS))]
8645pub struct SetStatement {
8646 pub items: Vec<SetItem>,
8648}
8649
8650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8652#[cfg_attr(feature = "bindings", derive(TS))]
8653pub struct SetItem {
8654 pub name: Expression,
8656 pub value: Expression,
8658 pub kind: Option<String>,
8660 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8662 pub no_equals: bool,
8663}
8664
8665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8667#[cfg_attr(feature = "bindings", derive(TS))]
8668pub struct Cache {
8669 pub table: Identifier,
8671 pub lazy: bool,
8673 pub options: Vec<(Expression, Expression)>,
8675 pub query: Option<Expression>,
8677}
8678
8679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8681#[cfg_attr(feature = "bindings", derive(TS))]
8682pub struct Uncache {
8683 pub table: Identifier,
8685 pub if_exists: bool,
8687}
8688
8689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8691#[cfg_attr(feature = "bindings", derive(TS))]
8692pub struct LoadData {
8693 pub local: bool,
8695 pub inpath: String,
8697 pub overwrite: bool,
8699 pub table: Expression,
8701 pub partition: Vec<(Identifier, Expression)>,
8703 pub input_format: Option<String>,
8705 pub serde: Option<String>,
8707}
8708
8709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8711#[cfg_attr(feature = "bindings", derive(TS))]
8712pub struct Pragma {
8713 pub schema: Option<Identifier>,
8715 pub name: Identifier,
8717 pub value: Option<Expression>,
8719 pub args: Vec<Expression>,
8721 #[serde(default)]
8723 pub use_assignment_syntax: bool,
8724}
8725
8726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8729#[cfg_attr(feature = "bindings", derive(TS))]
8730pub struct Privilege {
8731 pub name: String,
8733 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8735 pub columns: Vec<String>,
8736}
8737
8738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8740#[cfg_attr(feature = "bindings", derive(TS))]
8741pub struct GrantPrincipal {
8742 pub name: Identifier,
8744 pub is_role: bool,
8746 #[serde(default)]
8748 pub is_group: bool,
8749 #[serde(default)]
8751 pub is_share: bool,
8752}
8753
8754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8756#[cfg_attr(feature = "bindings", derive(TS))]
8757pub struct Grant {
8758 pub privileges: Vec<Privilege>,
8760 pub kind: Option<String>,
8762 pub securable: Identifier,
8764 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8766 pub function_params: Vec<String>,
8767 pub principals: Vec<GrantPrincipal>,
8769 pub grant_option: bool,
8771 #[serde(default, skip_serializing_if = "Option::is_none")]
8773 pub as_principal: Option<Identifier>,
8774}
8775
8776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8778#[cfg_attr(feature = "bindings", derive(TS))]
8779pub struct Revoke {
8780 pub privileges: Vec<Privilege>,
8782 pub kind: Option<String>,
8784 pub securable: Identifier,
8786 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8788 pub function_params: Vec<String>,
8789 pub principals: Vec<GrantPrincipal>,
8791 pub grant_option: bool,
8793 pub cascade: bool,
8795 #[serde(default)]
8797 pub restrict: bool,
8798}
8799
8800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8802#[cfg_attr(feature = "bindings", derive(TS))]
8803pub struct Comment {
8804 pub this: Expression,
8806 pub kind: String,
8808 pub expression: Expression,
8810 pub exists: bool,
8812 pub materialized: bool,
8814}
8815
8816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8822#[cfg_attr(feature = "bindings", derive(TS))]
8823pub struct AlterView {
8824 pub name: TableRef,
8825 pub actions: Vec<AlterViewAction>,
8826 #[serde(default, skip_serializing_if = "Option::is_none")]
8828 pub algorithm: Option<String>,
8829 #[serde(default, skip_serializing_if = "Option::is_none")]
8831 pub definer: Option<String>,
8832 #[serde(default, skip_serializing_if = "Option::is_none")]
8834 pub sql_security: Option<String>,
8835 #[serde(default, skip_serializing_if = "Option::is_none")]
8837 pub with_option: Option<String>,
8838 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8840 pub columns: Vec<ViewColumn>,
8841}
8842
8843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8845#[cfg_attr(feature = "bindings", derive(TS))]
8846pub enum AlterViewAction {
8847 Rename(TableRef),
8849 OwnerTo(Identifier),
8851 SetSchema(Identifier),
8853 SetAuthorization(String),
8855 AlterColumn {
8857 name: Identifier,
8858 action: AlterColumnAction,
8859 },
8860 AsSelect(Box<Expression>),
8862 SetTblproperties(Vec<(String, String)>),
8864 UnsetTblproperties(Vec<String>),
8866}
8867
8868impl AlterView {
8869 pub fn new(name: impl Into<String>) -> Self {
8870 Self {
8871 name: TableRef::new(name),
8872 actions: Vec::new(),
8873 algorithm: None,
8874 definer: None,
8875 sql_security: None,
8876 with_option: None,
8877 columns: Vec::new(),
8878 }
8879 }
8880}
8881
8882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8884#[cfg_attr(feature = "bindings", derive(TS))]
8885pub struct AlterIndex {
8886 pub name: Identifier,
8887 pub table: Option<TableRef>,
8888 pub actions: Vec<AlterIndexAction>,
8889}
8890
8891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8893#[cfg_attr(feature = "bindings", derive(TS))]
8894pub enum AlterIndexAction {
8895 Rename(Identifier),
8897 SetTablespace(Identifier),
8899 Visible(bool),
8901}
8902
8903impl AlterIndex {
8904 pub fn new(name: impl Into<String>) -> Self {
8905 Self {
8906 name: Identifier::new(name),
8907 table: None,
8908 actions: Vec::new(),
8909 }
8910 }
8911}
8912
8913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8915#[cfg_attr(feature = "bindings", derive(TS))]
8916pub struct CreateSchema {
8917 pub name: Vec<Identifier>,
8919 pub if_not_exists: bool,
8920 pub authorization: Option<Identifier>,
8921 #[serde(default)]
8923 pub clone_from: Option<Vec<Identifier>>,
8924 #[serde(default)]
8926 pub at_clause: Option<Expression>,
8927 #[serde(default)]
8929 pub properties: Vec<Expression>,
8930 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8932 pub leading_comments: Vec<String>,
8933}
8934
8935impl CreateSchema {
8936 pub fn new(name: impl Into<String>) -> Self {
8937 Self {
8938 name: vec![Identifier::new(name)],
8939 if_not_exists: false,
8940 authorization: None,
8941 clone_from: None,
8942 at_clause: None,
8943 properties: Vec::new(),
8944 leading_comments: Vec::new(),
8945 }
8946 }
8947}
8948
8949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8951#[cfg_attr(feature = "bindings", derive(TS))]
8952pub struct DropSchema {
8953 pub name: Identifier,
8954 pub if_exists: bool,
8955 pub cascade: bool,
8956}
8957
8958impl DropSchema {
8959 pub fn new(name: impl Into<String>) -> Self {
8960 Self {
8961 name: Identifier::new(name),
8962 if_exists: false,
8963 cascade: false,
8964 }
8965 }
8966}
8967
8968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8970#[cfg_attr(feature = "bindings", derive(TS))]
8971pub struct DropNamespace {
8972 pub name: Identifier,
8973 pub if_exists: bool,
8974 pub cascade: bool,
8975}
8976
8977impl DropNamespace {
8978 pub fn new(name: impl Into<String>) -> Self {
8979 Self {
8980 name: Identifier::new(name),
8981 if_exists: false,
8982 cascade: false,
8983 }
8984 }
8985}
8986
8987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8989#[cfg_attr(feature = "bindings", derive(TS))]
8990pub struct CreateDatabase {
8991 pub name: Identifier,
8992 pub if_not_exists: bool,
8993 pub options: Vec<DatabaseOption>,
8994 #[serde(default)]
8996 pub clone_from: Option<Identifier>,
8997 #[serde(default)]
8999 pub at_clause: Option<Expression>,
9000}
9001
9002#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9004#[cfg_attr(feature = "bindings", derive(TS))]
9005pub enum DatabaseOption {
9006 CharacterSet(String),
9007 Collate(String),
9008 Owner(Identifier),
9009 Template(Identifier),
9010 Encoding(String),
9011 Location(String),
9012}
9013
9014impl CreateDatabase {
9015 pub fn new(name: impl Into<String>) -> Self {
9016 Self {
9017 name: Identifier::new(name),
9018 if_not_exists: false,
9019 options: Vec::new(),
9020 clone_from: None,
9021 at_clause: None,
9022 }
9023 }
9024}
9025
9026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9028#[cfg_attr(feature = "bindings", derive(TS))]
9029pub struct DropDatabase {
9030 pub name: Identifier,
9031 pub if_exists: bool,
9032 #[serde(default)]
9034 pub sync: bool,
9035}
9036
9037impl DropDatabase {
9038 pub fn new(name: impl Into<String>) -> Self {
9039 Self {
9040 name: Identifier::new(name),
9041 if_exists: false,
9042 sync: false,
9043 }
9044 }
9045}
9046
9047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9049#[cfg_attr(feature = "bindings", derive(TS))]
9050pub struct CreateFunction {
9051 pub name: TableRef,
9052 pub parameters: Vec<FunctionParameter>,
9053 pub return_type: Option<DataType>,
9054 pub body: Option<FunctionBody>,
9055 pub or_replace: bool,
9056 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9058 pub or_alter: bool,
9059 pub if_not_exists: bool,
9060 pub temporary: bool,
9061 pub language: Option<String>,
9062 pub deterministic: Option<bool>,
9063 pub returns_null_on_null_input: Option<bool>,
9064 pub security: Option<FunctionSecurity>,
9065 #[serde(default = "default_true")]
9067 pub has_parens: bool,
9068 #[serde(default)]
9070 pub sql_data_access: Option<SqlDataAccess>,
9071 #[serde(default, skip_serializing_if = "Option::is_none")]
9073 pub returns_table_body: Option<String>,
9074 #[serde(default)]
9076 pub language_first: bool,
9077 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9079 pub set_options: Vec<FunctionSetOption>,
9080 #[serde(default)]
9082 pub strict: bool,
9083 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9085 pub options: Vec<Expression>,
9086 #[serde(default)]
9088 pub is_table_function: bool,
9089 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9091 pub property_order: Vec<FunctionPropertyKind>,
9092 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9094 pub using_resources: Vec<FunctionUsingResource>,
9095 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9097 pub environment: Vec<Expression>,
9098 #[serde(default, skip_serializing_if = "Option::is_none")]
9100 pub handler: Option<String>,
9101 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9103 pub handler_uses_eq: bool,
9104 #[serde(default, skip_serializing_if = "Option::is_none")]
9106 pub runtime_version: Option<String>,
9107 #[serde(default, skip_serializing_if = "Option::is_none")]
9109 pub packages: Option<Vec<String>>,
9110 #[serde(default, skip_serializing_if = "Option::is_none")]
9112 pub parameter_style: Option<String>,
9113}
9114
9115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9117#[cfg_attr(feature = "bindings", derive(TS))]
9118pub struct FunctionSetOption {
9119 pub name: String,
9120 pub value: FunctionSetValue,
9121}
9122
9123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9125#[cfg_attr(feature = "bindings", derive(TS))]
9126pub enum FunctionSetValue {
9127 Value { value: String, use_to: bool },
9129 FromCurrent,
9131}
9132
9133#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9135#[cfg_attr(feature = "bindings", derive(TS))]
9136pub enum SqlDataAccess {
9137 NoSql,
9139 ContainsSql,
9141 ReadsSqlData,
9143 ModifiesSqlData,
9145}
9146
9147#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9149#[cfg_attr(feature = "bindings", derive(TS))]
9150pub enum FunctionPropertyKind {
9151 Set,
9153 As,
9155 Using,
9157 Language,
9159 Determinism,
9161 NullInput,
9163 Security,
9165 SqlDataAccess,
9167 Options,
9169 Environment,
9171 Handler,
9173 RuntimeVersion,
9175 Packages,
9177 ParameterStyle,
9179}
9180
9181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9183#[cfg_attr(feature = "bindings", derive(TS))]
9184pub struct FunctionUsingResource {
9185 pub kind: String,
9186 pub uri: String,
9187}
9188
9189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9191#[cfg_attr(feature = "bindings", derive(TS))]
9192pub struct FunctionParameter {
9193 pub name: Option<Identifier>,
9194 pub data_type: DataType,
9195 pub mode: Option<ParameterMode>,
9196 pub default: Option<Expression>,
9197 #[serde(default, skip_serializing_if = "Option::is_none")]
9199 pub mode_text: Option<String>,
9200}
9201
9202#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9204#[cfg_attr(feature = "bindings", derive(TS))]
9205pub enum ParameterMode {
9206 In,
9207 Out,
9208 InOut,
9209 Variadic,
9210}
9211
9212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9214#[cfg_attr(feature = "bindings", derive(TS))]
9215pub enum FunctionBody {
9216 Block(String),
9218 StringLiteral(String),
9220 Expression(Expression),
9222 External(String),
9224 Return(Expression),
9226 Statements(Vec<Expression>),
9228 DollarQuoted {
9231 content: String,
9232 tag: Option<String>,
9233 },
9234 RawBlock(String),
9236}
9237
9238#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9240#[cfg_attr(feature = "bindings", derive(TS))]
9241pub enum FunctionSecurity {
9242 Definer,
9243 Invoker,
9244 None,
9246}
9247
9248impl CreateFunction {
9249 pub fn new(name: impl Into<String>) -> Self {
9250 Self {
9251 name: TableRef::new(name),
9252 parameters: Vec::new(),
9253 return_type: None,
9254 body: None,
9255 or_replace: false,
9256 or_alter: false,
9257 if_not_exists: false,
9258 temporary: false,
9259 language: None,
9260 deterministic: None,
9261 returns_null_on_null_input: None,
9262 security: None,
9263 has_parens: true,
9264 sql_data_access: None,
9265 returns_table_body: None,
9266 language_first: false,
9267 set_options: Vec::new(),
9268 strict: false,
9269 options: Vec::new(),
9270 is_table_function: false,
9271 property_order: Vec::new(),
9272 using_resources: Vec::new(),
9273 environment: Vec::new(),
9274 handler: None,
9275 handler_uses_eq: false,
9276 runtime_version: None,
9277 packages: None,
9278 parameter_style: None,
9279 }
9280 }
9281}
9282
9283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9285#[cfg_attr(feature = "bindings", derive(TS))]
9286pub struct DropFunction {
9287 pub name: TableRef,
9288 pub parameters: Option<Vec<DataType>>,
9289 pub if_exists: bool,
9290 pub cascade: bool,
9291}
9292
9293impl DropFunction {
9294 pub fn new(name: impl Into<String>) -> Self {
9295 Self {
9296 name: TableRef::new(name),
9297 parameters: None,
9298 if_exists: false,
9299 cascade: false,
9300 }
9301 }
9302}
9303
9304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9306#[cfg_attr(feature = "bindings", derive(TS))]
9307pub struct CreateProcedure {
9308 pub name: TableRef,
9309 pub parameters: Vec<FunctionParameter>,
9310 pub body: Option<FunctionBody>,
9311 pub or_replace: bool,
9312 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9314 pub or_alter: bool,
9315 pub if_not_exists: bool,
9316 pub language: Option<String>,
9317 pub security: Option<FunctionSecurity>,
9318 #[serde(default)]
9320 pub return_type: Option<DataType>,
9321 #[serde(default)]
9323 pub execute_as: Option<String>,
9324 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9326 pub with_options: Vec<String>,
9327 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9329 pub has_parens: bool,
9330 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9332 pub use_proc_keyword: bool,
9333}
9334
9335impl CreateProcedure {
9336 pub fn new(name: impl Into<String>) -> Self {
9337 Self {
9338 name: TableRef::new(name),
9339 parameters: Vec::new(),
9340 body: None,
9341 or_replace: false,
9342 or_alter: false,
9343 if_not_exists: false,
9344 language: None,
9345 security: None,
9346 return_type: None,
9347 execute_as: None,
9348 with_options: Vec::new(),
9349 has_parens: true,
9350 use_proc_keyword: false,
9351 }
9352 }
9353}
9354
9355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9357#[cfg_attr(feature = "bindings", derive(TS))]
9358pub struct DropProcedure {
9359 pub name: TableRef,
9360 pub parameters: Option<Vec<DataType>>,
9361 pub if_exists: bool,
9362 pub cascade: bool,
9363}
9364
9365impl DropProcedure {
9366 pub fn new(name: impl Into<String>) -> Self {
9367 Self {
9368 name: TableRef::new(name),
9369 parameters: None,
9370 if_exists: false,
9371 cascade: false,
9372 }
9373 }
9374}
9375
9376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9378#[cfg_attr(feature = "bindings", derive(TS))]
9379pub enum SeqPropKind {
9380 Start,
9381 Increment,
9382 Minvalue,
9383 Maxvalue,
9384 Cache,
9385 NoCache,
9386 Cycle,
9387 NoCycle,
9388 OwnedBy,
9389 Order,
9390 NoOrder,
9391 Comment,
9392 Sharing,
9394 Keep,
9396 NoKeep,
9398 Scale,
9400 NoScale,
9402 Shard,
9404 NoShard,
9406 Session,
9408 Global,
9410 NoCacheWord,
9412 NoCycleWord,
9414 NoMinvalueWord,
9416 NoMaxvalueWord,
9418}
9419
9420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9422#[cfg_attr(feature = "bindings", derive(TS))]
9423pub struct CreateSynonym {
9424 pub name: TableRef,
9426 pub target: TableRef,
9428}
9429
9430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9432#[cfg_attr(feature = "bindings", derive(TS))]
9433pub struct CreateSequence {
9434 pub name: TableRef,
9435 pub if_not_exists: bool,
9436 pub temporary: bool,
9437 #[serde(default)]
9438 pub or_replace: bool,
9439 #[serde(default, skip_serializing_if = "Option::is_none")]
9441 pub as_type: Option<DataType>,
9442 pub increment: Option<i64>,
9443 pub minvalue: Option<SequenceBound>,
9444 pub maxvalue: Option<SequenceBound>,
9445 pub start: Option<i64>,
9446 pub cache: Option<i64>,
9447 pub cycle: bool,
9448 pub owned_by: Option<TableRef>,
9449 #[serde(default)]
9451 pub owned_by_none: bool,
9452 #[serde(default)]
9454 pub order: Option<bool>,
9455 #[serde(default)]
9457 pub comment: Option<String>,
9458 #[serde(default, skip_serializing_if = "Option::is_none")]
9460 pub sharing: Option<String>,
9461 #[serde(default, skip_serializing_if = "Option::is_none")]
9463 pub scale_modifier: Option<String>,
9464 #[serde(default, skip_serializing_if = "Option::is_none")]
9466 pub shard_modifier: Option<String>,
9467 #[serde(default)]
9469 pub property_order: Vec<SeqPropKind>,
9470}
9471
9472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9474#[cfg_attr(feature = "bindings", derive(TS))]
9475pub enum SequenceBound {
9476 Value(i64),
9477 None,
9478}
9479
9480impl CreateSequence {
9481 pub fn new(name: impl Into<String>) -> Self {
9482 Self {
9483 name: TableRef::new(name),
9484 if_not_exists: false,
9485 temporary: false,
9486 or_replace: false,
9487 as_type: None,
9488 increment: None,
9489 minvalue: None,
9490 maxvalue: None,
9491 start: None,
9492 cache: None,
9493 cycle: false,
9494 owned_by: None,
9495 owned_by_none: false,
9496 order: None,
9497 comment: None,
9498 sharing: None,
9499 scale_modifier: None,
9500 shard_modifier: None,
9501 property_order: Vec::new(),
9502 }
9503 }
9504}
9505
9506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9508#[cfg_attr(feature = "bindings", derive(TS))]
9509pub struct DropSequence {
9510 pub name: TableRef,
9511 pub if_exists: bool,
9512 pub cascade: bool,
9513}
9514
9515impl DropSequence {
9516 pub fn new(name: impl Into<String>) -> Self {
9517 Self {
9518 name: TableRef::new(name),
9519 if_exists: false,
9520 cascade: false,
9521 }
9522 }
9523}
9524
9525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9527#[cfg_attr(feature = "bindings", derive(TS))]
9528pub struct AlterSequence {
9529 pub name: TableRef,
9530 pub if_exists: bool,
9531 pub increment: Option<i64>,
9532 pub minvalue: Option<SequenceBound>,
9533 pub maxvalue: Option<SequenceBound>,
9534 pub start: Option<i64>,
9535 pub restart: Option<Option<i64>>,
9536 pub cache: Option<i64>,
9537 pub cycle: Option<bool>,
9538 pub owned_by: Option<Option<TableRef>>,
9539}
9540
9541impl AlterSequence {
9542 pub fn new(name: impl Into<String>) -> Self {
9543 Self {
9544 name: TableRef::new(name),
9545 if_exists: false,
9546 increment: None,
9547 minvalue: None,
9548 maxvalue: None,
9549 start: None,
9550 restart: None,
9551 cache: None,
9552 cycle: None,
9553 owned_by: None,
9554 }
9555 }
9556}
9557
9558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9560#[cfg_attr(feature = "bindings", derive(TS))]
9561pub struct CreateTrigger {
9562 pub name: Identifier,
9563 pub table: TableRef,
9564 pub timing: TriggerTiming,
9565 pub events: Vec<TriggerEvent>,
9566 #[serde(default, skip_serializing_if = "Option::is_none")]
9567 pub for_each: Option<TriggerForEach>,
9568 pub when: Option<Expression>,
9569 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9571 pub when_paren: bool,
9572 pub body: TriggerBody,
9573 pub or_replace: bool,
9574 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9576 pub or_alter: bool,
9577 pub constraint: bool,
9578 pub deferrable: Option<bool>,
9579 pub initially_deferred: Option<bool>,
9580 pub referencing: Option<TriggerReferencing>,
9581}
9582
9583#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9585#[cfg_attr(feature = "bindings", derive(TS))]
9586pub enum TriggerTiming {
9587 Before,
9588 After,
9589 InsteadOf,
9590}
9591
9592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9594#[cfg_attr(feature = "bindings", derive(TS))]
9595pub enum TriggerEvent {
9596 Insert,
9597 Update(Option<Vec<Identifier>>),
9598 Delete,
9599 Truncate,
9600}
9601
9602#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9604#[cfg_attr(feature = "bindings", derive(TS))]
9605pub enum TriggerForEach {
9606 Row,
9607 Statement,
9608}
9609
9610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9612#[cfg_attr(feature = "bindings", derive(TS))]
9613pub enum TriggerBody {
9614 Execute {
9616 function: TableRef,
9617 args: Vec<Expression>,
9618 },
9619 Block(String),
9621}
9622
9623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9625#[cfg_attr(feature = "bindings", derive(TS))]
9626pub struct TriggerReferencing {
9627 pub old_table: Option<Identifier>,
9628 pub new_table: Option<Identifier>,
9629 pub old_row: Option<Identifier>,
9630 pub new_row: Option<Identifier>,
9631}
9632
9633impl CreateTrigger {
9634 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9635 Self {
9636 name: Identifier::new(name),
9637 table: TableRef::new(table),
9638 timing: TriggerTiming::Before,
9639 events: Vec::new(),
9640 for_each: Some(TriggerForEach::Row),
9641 when: None,
9642 when_paren: false,
9643 body: TriggerBody::Execute {
9644 function: TableRef::new(""),
9645 args: Vec::new(),
9646 },
9647 or_replace: false,
9648 or_alter: false,
9649 constraint: false,
9650 deferrable: None,
9651 initially_deferred: None,
9652 referencing: None,
9653 }
9654 }
9655}
9656
9657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9659#[cfg_attr(feature = "bindings", derive(TS))]
9660pub struct DropTrigger {
9661 pub name: Identifier,
9662 pub table: Option<TableRef>,
9663 pub if_exists: bool,
9664 pub cascade: bool,
9665}
9666
9667impl DropTrigger {
9668 pub fn new(name: impl Into<String>) -> Self {
9669 Self {
9670 name: Identifier::new(name),
9671 table: None,
9672 if_exists: false,
9673 cascade: false,
9674 }
9675 }
9676}
9677
9678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9680#[cfg_attr(feature = "bindings", derive(TS))]
9681pub struct CreateType {
9682 pub name: TableRef,
9683 pub definition: TypeDefinition,
9684 pub if_not_exists: bool,
9685}
9686
9687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9689#[cfg_attr(feature = "bindings", derive(TS))]
9690pub enum TypeDefinition {
9691 Enum(Vec<String>),
9693 Composite(Vec<TypeAttribute>),
9695 Range {
9697 subtype: DataType,
9698 subtype_diff: Option<String>,
9699 canonical: Option<String>,
9700 },
9701 Base {
9703 input: String,
9704 output: String,
9705 internallength: Option<i32>,
9706 },
9707 Domain {
9709 base_type: DataType,
9710 default: Option<Expression>,
9711 constraints: Vec<DomainConstraint>,
9712 },
9713}
9714
9715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9717#[cfg_attr(feature = "bindings", derive(TS))]
9718pub struct TypeAttribute {
9719 pub name: Identifier,
9720 pub data_type: DataType,
9721 pub collate: Option<Identifier>,
9722}
9723
9724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9726#[cfg_attr(feature = "bindings", derive(TS))]
9727pub struct DomainConstraint {
9728 pub name: Option<Identifier>,
9729 pub check: Expression,
9730}
9731
9732impl CreateType {
9733 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9734 Self {
9735 name: TableRef::new(name),
9736 definition: TypeDefinition::Enum(values),
9737 if_not_exists: false,
9738 }
9739 }
9740
9741 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9742 Self {
9743 name: TableRef::new(name),
9744 definition: TypeDefinition::Composite(attributes),
9745 if_not_exists: false,
9746 }
9747 }
9748}
9749
9750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9752#[cfg_attr(feature = "bindings", derive(TS))]
9753pub struct DropType {
9754 pub name: TableRef,
9755 pub if_exists: bool,
9756 pub cascade: bool,
9757}
9758
9759impl DropType {
9760 pub fn new(name: impl Into<String>) -> Self {
9761 Self {
9762 name: TableRef::new(name),
9763 if_exists: false,
9764 cascade: false,
9765 }
9766 }
9767}
9768
9769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9771#[cfg_attr(feature = "bindings", derive(TS))]
9772pub struct Describe {
9773 pub target: Expression,
9775 pub extended: bool,
9777 pub formatted: bool,
9779 #[serde(default)]
9781 pub kind: Option<String>,
9782 #[serde(default)]
9784 pub properties: Vec<(String, String)>,
9785 #[serde(default, skip_serializing_if = "Option::is_none")]
9787 pub style: Option<String>,
9788 #[serde(default)]
9790 pub partition: Option<Box<Expression>>,
9791 #[serde(default)]
9793 pub leading_comments: Vec<String>,
9794 #[serde(default)]
9796 pub as_json: bool,
9797 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9799 pub params: Vec<String>,
9800}
9801
9802impl Describe {
9803 pub fn new(target: Expression) -> Self {
9804 Self {
9805 target,
9806 extended: false,
9807 formatted: false,
9808 kind: None,
9809 properties: Vec::new(),
9810 style: None,
9811 partition: None,
9812 leading_comments: Vec::new(),
9813 as_json: false,
9814 params: Vec::new(),
9815 }
9816 }
9817}
9818
9819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9821#[cfg_attr(feature = "bindings", derive(TS))]
9822pub struct Show {
9823 pub this: String,
9825 #[serde(default)]
9827 pub terse: bool,
9828 #[serde(default)]
9830 pub history: bool,
9831 pub like: Option<Expression>,
9833 pub scope_kind: Option<String>,
9835 pub scope: Option<Expression>,
9837 pub starts_with: Option<Expression>,
9839 pub limit: Option<Box<Limit>>,
9841 pub from: Option<Expression>,
9843 #[serde(default, skip_serializing_if = "Option::is_none")]
9845 pub where_clause: Option<Expression>,
9846 #[serde(default, skip_serializing_if = "Option::is_none")]
9848 pub for_target: Option<Expression>,
9849 #[serde(default, skip_serializing_if = "Option::is_none")]
9851 pub db: Option<Expression>,
9852 #[serde(default, skip_serializing_if = "Option::is_none")]
9854 pub target: Option<Expression>,
9855 #[serde(default, skip_serializing_if = "Option::is_none")]
9857 pub mutex: Option<bool>,
9858 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9860 pub privileges: Vec<String>,
9861}
9862
9863impl Show {
9864 pub fn new(this: impl Into<String>) -> Self {
9865 Self {
9866 this: this.into(),
9867 terse: false,
9868 history: false,
9869 like: None,
9870 scope_kind: None,
9871 scope: None,
9872 starts_with: None,
9873 limit: None,
9874 from: None,
9875 where_clause: None,
9876 for_target: None,
9877 db: None,
9878 target: None,
9879 mutex: None,
9880 privileges: Vec::new(),
9881 }
9882 }
9883}
9884
9885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9890#[cfg_attr(feature = "bindings", derive(TS))]
9891pub struct Paren {
9892 pub this: Expression,
9894 #[serde(default)]
9895 pub trailing_comments: Vec<String>,
9896}
9897
9898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9900#[cfg_attr(feature = "bindings", derive(TS))]
9901pub struct Annotated {
9902 pub this: Expression,
9903 pub trailing_comments: Vec<String>,
9904}
9905
9906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9911#[cfg_attr(feature = "bindings", derive(TS))]
9912pub struct Refresh {
9913 pub this: Box<Expression>,
9914 pub kind: String,
9915}
9916
9917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9919#[cfg_attr(feature = "bindings", derive(TS))]
9920pub struct LockingStatement {
9921 pub this: Box<Expression>,
9922 pub expression: Box<Expression>,
9923}
9924
9925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9927#[cfg_attr(feature = "bindings", derive(TS))]
9928pub struct SequenceProperties {
9929 #[serde(default)]
9930 pub increment: Option<Box<Expression>>,
9931 #[serde(default)]
9932 pub minvalue: Option<Box<Expression>>,
9933 #[serde(default)]
9934 pub maxvalue: Option<Box<Expression>>,
9935 #[serde(default)]
9936 pub cache: Option<Box<Expression>>,
9937 #[serde(default)]
9938 pub start: Option<Box<Expression>>,
9939 #[serde(default)]
9940 pub owned: Option<Box<Expression>>,
9941 #[serde(default)]
9942 pub options: Vec<Expression>,
9943}
9944
9945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9947#[cfg_attr(feature = "bindings", derive(TS))]
9948pub struct TruncateTable {
9949 #[serde(default)]
9950 pub expressions: Vec<Expression>,
9951 #[serde(default)]
9952 pub is_database: Option<Box<Expression>>,
9953 #[serde(default)]
9954 pub exists: bool,
9955 #[serde(default)]
9956 pub only: Option<Box<Expression>>,
9957 #[serde(default)]
9958 pub cluster: Option<Box<Expression>>,
9959 #[serde(default)]
9960 pub identity: Option<Box<Expression>>,
9961 #[serde(default)]
9962 pub option: Option<Box<Expression>>,
9963 #[serde(default)]
9964 pub partition: Option<Box<Expression>>,
9965}
9966
9967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9969#[cfg_attr(feature = "bindings", derive(TS))]
9970pub struct Clone {
9971 pub this: Box<Expression>,
9972 #[serde(default)]
9973 pub shallow: Option<Box<Expression>>,
9974 #[serde(default)]
9975 pub copy: Option<Box<Expression>>,
9976}
9977
9978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9980#[cfg_attr(feature = "bindings", derive(TS))]
9981pub struct Attach {
9982 pub this: Box<Expression>,
9983 #[serde(default)]
9984 pub exists: bool,
9985 #[serde(default)]
9986 pub expressions: Vec<Expression>,
9987}
9988
9989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9991#[cfg_attr(feature = "bindings", derive(TS))]
9992pub struct Detach {
9993 pub this: Box<Expression>,
9994 #[serde(default)]
9995 pub exists: bool,
9996}
9997
9998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10000#[cfg_attr(feature = "bindings", derive(TS))]
10001pub struct Install {
10002 pub this: Box<Expression>,
10003 #[serde(default)]
10004 pub from_: Option<Box<Expression>>,
10005 #[serde(default)]
10006 pub force: Option<Box<Expression>>,
10007}
10008
10009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10011#[cfg_attr(feature = "bindings", derive(TS))]
10012pub struct Summarize {
10013 pub this: Box<Expression>,
10014 #[serde(default)]
10015 pub table: Option<Box<Expression>>,
10016}
10017
10018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10020#[cfg_attr(feature = "bindings", derive(TS))]
10021pub struct Declare {
10022 #[serde(default)]
10023 pub expressions: Vec<Expression>,
10024 #[serde(default)]
10025 pub replace: bool,
10026}
10027
10028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10030#[cfg_attr(feature = "bindings", derive(TS))]
10031pub struct DeclareItem {
10032 pub this: Box<Expression>,
10033 #[serde(default)]
10034 pub kind: Option<String>,
10035 #[serde(default)]
10036 pub default: Option<Box<Expression>>,
10037 #[serde(default)]
10038 pub has_as: bool,
10039 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10041 pub additional_names: Vec<Expression>,
10042}
10043
10044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10046#[cfg_attr(feature = "bindings", derive(TS))]
10047pub struct Set {
10048 #[serde(default)]
10049 pub expressions: Vec<Expression>,
10050 #[serde(default)]
10051 pub unset: Option<Box<Expression>>,
10052 #[serde(default)]
10053 pub tag: Option<Box<Expression>>,
10054}
10055
10056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10058#[cfg_attr(feature = "bindings", derive(TS))]
10059pub struct Heredoc {
10060 pub this: Box<Expression>,
10061 #[serde(default)]
10062 pub tag: Option<Box<Expression>>,
10063}
10064
10065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10067#[cfg_attr(feature = "bindings", derive(TS))]
10068pub struct QueryBand {
10069 pub this: Box<Expression>,
10070 #[serde(default)]
10071 pub scope: Option<Box<Expression>>,
10072 #[serde(default)]
10073 pub update: Option<Box<Expression>>,
10074}
10075
10076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10078#[cfg_attr(feature = "bindings", derive(TS))]
10079pub struct UserDefinedFunction {
10080 pub this: Box<Expression>,
10081 #[serde(default)]
10082 pub expressions: Vec<Expression>,
10083 #[serde(default)]
10084 pub wrapped: Option<Box<Expression>>,
10085}
10086
10087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10089#[cfg_attr(feature = "bindings", derive(TS))]
10090pub struct RecursiveWithSearch {
10091 pub kind: String,
10092 pub this: Box<Expression>,
10093 pub expression: Box<Expression>,
10094 #[serde(default)]
10095 pub using: Option<Box<Expression>>,
10096}
10097
10098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10100#[cfg_attr(feature = "bindings", derive(TS))]
10101pub struct ProjectionDef {
10102 pub this: Box<Expression>,
10103 pub expression: Box<Expression>,
10104}
10105
10106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10108#[cfg_attr(feature = "bindings", derive(TS))]
10109pub struct TableAlias {
10110 #[serde(default)]
10111 pub this: Option<Box<Expression>>,
10112 #[serde(default)]
10113 pub columns: Vec<Expression>,
10114}
10115
10116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10118#[cfg_attr(feature = "bindings", derive(TS))]
10119pub struct ByteString {
10120 pub this: Box<Expression>,
10121 #[serde(default)]
10122 pub is_bytes: Option<Box<Expression>>,
10123}
10124
10125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10128#[cfg_attr(feature = "bindings", derive(TS))]
10129pub struct HexStringExpr {
10130 pub this: Box<Expression>,
10131 #[serde(default)]
10132 pub is_integer: Option<bool>,
10133}
10134
10135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10137#[cfg_attr(feature = "bindings", derive(TS))]
10138pub struct UnicodeString {
10139 pub this: Box<Expression>,
10140 #[serde(default)]
10141 pub escape: Option<Box<Expression>>,
10142}
10143
10144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10146#[cfg_attr(feature = "bindings", derive(TS))]
10147pub struct AlterColumn {
10148 pub this: Box<Expression>,
10149 #[serde(default)]
10150 pub dtype: Option<Box<Expression>>,
10151 #[serde(default)]
10152 pub collate: Option<Box<Expression>>,
10153 #[serde(default)]
10154 pub using: Option<Box<Expression>>,
10155 #[serde(default)]
10156 pub default: Option<Box<Expression>>,
10157 #[serde(default)]
10158 pub drop: Option<Box<Expression>>,
10159 #[serde(default)]
10160 pub comment: Option<Box<Expression>>,
10161 #[serde(default)]
10162 pub allow_null: Option<Box<Expression>>,
10163 #[serde(default)]
10164 pub visible: Option<Box<Expression>>,
10165 #[serde(default)]
10166 pub rename_to: Option<Box<Expression>>,
10167}
10168
10169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10171#[cfg_attr(feature = "bindings", derive(TS))]
10172pub struct AlterSortKey {
10173 #[serde(default)]
10174 pub this: Option<Box<Expression>>,
10175 #[serde(default)]
10176 pub expressions: Vec<Expression>,
10177 #[serde(default)]
10178 pub compound: Option<Box<Expression>>,
10179}
10180
10181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10183#[cfg_attr(feature = "bindings", derive(TS))]
10184pub struct AlterSet {
10185 #[serde(default)]
10186 pub expressions: Vec<Expression>,
10187 #[serde(default)]
10188 pub option: Option<Box<Expression>>,
10189 #[serde(default)]
10190 pub tablespace: Option<Box<Expression>>,
10191 #[serde(default)]
10192 pub access_method: Option<Box<Expression>>,
10193 #[serde(default)]
10194 pub file_format: Option<Box<Expression>>,
10195 #[serde(default)]
10196 pub copy_options: Option<Box<Expression>>,
10197 #[serde(default)]
10198 pub tag: Option<Box<Expression>>,
10199 #[serde(default)]
10200 pub location: Option<Box<Expression>>,
10201 #[serde(default)]
10202 pub serde: Option<Box<Expression>>,
10203}
10204
10205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10207#[cfg_attr(feature = "bindings", derive(TS))]
10208pub struct RenameColumn {
10209 pub this: Box<Expression>,
10210 #[serde(default)]
10211 pub to: Option<Box<Expression>>,
10212 #[serde(default)]
10213 pub exists: bool,
10214}
10215
10216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10218#[cfg_attr(feature = "bindings", derive(TS))]
10219pub struct Comprehension {
10220 pub this: Box<Expression>,
10221 pub expression: Box<Expression>,
10222 #[serde(default)]
10223 pub position: Option<Box<Expression>>,
10224 #[serde(default)]
10225 pub iterator: Option<Box<Expression>>,
10226 #[serde(default)]
10227 pub condition: Option<Box<Expression>>,
10228}
10229
10230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10232#[cfg_attr(feature = "bindings", derive(TS))]
10233pub struct MergeTreeTTLAction {
10234 pub this: Box<Expression>,
10235 #[serde(default)]
10236 pub delete: Option<Box<Expression>>,
10237 #[serde(default)]
10238 pub recompress: Option<Box<Expression>>,
10239 #[serde(default)]
10240 pub to_disk: Option<Box<Expression>>,
10241 #[serde(default)]
10242 pub to_volume: Option<Box<Expression>>,
10243}
10244
10245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10247#[cfg_attr(feature = "bindings", derive(TS))]
10248pub struct MergeTreeTTL {
10249 #[serde(default)]
10250 pub expressions: Vec<Expression>,
10251 #[serde(default)]
10252 pub where_: Option<Box<Expression>>,
10253 #[serde(default)]
10254 pub group: Option<Box<Expression>>,
10255 #[serde(default)]
10256 pub aggregates: Option<Box<Expression>>,
10257}
10258
10259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10261#[cfg_attr(feature = "bindings", derive(TS))]
10262pub struct IndexConstraintOption {
10263 #[serde(default)]
10264 pub key_block_size: Option<Box<Expression>>,
10265 #[serde(default)]
10266 pub using: Option<Box<Expression>>,
10267 #[serde(default)]
10268 pub parser: Option<Box<Expression>>,
10269 #[serde(default)]
10270 pub comment: Option<Box<Expression>>,
10271 #[serde(default)]
10272 pub visible: Option<Box<Expression>>,
10273 #[serde(default)]
10274 pub engine_attr: Option<Box<Expression>>,
10275 #[serde(default)]
10276 pub secondary_engine_attr: Option<Box<Expression>>,
10277}
10278
10279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10281#[cfg_attr(feature = "bindings", derive(TS))]
10282pub struct PeriodForSystemTimeConstraint {
10283 pub this: Box<Expression>,
10284 pub expression: Box<Expression>,
10285}
10286
10287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10289#[cfg_attr(feature = "bindings", derive(TS))]
10290pub struct CaseSpecificColumnConstraint {
10291 #[serde(default)]
10292 pub not_: Option<Box<Expression>>,
10293}
10294
10295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10297#[cfg_attr(feature = "bindings", derive(TS))]
10298pub struct CharacterSetColumnConstraint {
10299 pub this: Box<Expression>,
10300}
10301
10302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10304#[cfg_attr(feature = "bindings", derive(TS))]
10305pub struct CheckColumnConstraint {
10306 pub this: Box<Expression>,
10307 #[serde(default)]
10308 pub enforced: Option<Box<Expression>>,
10309}
10310
10311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10313#[cfg_attr(feature = "bindings", derive(TS))]
10314pub struct AssumeColumnConstraint {
10315 pub this: Box<Expression>,
10316}
10317
10318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10320#[cfg_attr(feature = "bindings", derive(TS))]
10321pub struct CompressColumnConstraint {
10322 #[serde(default)]
10323 pub this: Option<Box<Expression>>,
10324}
10325
10326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10328#[cfg_attr(feature = "bindings", derive(TS))]
10329pub struct DateFormatColumnConstraint {
10330 pub this: Box<Expression>,
10331}
10332
10333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10335#[cfg_attr(feature = "bindings", derive(TS))]
10336pub struct EphemeralColumnConstraint {
10337 #[serde(default)]
10338 pub this: Option<Box<Expression>>,
10339}
10340
10341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10343#[cfg_attr(feature = "bindings", derive(TS))]
10344pub struct WithOperator {
10345 pub this: Box<Expression>,
10346 pub op: String,
10347}
10348
10349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10351#[cfg_attr(feature = "bindings", derive(TS))]
10352pub struct GeneratedAsIdentityColumnConstraint {
10353 #[serde(default)]
10354 pub this: Option<Box<Expression>>,
10355 #[serde(default)]
10356 pub expression: Option<Box<Expression>>,
10357 #[serde(default)]
10358 pub on_null: Option<Box<Expression>>,
10359 #[serde(default)]
10360 pub start: Option<Box<Expression>>,
10361 #[serde(default)]
10362 pub increment: Option<Box<Expression>>,
10363 #[serde(default)]
10364 pub minvalue: Option<Box<Expression>>,
10365 #[serde(default)]
10366 pub maxvalue: Option<Box<Expression>>,
10367 #[serde(default)]
10368 pub cycle: Option<Box<Expression>>,
10369 #[serde(default)]
10370 pub order: Option<Box<Expression>>,
10371}
10372
10373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10376#[cfg_attr(feature = "bindings", derive(TS))]
10377pub struct AutoIncrementColumnConstraint;
10378
10379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10381#[cfg_attr(feature = "bindings", derive(TS))]
10382pub struct CommentColumnConstraint;
10383
10384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10386#[cfg_attr(feature = "bindings", derive(TS))]
10387pub struct GeneratedAsRowColumnConstraint {
10388 #[serde(default)]
10389 pub start: Option<Box<Expression>>,
10390 #[serde(default)]
10391 pub hidden: Option<Box<Expression>>,
10392}
10393
10394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10396#[cfg_attr(feature = "bindings", derive(TS))]
10397pub struct IndexColumnConstraint {
10398 #[serde(default)]
10399 pub this: Option<Box<Expression>>,
10400 #[serde(default)]
10401 pub expressions: Vec<Expression>,
10402 #[serde(default)]
10403 pub kind: Option<String>,
10404 #[serde(default)]
10405 pub index_type: Option<Box<Expression>>,
10406 #[serde(default)]
10407 pub options: Vec<Expression>,
10408 #[serde(default)]
10409 pub expression: Option<Box<Expression>>,
10410 #[serde(default)]
10411 pub granularity: Option<Box<Expression>>,
10412}
10413
10414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10416#[cfg_attr(feature = "bindings", derive(TS))]
10417pub struct MaskingPolicyColumnConstraint {
10418 pub this: Box<Expression>,
10419 #[serde(default)]
10420 pub expressions: Vec<Expression>,
10421}
10422
10423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10425#[cfg_attr(feature = "bindings", derive(TS))]
10426pub struct NotNullColumnConstraint {
10427 #[serde(default)]
10428 pub allow_null: Option<Box<Expression>>,
10429}
10430
10431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10433#[cfg_attr(feature = "bindings", derive(TS))]
10434pub struct DefaultColumnConstraint {
10435 pub this: Box<Expression>,
10436 #[serde(default, skip_serializing_if = "Option::is_none")]
10438 pub for_column: Option<Identifier>,
10439}
10440
10441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10443#[cfg_attr(feature = "bindings", derive(TS))]
10444pub struct PrimaryKeyColumnConstraint {
10445 #[serde(default)]
10446 pub desc: Option<Box<Expression>>,
10447 #[serde(default)]
10448 pub options: Vec<Expression>,
10449}
10450
10451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10453#[cfg_attr(feature = "bindings", derive(TS))]
10454pub struct UniqueColumnConstraint {
10455 #[serde(default)]
10456 pub this: Option<Box<Expression>>,
10457 #[serde(default)]
10458 pub index_type: Option<Box<Expression>>,
10459 #[serde(default)]
10460 pub on_conflict: Option<Box<Expression>>,
10461 #[serde(default)]
10462 pub nulls: Option<Box<Expression>>,
10463 #[serde(default)]
10464 pub options: Vec<Expression>,
10465}
10466
10467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10469#[cfg_attr(feature = "bindings", derive(TS))]
10470pub struct WatermarkColumnConstraint {
10471 pub this: Box<Expression>,
10472 pub expression: Box<Expression>,
10473}
10474
10475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10477#[cfg_attr(feature = "bindings", derive(TS))]
10478pub struct ComputedColumnConstraint {
10479 pub this: Box<Expression>,
10480 #[serde(default)]
10481 pub persisted: Option<Box<Expression>>,
10482 #[serde(default)]
10483 pub not_null: Option<Box<Expression>>,
10484 #[serde(default)]
10485 pub data_type: Option<Box<Expression>>,
10486}
10487
10488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10490#[cfg_attr(feature = "bindings", derive(TS))]
10491pub struct InOutColumnConstraint {
10492 #[serde(default)]
10493 pub input_: Option<Box<Expression>>,
10494 #[serde(default)]
10495 pub output: Option<Box<Expression>>,
10496}
10497
10498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10500#[cfg_attr(feature = "bindings", derive(TS))]
10501pub struct PathColumnConstraint {
10502 pub this: Box<Expression>,
10503}
10504
10505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10507#[cfg_attr(feature = "bindings", derive(TS))]
10508pub struct Constraint {
10509 pub this: Box<Expression>,
10510 #[serde(default)]
10511 pub expressions: Vec<Expression>,
10512}
10513
10514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10516#[cfg_attr(feature = "bindings", derive(TS))]
10517pub struct Export {
10518 pub this: Box<Expression>,
10519 #[serde(default)]
10520 pub connection: Option<Box<Expression>>,
10521 #[serde(default)]
10522 pub options: Vec<Expression>,
10523}
10524
10525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10527#[cfg_attr(feature = "bindings", derive(TS))]
10528pub struct Filter {
10529 pub this: Box<Expression>,
10530 pub expression: Box<Expression>,
10531}
10532
10533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10535#[cfg_attr(feature = "bindings", derive(TS))]
10536pub struct Changes {
10537 #[serde(default)]
10538 pub information: Option<Box<Expression>>,
10539 #[serde(default)]
10540 pub at_before: Option<Box<Expression>>,
10541 #[serde(default)]
10542 pub end: Option<Box<Expression>>,
10543}
10544
10545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10547#[cfg_attr(feature = "bindings", derive(TS))]
10548pub struct Directory {
10549 pub this: Box<Expression>,
10550 #[serde(default)]
10551 pub local: Option<Box<Expression>>,
10552 #[serde(default)]
10553 pub row_format: Option<Box<Expression>>,
10554}
10555
10556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10558#[cfg_attr(feature = "bindings", derive(TS))]
10559pub struct ForeignKey {
10560 #[serde(default)]
10561 pub expressions: Vec<Expression>,
10562 #[serde(default)]
10563 pub reference: Option<Box<Expression>>,
10564 #[serde(default)]
10565 pub delete: Option<Box<Expression>>,
10566 #[serde(default)]
10567 pub update: Option<Box<Expression>>,
10568 #[serde(default)]
10569 pub options: Vec<Expression>,
10570}
10571
10572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10574#[cfg_attr(feature = "bindings", derive(TS))]
10575pub struct ColumnPrefix {
10576 pub this: Box<Expression>,
10577 pub expression: Box<Expression>,
10578}
10579
10580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10582#[cfg_attr(feature = "bindings", derive(TS))]
10583pub struct PrimaryKey {
10584 #[serde(default)]
10585 pub this: Option<Box<Expression>>,
10586 #[serde(default)]
10587 pub expressions: Vec<Expression>,
10588 #[serde(default)]
10589 pub options: Vec<Expression>,
10590 #[serde(default)]
10591 pub include: Option<Box<Expression>>,
10592}
10593
10594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10596#[cfg_attr(feature = "bindings", derive(TS))]
10597pub struct IntoClause {
10598 #[serde(default)]
10599 pub this: Option<Box<Expression>>,
10600 #[serde(default)]
10601 pub temporary: bool,
10602 #[serde(default)]
10603 pub unlogged: Option<Box<Expression>>,
10604 #[serde(default)]
10605 pub bulk_collect: Option<Box<Expression>>,
10606 #[serde(default)]
10607 pub expressions: Vec<Expression>,
10608}
10609
10610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10612#[cfg_attr(feature = "bindings", derive(TS))]
10613pub struct JoinHint {
10614 pub this: Box<Expression>,
10615 #[serde(default)]
10616 pub expressions: Vec<Expression>,
10617}
10618
10619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10621#[cfg_attr(feature = "bindings", derive(TS))]
10622pub struct Opclass {
10623 pub this: Box<Expression>,
10624 pub expression: Box<Expression>,
10625}
10626
10627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10629#[cfg_attr(feature = "bindings", derive(TS))]
10630pub struct Index {
10631 #[serde(default)]
10632 pub this: Option<Box<Expression>>,
10633 #[serde(default)]
10634 pub table: Option<Box<Expression>>,
10635 #[serde(default)]
10636 pub unique: bool,
10637 #[serde(default)]
10638 pub primary: Option<Box<Expression>>,
10639 #[serde(default)]
10640 pub amp: Option<Box<Expression>>,
10641 #[serde(default)]
10642 pub params: Vec<Expression>,
10643}
10644
10645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10647#[cfg_attr(feature = "bindings", derive(TS))]
10648pub struct IndexParameters {
10649 #[serde(default)]
10650 pub using: Option<Box<Expression>>,
10651 #[serde(default)]
10652 pub include: Option<Box<Expression>>,
10653 #[serde(default)]
10654 pub columns: Vec<Expression>,
10655 #[serde(default)]
10656 pub with_storage: Option<Box<Expression>>,
10657 #[serde(default)]
10658 pub partition_by: Option<Box<Expression>>,
10659 #[serde(default)]
10660 pub tablespace: Option<Box<Expression>>,
10661 #[serde(default)]
10662 pub where_: Option<Box<Expression>>,
10663 #[serde(default)]
10664 pub on: Option<Box<Expression>>,
10665}
10666
10667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10669#[cfg_attr(feature = "bindings", derive(TS))]
10670pub struct ConditionalInsert {
10671 pub this: Box<Expression>,
10672 #[serde(default)]
10673 pub expression: Option<Box<Expression>>,
10674 #[serde(default)]
10675 pub else_: Option<Box<Expression>>,
10676}
10677
10678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10680#[cfg_attr(feature = "bindings", derive(TS))]
10681pub struct MultitableInserts {
10682 #[serde(default)]
10683 pub expressions: Vec<Expression>,
10684 pub kind: String,
10685 #[serde(default)]
10686 pub source: Option<Box<Expression>>,
10687 #[serde(default)]
10689 pub leading_comments: Vec<String>,
10690 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10692 pub overwrite: bool,
10693}
10694
10695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10697#[cfg_attr(feature = "bindings", derive(TS))]
10698pub struct OnConflict {
10699 #[serde(default)]
10700 pub duplicate: Option<Box<Expression>>,
10701 #[serde(default)]
10702 pub expressions: Vec<Expression>,
10703 #[serde(default)]
10704 pub action: Option<Box<Expression>>,
10705 #[serde(default)]
10706 pub conflict_keys: Option<Box<Expression>>,
10707 #[serde(default)]
10708 pub index_predicate: Option<Box<Expression>>,
10709 #[serde(default)]
10710 pub constraint: Option<Box<Expression>>,
10711 #[serde(default)]
10712 pub where_: Option<Box<Expression>>,
10713}
10714
10715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10717#[cfg_attr(feature = "bindings", derive(TS))]
10718pub struct OnCondition {
10719 #[serde(default)]
10720 pub error: Option<Box<Expression>>,
10721 #[serde(default)]
10722 pub empty: Option<Box<Expression>>,
10723 #[serde(default)]
10724 pub null: Option<Box<Expression>>,
10725}
10726
10727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10729#[cfg_attr(feature = "bindings", derive(TS))]
10730pub struct Returning {
10731 #[serde(default)]
10732 pub expressions: Vec<Expression>,
10733 #[serde(default)]
10734 pub into: Option<Box<Expression>>,
10735}
10736
10737#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10739#[cfg_attr(feature = "bindings", derive(TS))]
10740pub struct Introducer {
10741 pub this: Box<Expression>,
10742 pub expression: Box<Expression>,
10743}
10744
10745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10747#[cfg_attr(feature = "bindings", derive(TS))]
10748pub struct PartitionRange {
10749 pub this: Box<Expression>,
10750 #[serde(default)]
10751 pub expression: Option<Box<Expression>>,
10752 #[serde(default)]
10753 pub expressions: Vec<Expression>,
10754}
10755
10756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10758#[cfg_attr(feature = "bindings", derive(TS))]
10759pub struct Group {
10760 #[serde(default)]
10761 pub expressions: Vec<Expression>,
10762 #[serde(default)]
10763 pub grouping_sets: Option<Box<Expression>>,
10764 #[serde(default)]
10765 pub cube: Option<Box<Expression>>,
10766 #[serde(default)]
10767 pub rollup: Option<Box<Expression>>,
10768 #[serde(default)]
10769 pub totals: Option<Box<Expression>>,
10770 #[serde(default)]
10772 pub all: Option<bool>,
10773}
10774
10775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10777#[cfg_attr(feature = "bindings", derive(TS))]
10778pub struct Cube {
10779 #[serde(default)]
10780 pub expressions: Vec<Expression>,
10781}
10782
10783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10785#[cfg_attr(feature = "bindings", derive(TS))]
10786pub struct Rollup {
10787 #[serde(default)]
10788 pub expressions: Vec<Expression>,
10789}
10790
10791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10793#[cfg_attr(feature = "bindings", derive(TS))]
10794pub struct GroupingSets {
10795 #[serde(default)]
10796 pub expressions: Vec<Expression>,
10797}
10798
10799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10801#[cfg_attr(feature = "bindings", derive(TS))]
10802pub struct LimitOptions {
10803 #[serde(default)]
10804 pub percent: Option<Box<Expression>>,
10805 #[serde(default)]
10806 pub rows: Option<Box<Expression>>,
10807 #[serde(default)]
10808 pub with_ties: Option<Box<Expression>>,
10809}
10810
10811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10813#[cfg_attr(feature = "bindings", derive(TS))]
10814pub struct Lateral {
10815 pub this: Box<Expression>,
10816 #[serde(default)]
10817 pub view: Option<Box<Expression>>,
10818 #[serde(default)]
10819 pub outer: Option<Box<Expression>>,
10820 #[serde(default)]
10821 pub alias: Option<String>,
10822 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10824 pub alias_quoted: bool,
10825 #[serde(default)]
10826 pub cross_apply: Option<Box<Expression>>,
10827 #[serde(default)]
10828 pub ordinality: Option<Box<Expression>>,
10829 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10831 pub column_aliases: Vec<String>,
10832}
10833
10834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10836#[cfg_attr(feature = "bindings", derive(TS))]
10837pub struct TableFromRows {
10838 pub this: Box<Expression>,
10839 #[serde(default)]
10840 pub alias: Option<String>,
10841 #[serde(default)]
10842 pub joins: Vec<Expression>,
10843 #[serde(default)]
10844 pub pivots: Option<Box<Expression>>,
10845 #[serde(default)]
10846 pub sample: Option<Box<Expression>>,
10847}
10848
10849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10852#[cfg_attr(feature = "bindings", derive(TS))]
10853pub struct RowsFrom {
10854 pub expressions: Vec<Expression>,
10856 #[serde(default)]
10858 pub ordinality: bool,
10859 #[serde(default)]
10861 pub alias: Option<Box<Expression>>,
10862}
10863
10864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10866#[cfg_attr(feature = "bindings", derive(TS))]
10867pub struct WithFill {
10868 #[serde(default)]
10869 pub from_: Option<Box<Expression>>,
10870 #[serde(default)]
10871 pub to: Option<Box<Expression>>,
10872 #[serde(default)]
10873 pub step: Option<Box<Expression>>,
10874 #[serde(default)]
10875 pub staleness: Option<Box<Expression>>,
10876 #[serde(default)]
10877 pub interpolate: Option<Box<Expression>>,
10878}
10879
10880#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10882#[cfg_attr(feature = "bindings", derive(TS))]
10883pub struct Property {
10884 pub this: Box<Expression>,
10885 #[serde(default)]
10886 pub value: Option<Box<Expression>>,
10887}
10888
10889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10891#[cfg_attr(feature = "bindings", derive(TS))]
10892pub struct GrantPrivilege {
10893 pub this: Box<Expression>,
10894 #[serde(default)]
10895 pub expressions: Vec<Expression>,
10896}
10897
10898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10900#[cfg_attr(feature = "bindings", derive(TS))]
10901pub struct AllowedValuesProperty {
10902 #[serde(default)]
10903 pub expressions: Vec<Expression>,
10904}
10905
10906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10908#[cfg_attr(feature = "bindings", derive(TS))]
10909pub struct AlgorithmProperty {
10910 pub this: Box<Expression>,
10911}
10912
10913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10915#[cfg_attr(feature = "bindings", derive(TS))]
10916pub struct AutoIncrementProperty {
10917 pub this: Box<Expression>,
10918}
10919
10920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10922#[cfg_attr(feature = "bindings", derive(TS))]
10923pub struct AutoRefreshProperty {
10924 pub this: Box<Expression>,
10925}
10926
10927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10929#[cfg_attr(feature = "bindings", derive(TS))]
10930pub struct BackupProperty {
10931 pub this: Box<Expression>,
10932}
10933
10934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10936#[cfg_attr(feature = "bindings", derive(TS))]
10937pub struct BuildProperty {
10938 pub this: Box<Expression>,
10939}
10940
10941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10943#[cfg_attr(feature = "bindings", derive(TS))]
10944pub struct BlockCompressionProperty {
10945 #[serde(default)]
10946 pub autotemp: Option<Box<Expression>>,
10947 #[serde(default)]
10948 pub always: Option<Box<Expression>>,
10949 #[serde(default)]
10950 pub default: Option<Box<Expression>>,
10951 #[serde(default)]
10952 pub manual: Option<Box<Expression>>,
10953 #[serde(default)]
10954 pub never: Option<Box<Expression>>,
10955}
10956
10957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10959#[cfg_attr(feature = "bindings", derive(TS))]
10960pub struct CharacterSetProperty {
10961 pub this: Box<Expression>,
10962 #[serde(default)]
10963 pub default: Option<Box<Expression>>,
10964}
10965
10966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10968#[cfg_attr(feature = "bindings", derive(TS))]
10969pub struct ChecksumProperty {
10970 #[serde(default)]
10971 pub on: Option<Box<Expression>>,
10972 #[serde(default)]
10973 pub default: Option<Box<Expression>>,
10974}
10975
10976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10978#[cfg_attr(feature = "bindings", derive(TS))]
10979pub struct CollateProperty {
10980 pub this: Box<Expression>,
10981 #[serde(default)]
10982 pub default: Option<Box<Expression>>,
10983}
10984
10985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10987#[cfg_attr(feature = "bindings", derive(TS))]
10988pub struct DataBlocksizeProperty {
10989 #[serde(default)]
10990 pub size: Option<i64>,
10991 #[serde(default)]
10992 pub units: Option<Box<Expression>>,
10993 #[serde(default)]
10994 pub minimum: Option<Box<Expression>>,
10995 #[serde(default)]
10996 pub maximum: Option<Box<Expression>>,
10997 #[serde(default)]
10998 pub default: Option<Box<Expression>>,
10999}
11000
11001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11003#[cfg_attr(feature = "bindings", derive(TS))]
11004pub struct DataDeletionProperty {
11005 pub on: Box<Expression>,
11006 #[serde(default)]
11007 pub filter_column: Option<Box<Expression>>,
11008 #[serde(default)]
11009 pub retention_period: Option<Box<Expression>>,
11010}
11011
11012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11014#[cfg_attr(feature = "bindings", derive(TS))]
11015pub struct DefinerProperty {
11016 pub this: Box<Expression>,
11017}
11018
11019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11021#[cfg_attr(feature = "bindings", derive(TS))]
11022pub struct DistKeyProperty {
11023 pub this: Box<Expression>,
11024}
11025
11026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11028#[cfg_attr(feature = "bindings", derive(TS))]
11029pub struct DistributedByProperty {
11030 #[serde(default)]
11031 pub expressions: Vec<Expression>,
11032 pub kind: String,
11033 #[serde(default)]
11034 pub buckets: Option<Box<Expression>>,
11035 #[serde(default)]
11036 pub order: Option<Box<Expression>>,
11037}
11038
11039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11041#[cfg_attr(feature = "bindings", derive(TS))]
11042pub struct DistStyleProperty {
11043 pub this: Box<Expression>,
11044}
11045
11046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11048#[cfg_attr(feature = "bindings", derive(TS))]
11049pub struct DuplicateKeyProperty {
11050 #[serde(default)]
11051 pub expressions: Vec<Expression>,
11052}
11053
11054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11056#[cfg_attr(feature = "bindings", derive(TS))]
11057pub struct EngineProperty {
11058 pub this: Box<Expression>,
11059}
11060
11061#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11063#[cfg_attr(feature = "bindings", derive(TS))]
11064pub struct ToTableProperty {
11065 pub this: Box<Expression>,
11066}
11067
11068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11070#[cfg_attr(feature = "bindings", derive(TS))]
11071pub struct ExecuteAsProperty {
11072 pub this: Box<Expression>,
11073}
11074
11075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11077#[cfg_attr(feature = "bindings", derive(TS))]
11078pub struct ExternalProperty {
11079 #[serde(default)]
11080 pub this: Option<Box<Expression>>,
11081}
11082
11083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11085#[cfg_attr(feature = "bindings", derive(TS))]
11086pub struct FallbackProperty {
11087 #[serde(default)]
11088 pub no: Option<Box<Expression>>,
11089 #[serde(default)]
11090 pub protection: Option<Box<Expression>>,
11091}
11092
11093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11095#[cfg_attr(feature = "bindings", derive(TS))]
11096pub struct FileFormatProperty {
11097 #[serde(default)]
11098 pub this: Option<Box<Expression>>,
11099 #[serde(default)]
11100 pub expressions: Vec<Expression>,
11101 #[serde(default)]
11102 pub hive_format: Option<Box<Expression>>,
11103}
11104
11105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11107#[cfg_attr(feature = "bindings", derive(TS))]
11108pub struct CredentialsProperty {
11109 #[serde(default)]
11110 pub expressions: Vec<Expression>,
11111}
11112
11113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11115#[cfg_attr(feature = "bindings", derive(TS))]
11116pub struct FreespaceProperty {
11117 pub this: Box<Expression>,
11118 #[serde(default)]
11119 pub percent: Option<Box<Expression>>,
11120}
11121
11122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11124#[cfg_attr(feature = "bindings", derive(TS))]
11125pub struct InheritsProperty {
11126 #[serde(default)]
11127 pub expressions: Vec<Expression>,
11128}
11129
11130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11132#[cfg_attr(feature = "bindings", derive(TS))]
11133pub struct InputModelProperty {
11134 pub this: Box<Expression>,
11135}
11136
11137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11139#[cfg_attr(feature = "bindings", derive(TS))]
11140pub struct OutputModelProperty {
11141 pub this: Box<Expression>,
11142}
11143
11144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11146#[cfg_attr(feature = "bindings", derive(TS))]
11147pub struct IsolatedLoadingProperty {
11148 #[serde(default)]
11149 pub no: Option<Box<Expression>>,
11150 #[serde(default)]
11151 pub concurrent: Option<Box<Expression>>,
11152 #[serde(default)]
11153 pub target: Option<Box<Expression>>,
11154}
11155
11156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11158#[cfg_attr(feature = "bindings", derive(TS))]
11159pub struct JournalProperty {
11160 #[serde(default)]
11161 pub no: Option<Box<Expression>>,
11162 #[serde(default)]
11163 pub dual: Option<Box<Expression>>,
11164 #[serde(default)]
11165 pub before: Option<Box<Expression>>,
11166 #[serde(default)]
11167 pub local: Option<Box<Expression>>,
11168 #[serde(default)]
11169 pub after: Option<Box<Expression>>,
11170}
11171
11172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11174#[cfg_attr(feature = "bindings", derive(TS))]
11175pub struct LanguageProperty {
11176 pub this: Box<Expression>,
11177}
11178
11179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11181#[cfg_attr(feature = "bindings", derive(TS))]
11182pub struct EnviromentProperty {
11183 #[serde(default)]
11184 pub expressions: Vec<Expression>,
11185}
11186
11187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11189#[cfg_attr(feature = "bindings", derive(TS))]
11190pub struct ClusteredByProperty {
11191 #[serde(default)]
11192 pub expressions: Vec<Expression>,
11193 #[serde(default)]
11194 pub sorted_by: Option<Box<Expression>>,
11195 #[serde(default)]
11196 pub buckets: Option<Box<Expression>>,
11197}
11198
11199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11201#[cfg_attr(feature = "bindings", derive(TS))]
11202pub struct DictProperty {
11203 pub this: Box<Expression>,
11204 pub kind: String,
11205 #[serde(default)]
11206 pub settings: Option<Box<Expression>>,
11207}
11208
11209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11211#[cfg_attr(feature = "bindings", derive(TS))]
11212pub struct DictRange {
11213 pub this: Box<Expression>,
11214 #[serde(default)]
11215 pub min: Option<Box<Expression>>,
11216 #[serde(default)]
11217 pub max: Option<Box<Expression>>,
11218}
11219
11220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11222#[cfg_attr(feature = "bindings", derive(TS))]
11223pub struct OnCluster {
11224 pub this: Box<Expression>,
11225}
11226
11227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11229#[cfg_attr(feature = "bindings", derive(TS))]
11230pub struct LikeProperty {
11231 pub this: Box<Expression>,
11232 #[serde(default)]
11233 pub expressions: Vec<Expression>,
11234}
11235
11236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11238#[cfg_attr(feature = "bindings", derive(TS))]
11239pub struct LocationProperty {
11240 pub this: Box<Expression>,
11241}
11242
11243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11245#[cfg_attr(feature = "bindings", derive(TS))]
11246pub struct LockProperty {
11247 pub this: Box<Expression>,
11248}
11249
11250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11252#[cfg_attr(feature = "bindings", derive(TS))]
11253pub struct LockingProperty {
11254 #[serde(default)]
11255 pub this: Option<Box<Expression>>,
11256 pub kind: String,
11257 #[serde(default)]
11258 pub for_or_in: Option<Box<Expression>>,
11259 #[serde(default)]
11260 pub lock_type: Option<Box<Expression>>,
11261 #[serde(default)]
11262 pub override_: Option<Box<Expression>>,
11263}
11264
11265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11267#[cfg_attr(feature = "bindings", derive(TS))]
11268pub struct LogProperty {
11269 #[serde(default)]
11270 pub no: Option<Box<Expression>>,
11271}
11272
11273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11275#[cfg_attr(feature = "bindings", derive(TS))]
11276pub struct MaterializedProperty {
11277 #[serde(default)]
11278 pub this: Option<Box<Expression>>,
11279}
11280
11281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11283#[cfg_attr(feature = "bindings", derive(TS))]
11284pub struct MergeBlockRatioProperty {
11285 #[serde(default)]
11286 pub this: Option<Box<Expression>>,
11287 #[serde(default)]
11288 pub no: Option<Box<Expression>>,
11289 #[serde(default)]
11290 pub default: Option<Box<Expression>>,
11291 #[serde(default)]
11292 pub percent: Option<Box<Expression>>,
11293}
11294
11295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11297#[cfg_attr(feature = "bindings", derive(TS))]
11298pub struct OnProperty {
11299 pub this: Box<Expression>,
11300}
11301
11302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11304#[cfg_attr(feature = "bindings", derive(TS))]
11305pub struct OnCommitProperty {
11306 #[serde(default)]
11307 pub delete: Option<Box<Expression>>,
11308}
11309
11310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11312#[cfg_attr(feature = "bindings", derive(TS))]
11313pub struct PartitionedByProperty {
11314 pub this: Box<Expression>,
11315}
11316
11317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11319#[cfg_attr(feature = "bindings", derive(TS))]
11320pub struct PartitionByProperty {
11321 #[serde(default)]
11322 pub expressions: Vec<Expression>,
11323}
11324
11325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11327#[cfg_attr(feature = "bindings", derive(TS))]
11328pub struct PartitionedByBucket {
11329 pub this: Box<Expression>,
11330 pub expression: Box<Expression>,
11331}
11332
11333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11335#[cfg_attr(feature = "bindings", derive(TS))]
11336pub struct ClusterByColumnsProperty {
11337 #[serde(default)]
11338 pub columns: Vec<Identifier>,
11339}
11340
11341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11343#[cfg_attr(feature = "bindings", derive(TS))]
11344pub struct PartitionByTruncate {
11345 pub this: Box<Expression>,
11346 pub expression: Box<Expression>,
11347}
11348
11349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11351#[cfg_attr(feature = "bindings", derive(TS))]
11352pub struct PartitionByRangeProperty {
11353 #[serde(default)]
11354 pub partition_expressions: Option<Box<Expression>>,
11355 #[serde(default)]
11356 pub create_expressions: Option<Box<Expression>>,
11357}
11358
11359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11361#[cfg_attr(feature = "bindings", derive(TS))]
11362pub struct PartitionByRangePropertyDynamic {
11363 #[serde(default)]
11364 pub this: Option<Box<Expression>>,
11365 #[serde(default)]
11366 pub start: Option<Box<Expression>>,
11367 #[serde(default)]
11369 pub use_start_end: bool,
11370 #[serde(default)]
11371 pub end: Option<Box<Expression>>,
11372 #[serde(default)]
11373 pub every: Option<Box<Expression>>,
11374}
11375
11376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11378#[cfg_attr(feature = "bindings", derive(TS))]
11379pub struct PartitionByListProperty {
11380 #[serde(default)]
11381 pub partition_expressions: Option<Box<Expression>>,
11382 #[serde(default)]
11383 pub create_expressions: Option<Box<Expression>>,
11384}
11385
11386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11388#[cfg_attr(feature = "bindings", derive(TS))]
11389pub struct PartitionList {
11390 pub this: Box<Expression>,
11391 #[serde(default)]
11392 pub expressions: Vec<Expression>,
11393}
11394
11395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11397#[cfg_attr(feature = "bindings", derive(TS))]
11398pub struct Partition {
11399 pub expressions: Vec<Expression>,
11400 #[serde(default)]
11401 pub subpartition: bool,
11402}
11403
11404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11407#[cfg_attr(feature = "bindings", derive(TS))]
11408pub struct RefreshTriggerProperty {
11409 pub method: String,
11411 #[serde(default)]
11413 pub kind: Option<String>,
11414 #[serde(default)]
11416 pub every: Option<Box<Expression>>,
11417 #[serde(default)]
11419 pub unit: Option<String>,
11420 #[serde(default)]
11422 pub starts: Option<Box<Expression>>,
11423}
11424
11425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11427#[cfg_attr(feature = "bindings", derive(TS))]
11428pub struct UniqueKeyProperty {
11429 #[serde(default)]
11430 pub expressions: Vec<Expression>,
11431}
11432
11433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11435#[cfg_attr(feature = "bindings", derive(TS))]
11436pub struct RollupProperty {
11437 pub expressions: Vec<RollupIndex>,
11438}
11439
11440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11442#[cfg_attr(feature = "bindings", derive(TS))]
11443pub struct RollupIndex {
11444 pub name: Identifier,
11445 pub expressions: Vec<Identifier>,
11446}
11447
11448#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11450#[cfg_attr(feature = "bindings", derive(TS))]
11451pub struct PartitionBoundSpec {
11452 #[serde(default)]
11453 pub this: Option<Box<Expression>>,
11454 #[serde(default)]
11455 pub expression: Option<Box<Expression>>,
11456 #[serde(default)]
11457 pub from_expressions: Option<Box<Expression>>,
11458 #[serde(default)]
11459 pub to_expressions: Option<Box<Expression>>,
11460}
11461
11462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11464#[cfg_attr(feature = "bindings", derive(TS))]
11465pub struct PartitionedOfProperty {
11466 pub this: Box<Expression>,
11467 pub expression: Box<Expression>,
11468}
11469
11470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11472#[cfg_attr(feature = "bindings", derive(TS))]
11473pub struct RemoteWithConnectionModelProperty {
11474 pub this: Box<Expression>,
11475}
11476
11477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11479#[cfg_attr(feature = "bindings", derive(TS))]
11480pub struct ReturnsProperty {
11481 #[serde(default)]
11482 pub this: Option<Box<Expression>>,
11483 #[serde(default)]
11484 pub is_table: Option<Box<Expression>>,
11485 #[serde(default)]
11486 pub table: Option<Box<Expression>>,
11487 #[serde(default)]
11488 pub null: Option<Box<Expression>>,
11489}
11490
11491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11493#[cfg_attr(feature = "bindings", derive(TS))]
11494pub struct RowFormatProperty {
11495 pub this: Box<Expression>,
11496}
11497
11498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11500#[cfg_attr(feature = "bindings", derive(TS))]
11501pub struct RowFormatDelimitedProperty {
11502 #[serde(default)]
11503 pub fields: Option<Box<Expression>>,
11504 #[serde(default)]
11505 pub escaped: Option<Box<Expression>>,
11506 #[serde(default)]
11507 pub collection_items: Option<Box<Expression>>,
11508 #[serde(default)]
11509 pub map_keys: Option<Box<Expression>>,
11510 #[serde(default)]
11511 pub lines: Option<Box<Expression>>,
11512 #[serde(default)]
11513 pub null: Option<Box<Expression>>,
11514 #[serde(default)]
11515 pub serde: Option<Box<Expression>>,
11516}
11517
11518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11520#[cfg_attr(feature = "bindings", derive(TS))]
11521pub struct RowFormatSerdeProperty {
11522 pub this: Box<Expression>,
11523 #[serde(default)]
11524 pub serde_properties: Option<Box<Expression>>,
11525}
11526
11527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11529#[cfg_attr(feature = "bindings", derive(TS))]
11530pub struct QueryTransform {
11531 #[serde(default)]
11532 pub expressions: Vec<Expression>,
11533 #[serde(default)]
11534 pub command_script: Option<Box<Expression>>,
11535 #[serde(default)]
11536 pub schema: Option<Box<Expression>>,
11537 #[serde(default)]
11538 pub row_format_before: Option<Box<Expression>>,
11539 #[serde(default)]
11540 pub record_writer: Option<Box<Expression>>,
11541 #[serde(default)]
11542 pub row_format_after: Option<Box<Expression>>,
11543 #[serde(default)]
11544 pub record_reader: Option<Box<Expression>>,
11545}
11546
11547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11549#[cfg_attr(feature = "bindings", derive(TS))]
11550pub struct SampleProperty {
11551 pub this: Box<Expression>,
11552}
11553
11554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11556#[cfg_attr(feature = "bindings", derive(TS))]
11557pub struct SecurityProperty {
11558 pub this: Box<Expression>,
11559}
11560
11561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11563#[cfg_attr(feature = "bindings", derive(TS))]
11564pub struct SchemaCommentProperty {
11565 pub this: Box<Expression>,
11566}
11567
11568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11570#[cfg_attr(feature = "bindings", derive(TS))]
11571pub struct SemanticView {
11572 pub this: Box<Expression>,
11573 #[serde(default)]
11574 pub metrics: Option<Box<Expression>>,
11575 #[serde(default)]
11576 pub dimensions: Option<Box<Expression>>,
11577 #[serde(default)]
11578 pub facts: Option<Box<Expression>>,
11579 #[serde(default)]
11580 pub where_: Option<Box<Expression>>,
11581}
11582
11583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11585#[cfg_attr(feature = "bindings", derive(TS))]
11586pub struct SerdeProperties {
11587 #[serde(default)]
11588 pub expressions: Vec<Expression>,
11589 #[serde(default)]
11590 pub with_: Option<Box<Expression>>,
11591}
11592
11593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11595#[cfg_attr(feature = "bindings", derive(TS))]
11596pub struct SetProperty {
11597 #[serde(default)]
11598 pub multi: Option<Box<Expression>>,
11599}
11600
11601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11603#[cfg_attr(feature = "bindings", derive(TS))]
11604pub struct SharingProperty {
11605 #[serde(default)]
11606 pub this: Option<Box<Expression>>,
11607}
11608
11609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11611#[cfg_attr(feature = "bindings", derive(TS))]
11612pub struct SetConfigProperty {
11613 pub this: Box<Expression>,
11614}
11615
11616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11618#[cfg_attr(feature = "bindings", derive(TS))]
11619pub struct SettingsProperty {
11620 #[serde(default)]
11621 pub expressions: Vec<Expression>,
11622}
11623
11624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11626#[cfg_attr(feature = "bindings", derive(TS))]
11627pub struct SortKeyProperty {
11628 pub this: Box<Expression>,
11629 #[serde(default)]
11630 pub compound: Option<Box<Expression>>,
11631}
11632
11633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11635#[cfg_attr(feature = "bindings", derive(TS))]
11636pub struct SqlReadWriteProperty {
11637 pub this: Box<Expression>,
11638}
11639
11640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11642#[cfg_attr(feature = "bindings", derive(TS))]
11643pub struct SqlSecurityProperty {
11644 pub this: Box<Expression>,
11645}
11646
11647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11649#[cfg_attr(feature = "bindings", derive(TS))]
11650pub struct StabilityProperty {
11651 pub this: Box<Expression>,
11652}
11653
11654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11656#[cfg_attr(feature = "bindings", derive(TS))]
11657pub struct StorageHandlerProperty {
11658 pub this: Box<Expression>,
11659}
11660
11661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11663#[cfg_attr(feature = "bindings", derive(TS))]
11664pub struct TemporaryProperty {
11665 #[serde(default)]
11666 pub this: Option<Box<Expression>>,
11667}
11668
11669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11671#[cfg_attr(feature = "bindings", derive(TS))]
11672pub struct Tags {
11673 #[serde(default)]
11674 pub expressions: Vec<Expression>,
11675}
11676
11677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11679#[cfg_attr(feature = "bindings", derive(TS))]
11680pub struct TransformModelProperty {
11681 #[serde(default)]
11682 pub expressions: Vec<Expression>,
11683}
11684
11685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11687#[cfg_attr(feature = "bindings", derive(TS))]
11688pub struct TransientProperty {
11689 #[serde(default)]
11690 pub this: Option<Box<Expression>>,
11691}
11692
11693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11695#[cfg_attr(feature = "bindings", derive(TS))]
11696pub struct UsingTemplateProperty {
11697 pub this: Box<Expression>,
11698}
11699
11700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11702#[cfg_attr(feature = "bindings", derive(TS))]
11703pub struct ViewAttributeProperty {
11704 pub this: Box<Expression>,
11705}
11706
11707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11709#[cfg_attr(feature = "bindings", derive(TS))]
11710pub struct VolatileProperty {
11711 #[serde(default)]
11712 pub this: Option<Box<Expression>>,
11713}
11714
11715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11717#[cfg_attr(feature = "bindings", derive(TS))]
11718pub struct WithDataProperty {
11719 #[serde(default)]
11720 pub no: Option<Box<Expression>>,
11721 #[serde(default)]
11722 pub statistics: Option<Box<Expression>>,
11723}
11724
11725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11727#[cfg_attr(feature = "bindings", derive(TS))]
11728pub struct WithJournalTableProperty {
11729 pub this: Box<Expression>,
11730}
11731
11732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11734#[cfg_attr(feature = "bindings", derive(TS))]
11735pub struct WithSchemaBindingProperty {
11736 pub this: Box<Expression>,
11737}
11738
11739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11741#[cfg_attr(feature = "bindings", derive(TS))]
11742pub struct WithSystemVersioningProperty {
11743 #[serde(default)]
11744 pub on: Option<Box<Expression>>,
11745 #[serde(default)]
11746 pub this: Option<Box<Expression>>,
11747 #[serde(default)]
11748 pub data_consistency: Option<Box<Expression>>,
11749 #[serde(default)]
11750 pub retention_period: Option<Box<Expression>>,
11751 #[serde(default)]
11752 pub with_: Option<Box<Expression>>,
11753}
11754
11755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11757#[cfg_attr(feature = "bindings", derive(TS))]
11758pub struct WithProcedureOptions {
11759 #[serde(default)]
11760 pub expressions: Vec<Expression>,
11761}
11762
11763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11765#[cfg_attr(feature = "bindings", derive(TS))]
11766pub struct EncodeProperty {
11767 pub this: Box<Expression>,
11768 #[serde(default)]
11769 pub properties: Vec<Expression>,
11770 #[serde(default)]
11771 pub key: Option<Box<Expression>>,
11772}
11773
11774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11776#[cfg_attr(feature = "bindings", derive(TS))]
11777pub struct IncludeProperty {
11778 pub this: Box<Expression>,
11779 #[serde(default)]
11780 pub alias: Option<String>,
11781 #[serde(default)]
11782 pub column_def: Option<Box<Expression>>,
11783}
11784
11785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11787#[cfg_attr(feature = "bindings", derive(TS))]
11788pub struct Properties {
11789 #[serde(default)]
11790 pub expressions: Vec<Expression>,
11791}
11792
11793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11795#[cfg_attr(feature = "bindings", derive(TS))]
11796pub struct OptionEntry {
11797 pub key: Identifier,
11798 pub value: Expression,
11799}
11800
11801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11803#[cfg_attr(feature = "bindings", derive(TS))]
11804pub struct OptionsProperty {
11805 #[serde(default)]
11806 pub entries: Vec<OptionEntry>,
11807}
11808
11809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11811#[cfg_attr(feature = "bindings", derive(TS))]
11812pub struct InputOutputFormat {
11813 #[serde(default)]
11814 pub input_format: Option<Box<Expression>>,
11815 #[serde(default)]
11816 pub output_format: Option<Box<Expression>>,
11817}
11818
11819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11821#[cfg_attr(feature = "bindings", derive(TS))]
11822pub struct Reference {
11823 pub this: Box<Expression>,
11824 #[serde(default)]
11825 pub expressions: Vec<Expression>,
11826 #[serde(default)]
11827 pub options: Vec<Expression>,
11828}
11829
11830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11832#[cfg_attr(feature = "bindings", derive(TS))]
11833pub struct QueryOption {
11834 pub this: Box<Expression>,
11835 #[serde(default)]
11836 pub expression: Option<Box<Expression>>,
11837}
11838
11839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11841#[cfg_attr(feature = "bindings", derive(TS))]
11842pub struct WithTableHint {
11843 #[serde(default)]
11844 pub expressions: Vec<Expression>,
11845}
11846
11847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11849#[cfg_attr(feature = "bindings", derive(TS))]
11850pub struct IndexTableHint {
11851 pub this: Box<Expression>,
11852 #[serde(default)]
11853 pub expressions: Vec<Expression>,
11854 #[serde(default)]
11855 pub target: Option<Box<Expression>>,
11856}
11857
11858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11860#[cfg_attr(feature = "bindings", derive(TS))]
11861pub struct Get {
11862 pub this: Box<Expression>,
11863 #[serde(default)]
11864 pub target: Option<Box<Expression>>,
11865 #[serde(default)]
11866 pub properties: Vec<Expression>,
11867}
11868
11869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11871#[cfg_attr(feature = "bindings", derive(TS))]
11872pub struct SetOperation {
11873 #[serde(default)]
11874 pub with_: Option<Box<Expression>>,
11875 pub this: Box<Expression>,
11876 pub expression: Box<Expression>,
11877 #[serde(default)]
11878 pub distinct: bool,
11879 #[serde(default)]
11880 pub by_name: Option<Box<Expression>>,
11881 #[serde(default)]
11882 pub side: Option<Box<Expression>>,
11883 #[serde(default)]
11884 pub kind: Option<String>,
11885 #[serde(default)]
11886 pub on: Option<Box<Expression>>,
11887}
11888
11889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11891#[cfg_attr(feature = "bindings", derive(TS))]
11892pub struct Var {
11893 pub this: String,
11894}
11895
11896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11898#[cfg_attr(feature = "bindings", derive(TS))]
11899pub struct Variadic {
11900 pub this: Box<Expression>,
11901}
11902
11903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11905#[cfg_attr(feature = "bindings", derive(TS))]
11906pub struct Version {
11907 pub this: Box<Expression>,
11908 pub kind: String,
11909 #[serde(default)]
11910 pub expression: Option<Box<Expression>>,
11911}
11912
11913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11915#[cfg_attr(feature = "bindings", derive(TS))]
11916pub struct Schema {
11917 #[serde(default)]
11918 pub this: Option<Box<Expression>>,
11919 #[serde(default)]
11920 pub expressions: Vec<Expression>,
11921}
11922
11923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11925#[cfg_attr(feature = "bindings", derive(TS))]
11926pub struct Lock {
11927 #[serde(default)]
11928 pub update: Option<Box<Expression>>,
11929 #[serde(default)]
11930 pub expressions: Vec<Expression>,
11931 #[serde(default)]
11932 pub wait: Option<Box<Expression>>,
11933 #[serde(default)]
11934 pub key: Option<Box<Expression>>,
11935}
11936
11937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11940#[cfg_attr(feature = "bindings", derive(TS))]
11941pub struct TableSample {
11942 #[serde(default, skip_serializing_if = "Option::is_none")]
11944 pub this: Option<Box<Expression>>,
11945 #[serde(default, skip_serializing_if = "Option::is_none")]
11947 pub sample: Option<Box<Sample>>,
11948 #[serde(default)]
11949 pub expressions: Vec<Expression>,
11950 #[serde(default)]
11951 pub method: Option<String>,
11952 #[serde(default)]
11953 pub bucket_numerator: Option<Box<Expression>>,
11954 #[serde(default)]
11955 pub bucket_denominator: Option<Box<Expression>>,
11956 #[serde(default)]
11957 pub bucket_field: Option<Box<Expression>>,
11958 #[serde(default)]
11959 pub percent: Option<Box<Expression>>,
11960 #[serde(default)]
11961 pub rows: Option<Box<Expression>>,
11962 #[serde(default)]
11963 pub size: Option<i64>,
11964 #[serde(default)]
11965 pub seed: Option<Box<Expression>>,
11966}
11967
11968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11970#[cfg_attr(feature = "bindings", derive(TS))]
11971pub struct Tag {
11972 #[serde(default)]
11973 pub this: Option<Box<Expression>>,
11974 #[serde(default)]
11975 pub prefix: Option<Box<Expression>>,
11976 #[serde(default)]
11977 pub postfix: Option<Box<Expression>>,
11978}
11979
11980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11982#[cfg_attr(feature = "bindings", derive(TS))]
11983pub struct UnpivotColumns {
11984 pub this: Box<Expression>,
11985 #[serde(default)]
11986 pub expressions: Vec<Expression>,
11987}
11988
11989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11991#[cfg_attr(feature = "bindings", derive(TS))]
11992pub struct SessionParameter {
11993 pub this: Box<Expression>,
11994 #[serde(default)]
11995 pub kind: Option<String>,
11996}
11997
11998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12000#[cfg_attr(feature = "bindings", derive(TS))]
12001pub struct PseudoType {
12002 pub this: Box<Expression>,
12003}
12004
12005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12007#[cfg_attr(feature = "bindings", derive(TS))]
12008pub struct ObjectIdentifier {
12009 pub this: Box<Expression>,
12010}
12011
12012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12014#[cfg_attr(feature = "bindings", derive(TS))]
12015pub struct Transaction {
12016 #[serde(default)]
12017 pub this: Option<Box<Expression>>,
12018 #[serde(default)]
12019 pub modes: Option<Box<Expression>>,
12020 #[serde(default)]
12021 pub mark: Option<Box<Expression>>,
12022}
12023
12024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12026#[cfg_attr(feature = "bindings", derive(TS))]
12027pub struct Commit {
12028 #[serde(default)]
12029 pub chain: Option<Box<Expression>>,
12030 #[serde(default)]
12031 pub this: Option<Box<Expression>>,
12032 #[serde(default)]
12033 pub durability: Option<Box<Expression>>,
12034}
12035
12036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12038#[cfg_attr(feature = "bindings", derive(TS))]
12039pub struct Rollback {
12040 #[serde(default)]
12041 pub savepoint: Option<Box<Expression>>,
12042 #[serde(default)]
12043 pub this: Option<Box<Expression>>,
12044}
12045
12046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12048#[cfg_attr(feature = "bindings", derive(TS))]
12049pub struct AlterSession {
12050 #[serde(default)]
12051 pub expressions: Vec<Expression>,
12052 #[serde(default)]
12053 pub unset: Option<Box<Expression>>,
12054}
12055
12056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12058#[cfg_attr(feature = "bindings", derive(TS))]
12059pub struct Analyze {
12060 #[serde(default)]
12061 pub kind: Option<String>,
12062 #[serde(default)]
12063 pub this: Option<Box<Expression>>,
12064 #[serde(default)]
12065 pub options: Vec<Expression>,
12066 #[serde(default)]
12067 pub mode: Option<Box<Expression>>,
12068 #[serde(default)]
12069 pub partition: Option<Box<Expression>>,
12070 #[serde(default)]
12071 pub expression: Option<Box<Expression>>,
12072 #[serde(default)]
12073 pub properties: Vec<Expression>,
12074 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12076 pub columns: Vec<String>,
12077}
12078
12079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12081#[cfg_attr(feature = "bindings", derive(TS))]
12082pub struct AnalyzeStatistics {
12083 pub kind: String,
12084 #[serde(default)]
12085 pub option: Option<Box<Expression>>,
12086 #[serde(default)]
12087 pub this: Option<Box<Expression>>,
12088 #[serde(default)]
12089 pub expressions: Vec<Expression>,
12090}
12091
12092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12094#[cfg_attr(feature = "bindings", derive(TS))]
12095pub struct AnalyzeHistogram {
12096 pub this: Box<Expression>,
12097 #[serde(default)]
12098 pub expressions: Vec<Expression>,
12099 #[serde(default)]
12100 pub expression: Option<Box<Expression>>,
12101 #[serde(default)]
12102 pub update_options: Option<Box<Expression>>,
12103}
12104
12105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12107#[cfg_attr(feature = "bindings", derive(TS))]
12108pub struct AnalyzeSample {
12109 pub kind: String,
12110 #[serde(default)]
12111 pub sample: Option<Box<Expression>>,
12112}
12113
12114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12116#[cfg_attr(feature = "bindings", derive(TS))]
12117pub struct AnalyzeListChainedRows {
12118 #[serde(default)]
12119 pub expression: Option<Box<Expression>>,
12120}
12121
12122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12124#[cfg_attr(feature = "bindings", derive(TS))]
12125pub struct AnalyzeDelete {
12126 #[serde(default)]
12127 pub kind: Option<String>,
12128}
12129
12130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12132#[cfg_attr(feature = "bindings", derive(TS))]
12133pub struct AnalyzeWith {
12134 #[serde(default)]
12135 pub expressions: Vec<Expression>,
12136}
12137
12138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12140#[cfg_attr(feature = "bindings", derive(TS))]
12141pub struct AnalyzeValidate {
12142 pub kind: String,
12143 #[serde(default)]
12144 pub this: Option<Box<Expression>>,
12145 #[serde(default)]
12146 pub expression: Option<Box<Expression>>,
12147}
12148
12149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12151#[cfg_attr(feature = "bindings", derive(TS))]
12152pub struct AddPartition {
12153 pub this: Box<Expression>,
12154 #[serde(default)]
12155 pub exists: bool,
12156 #[serde(default)]
12157 pub location: Option<Box<Expression>>,
12158}
12159
12160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12162#[cfg_attr(feature = "bindings", derive(TS))]
12163pub struct AttachOption {
12164 pub this: Box<Expression>,
12165 #[serde(default)]
12166 pub expression: Option<Box<Expression>>,
12167}
12168
12169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12171#[cfg_attr(feature = "bindings", derive(TS))]
12172pub struct DropPartition {
12173 #[serde(default)]
12174 pub expressions: Vec<Expression>,
12175 #[serde(default)]
12176 pub exists: bool,
12177}
12178
12179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12181#[cfg_attr(feature = "bindings", derive(TS))]
12182pub struct ReplacePartition {
12183 pub expression: Box<Expression>,
12184 #[serde(default)]
12185 pub source: Option<Box<Expression>>,
12186}
12187
12188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12190#[cfg_attr(feature = "bindings", derive(TS))]
12191pub struct DPipe {
12192 pub this: Box<Expression>,
12193 pub expression: Box<Expression>,
12194 #[serde(default)]
12195 pub safe: Option<Box<Expression>>,
12196}
12197
12198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12200#[cfg_attr(feature = "bindings", derive(TS))]
12201pub struct Operator {
12202 pub this: Box<Expression>,
12203 #[serde(default)]
12204 pub operator: Option<Box<Expression>>,
12205 pub expression: Box<Expression>,
12206 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12208 pub comments: Vec<String>,
12209}
12210
12211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12213#[cfg_attr(feature = "bindings", derive(TS))]
12214pub struct PivotAny {
12215 #[serde(default)]
12216 pub this: Option<Box<Expression>>,
12217}
12218
12219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12221#[cfg_attr(feature = "bindings", derive(TS))]
12222pub struct Aliases {
12223 pub this: Box<Expression>,
12224 #[serde(default)]
12225 pub expressions: Vec<Expression>,
12226}
12227
12228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12230#[cfg_attr(feature = "bindings", derive(TS))]
12231pub struct AtIndex {
12232 pub this: Box<Expression>,
12233 pub expression: Box<Expression>,
12234}
12235
12236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12238#[cfg_attr(feature = "bindings", derive(TS))]
12239pub struct FromTimeZone {
12240 pub this: Box<Expression>,
12241 #[serde(default)]
12242 pub zone: Option<Box<Expression>>,
12243}
12244
12245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12247#[cfg_attr(feature = "bindings", derive(TS))]
12248pub struct FormatPhrase {
12249 pub this: Box<Expression>,
12250 pub format: String,
12251}
12252
12253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12255#[cfg_attr(feature = "bindings", derive(TS))]
12256pub struct ForIn {
12257 pub this: Box<Expression>,
12258 pub expression: Box<Expression>,
12259}
12260
12261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12263#[cfg_attr(feature = "bindings", derive(TS))]
12264pub struct TimeUnit {
12265 #[serde(default)]
12266 pub unit: Option<String>,
12267}
12268
12269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12271#[cfg_attr(feature = "bindings", derive(TS))]
12272pub struct IntervalOp {
12273 #[serde(default)]
12274 pub unit: Option<String>,
12275 pub expression: Box<Expression>,
12276}
12277
12278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12280#[cfg_attr(feature = "bindings", derive(TS))]
12281pub struct HavingMax {
12282 pub this: Box<Expression>,
12283 pub expression: Box<Expression>,
12284 #[serde(default)]
12285 pub max: Option<Box<Expression>>,
12286}
12287
12288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12290#[cfg_attr(feature = "bindings", derive(TS))]
12291pub struct CosineDistance {
12292 pub this: Box<Expression>,
12293 pub expression: Box<Expression>,
12294}
12295
12296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12298#[cfg_attr(feature = "bindings", derive(TS))]
12299pub struct DotProduct {
12300 pub this: Box<Expression>,
12301 pub expression: Box<Expression>,
12302}
12303
12304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12306#[cfg_attr(feature = "bindings", derive(TS))]
12307pub struct EuclideanDistance {
12308 pub this: Box<Expression>,
12309 pub expression: Box<Expression>,
12310}
12311
12312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12314#[cfg_attr(feature = "bindings", derive(TS))]
12315pub struct ManhattanDistance {
12316 pub this: Box<Expression>,
12317 pub expression: Box<Expression>,
12318}
12319
12320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12322#[cfg_attr(feature = "bindings", derive(TS))]
12323pub struct JarowinklerSimilarity {
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 Booland {
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 Boolor {
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 ParameterizedAgg {
12348 pub this: Box<Expression>,
12349 #[serde(default)]
12350 pub expressions: Vec<Expression>,
12351 #[serde(default)]
12352 pub params: Vec<Expression>,
12353}
12354
12355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12357#[cfg_attr(feature = "bindings", derive(TS))]
12358pub struct ArgMax {
12359 pub this: Box<Expression>,
12360 pub expression: Box<Expression>,
12361 #[serde(default)]
12362 pub count: Option<Box<Expression>>,
12363}
12364
12365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12367#[cfg_attr(feature = "bindings", derive(TS))]
12368pub struct ArgMin {
12369 pub this: Box<Expression>,
12370 pub expression: Box<Expression>,
12371 #[serde(default)]
12372 pub count: Option<Box<Expression>>,
12373}
12374
12375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12377#[cfg_attr(feature = "bindings", derive(TS))]
12378pub struct ApproxTopK {
12379 pub this: Box<Expression>,
12380 #[serde(default)]
12381 pub expression: Option<Box<Expression>>,
12382 #[serde(default)]
12383 pub counters: Option<Box<Expression>>,
12384}
12385
12386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12388#[cfg_attr(feature = "bindings", derive(TS))]
12389pub struct ApproxTopKAccumulate {
12390 pub this: Box<Expression>,
12391 #[serde(default)]
12392 pub expression: Option<Box<Expression>>,
12393}
12394
12395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12397#[cfg_attr(feature = "bindings", derive(TS))]
12398pub struct ApproxTopKCombine {
12399 pub this: Box<Expression>,
12400 #[serde(default)]
12401 pub expression: Option<Box<Expression>>,
12402}
12403
12404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12406#[cfg_attr(feature = "bindings", derive(TS))]
12407pub struct ApproxTopKEstimate {
12408 pub this: Box<Expression>,
12409 #[serde(default)]
12410 pub expression: Option<Box<Expression>>,
12411}
12412
12413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12415#[cfg_attr(feature = "bindings", derive(TS))]
12416pub struct ApproxTopSum {
12417 pub this: Box<Expression>,
12418 pub expression: Box<Expression>,
12419 #[serde(default)]
12420 pub count: Option<Box<Expression>>,
12421}
12422
12423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12425#[cfg_attr(feature = "bindings", derive(TS))]
12426pub struct ApproxQuantiles {
12427 pub this: Box<Expression>,
12428 #[serde(default)]
12429 pub expression: Option<Box<Expression>>,
12430}
12431
12432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12434#[cfg_attr(feature = "bindings", derive(TS))]
12435pub struct Minhash {
12436 pub this: Box<Expression>,
12437 #[serde(default)]
12438 pub expressions: Vec<Expression>,
12439}
12440
12441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12443#[cfg_attr(feature = "bindings", derive(TS))]
12444pub struct FarmFingerprint {
12445 #[serde(default)]
12446 pub expressions: Vec<Expression>,
12447}
12448
12449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12451#[cfg_attr(feature = "bindings", derive(TS))]
12452pub struct Float64 {
12453 pub this: Box<Expression>,
12454 #[serde(default)]
12455 pub expression: Option<Box<Expression>>,
12456}
12457
12458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12460#[cfg_attr(feature = "bindings", derive(TS))]
12461pub struct Transform {
12462 pub this: Box<Expression>,
12463 pub expression: Box<Expression>,
12464}
12465
12466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12468#[cfg_attr(feature = "bindings", derive(TS))]
12469pub struct Translate {
12470 pub this: Box<Expression>,
12471 #[serde(default)]
12472 pub from_: Option<Box<Expression>>,
12473 #[serde(default)]
12474 pub to: Option<Box<Expression>>,
12475}
12476
12477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12479#[cfg_attr(feature = "bindings", derive(TS))]
12480pub struct Grouping {
12481 #[serde(default)]
12482 pub expressions: Vec<Expression>,
12483}
12484
12485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12487#[cfg_attr(feature = "bindings", derive(TS))]
12488pub struct GroupingId {
12489 #[serde(default)]
12490 pub expressions: Vec<Expression>,
12491}
12492
12493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12495#[cfg_attr(feature = "bindings", derive(TS))]
12496pub struct Anonymous {
12497 pub this: Box<Expression>,
12498 #[serde(default)]
12499 pub expressions: Vec<Expression>,
12500}
12501
12502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12504#[cfg_attr(feature = "bindings", derive(TS))]
12505pub struct AnonymousAggFunc {
12506 pub this: Box<Expression>,
12507 #[serde(default)]
12508 pub expressions: Vec<Expression>,
12509}
12510
12511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12513#[cfg_attr(feature = "bindings", derive(TS))]
12514pub struct CombinedAggFunc {
12515 pub this: Box<Expression>,
12516 #[serde(default)]
12517 pub expressions: Vec<Expression>,
12518}
12519
12520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12522#[cfg_attr(feature = "bindings", derive(TS))]
12523pub struct CombinedParameterizedAgg {
12524 pub this: Box<Expression>,
12525 #[serde(default)]
12526 pub expressions: Vec<Expression>,
12527 #[serde(default)]
12528 pub params: Vec<Expression>,
12529}
12530
12531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12533#[cfg_attr(feature = "bindings", derive(TS))]
12534pub struct HashAgg {
12535 pub this: Box<Expression>,
12536 #[serde(default)]
12537 pub expressions: Vec<Expression>,
12538}
12539
12540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12542#[cfg_attr(feature = "bindings", derive(TS))]
12543pub struct Hll {
12544 pub this: Box<Expression>,
12545 #[serde(default)]
12546 pub expressions: Vec<Expression>,
12547}
12548
12549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12551#[cfg_attr(feature = "bindings", derive(TS))]
12552pub struct Apply {
12553 pub this: Box<Expression>,
12554 pub expression: Box<Expression>,
12555}
12556
12557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12559#[cfg_attr(feature = "bindings", derive(TS))]
12560pub struct ToBoolean {
12561 pub this: Box<Expression>,
12562 #[serde(default)]
12563 pub safe: Option<Box<Expression>>,
12564}
12565
12566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12568#[cfg_attr(feature = "bindings", derive(TS))]
12569pub struct List {
12570 #[serde(default)]
12571 pub expressions: Vec<Expression>,
12572}
12573
12574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12579#[cfg_attr(feature = "bindings", derive(TS))]
12580pub struct ToMap {
12581 pub this: Box<Expression>,
12583}
12584
12585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12587#[cfg_attr(feature = "bindings", derive(TS))]
12588pub struct Pad {
12589 pub this: Box<Expression>,
12590 pub expression: Box<Expression>,
12591 #[serde(default)]
12592 pub fill_pattern: Option<Box<Expression>>,
12593 #[serde(default)]
12594 pub is_left: Option<Box<Expression>>,
12595}
12596
12597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12599#[cfg_attr(feature = "bindings", derive(TS))]
12600pub struct ToChar {
12601 pub this: Box<Expression>,
12602 #[serde(default)]
12603 pub format: Option<String>,
12604 #[serde(default)]
12605 pub nlsparam: Option<Box<Expression>>,
12606 #[serde(default)]
12607 pub is_numeric: Option<Box<Expression>>,
12608}
12609
12610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12612#[cfg_attr(feature = "bindings", derive(TS))]
12613pub struct StringFunc {
12614 pub this: Box<Expression>,
12615 #[serde(default)]
12616 pub zone: Option<Box<Expression>>,
12617}
12618
12619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12621#[cfg_attr(feature = "bindings", derive(TS))]
12622pub struct ToNumber {
12623 pub this: Box<Expression>,
12624 #[serde(default)]
12625 pub format: Option<Box<Expression>>,
12626 #[serde(default)]
12627 pub nlsparam: Option<Box<Expression>>,
12628 #[serde(default)]
12629 pub precision: Option<Box<Expression>>,
12630 #[serde(default)]
12631 pub scale: Option<Box<Expression>>,
12632 #[serde(default)]
12633 pub safe: Option<Box<Expression>>,
12634 #[serde(default)]
12635 pub safe_name: Option<Box<Expression>>,
12636}
12637
12638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12640#[cfg_attr(feature = "bindings", derive(TS))]
12641pub struct ToDouble {
12642 pub this: Box<Expression>,
12643 #[serde(default)]
12644 pub format: Option<String>,
12645 #[serde(default)]
12646 pub safe: Option<Box<Expression>>,
12647}
12648
12649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12651#[cfg_attr(feature = "bindings", derive(TS))]
12652pub struct ToDecfloat {
12653 pub this: Box<Expression>,
12654 #[serde(default)]
12655 pub format: Option<String>,
12656}
12657
12658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12660#[cfg_attr(feature = "bindings", derive(TS))]
12661pub struct TryToDecfloat {
12662 pub this: Box<Expression>,
12663 #[serde(default)]
12664 pub format: Option<String>,
12665}
12666
12667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12669#[cfg_attr(feature = "bindings", derive(TS))]
12670pub struct ToFile {
12671 pub this: Box<Expression>,
12672 #[serde(default)]
12673 pub path: Option<Box<Expression>>,
12674 #[serde(default)]
12675 pub safe: Option<Box<Expression>>,
12676}
12677
12678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12680#[cfg_attr(feature = "bindings", derive(TS))]
12681pub struct Columns {
12682 pub this: Box<Expression>,
12683 #[serde(default)]
12684 pub unpack: Option<Box<Expression>>,
12685}
12686
12687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12689#[cfg_attr(feature = "bindings", derive(TS))]
12690pub struct ConvertToCharset {
12691 pub this: Box<Expression>,
12692 #[serde(default)]
12693 pub dest: Option<Box<Expression>>,
12694 #[serde(default)]
12695 pub source: Option<Box<Expression>>,
12696}
12697
12698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12700#[cfg_attr(feature = "bindings", derive(TS))]
12701pub struct ConvertTimezone {
12702 #[serde(default)]
12703 pub source_tz: Option<Box<Expression>>,
12704 #[serde(default)]
12705 pub target_tz: Option<Box<Expression>>,
12706 #[serde(default)]
12707 pub timestamp: Option<Box<Expression>>,
12708 #[serde(default)]
12709 pub options: Vec<Expression>,
12710}
12711
12712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12714#[cfg_attr(feature = "bindings", derive(TS))]
12715pub struct GenerateSeries {
12716 #[serde(default)]
12717 pub start: Option<Box<Expression>>,
12718 #[serde(default)]
12719 pub end: Option<Box<Expression>>,
12720 #[serde(default)]
12721 pub step: Option<Box<Expression>>,
12722 #[serde(default)]
12723 pub is_end_exclusive: Option<Box<Expression>>,
12724}
12725
12726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12728#[cfg_attr(feature = "bindings", derive(TS))]
12729pub struct AIAgg {
12730 pub this: Box<Expression>,
12731 pub expression: Box<Expression>,
12732}
12733
12734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12736#[cfg_attr(feature = "bindings", derive(TS))]
12737pub struct AIClassify {
12738 pub this: Box<Expression>,
12739 #[serde(default)]
12740 pub categories: Option<Box<Expression>>,
12741 #[serde(default)]
12742 pub config: Option<Box<Expression>>,
12743}
12744
12745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12747#[cfg_attr(feature = "bindings", derive(TS))]
12748pub struct ArrayAll {
12749 pub this: Box<Expression>,
12750 pub expression: Box<Expression>,
12751}
12752
12753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12755#[cfg_attr(feature = "bindings", derive(TS))]
12756pub struct ArrayAny {
12757 pub this: Box<Expression>,
12758 pub expression: Box<Expression>,
12759}
12760
12761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12763#[cfg_attr(feature = "bindings", derive(TS))]
12764pub struct ArrayConstructCompact {
12765 #[serde(default)]
12766 pub expressions: Vec<Expression>,
12767}
12768
12769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12771#[cfg_attr(feature = "bindings", derive(TS))]
12772pub struct StPoint {
12773 pub this: Box<Expression>,
12774 pub expression: Box<Expression>,
12775 #[serde(default)]
12776 pub null: Option<Box<Expression>>,
12777}
12778
12779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12781#[cfg_attr(feature = "bindings", derive(TS))]
12782pub struct StDistance {
12783 pub this: Box<Expression>,
12784 pub expression: Box<Expression>,
12785 #[serde(default)]
12786 pub use_spheroid: Option<Box<Expression>>,
12787}
12788
12789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12791#[cfg_attr(feature = "bindings", derive(TS))]
12792pub struct StringToArray {
12793 pub this: Box<Expression>,
12794 #[serde(default)]
12795 pub expression: Option<Box<Expression>>,
12796 #[serde(default)]
12797 pub null: Option<Box<Expression>>,
12798}
12799
12800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12802#[cfg_attr(feature = "bindings", derive(TS))]
12803pub struct ArraySum {
12804 pub this: Box<Expression>,
12805 #[serde(default)]
12806 pub expression: Option<Box<Expression>>,
12807}
12808
12809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12811#[cfg_attr(feature = "bindings", derive(TS))]
12812pub struct ObjectAgg {
12813 pub this: Box<Expression>,
12814 pub expression: Box<Expression>,
12815}
12816
12817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12819#[cfg_attr(feature = "bindings", derive(TS))]
12820pub struct CastToStrType {
12821 pub this: Box<Expression>,
12822 #[serde(default)]
12823 pub to: Option<Box<Expression>>,
12824}
12825
12826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12828#[cfg_attr(feature = "bindings", derive(TS))]
12829pub struct CheckJson {
12830 pub this: Box<Expression>,
12831}
12832
12833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12835#[cfg_attr(feature = "bindings", derive(TS))]
12836pub struct CheckXml {
12837 pub this: Box<Expression>,
12838 #[serde(default)]
12839 pub disable_auto_convert: Option<Box<Expression>>,
12840}
12841
12842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12844#[cfg_attr(feature = "bindings", derive(TS))]
12845pub struct TranslateCharacters {
12846 pub this: Box<Expression>,
12847 pub expression: Box<Expression>,
12848 #[serde(default)]
12849 pub with_error: Option<Box<Expression>>,
12850}
12851
12852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12854#[cfg_attr(feature = "bindings", derive(TS))]
12855pub struct CurrentSchemas {
12856 #[serde(default)]
12857 pub this: Option<Box<Expression>>,
12858}
12859
12860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12862#[cfg_attr(feature = "bindings", derive(TS))]
12863pub struct CurrentDatetime {
12864 #[serde(default)]
12865 pub this: Option<Box<Expression>>,
12866}
12867
12868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12870#[cfg_attr(feature = "bindings", derive(TS))]
12871pub struct Localtime {
12872 #[serde(default)]
12873 pub this: Option<Box<Expression>>,
12874}
12875
12876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12878#[cfg_attr(feature = "bindings", derive(TS))]
12879pub struct Localtimestamp {
12880 #[serde(default)]
12881 pub this: Option<Box<Expression>>,
12882}
12883
12884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12886#[cfg_attr(feature = "bindings", derive(TS))]
12887pub struct Systimestamp {
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 CurrentSchema {
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 CurrentUser {
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 SessionUser;
12912
12913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12915#[cfg_attr(feature = "bindings", derive(TS))]
12916pub struct JSONPathRoot;
12917
12918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12920#[cfg_attr(feature = "bindings", derive(TS))]
12921pub struct UtcTime {
12922 #[serde(default)]
12923 pub this: Option<Box<Expression>>,
12924}
12925
12926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12928#[cfg_attr(feature = "bindings", derive(TS))]
12929pub struct UtcTimestamp {
12930 #[serde(default)]
12931 pub this: Option<Box<Expression>>,
12932}
12933
12934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12936#[cfg_attr(feature = "bindings", derive(TS))]
12937pub struct TimestampFunc {
12938 #[serde(default)]
12939 pub this: Option<Box<Expression>>,
12940 #[serde(default)]
12941 pub zone: Option<Box<Expression>>,
12942 #[serde(default)]
12943 pub with_tz: Option<bool>,
12944 #[serde(default)]
12945 pub safe: Option<bool>,
12946}
12947
12948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12950#[cfg_attr(feature = "bindings", derive(TS))]
12951pub struct DateBin {
12952 pub this: Box<Expression>,
12953 pub expression: Box<Expression>,
12954 #[serde(default)]
12955 pub unit: Option<String>,
12956 #[serde(default)]
12957 pub zone: Option<Box<Expression>>,
12958 #[serde(default)]
12959 pub origin: Option<Box<Expression>>,
12960}
12961
12962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12964#[cfg_attr(feature = "bindings", derive(TS))]
12965pub struct Datetime {
12966 pub this: Box<Expression>,
12967 #[serde(default)]
12968 pub expression: Option<Box<Expression>>,
12969}
12970
12971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12973#[cfg_attr(feature = "bindings", derive(TS))]
12974pub struct DatetimeAdd {
12975 pub this: Box<Expression>,
12976 pub expression: Box<Expression>,
12977 #[serde(default)]
12978 pub unit: Option<String>,
12979}
12980
12981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12983#[cfg_attr(feature = "bindings", derive(TS))]
12984pub struct DatetimeSub {
12985 pub this: Box<Expression>,
12986 pub expression: Box<Expression>,
12987 #[serde(default)]
12988 pub unit: Option<String>,
12989}
12990
12991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12993#[cfg_attr(feature = "bindings", derive(TS))]
12994pub struct DatetimeDiff {
12995 pub this: Box<Expression>,
12996 pub expression: Box<Expression>,
12997 #[serde(default)]
12998 pub unit: Option<String>,
12999}
13000
13001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13003#[cfg_attr(feature = "bindings", derive(TS))]
13004pub struct DatetimeTrunc {
13005 pub this: Box<Expression>,
13006 pub unit: String,
13007 #[serde(default)]
13008 pub zone: Option<Box<Expression>>,
13009}
13010
13011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13013#[cfg_attr(feature = "bindings", derive(TS))]
13014pub struct Dayname {
13015 pub this: Box<Expression>,
13016 #[serde(default)]
13017 pub abbreviated: Option<Box<Expression>>,
13018}
13019
13020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13022#[cfg_attr(feature = "bindings", derive(TS))]
13023pub struct MakeInterval {
13024 #[serde(default)]
13025 pub year: Option<Box<Expression>>,
13026 #[serde(default)]
13027 pub month: Option<Box<Expression>>,
13028 #[serde(default)]
13029 pub week: Option<Box<Expression>>,
13030 #[serde(default)]
13031 pub day: Option<Box<Expression>>,
13032 #[serde(default)]
13033 pub hour: Option<Box<Expression>>,
13034 #[serde(default)]
13035 pub minute: Option<Box<Expression>>,
13036 #[serde(default)]
13037 pub second: Option<Box<Expression>>,
13038}
13039
13040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13042#[cfg_attr(feature = "bindings", derive(TS))]
13043pub struct PreviousDay {
13044 pub this: Box<Expression>,
13045 pub expression: Box<Expression>,
13046}
13047
13048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13050#[cfg_attr(feature = "bindings", derive(TS))]
13051pub struct Elt {
13052 pub this: Box<Expression>,
13053 #[serde(default)]
13054 pub expressions: Vec<Expression>,
13055}
13056
13057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13059#[cfg_attr(feature = "bindings", derive(TS))]
13060pub struct TimestampAdd {
13061 pub this: Box<Expression>,
13062 pub expression: Box<Expression>,
13063 #[serde(default)]
13064 pub unit: Option<String>,
13065}
13066
13067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13069#[cfg_attr(feature = "bindings", derive(TS))]
13070pub struct TimestampSub {
13071 pub this: Box<Expression>,
13072 pub expression: Box<Expression>,
13073 #[serde(default)]
13074 pub unit: Option<String>,
13075}
13076
13077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13079#[cfg_attr(feature = "bindings", derive(TS))]
13080pub struct TimestampDiff {
13081 pub this: Box<Expression>,
13082 pub expression: Box<Expression>,
13083 #[serde(default)]
13084 pub unit: Option<String>,
13085}
13086
13087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13089#[cfg_attr(feature = "bindings", derive(TS))]
13090pub struct TimeSlice {
13091 pub this: Box<Expression>,
13092 pub expression: Box<Expression>,
13093 pub unit: String,
13094 #[serde(default)]
13095 pub kind: Option<String>,
13096}
13097
13098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13100#[cfg_attr(feature = "bindings", derive(TS))]
13101pub struct TimeAdd {
13102 pub this: Box<Expression>,
13103 pub expression: Box<Expression>,
13104 #[serde(default)]
13105 pub unit: Option<String>,
13106}
13107
13108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13110#[cfg_attr(feature = "bindings", derive(TS))]
13111pub struct TimeSub {
13112 pub this: Box<Expression>,
13113 pub expression: Box<Expression>,
13114 #[serde(default)]
13115 pub unit: Option<String>,
13116}
13117
13118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13120#[cfg_attr(feature = "bindings", derive(TS))]
13121pub struct TimeDiff {
13122 pub this: Box<Expression>,
13123 pub expression: Box<Expression>,
13124 #[serde(default)]
13125 pub unit: Option<String>,
13126}
13127
13128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13130#[cfg_attr(feature = "bindings", derive(TS))]
13131pub struct TimeTrunc {
13132 pub this: Box<Expression>,
13133 pub unit: String,
13134 #[serde(default)]
13135 pub zone: Option<Box<Expression>>,
13136}
13137
13138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13140#[cfg_attr(feature = "bindings", derive(TS))]
13141pub struct DateFromParts {
13142 #[serde(default)]
13143 pub year: Option<Box<Expression>>,
13144 #[serde(default)]
13145 pub month: Option<Box<Expression>>,
13146 #[serde(default)]
13147 pub day: Option<Box<Expression>>,
13148 #[serde(default)]
13149 pub allow_overflow: Option<Box<Expression>>,
13150}
13151
13152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13154#[cfg_attr(feature = "bindings", derive(TS))]
13155pub struct TimeFromParts {
13156 #[serde(default)]
13157 pub hour: Option<Box<Expression>>,
13158 #[serde(default)]
13159 pub min: Option<Box<Expression>>,
13160 #[serde(default)]
13161 pub sec: Option<Box<Expression>>,
13162 #[serde(default)]
13163 pub nano: Option<Box<Expression>>,
13164 #[serde(default)]
13165 pub fractions: Option<Box<Expression>>,
13166 #[serde(default)]
13167 pub precision: Option<i64>,
13168}
13169
13170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13172#[cfg_attr(feature = "bindings", derive(TS))]
13173pub struct DecodeCase {
13174 #[serde(default)]
13175 pub expressions: Vec<Expression>,
13176}
13177
13178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13180#[cfg_attr(feature = "bindings", derive(TS))]
13181pub struct Decrypt {
13182 pub this: Box<Expression>,
13183 #[serde(default)]
13184 pub passphrase: Option<Box<Expression>>,
13185 #[serde(default)]
13186 pub aad: Option<Box<Expression>>,
13187 #[serde(default)]
13188 pub encryption_method: Option<Box<Expression>>,
13189 #[serde(default)]
13190 pub safe: Option<Box<Expression>>,
13191}
13192
13193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13195#[cfg_attr(feature = "bindings", derive(TS))]
13196pub struct DecryptRaw {
13197 pub this: Box<Expression>,
13198 #[serde(default)]
13199 pub key: Option<Box<Expression>>,
13200 #[serde(default)]
13201 pub iv: Option<Box<Expression>>,
13202 #[serde(default)]
13203 pub aad: Option<Box<Expression>>,
13204 #[serde(default)]
13205 pub encryption_method: Option<Box<Expression>>,
13206 #[serde(default)]
13207 pub aead: Option<Box<Expression>>,
13208 #[serde(default)]
13209 pub safe: Option<Box<Expression>>,
13210}
13211
13212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13214#[cfg_attr(feature = "bindings", derive(TS))]
13215pub struct Encode {
13216 pub this: Box<Expression>,
13217 #[serde(default)]
13218 pub charset: Option<Box<Expression>>,
13219}
13220
13221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13223#[cfg_attr(feature = "bindings", derive(TS))]
13224pub struct Encrypt {
13225 pub this: Box<Expression>,
13226 #[serde(default)]
13227 pub passphrase: Option<Box<Expression>>,
13228 #[serde(default)]
13229 pub aad: Option<Box<Expression>>,
13230 #[serde(default)]
13231 pub encryption_method: Option<Box<Expression>>,
13232}
13233
13234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13236#[cfg_attr(feature = "bindings", derive(TS))]
13237pub struct EncryptRaw {
13238 pub this: Box<Expression>,
13239 #[serde(default)]
13240 pub key: Option<Box<Expression>>,
13241 #[serde(default)]
13242 pub iv: Option<Box<Expression>>,
13243 #[serde(default)]
13244 pub aad: Option<Box<Expression>>,
13245 #[serde(default)]
13246 pub encryption_method: Option<Box<Expression>>,
13247}
13248
13249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13251#[cfg_attr(feature = "bindings", derive(TS))]
13252pub struct EqualNull {
13253 pub this: Box<Expression>,
13254 pub expression: Box<Expression>,
13255}
13256
13257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13259#[cfg_attr(feature = "bindings", derive(TS))]
13260pub struct ToBinary {
13261 pub this: Box<Expression>,
13262 #[serde(default)]
13263 pub format: Option<String>,
13264 #[serde(default)]
13265 pub safe: Option<Box<Expression>>,
13266}
13267
13268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13270#[cfg_attr(feature = "bindings", derive(TS))]
13271pub struct Base64DecodeBinary {
13272 pub this: Box<Expression>,
13273 #[serde(default)]
13274 pub alphabet: Option<Box<Expression>>,
13275}
13276
13277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13279#[cfg_attr(feature = "bindings", derive(TS))]
13280pub struct Base64DecodeString {
13281 pub this: Box<Expression>,
13282 #[serde(default)]
13283 pub alphabet: Option<Box<Expression>>,
13284}
13285
13286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13288#[cfg_attr(feature = "bindings", derive(TS))]
13289pub struct Base64Encode {
13290 pub this: Box<Expression>,
13291 #[serde(default)]
13292 pub max_line_length: Option<Box<Expression>>,
13293 #[serde(default)]
13294 pub alphabet: Option<Box<Expression>>,
13295}
13296
13297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13299#[cfg_attr(feature = "bindings", derive(TS))]
13300pub struct TryBase64DecodeBinary {
13301 pub this: Box<Expression>,
13302 #[serde(default)]
13303 pub alphabet: Option<Box<Expression>>,
13304}
13305
13306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13308#[cfg_attr(feature = "bindings", derive(TS))]
13309pub struct TryBase64DecodeString {
13310 pub this: Box<Expression>,
13311 #[serde(default)]
13312 pub alphabet: Option<Box<Expression>>,
13313}
13314
13315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13317#[cfg_attr(feature = "bindings", derive(TS))]
13318pub struct GapFill {
13319 pub this: Box<Expression>,
13320 #[serde(default)]
13321 pub ts_column: Option<Box<Expression>>,
13322 #[serde(default)]
13323 pub bucket_width: Option<Box<Expression>>,
13324 #[serde(default)]
13325 pub partitioning_columns: Option<Box<Expression>>,
13326 #[serde(default)]
13327 pub value_columns: Option<Box<Expression>>,
13328 #[serde(default)]
13329 pub origin: Option<Box<Expression>>,
13330 #[serde(default)]
13331 pub ignore_nulls: Option<Box<Expression>>,
13332}
13333
13334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13336#[cfg_attr(feature = "bindings", derive(TS))]
13337pub struct GenerateDateArray {
13338 #[serde(default)]
13339 pub start: Option<Box<Expression>>,
13340 #[serde(default)]
13341 pub end: Option<Box<Expression>>,
13342 #[serde(default)]
13343 pub step: Option<Box<Expression>>,
13344}
13345
13346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13348#[cfg_attr(feature = "bindings", derive(TS))]
13349pub struct GenerateTimestampArray {
13350 #[serde(default)]
13351 pub start: Option<Box<Expression>>,
13352 #[serde(default)]
13353 pub end: Option<Box<Expression>>,
13354 #[serde(default)]
13355 pub step: Option<Box<Expression>>,
13356}
13357
13358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13360#[cfg_attr(feature = "bindings", derive(TS))]
13361pub struct GetExtract {
13362 pub this: Box<Expression>,
13363 pub expression: Box<Expression>,
13364}
13365
13366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13368#[cfg_attr(feature = "bindings", derive(TS))]
13369pub struct Getbit {
13370 pub this: Box<Expression>,
13371 pub expression: Box<Expression>,
13372 #[serde(default)]
13373 pub zero_is_msb: Option<Box<Expression>>,
13374}
13375
13376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13378#[cfg_attr(feature = "bindings", derive(TS))]
13379pub struct OverflowTruncateBehavior {
13380 #[serde(default)]
13381 pub this: Option<Box<Expression>>,
13382 #[serde(default)]
13383 pub with_count: Option<Box<Expression>>,
13384}
13385
13386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13388#[cfg_attr(feature = "bindings", derive(TS))]
13389pub struct HexEncode {
13390 pub this: Box<Expression>,
13391 #[serde(default)]
13392 pub case: Option<Box<Expression>>,
13393}
13394
13395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13397#[cfg_attr(feature = "bindings", derive(TS))]
13398pub struct Compress {
13399 pub this: Box<Expression>,
13400 #[serde(default)]
13401 pub method: Option<String>,
13402}
13403
13404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13406#[cfg_attr(feature = "bindings", derive(TS))]
13407pub struct DecompressBinary {
13408 pub this: Box<Expression>,
13409 pub method: String,
13410}
13411
13412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13414#[cfg_attr(feature = "bindings", derive(TS))]
13415pub struct DecompressString {
13416 pub this: Box<Expression>,
13417 pub method: String,
13418}
13419
13420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13422#[cfg_attr(feature = "bindings", derive(TS))]
13423pub struct Xor {
13424 #[serde(default)]
13425 pub this: Option<Box<Expression>>,
13426 #[serde(default)]
13427 pub expression: Option<Box<Expression>>,
13428 #[serde(default)]
13429 pub expressions: Vec<Expression>,
13430}
13431
13432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13434#[cfg_attr(feature = "bindings", derive(TS))]
13435pub struct Nullif {
13436 pub this: Box<Expression>,
13437 pub expression: Box<Expression>,
13438}
13439
13440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13442#[cfg_attr(feature = "bindings", derive(TS))]
13443pub struct JSON {
13444 #[serde(default)]
13445 pub this: Option<Box<Expression>>,
13446 #[serde(default)]
13447 pub with_: Option<Box<Expression>>,
13448 #[serde(default)]
13449 pub unique: bool,
13450}
13451
13452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13454#[cfg_attr(feature = "bindings", derive(TS))]
13455pub struct JSONPath {
13456 #[serde(default)]
13457 pub expressions: Vec<Expression>,
13458 #[serde(default)]
13459 pub escape: Option<Box<Expression>>,
13460}
13461
13462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13464#[cfg_attr(feature = "bindings", derive(TS))]
13465pub struct JSONPathFilter {
13466 pub this: Box<Expression>,
13467}
13468
13469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13471#[cfg_attr(feature = "bindings", derive(TS))]
13472pub struct JSONPathKey {
13473 pub this: Box<Expression>,
13474}
13475
13476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13478#[cfg_attr(feature = "bindings", derive(TS))]
13479pub struct JSONPathRecursive {
13480 #[serde(default)]
13481 pub this: Option<Box<Expression>>,
13482}
13483
13484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13486#[cfg_attr(feature = "bindings", derive(TS))]
13487pub struct JSONPathScript {
13488 pub this: Box<Expression>,
13489}
13490
13491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13493#[cfg_attr(feature = "bindings", derive(TS))]
13494pub struct JSONPathSlice {
13495 #[serde(default)]
13496 pub start: Option<Box<Expression>>,
13497 #[serde(default)]
13498 pub end: Option<Box<Expression>>,
13499 #[serde(default)]
13500 pub step: Option<Box<Expression>>,
13501}
13502
13503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13505#[cfg_attr(feature = "bindings", derive(TS))]
13506pub struct JSONPathSelector {
13507 pub this: Box<Expression>,
13508}
13509
13510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13512#[cfg_attr(feature = "bindings", derive(TS))]
13513pub struct JSONPathSubscript {
13514 pub this: Box<Expression>,
13515}
13516
13517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13519#[cfg_attr(feature = "bindings", derive(TS))]
13520pub struct JSONPathUnion {
13521 #[serde(default)]
13522 pub expressions: Vec<Expression>,
13523}
13524
13525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13527#[cfg_attr(feature = "bindings", derive(TS))]
13528pub struct Format {
13529 pub this: Box<Expression>,
13530 #[serde(default)]
13531 pub expressions: Vec<Expression>,
13532}
13533
13534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13536#[cfg_attr(feature = "bindings", derive(TS))]
13537pub struct JSONKeys {
13538 pub this: Box<Expression>,
13539 #[serde(default)]
13540 pub expression: Option<Box<Expression>>,
13541 #[serde(default)]
13542 pub expressions: Vec<Expression>,
13543}
13544
13545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13547#[cfg_attr(feature = "bindings", derive(TS))]
13548pub struct JSONKeyValue {
13549 pub this: Box<Expression>,
13550 pub expression: Box<Expression>,
13551}
13552
13553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13555#[cfg_attr(feature = "bindings", derive(TS))]
13556pub struct JSONKeysAtDepth {
13557 pub this: Box<Expression>,
13558 #[serde(default)]
13559 pub expression: Option<Box<Expression>>,
13560 #[serde(default)]
13561 pub mode: Option<Box<Expression>>,
13562}
13563
13564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13566#[cfg_attr(feature = "bindings", derive(TS))]
13567pub struct JSONObject {
13568 #[serde(default)]
13569 pub expressions: Vec<Expression>,
13570 #[serde(default)]
13571 pub null_handling: Option<Box<Expression>>,
13572 #[serde(default)]
13573 pub unique_keys: Option<Box<Expression>>,
13574 #[serde(default)]
13575 pub return_type: Option<Box<Expression>>,
13576 #[serde(default)]
13577 pub encoding: Option<Box<Expression>>,
13578}
13579
13580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13582#[cfg_attr(feature = "bindings", derive(TS))]
13583pub struct JSONObjectAgg {
13584 #[serde(default)]
13585 pub expressions: Vec<Expression>,
13586 #[serde(default)]
13587 pub null_handling: Option<Box<Expression>>,
13588 #[serde(default)]
13589 pub unique_keys: Option<Box<Expression>>,
13590 #[serde(default)]
13591 pub return_type: Option<Box<Expression>>,
13592 #[serde(default)]
13593 pub encoding: Option<Box<Expression>>,
13594}
13595
13596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13598#[cfg_attr(feature = "bindings", derive(TS))]
13599pub struct JSONBObjectAgg {
13600 pub this: Box<Expression>,
13601 pub expression: Box<Expression>,
13602}
13603
13604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13606#[cfg_attr(feature = "bindings", derive(TS))]
13607pub struct JSONArray {
13608 #[serde(default)]
13609 pub expressions: Vec<Expression>,
13610 #[serde(default)]
13611 pub null_handling: Option<Box<Expression>>,
13612 #[serde(default)]
13613 pub return_type: Option<Box<Expression>>,
13614 #[serde(default)]
13615 pub strict: Option<Box<Expression>>,
13616}
13617
13618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13620#[cfg_attr(feature = "bindings", derive(TS))]
13621pub struct JSONArrayAgg {
13622 pub this: Box<Expression>,
13623 #[serde(default)]
13624 pub order: Option<Box<Expression>>,
13625 #[serde(default)]
13626 pub null_handling: Option<Box<Expression>>,
13627 #[serde(default)]
13628 pub return_type: Option<Box<Expression>>,
13629 #[serde(default)]
13630 pub strict: Option<Box<Expression>>,
13631}
13632
13633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13635#[cfg_attr(feature = "bindings", derive(TS))]
13636pub struct JSONExists {
13637 pub this: Box<Expression>,
13638 #[serde(default)]
13639 pub path: Option<Box<Expression>>,
13640 #[serde(default)]
13641 pub passing: Option<Box<Expression>>,
13642 #[serde(default)]
13643 pub on_condition: Option<Box<Expression>>,
13644 #[serde(default)]
13645 pub from_dcolonqmark: Option<Box<Expression>>,
13646}
13647
13648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13650#[cfg_attr(feature = "bindings", derive(TS))]
13651pub struct JSONColumnDef {
13652 #[serde(default)]
13653 pub this: Option<Box<Expression>>,
13654 #[serde(default)]
13655 pub kind: Option<String>,
13656 #[serde(default)]
13657 pub format_json: bool,
13658 #[serde(default)]
13659 pub path: Option<Box<Expression>>,
13660 #[serde(default)]
13661 pub nested_schema: Option<Box<Expression>>,
13662 #[serde(default)]
13663 pub ordinality: Option<Box<Expression>>,
13664}
13665
13666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13668#[cfg_attr(feature = "bindings", derive(TS))]
13669pub struct JSONSchema {
13670 #[serde(default)]
13671 pub expressions: Vec<Expression>,
13672}
13673
13674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13676#[cfg_attr(feature = "bindings", derive(TS))]
13677pub struct JSONSet {
13678 pub this: Box<Expression>,
13679 #[serde(default)]
13680 pub expressions: Vec<Expression>,
13681}
13682
13683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13685#[cfg_attr(feature = "bindings", derive(TS))]
13686pub struct JSONStripNulls {
13687 pub this: Box<Expression>,
13688 #[serde(default)]
13689 pub expression: Option<Box<Expression>>,
13690 #[serde(default)]
13691 pub include_arrays: Option<Box<Expression>>,
13692 #[serde(default)]
13693 pub remove_empty: Option<Box<Expression>>,
13694}
13695
13696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13698#[cfg_attr(feature = "bindings", derive(TS))]
13699pub struct JSONValue {
13700 pub this: Box<Expression>,
13701 #[serde(default)]
13702 pub path: Option<Box<Expression>>,
13703 #[serde(default)]
13704 pub returning: Option<Box<Expression>>,
13705 #[serde(default)]
13706 pub on_condition: Option<Box<Expression>>,
13707}
13708
13709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13711#[cfg_attr(feature = "bindings", derive(TS))]
13712pub struct JSONValueArray {
13713 pub this: Box<Expression>,
13714 #[serde(default)]
13715 pub expression: Option<Box<Expression>>,
13716}
13717
13718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13720#[cfg_attr(feature = "bindings", derive(TS))]
13721pub struct JSONRemove {
13722 pub this: Box<Expression>,
13723 #[serde(default)]
13724 pub expressions: Vec<Expression>,
13725}
13726
13727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13729#[cfg_attr(feature = "bindings", derive(TS))]
13730pub struct JSONTable {
13731 pub this: Box<Expression>,
13732 #[serde(default)]
13733 pub schema: Option<Box<Expression>>,
13734 #[serde(default)]
13735 pub path: Option<Box<Expression>>,
13736 #[serde(default)]
13737 pub error_handling: Option<Box<Expression>>,
13738 #[serde(default)]
13739 pub empty_handling: Option<Box<Expression>>,
13740}
13741
13742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13744#[cfg_attr(feature = "bindings", derive(TS))]
13745pub struct JSONType {
13746 pub this: Box<Expression>,
13747 #[serde(default)]
13748 pub expression: Option<Box<Expression>>,
13749}
13750
13751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13753#[cfg_attr(feature = "bindings", derive(TS))]
13754pub struct ObjectInsert {
13755 pub this: Box<Expression>,
13756 #[serde(default)]
13757 pub key: Option<Box<Expression>>,
13758 #[serde(default)]
13759 pub value: Option<Box<Expression>>,
13760 #[serde(default)]
13761 pub update_flag: Option<Box<Expression>>,
13762}
13763
13764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13766#[cfg_attr(feature = "bindings", derive(TS))]
13767pub struct OpenJSONColumnDef {
13768 pub this: Box<Expression>,
13769 pub kind: String,
13770 #[serde(default)]
13771 pub path: Option<Box<Expression>>,
13772 #[serde(default)]
13773 pub as_json: Option<Box<Expression>>,
13774 #[serde(default, skip_serializing_if = "Option::is_none")]
13776 pub data_type: Option<DataType>,
13777}
13778
13779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13781#[cfg_attr(feature = "bindings", derive(TS))]
13782pub struct OpenJSON {
13783 pub this: Box<Expression>,
13784 #[serde(default)]
13785 pub path: Option<Box<Expression>>,
13786 #[serde(default)]
13787 pub expressions: Vec<Expression>,
13788}
13789
13790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13792#[cfg_attr(feature = "bindings", derive(TS))]
13793pub struct JSONBExists {
13794 pub this: Box<Expression>,
13795 #[serde(default)]
13796 pub path: Option<Box<Expression>>,
13797}
13798
13799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13801#[cfg_attr(feature = "bindings", derive(TS))]
13802pub struct JSONCast {
13803 pub this: Box<Expression>,
13804 pub to: DataType,
13805}
13806
13807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13809#[cfg_attr(feature = "bindings", derive(TS))]
13810pub struct JSONExtract {
13811 pub this: Box<Expression>,
13812 pub expression: Box<Expression>,
13813 #[serde(default)]
13814 pub only_json_types: Option<Box<Expression>>,
13815 #[serde(default)]
13816 pub expressions: Vec<Expression>,
13817 #[serde(default)]
13818 pub variant_extract: Option<Box<Expression>>,
13819 #[serde(default)]
13820 pub json_query: Option<Box<Expression>>,
13821 #[serde(default)]
13822 pub option: Option<Box<Expression>>,
13823 #[serde(default)]
13824 pub quote: Option<Box<Expression>>,
13825 #[serde(default)]
13826 pub on_condition: Option<Box<Expression>>,
13827 #[serde(default)]
13828 pub requires_json: Option<Box<Expression>>,
13829}
13830
13831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13833#[cfg_attr(feature = "bindings", derive(TS))]
13834pub struct JSONExtractQuote {
13835 #[serde(default)]
13836 pub option: Option<Box<Expression>>,
13837 #[serde(default)]
13838 pub scalar: Option<Box<Expression>>,
13839}
13840
13841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13843#[cfg_attr(feature = "bindings", derive(TS))]
13844pub struct JSONExtractArray {
13845 pub this: Box<Expression>,
13846 #[serde(default)]
13847 pub expression: Option<Box<Expression>>,
13848}
13849
13850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13852#[cfg_attr(feature = "bindings", derive(TS))]
13853pub struct JSONExtractScalar {
13854 pub this: Box<Expression>,
13855 pub expression: Box<Expression>,
13856 #[serde(default)]
13857 pub only_json_types: Option<Box<Expression>>,
13858 #[serde(default)]
13859 pub expressions: Vec<Expression>,
13860 #[serde(default)]
13861 pub json_type: Option<Box<Expression>>,
13862 #[serde(default)]
13863 pub scalar_only: Option<Box<Expression>>,
13864}
13865
13866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13868#[cfg_attr(feature = "bindings", derive(TS))]
13869pub struct JSONBExtractScalar {
13870 pub this: Box<Expression>,
13871 pub expression: Box<Expression>,
13872 #[serde(default)]
13873 pub json_type: Option<Box<Expression>>,
13874}
13875
13876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13878#[cfg_attr(feature = "bindings", derive(TS))]
13879pub struct JSONFormat {
13880 #[serde(default)]
13881 pub this: Option<Box<Expression>>,
13882 #[serde(default)]
13883 pub options: Vec<Expression>,
13884 #[serde(default)]
13885 pub is_json: Option<Box<Expression>>,
13886 #[serde(default)]
13887 pub to_json: Option<Box<Expression>>,
13888}
13889
13890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13892#[cfg_attr(feature = "bindings", derive(TS))]
13893pub struct JSONArrayAppend {
13894 pub this: Box<Expression>,
13895 #[serde(default)]
13896 pub expressions: Vec<Expression>,
13897}
13898
13899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13901#[cfg_attr(feature = "bindings", derive(TS))]
13902pub struct JSONArrayContains {
13903 pub this: Box<Expression>,
13904 pub expression: Box<Expression>,
13905 #[serde(default)]
13906 pub json_type: Option<Box<Expression>>,
13907}
13908
13909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13911#[cfg_attr(feature = "bindings", derive(TS))]
13912pub struct JSONArrayInsert {
13913 pub this: Box<Expression>,
13914 #[serde(default)]
13915 pub expressions: Vec<Expression>,
13916}
13917
13918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13920#[cfg_attr(feature = "bindings", derive(TS))]
13921pub struct ParseJSON {
13922 pub this: Box<Expression>,
13923 #[serde(default)]
13924 pub expression: Option<Box<Expression>>,
13925 #[serde(default)]
13926 pub safe: Option<Box<Expression>>,
13927}
13928
13929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13931#[cfg_attr(feature = "bindings", derive(TS))]
13932pub struct ParseUrl {
13933 pub this: Box<Expression>,
13934 #[serde(default)]
13935 pub part_to_extract: Option<Box<Expression>>,
13936 #[serde(default)]
13937 pub key: Option<Box<Expression>>,
13938 #[serde(default)]
13939 pub permissive: Option<Box<Expression>>,
13940}
13941
13942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13944#[cfg_attr(feature = "bindings", derive(TS))]
13945pub struct ParseIp {
13946 pub this: Box<Expression>,
13947 #[serde(default)]
13948 pub type_: Option<Box<Expression>>,
13949 #[serde(default)]
13950 pub permissive: Option<Box<Expression>>,
13951}
13952
13953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13955#[cfg_attr(feature = "bindings", derive(TS))]
13956pub struct ParseTime {
13957 pub this: Box<Expression>,
13958 pub format: String,
13959}
13960
13961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13963#[cfg_attr(feature = "bindings", derive(TS))]
13964pub struct ParseDatetime {
13965 pub this: Box<Expression>,
13966 #[serde(default)]
13967 pub format: Option<String>,
13968 #[serde(default)]
13969 pub zone: Option<Box<Expression>>,
13970}
13971
13972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13974#[cfg_attr(feature = "bindings", derive(TS))]
13975pub struct Map {
13976 #[serde(default)]
13977 pub keys: Vec<Expression>,
13978 #[serde(default)]
13979 pub values: Vec<Expression>,
13980}
13981
13982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13984#[cfg_attr(feature = "bindings", derive(TS))]
13985pub struct MapCat {
13986 pub this: Box<Expression>,
13987 pub expression: Box<Expression>,
13988}
13989
13990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13992#[cfg_attr(feature = "bindings", derive(TS))]
13993pub struct MapDelete {
13994 pub this: Box<Expression>,
13995 #[serde(default)]
13996 pub expressions: Vec<Expression>,
13997}
13998
13999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14001#[cfg_attr(feature = "bindings", derive(TS))]
14002pub struct MapInsert {
14003 pub this: Box<Expression>,
14004 #[serde(default)]
14005 pub key: Option<Box<Expression>>,
14006 #[serde(default)]
14007 pub value: Option<Box<Expression>>,
14008 #[serde(default)]
14009 pub update_flag: Option<Box<Expression>>,
14010}
14011
14012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14014#[cfg_attr(feature = "bindings", derive(TS))]
14015pub struct MapPick {
14016 pub this: Box<Expression>,
14017 #[serde(default)]
14018 pub expressions: Vec<Expression>,
14019}
14020
14021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14023#[cfg_attr(feature = "bindings", derive(TS))]
14024pub struct ScopeResolution {
14025 #[serde(default)]
14026 pub this: Option<Box<Expression>>,
14027 pub expression: Box<Expression>,
14028}
14029
14030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14032#[cfg_attr(feature = "bindings", derive(TS))]
14033pub struct Slice {
14034 #[serde(default)]
14035 pub this: Option<Box<Expression>>,
14036 #[serde(default)]
14037 pub expression: Option<Box<Expression>>,
14038 #[serde(default)]
14039 pub step: Option<Box<Expression>>,
14040}
14041
14042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14044#[cfg_attr(feature = "bindings", derive(TS))]
14045pub struct VarMap {
14046 #[serde(default)]
14047 pub keys: Vec<Expression>,
14048 #[serde(default)]
14049 pub values: Vec<Expression>,
14050}
14051
14052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14054#[cfg_attr(feature = "bindings", derive(TS))]
14055pub struct MatchAgainst {
14056 pub this: Box<Expression>,
14057 #[serde(default)]
14058 pub expressions: Vec<Expression>,
14059 #[serde(default)]
14060 pub modifier: Option<Box<Expression>>,
14061}
14062
14063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14065#[cfg_attr(feature = "bindings", derive(TS))]
14066pub struct MD5Digest {
14067 pub this: Box<Expression>,
14068 #[serde(default)]
14069 pub expressions: Vec<Expression>,
14070}
14071
14072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14074#[cfg_attr(feature = "bindings", derive(TS))]
14075pub struct Monthname {
14076 pub this: Box<Expression>,
14077 #[serde(default)]
14078 pub abbreviated: Option<Box<Expression>>,
14079}
14080
14081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14083#[cfg_attr(feature = "bindings", derive(TS))]
14084pub struct Ntile {
14085 #[serde(default)]
14086 pub this: Option<Box<Expression>>,
14087}
14088
14089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14091#[cfg_attr(feature = "bindings", derive(TS))]
14092pub struct Normalize {
14093 pub this: Box<Expression>,
14094 #[serde(default)]
14095 pub form: Option<Box<Expression>>,
14096 #[serde(default)]
14097 pub is_casefold: Option<Box<Expression>>,
14098}
14099
14100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14102#[cfg_attr(feature = "bindings", derive(TS))]
14103pub struct Normal {
14104 pub this: Box<Expression>,
14105 #[serde(default)]
14106 pub stddev: Option<Box<Expression>>,
14107 #[serde(default)]
14108 pub gen: Option<Box<Expression>>,
14109}
14110
14111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14113#[cfg_attr(feature = "bindings", derive(TS))]
14114pub struct Predict {
14115 pub this: Box<Expression>,
14116 pub expression: Box<Expression>,
14117 #[serde(default)]
14118 pub params_struct: Option<Box<Expression>>,
14119}
14120
14121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14123#[cfg_attr(feature = "bindings", derive(TS))]
14124pub struct MLTranslate {
14125 pub this: Box<Expression>,
14126 pub expression: Box<Expression>,
14127 #[serde(default)]
14128 pub params_struct: Option<Box<Expression>>,
14129}
14130
14131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14133#[cfg_attr(feature = "bindings", derive(TS))]
14134pub struct FeaturesAtTime {
14135 pub this: Box<Expression>,
14136 #[serde(default)]
14137 pub time: Option<Box<Expression>>,
14138 #[serde(default)]
14139 pub num_rows: Option<Box<Expression>>,
14140 #[serde(default)]
14141 pub ignore_feature_nulls: Option<Box<Expression>>,
14142}
14143
14144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14146#[cfg_attr(feature = "bindings", derive(TS))]
14147pub struct GenerateEmbedding {
14148 pub this: Box<Expression>,
14149 pub expression: Box<Expression>,
14150 #[serde(default)]
14151 pub params_struct: Option<Box<Expression>>,
14152 #[serde(default)]
14153 pub is_text: Option<Box<Expression>>,
14154}
14155
14156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14158#[cfg_attr(feature = "bindings", derive(TS))]
14159pub struct MLForecast {
14160 pub this: Box<Expression>,
14161 #[serde(default)]
14162 pub expression: Option<Box<Expression>>,
14163 #[serde(default)]
14164 pub params_struct: Option<Box<Expression>>,
14165}
14166
14167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14169#[cfg_attr(feature = "bindings", derive(TS))]
14170pub struct ModelAttribute {
14171 pub this: Box<Expression>,
14172 pub expression: Box<Expression>,
14173}
14174
14175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14177#[cfg_attr(feature = "bindings", derive(TS))]
14178pub struct VectorSearch {
14179 pub this: Box<Expression>,
14180 #[serde(default)]
14181 pub column_to_search: Option<Box<Expression>>,
14182 #[serde(default)]
14183 pub query_table: Option<Box<Expression>>,
14184 #[serde(default)]
14185 pub query_column_to_search: Option<Box<Expression>>,
14186 #[serde(default)]
14187 pub top_k: Option<Box<Expression>>,
14188 #[serde(default)]
14189 pub distance_type: Option<Box<Expression>>,
14190 #[serde(default)]
14191 pub options: Vec<Expression>,
14192}
14193
14194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14196#[cfg_attr(feature = "bindings", derive(TS))]
14197pub struct Quantile {
14198 pub this: Box<Expression>,
14199 #[serde(default)]
14200 pub quantile: Option<Box<Expression>>,
14201}
14202
14203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14205#[cfg_attr(feature = "bindings", derive(TS))]
14206pub struct ApproxQuantile {
14207 pub this: Box<Expression>,
14208 #[serde(default)]
14209 pub quantile: Option<Box<Expression>>,
14210 #[serde(default)]
14211 pub accuracy: Option<Box<Expression>>,
14212 #[serde(default)]
14213 pub weight: Option<Box<Expression>>,
14214 #[serde(default)]
14215 pub error_tolerance: Option<Box<Expression>>,
14216}
14217
14218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14220#[cfg_attr(feature = "bindings", derive(TS))]
14221pub struct ApproxPercentileEstimate {
14222 pub this: Box<Expression>,
14223 #[serde(default)]
14224 pub percentile: Option<Box<Expression>>,
14225}
14226
14227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14229#[cfg_attr(feature = "bindings", derive(TS))]
14230pub struct Randn {
14231 #[serde(default)]
14232 pub this: Option<Box<Expression>>,
14233}
14234
14235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14237#[cfg_attr(feature = "bindings", derive(TS))]
14238pub struct Randstr {
14239 pub this: Box<Expression>,
14240 #[serde(default)]
14241 pub generator: Option<Box<Expression>>,
14242}
14243
14244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14246#[cfg_attr(feature = "bindings", derive(TS))]
14247pub struct RangeN {
14248 pub this: Box<Expression>,
14249 #[serde(default)]
14250 pub expressions: Vec<Expression>,
14251 #[serde(default)]
14252 pub each: Option<Box<Expression>>,
14253}
14254
14255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14257#[cfg_attr(feature = "bindings", derive(TS))]
14258pub struct RangeBucket {
14259 pub this: Box<Expression>,
14260 pub expression: Box<Expression>,
14261}
14262
14263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14265#[cfg_attr(feature = "bindings", derive(TS))]
14266pub struct ReadCSV {
14267 pub this: Box<Expression>,
14268 #[serde(default)]
14269 pub expressions: Vec<Expression>,
14270}
14271
14272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14274#[cfg_attr(feature = "bindings", derive(TS))]
14275pub struct ReadParquet {
14276 #[serde(default)]
14277 pub expressions: Vec<Expression>,
14278}
14279
14280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14282#[cfg_attr(feature = "bindings", derive(TS))]
14283pub struct Reduce {
14284 pub this: Box<Expression>,
14285 #[serde(default)]
14286 pub initial: Option<Box<Expression>>,
14287 #[serde(default)]
14288 pub merge: Option<Box<Expression>>,
14289 #[serde(default)]
14290 pub finish: Option<Box<Expression>>,
14291}
14292
14293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14295#[cfg_attr(feature = "bindings", derive(TS))]
14296pub struct RegexpExtractAll {
14297 pub this: Box<Expression>,
14298 pub expression: Box<Expression>,
14299 #[serde(default)]
14300 pub group: Option<Box<Expression>>,
14301 #[serde(default)]
14302 pub parameters: Option<Box<Expression>>,
14303 #[serde(default)]
14304 pub position: Option<Box<Expression>>,
14305 #[serde(default)]
14306 pub occurrence: Option<Box<Expression>>,
14307}
14308
14309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14311#[cfg_attr(feature = "bindings", derive(TS))]
14312pub struct RegexpILike {
14313 pub this: Box<Expression>,
14314 pub expression: Box<Expression>,
14315 #[serde(default)]
14316 pub flag: Option<Box<Expression>>,
14317}
14318
14319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14321#[cfg_attr(feature = "bindings", derive(TS))]
14322pub struct RegexpFullMatch {
14323 pub this: Box<Expression>,
14324 pub expression: Box<Expression>,
14325 #[serde(default)]
14326 pub options: Vec<Expression>,
14327}
14328
14329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14331#[cfg_attr(feature = "bindings", derive(TS))]
14332pub struct RegexpInstr {
14333 pub this: Box<Expression>,
14334 pub expression: Box<Expression>,
14335 #[serde(default)]
14336 pub position: Option<Box<Expression>>,
14337 #[serde(default)]
14338 pub occurrence: Option<Box<Expression>>,
14339 #[serde(default)]
14340 pub option: Option<Box<Expression>>,
14341 #[serde(default)]
14342 pub parameters: Option<Box<Expression>>,
14343 #[serde(default)]
14344 pub group: Option<Box<Expression>>,
14345}
14346
14347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14349#[cfg_attr(feature = "bindings", derive(TS))]
14350pub struct RegexpSplit {
14351 pub this: Box<Expression>,
14352 pub expression: Box<Expression>,
14353 #[serde(default)]
14354 pub limit: Option<Box<Expression>>,
14355}
14356
14357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14359#[cfg_attr(feature = "bindings", derive(TS))]
14360pub struct RegexpCount {
14361 pub this: Box<Expression>,
14362 pub expression: Box<Expression>,
14363 #[serde(default)]
14364 pub position: Option<Box<Expression>>,
14365 #[serde(default)]
14366 pub parameters: Option<Box<Expression>>,
14367}
14368
14369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14371#[cfg_attr(feature = "bindings", derive(TS))]
14372pub struct RegrValx {
14373 pub this: Box<Expression>,
14374 pub expression: Box<Expression>,
14375}
14376
14377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14379#[cfg_attr(feature = "bindings", derive(TS))]
14380pub struct RegrValy {
14381 pub this: Box<Expression>,
14382 pub expression: Box<Expression>,
14383}
14384
14385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14387#[cfg_attr(feature = "bindings", derive(TS))]
14388pub struct RegrAvgy {
14389 pub this: Box<Expression>,
14390 pub expression: Box<Expression>,
14391}
14392
14393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14395#[cfg_attr(feature = "bindings", derive(TS))]
14396pub struct RegrAvgx {
14397 pub this: Box<Expression>,
14398 pub expression: Box<Expression>,
14399}
14400
14401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14403#[cfg_attr(feature = "bindings", derive(TS))]
14404pub struct RegrCount {
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 RegrIntercept {
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 RegrR2 {
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 RegrSxx {
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 RegrSxy {
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 RegrSyy {
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 RegrSlope {
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 SafeAdd {
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 SafeDivide {
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 SafeMultiply {
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 SafeSubtract {
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 SHA2 {
14493 pub this: Box<Expression>,
14494 #[serde(default)]
14495 pub length: Option<i64>,
14496}
14497
14498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14500#[cfg_attr(feature = "bindings", derive(TS))]
14501pub struct SHA2Digest {
14502 pub this: Box<Expression>,
14503 #[serde(default)]
14504 pub length: Option<i64>,
14505}
14506
14507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14509#[cfg_attr(feature = "bindings", derive(TS))]
14510pub struct SortArray {
14511 pub this: Box<Expression>,
14512 #[serde(default)]
14513 pub asc: Option<Box<Expression>>,
14514 #[serde(default)]
14515 pub nulls_first: Option<Box<Expression>>,
14516}
14517
14518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14520#[cfg_attr(feature = "bindings", derive(TS))]
14521pub struct SplitPart {
14522 pub this: Box<Expression>,
14523 #[serde(default)]
14524 pub delimiter: Option<Box<Expression>>,
14525 #[serde(default)]
14526 pub part_index: Option<Box<Expression>>,
14527}
14528
14529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14531#[cfg_attr(feature = "bindings", derive(TS))]
14532pub struct SubstringIndex {
14533 pub this: Box<Expression>,
14534 #[serde(default)]
14535 pub delimiter: Option<Box<Expression>>,
14536 #[serde(default)]
14537 pub count: Option<Box<Expression>>,
14538}
14539
14540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14542#[cfg_attr(feature = "bindings", derive(TS))]
14543pub struct StandardHash {
14544 pub this: Box<Expression>,
14545 #[serde(default)]
14546 pub expression: Option<Box<Expression>>,
14547}
14548
14549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14551#[cfg_attr(feature = "bindings", derive(TS))]
14552pub struct StrPosition {
14553 pub this: Box<Expression>,
14554 #[serde(default)]
14555 pub substr: Option<Box<Expression>>,
14556 #[serde(default)]
14557 pub position: Option<Box<Expression>>,
14558 #[serde(default)]
14559 pub occurrence: Option<Box<Expression>>,
14560}
14561
14562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14564#[cfg_attr(feature = "bindings", derive(TS))]
14565pub struct Search {
14566 pub this: Box<Expression>,
14567 pub expression: Box<Expression>,
14568 #[serde(default)]
14569 pub json_scope: Option<Box<Expression>>,
14570 #[serde(default)]
14571 pub analyzer: Option<Box<Expression>>,
14572 #[serde(default)]
14573 pub analyzer_options: Option<Box<Expression>>,
14574 #[serde(default)]
14575 pub search_mode: Option<Box<Expression>>,
14576}
14577
14578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14580#[cfg_attr(feature = "bindings", derive(TS))]
14581pub struct SearchIp {
14582 pub this: Box<Expression>,
14583 pub expression: Box<Expression>,
14584}
14585
14586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14588#[cfg_attr(feature = "bindings", derive(TS))]
14589pub struct StrToDate {
14590 pub this: Box<Expression>,
14591 #[serde(default)]
14592 pub format: Option<String>,
14593 #[serde(default)]
14594 pub safe: Option<Box<Expression>>,
14595}
14596
14597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14599#[cfg_attr(feature = "bindings", derive(TS))]
14600pub struct StrToTime {
14601 pub this: Box<Expression>,
14602 pub format: String,
14603 #[serde(default)]
14604 pub zone: Option<Box<Expression>>,
14605 #[serde(default)]
14606 pub safe: Option<Box<Expression>>,
14607 #[serde(default)]
14608 pub target_type: Option<Box<Expression>>,
14609}
14610
14611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14613#[cfg_attr(feature = "bindings", derive(TS))]
14614pub struct StrToUnix {
14615 #[serde(default)]
14616 pub this: Option<Box<Expression>>,
14617 #[serde(default)]
14618 pub format: Option<String>,
14619}
14620
14621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14623#[cfg_attr(feature = "bindings", derive(TS))]
14624pub struct StrToMap {
14625 pub this: Box<Expression>,
14626 #[serde(default)]
14627 pub pair_delim: Option<Box<Expression>>,
14628 #[serde(default)]
14629 pub key_value_delim: Option<Box<Expression>>,
14630 #[serde(default)]
14631 pub duplicate_resolution_callback: Option<Box<Expression>>,
14632}
14633
14634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14636#[cfg_attr(feature = "bindings", derive(TS))]
14637pub struct NumberToStr {
14638 pub this: Box<Expression>,
14639 pub format: String,
14640 #[serde(default)]
14641 pub culture: Option<Box<Expression>>,
14642}
14643
14644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14646#[cfg_attr(feature = "bindings", derive(TS))]
14647pub struct FromBase {
14648 pub this: Box<Expression>,
14649 pub expression: Box<Expression>,
14650}
14651
14652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14654#[cfg_attr(feature = "bindings", derive(TS))]
14655pub struct Stuff {
14656 pub this: Box<Expression>,
14657 #[serde(default)]
14658 pub start: Option<Box<Expression>>,
14659 #[serde(default)]
14660 pub length: Option<i64>,
14661 pub expression: Box<Expression>,
14662}
14663
14664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14666#[cfg_attr(feature = "bindings", derive(TS))]
14667pub struct TimeToStr {
14668 pub this: Box<Expression>,
14669 pub format: String,
14670 #[serde(default)]
14671 pub culture: Option<Box<Expression>>,
14672 #[serde(default)]
14673 pub zone: Option<Box<Expression>>,
14674}
14675
14676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14678#[cfg_attr(feature = "bindings", derive(TS))]
14679pub struct TimeStrToTime {
14680 pub this: Box<Expression>,
14681 #[serde(default)]
14682 pub zone: Option<Box<Expression>>,
14683}
14684
14685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14687#[cfg_attr(feature = "bindings", derive(TS))]
14688pub struct TsOrDsAdd {
14689 pub this: Box<Expression>,
14690 pub expression: Box<Expression>,
14691 #[serde(default)]
14692 pub unit: Option<String>,
14693 #[serde(default)]
14694 pub return_type: Option<Box<Expression>>,
14695}
14696
14697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14699#[cfg_attr(feature = "bindings", derive(TS))]
14700pub struct TsOrDsDiff {
14701 pub this: Box<Expression>,
14702 pub expression: Box<Expression>,
14703 #[serde(default)]
14704 pub unit: Option<String>,
14705}
14706
14707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14709#[cfg_attr(feature = "bindings", derive(TS))]
14710pub struct TsOrDsToDate {
14711 pub this: Box<Expression>,
14712 #[serde(default)]
14713 pub format: Option<String>,
14714 #[serde(default)]
14715 pub safe: Option<Box<Expression>>,
14716}
14717
14718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14720#[cfg_attr(feature = "bindings", derive(TS))]
14721pub struct TsOrDsToTime {
14722 pub this: Box<Expression>,
14723 #[serde(default)]
14724 pub format: Option<String>,
14725 #[serde(default)]
14726 pub safe: Option<Box<Expression>>,
14727}
14728
14729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14731#[cfg_attr(feature = "bindings", derive(TS))]
14732pub struct Unhex {
14733 pub this: Box<Expression>,
14734 #[serde(default)]
14735 pub expression: Option<Box<Expression>>,
14736}
14737
14738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14740#[cfg_attr(feature = "bindings", derive(TS))]
14741pub struct Uniform {
14742 pub this: Box<Expression>,
14743 pub expression: Box<Expression>,
14744 #[serde(default)]
14745 pub gen: Option<Box<Expression>>,
14746 #[serde(default)]
14747 pub seed: Option<Box<Expression>>,
14748}
14749
14750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14752#[cfg_attr(feature = "bindings", derive(TS))]
14753pub struct UnixToStr {
14754 pub this: Box<Expression>,
14755 #[serde(default)]
14756 pub format: Option<String>,
14757}
14758
14759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14761#[cfg_attr(feature = "bindings", derive(TS))]
14762pub struct UnixToTime {
14763 pub this: Box<Expression>,
14764 #[serde(default)]
14765 pub scale: Option<i64>,
14766 #[serde(default)]
14767 pub zone: Option<Box<Expression>>,
14768 #[serde(default)]
14769 pub hours: Option<Box<Expression>>,
14770 #[serde(default)]
14771 pub minutes: Option<Box<Expression>>,
14772 #[serde(default)]
14773 pub format: Option<String>,
14774 #[serde(default)]
14775 pub target_type: Option<Box<Expression>>,
14776}
14777
14778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14780#[cfg_attr(feature = "bindings", derive(TS))]
14781pub struct Uuid {
14782 #[serde(default)]
14783 pub this: Option<Box<Expression>>,
14784 #[serde(default)]
14785 pub name: Option<String>,
14786 #[serde(default)]
14787 pub is_string: Option<Box<Expression>>,
14788}
14789
14790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14792#[cfg_attr(feature = "bindings", derive(TS))]
14793pub struct TimestampFromParts {
14794 #[serde(default)]
14795 pub zone: Option<Box<Expression>>,
14796 #[serde(default)]
14797 pub milli: Option<Box<Expression>>,
14798 #[serde(default)]
14799 pub this: Option<Box<Expression>>,
14800 #[serde(default)]
14801 pub expression: Option<Box<Expression>>,
14802}
14803
14804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14806#[cfg_attr(feature = "bindings", derive(TS))]
14807pub struct TimestampTzFromParts {
14808 #[serde(default)]
14809 pub zone: Option<Box<Expression>>,
14810}
14811
14812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14814#[cfg_attr(feature = "bindings", derive(TS))]
14815pub struct Corr {
14816 pub this: Box<Expression>,
14817 pub expression: Box<Expression>,
14818 #[serde(default)]
14819 pub null_on_zero_variance: Option<Box<Expression>>,
14820}
14821
14822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14824#[cfg_attr(feature = "bindings", derive(TS))]
14825pub struct WidthBucket {
14826 pub this: Box<Expression>,
14827 #[serde(default)]
14828 pub min_value: Option<Box<Expression>>,
14829 #[serde(default)]
14830 pub max_value: Option<Box<Expression>>,
14831 #[serde(default)]
14832 pub num_buckets: Option<Box<Expression>>,
14833 #[serde(default)]
14834 pub threshold: Option<Box<Expression>>,
14835}
14836
14837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14839#[cfg_attr(feature = "bindings", derive(TS))]
14840pub struct CovarSamp {
14841 pub this: Box<Expression>,
14842 pub expression: Box<Expression>,
14843}
14844
14845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14847#[cfg_attr(feature = "bindings", derive(TS))]
14848pub struct CovarPop {
14849 pub this: Box<Expression>,
14850 pub expression: Box<Expression>,
14851}
14852
14853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14855#[cfg_attr(feature = "bindings", derive(TS))]
14856pub struct Week {
14857 pub this: Box<Expression>,
14858 #[serde(default)]
14859 pub mode: Option<Box<Expression>>,
14860}
14861
14862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14864#[cfg_attr(feature = "bindings", derive(TS))]
14865pub struct XMLElement {
14866 pub this: Box<Expression>,
14867 #[serde(default)]
14868 pub expressions: Vec<Expression>,
14869 #[serde(default)]
14870 pub evalname: Option<Box<Expression>>,
14871}
14872
14873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14875#[cfg_attr(feature = "bindings", derive(TS))]
14876pub struct XMLGet {
14877 pub this: Box<Expression>,
14878 pub expression: Box<Expression>,
14879 #[serde(default)]
14880 pub instance: Option<Box<Expression>>,
14881}
14882
14883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14885#[cfg_attr(feature = "bindings", derive(TS))]
14886pub struct XMLTable {
14887 pub this: Box<Expression>,
14888 #[serde(default)]
14889 pub namespaces: Option<Box<Expression>>,
14890 #[serde(default)]
14891 pub passing: Option<Box<Expression>>,
14892 #[serde(default)]
14893 pub columns: Vec<Expression>,
14894 #[serde(default)]
14895 pub by_ref: Option<Box<Expression>>,
14896}
14897
14898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14900#[cfg_attr(feature = "bindings", derive(TS))]
14901pub struct XMLKeyValueOption {
14902 pub this: Box<Expression>,
14903 #[serde(default)]
14904 pub expression: Option<Box<Expression>>,
14905}
14906
14907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14909#[cfg_attr(feature = "bindings", derive(TS))]
14910pub struct Zipf {
14911 pub this: Box<Expression>,
14912 #[serde(default)]
14913 pub elementcount: Option<Box<Expression>>,
14914 #[serde(default)]
14915 pub gen: Option<Box<Expression>>,
14916}
14917
14918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14920#[cfg_attr(feature = "bindings", derive(TS))]
14921pub struct Merge {
14922 pub this: Box<Expression>,
14923 pub using: Box<Expression>,
14924 #[serde(default)]
14925 pub on: Option<Box<Expression>>,
14926 #[serde(default)]
14927 pub using_cond: Option<Box<Expression>>,
14928 #[serde(default)]
14929 pub whens: Option<Box<Expression>>,
14930 #[serde(default)]
14931 pub with_: Option<Box<Expression>>,
14932 #[serde(default)]
14933 pub returning: Option<Box<Expression>>,
14934}
14935
14936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14938#[cfg_attr(feature = "bindings", derive(TS))]
14939pub struct When {
14940 #[serde(default)]
14941 pub matched: Option<Box<Expression>>,
14942 #[serde(default)]
14943 pub source: Option<Box<Expression>>,
14944 #[serde(default)]
14945 pub condition: Option<Box<Expression>>,
14946 pub then: Box<Expression>,
14947}
14948
14949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14951#[cfg_attr(feature = "bindings", derive(TS))]
14952pub struct Whens {
14953 #[serde(default)]
14954 pub expressions: Vec<Expression>,
14955}
14956
14957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14959#[cfg_attr(feature = "bindings", derive(TS))]
14960pub struct NextValueFor {
14961 pub this: Box<Expression>,
14962 #[serde(default)]
14963 pub order: Option<Box<Expression>>,
14964}
14965
14966#[cfg(test)]
14967mod tests {
14968 use super::*;
14969
14970 #[test]
14971 #[cfg(feature = "bindings")]
14972 fn export_typescript_types() {
14973 Expression::export_all(&ts_rs::Config::default())
14976 .expect("Failed to export Expression types");
14977 }
14978
14979 #[test]
14980 fn test_simple_select_builder() {
14981 let select = Select::new()
14982 .column(Expression::star())
14983 .from(Expression::Table(Box::new(TableRef::new("users"))));
14984
14985 assert_eq!(select.expressions.len(), 1);
14986 assert!(select.from.is_some());
14987 }
14988
14989 #[test]
14990 fn test_expression_alias() {
14991 let expr = Expression::column("id").alias("user_id");
14992
14993 match expr {
14994 Expression::Alias(a) => {
14995 assert_eq!(a.alias.name, "user_id");
14996 }
14997 _ => panic!("Expected Alias"),
14998 }
14999 }
15000
15001 #[test]
15002 fn test_literal_creation() {
15003 let num = Expression::number(42);
15004 let str = Expression::string("hello");
15005
15006 match num {
15007 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
15008 let Literal::Number(n) = lit.as_ref() else {
15009 unreachable!()
15010 };
15011 assert_eq!(n, "42")
15012 }
15013 _ => panic!("Expected Number"),
15014 }
15015
15016 match str {
15017 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
15018 let Literal::String(s) = lit.as_ref() else {
15019 unreachable!()
15020 };
15021 assert_eq!(s, "hello")
15022 }
15023 _ => panic!("Expected String"),
15024 }
15025 }
15026
15027 #[test]
15028 fn test_expression_sql() {
15029 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
15030 assert_eq!(expr.sql(), "SELECT 1 + 2");
15031 }
15032
15033 #[test]
15034 fn test_expression_sql_for() {
15035 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
15036 let sql = expr.sql_for(crate::DialectType::Generic);
15037 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15039 }
15040}